|
Lines 540-545
Link Here
|
| 540 |
IContentType inappropriate = contentTypeManager.getContentType(RuntimeTestsPlugin.PI_RUNTIME_TESTS + ".sample-binary1"); |
540 |
IContentType inappropriate = contentTypeManager.getContentType(RuntimeTestsPlugin.PI_RUNTIME_TESTS + ".sample-binary1"); |
| 541 |
IContentType appropriate = contentTypeManager.getContentType(Platform.PI_RUNTIME + ".xml"); |
541 |
IContentType appropriate = contentTypeManager.getContentType(Platform.PI_RUNTIME + ".xml"); |
| 542 |
IContentType appropriateSpecific1 = contentTypeManager.getContentType(RuntimeTestsPlugin.PI_RUNTIME_TESTS + ".xml-based-different-extension"); |
542 |
IContentType appropriateSpecific1 = contentTypeManager.getContentType(RuntimeTestsPlugin.PI_RUNTIME_TESTS + ".xml-based-different-extension"); |
|
|
543 |
IContentType appropriateSpecific1LowPriority = contentTypeManager.getContentType(RuntimeTestsPlugin.PI_RUNTIME_TESTS + ".xml-based-different-extension-low-priority"); |
| 543 |
IContentType appropriateSpecific2 = contentTypeManager.getContentType(RuntimeTestsPlugin.PI_RUNTIME_TESTS + ".xml-based-specific-name"); |
544 |
IContentType appropriateSpecific2 = contentTypeManager.getContentType(RuntimeTestsPlugin.PI_RUNTIME_TESTS + ".xml-based-specific-name"); |
| 544 |
|
545 |
|
| 545 |
// if only inappropriate is provided, none will be selected |
546 |
// if only inappropriate is provided, none will be selected |
|
Lines 563-568
Link Here
|
| 563 |
assertTrue("4.1", appropriateSpecific1.equals(selected[0]) || appropriateSpecific1.equals(selected[1])); |
564 |
assertTrue("4.1", appropriateSpecific1.equals(selected[0]) || appropriateSpecific1.equals(selected[1])); |
| 564 |
assertTrue("4.2", appropriateSpecific2.equals(selected[0]) || appropriateSpecific2.equals(selected[1])); |
565 |
assertTrue("4.2", appropriateSpecific2.equals(selected[0]) || appropriateSpecific2.equals(selected[1])); |
| 565 |
assertTrue("4.3", appropriate.equals(selected[2])); |
566 |
assertTrue("4.3", appropriate.equals(selected[2])); |
|
|
567 |
|
| 568 |
// if appropriate and a more specific appropriate type (but with low priority) are provided, the specific type will be selected |
| 569 |
finder = contentTypeManager.getMatcher(new SubsetSelectionPolicy(new IContentType[] {appropriate, appropriateSpecific1LowPriority}), null); |
| 570 |
assertEquals("5.0", appropriateSpecific1LowPriority, finder.findContentTypeFor(getInputStream(MINIMAL_XML), null)); |
| 571 |
|
| 572 |
// if appropriate and two specific appropriate types (but one with lower priority) are provided, the specific type with higher priority will be selected |
| 573 |
finder = contentTypeManager.getMatcher(new SubsetSelectionPolicy(new IContentType[] {appropriate, appropriateSpecific1, appropriateSpecific1LowPriority}), null); |
| 574 |
assertEquals("5.1", appropriateSpecific1, finder.findContentTypeFor(getInputStream(MINIMAL_XML), null)); |
| 566 |
} |
575 |
} |
| 567 |
|
576 |
|
| 568 |
public void testDefaultProperties() throws IOException /* never actually thrown */{ |
577 |
public void testDefaultProperties() throws IOException /* never actually thrown */{ |