| @@ -45,7 +45,7 @@ import static org.junit.Assert.fail; | |||||
| * | * | ||||
| */ | */ | ||||
| public class ManifestTest { | public class ManifestTest { | ||||
| @Rule | @Rule | ||||
| public final BuildFileRule buildRule = new BuildFileRule(); | public final BuildFileRule buildRule = new BuildFileRule(); | ||||
| @@ -108,11 +108,11 @@ public class ManifestTest { | |||||
| @Test | @Test | ||||
| public void test3() { | public void test3() { | ||||
| try { | try { | ||||
| buildRule.executeTarget("test3"); | |||||
| fail("BuildException expected: Manifest is invalid - no colon on header line"); | |||||
| } catch (BuildException ex) { | |||||
| assertContains("Invalid Manifest", ex.getMessage()); | |||||
| } | |||||
| buildRule.executeTarget("test3"); | |||||
| fail("BuildException expected: Manifest is invalid - no colon on header line"); | |||||
| } catch (BuildException ex) { | |||||
| assertContains("Invalid Manifest", ex.getMessage()); | |||||
| } | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -121,11 +121,11 @@ public class ManifestTest { | |||||
| @Test | @Test | ||||
| public void test4() { | public void test4() { | ||||
| try { | try { | ||||
| buildRule.executeTarget("test4"); | |||||
| fail("BuildException expected: Manifest is invalid - section starts with continuation line"); | |||||
| } catch (BuildException ex) { | |||||
| assertContains("Invalid Manifest", ex.getMessage()); | |||||
| } | |||||
| buildRule.executeTarget("test4"); | |||||
| fail("BuildException expected: Manifest is invalid - section starts with continuation line"); | |||||
| } catch (BuildException ex) { | |||||
| assertContains("Invalid Manifest", ex.getMessage()); | |||||
| } | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -145,11 +145,11 @@ public class ManifestTest { | |||||
| @Test | @Test | ||||
| public void test6() { | public void test6() { | ||||
| try { | try { | ||||
| buildRule.executeTarget("test6"); | |||||
| fail("BuildException expected: Manifest is invalid - section starts with incorrect attribute"); | |||||
| } catch (BuildException ex) { | |||||
| assertContains("Invalid Manifest", ex.getMessage()); | |||||
| } | |||||
| buildRule.executeTarget("test6"); | |||||
| fail("BuildException expected: Manifest is invalid - section starts with incorrect attribute"); | |||||
| } catch (BuildException ex) { | |||||
| assertContains("Invalid Manifest", ex.getMessage()); | |||||
| } | |||||
| String output = buildRule.getLog(); | String output = buildRule.getLog(); | ||||
| boolean hasWarning = output.indexOf("Manifest sections should start with a \"Name\" attribute") != -1; | boolean hasWarning = output.indexOf("Manifest sections should start with a \"Name\" attribute") != -1; | ||||
| assertTrue("Expected warning about section not starting with Name: attribute", hasWarning); | assertTrue("Expected warning about section not starting with Name: attribute", hasWarning); | ||||
| @@ -189,12 +189,12 @@ public class ManifestTest { | |||||
| @Test | @Test | ||||
| public void test9() { | public void test9() { | ||||
| try { | try { | ||||
| buildRule.executeTarget("test9"); | |||||
| fail("BuildException expected: Construction is invalid - Name attribute should not be used"); | |||||
| } catch (BuildException ex) { | |||||
| assertContains("Specify the section name using the \"name\" attribute of the <section> element", | |||||
| ex.getMessage()); | |||||
| } | |||||
| buildRule.executeTarget("test9"); | |||||
| fail("BuildException expected: Construction is invalid - Name attribute should not be used"); | |||||
| } catch (BuildException ex) { | |||||
| assertContains("Specify the section name using the \"name\" attribute of the <section> element", | |||||
| ex.getMessage()); | |||||
| } | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -203,11 +203,11 @@ public class ManifestTest { | |||||
| @Test | @Test | ||||
| public void test10() { | public void test10() { | ||||
| try { | try { | ||||
| buildRule.executeTarget("test10"); | |||||
| fail("BuildException expected: Attribute has no name"); | |||||
| } catch (BuildException ex) { | |||||
| assertContains("Attributes must have name and value", ex.getMessage()); | |||||
| } | |||||
| buildRule.executeTarget("test10"); | |||||
| fail("BuildException expected: Attribute has no name"); | |||||
| } catch (BuildException ex) { | |||||
| assertContains("Attributes must have name and value", ex.getMessage()); | |||||
| } | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -216,11 +216,11 @@ public class ManifestTest { | |||||
| @Test | @Test | ||||
| public void test11() { | public void test11() { | ||||
| try { | try { | ||||
| buildRule.executeTarget("test11"); | |||||
| fail("BuildException expected: Attribute has no value"); | |||||
| } catch (BuildException ex) { | |||||
| assertContains("Attributes must have name and value", ex.getMessage()); | |||||
| } | |||||
| buildRule.executeTarget("test11"); | |||||
| fail("BuildException expected: Attribute has no value"); | |||||
| } catch (BuildException ex) { | |||||
| assertContains("Attributes must have name and value", ex.getMessage()); | |||||
| } | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -229,11 +229,11 @@ public class ManifestTest { | |||||
| @Test | @Test | ||||
| public void test12() { | public void test12() { | ||||
| try { | try { | ||||
| buildRule.executeTarget("test12"); | |||||
| fail("BuildException expected: Section with no name"); | |||||
| } catch (BuildException ex) { | |||||
| assertContains("Sections must have a name", ex.getMessage()); | |||||
| } | |||||
| buildRule.executeTarget("test12"); | |||||
| fail("BuildException expected: Section with no name"); | |||||
| } catch (BuildException ex) { | |||||
| assertContains("Sections must have a name", ex.getMessage()); | |||||
| } | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -242,11 +242,11 @@ public class ManifestTest { | |||||
| @Test | @Test | ||||
| public void test13() { | public void test13() { | ||||
| try { | try { | ||||
| buildRule.executeTarget("test13"); | |||||
| fail("BuildException expected: Duplicate Attribute"); | |||||
| } catch (BuildException ex) { | |||||
| assertContains("The attribute \"Test\" may not occur more than once in the same section", ex.getMessage()); | |||||
| } | |||||
| buildRule.executeTarget("test13"); | |||||
| fail("BuildException expected: Duplicate Attribute"); | |||||
| } catch (BuildException ex) { | |||||
| assertContains("The attribute \"Test\" may not occur more than once in the same section", ex.getMessage()); | |||||
| } | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -280,25 +280,24 @@ public class ManifestTest { | |||||
| String classpath = mainSection.getAttributeValue("class-path"); | String classpath = mainSection.getAttributeValue("class-path"); | ||||
| assertEquals("Class-Path attribute was not set correctly - ", | assertEquals("Class-Path attribute was not set correctly - ", | ||||
| LONG_LINE, classpath); | LONG_LINE, classpath); | ||||
| String value = mainSection.getAttributeValue(LONG_68_NAME); | String value = mainSection.getAttributeValue(LONG_68_NAME); | ||||
| assertEquals("LONG_68_NAME_VALUE_MISMATCH", VALUE, value); | assertEquals("LONG_68_NAME_VALUE_MISMATCH", VALUE, value); | ||||
| value = mainSection.getAttributeValue(LONG_70_NAME); | value = mainSection.getAttributeValue(LONG_70_NAME); | ||||
| assertEquals("LONG_70_NAME_VALUE_MISMATCH", VALUE, value); | assertEquals("LONG_70_NAME_VALUE_MISMATCH", VALUE, value); | ||||
| value = mainSection.getAttributeValue(NOT_LONG_NAME); | value = mainSection.getAttributeValue(NOT_LONG_NAME); | ||||
| assertEquals("NOT_LONG_NAME_VALUE_MISMATCH", VALUE, value); | assertEquals("NOT_LONG_NAME_VALUE_MISMATCH", VALUE, value); | ||||
| Set set = new HashSet(); | Set set = new HashSet(); | ||||
| FileReader fin = new FileReader(expandedManifest); | FileReader fin = new FileReader(expandedManifest); | ||||
| try { | try { | ||||
| BufferedReader in = new BufferedReader(fin); | |||||
| String read = in.readLine(); | |||||
| while (read != null) | |||||
| { | |||||
| set.add(read); | |||||
| read = in.readLine(); | |||||
| } | |||||
| BufferedReader in = new BufferedReader(fin); | |||||
| String read = in.readLine(); | |||||
| while (read != null) { | |||||
| set.add(read); | |||||
| read = in.readLine(); | |||||
| } | |||||
| in.close(); | in.close(); | ||||
| } finally { | } finally { | ||||
| fin.close(); | fin.close(); | ||||
| @@ -368,11 +367,11 @@ public class ManifestTest { | |||||
| @Test | @Test | ||||
| public void testNoFile() { | public void testNoFile() { | ||||
| try { | try { | ||||
| buildRule.executeTarget("testNoFile"); | |||||
| fail("BuildException expected: file is required"); | |||||
| } catch (BuildException ex) { | |||||
| //TODO assert value | |||||
| } | |||||
| buildRule.executeTarget("testNoFile"); | |||||
| fail("BuildException expected: file is required"); | |||||
| } catch (BuildException ex) { | |||||
| //TODO assert value | |||||
| } | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -411,57 +410,57 @@ public class ManifestTest { | |||||
| @Test | @Test | ||||
| public void testFrom() { | public void testFrom() { | ||||
| buildRule.executeTarget("testFrom"); | buildRule.executeTarget("testFrom"); | ||||
| assertContains(Manifest.ERROR_FROM_FORBIDDEN, buildRule.getLog()); | |||||
| assertContains(Manifest.ERROR_FROM_FORBIDDEN, buildRule.getLog()); | |||||
| } | } | ||||
| @Test | @Test | ||||
| public void testIllegalName() { | public void testIllegalName() { | ||||
| try { | try { | ||||
| buildRule.executeTarget("testIllegalName"); | |||||
| fail("BuildException expected: Manifest attribute names must not contain ' '"); | |||||
| } catch (BuildException ex) { | |||||
| //TODO assert value | |||||
| } | |||||
| buildRule.executeTarget("testIllegalName"); | |||||
| fail("BuildException expected: Manifest attribute names must not contain ' '"); | |||||
| } catch (BuildException ex) { | |||||
| //TODO assert value | |||||
| } | |||||
| } | } | ||||
| @Test | @Test | ||||
| public void testIllegalNameInSection() { | public void testIllegalNameInSection() { | ||||
| try { | try { | ||||
| buildRule.executeTarget("testIllegalNameInSection"); | |||||
| fail("BuildException expected: Manifest attribute names must not contain ' '"); | |||||
| } catch (BuildException ex) { | |||||
| //TODO assert value | |||||
| } | |||||
| buildRule.executeTarget("testIllegalNameInSection"); | |||||
| fail("BuildException expected: Manifest attribute names must not contain ' '"); | |||||
| } catch (BuildException ex) { | |||||
| //TODO assert value | |||||
| } | |||||
| } | } | ||||
| @Test | @Test | ||||
| public void testIllegalNameBegin() { | public void testIllegalNameBegin() { | ||||
| try { | try { | ||||
| buildRule.executeTarget("testIllegalNameInSection"); | |||||
| fail("BuildException expected: Manifest attribute names must not start with '-' at the begin."); | |||||
| } catch (BuildException ex) { | |||||
| //TODO assert value | |||||
| } | |||||
| buildRule.executeTarget("testIllegalNameInSection"); | |||||
| fail("BuildException expected: Manifest attribute names must not start with '-' at the begin."); | |||||
| } catch (BuildException ex) { | |||||
| //TODO assert value | |||||
| } | |||||
| } | } | ||||
| @Test | @Test | ||||
| public void testIllegalName2() { | public void testIllegalName2() { | ||||
| try { | try { | ||||
| buildRule.executeTarget("testIllegalName"); | |||||
| fail("BuildException expected: Manifest attribute names must not contain '.'"); | |||||
| } catch (BuildException ex) { | |||||
| //TODO assert value | |||||
| } | |||||
| buildRule.executeTarget("testIllegalName"); | |||||
| fail("BuildException expected: Manifest attribute names must not contain '.'"); | |||||
| } catch (BuildException ex) { | |||||
| //TODO assert value | |||||
| } | |||||
| } | } | ||||
| @Test | @Test | ||||
| public void testIllegalName3() { | public void testIllegalName3() { | ||||
| try { | try { | ||||
| buildRule.executeTarget("testIllegalName"); | |||||
| fail("BuildException expected: Manifest attribute names must not contain '*'"); | |||||
| } catch (BuildException ex) { | |||||
| //TODO assert value | |||||
| } | |||||
| buildRule.executeTarget("testIllegalName"); | |||||
| fail("BuildException expected: Manifest attribute names must not contain '*'"); | |||||
| } catch (BuildException ex) { | |||||
| //TODO assert value | |||||
| } | |||||
| } | } | ||||
| /** | /** | ||||