@Test public void testModuleDefinition() throws Exception { String spec = "osgi:eager,web"; String prefix = "configuration/subsystems"; String inputname = "target/subsystems-osgi.xml"; GenerateSubsystemsDefinition.main(new String[] {spec, "", prefix, inputname}); File inputFile = new File(inputname); Assert.assertTrue("File exists: " + inputname, inputFile.exists()); String basedir = "src/test/resources"; String outputname = "target/subsystem-modules.txt"; GenerateModulesDefinition.main(new String[] {inputname, "", basedir, null, outputname}); File outfile = new File(outputname); Assert.assertTrue("File exists: " + outfile, outfile.exists()); File xmlfile = new File("target/subsystem-modules.xml"); Assert.assertTrue("File exists: " + xmlfile, xmlfile.exists()); BufferedReader br = new BufferedReader(new FileReader(outfile)); Assert.assertEquals("javax/servlet/api/main/**", br.readLine()); Assert.assertEquals("org/apache/commons/logging/main/**", br.readLine()); Assert.assertEquals("org/jboss/as/osgi/main/**", br.readLine()); Assert.assertEquals("org/jboss/as/web/main/**", br.readLine()); Assert.assertEquals("org/jboss/osgi/framework/main/**", br.readLine()); Assert.assertEquals("org/osgi/core/main/**", br.readLine()); Assert.assertEquals("org/osgi/enterprise/main/**", br.readLine()); Assert.assertEquals("org/slf4j/jcl-over-slf4j/main/**", br.readLine()); Assert.assertEquals("org/slf4j/main/**", br.readLine()); Assert.assertNull(br.readLine()); }
@Test public void testNoModuleDependencies() throws Exception { String basedir = "src/test/resources"; String outputname = "target/no-modules.txt"; GenerateModulesDefinition.main(new String[] {SKIP_SUBSYSTEMS, "", basedir, null, outputname}); File outfile = new File(outputname); Assert.assertTrue("File exists: " + outfile, outfile.exists()); BufferedReader br = new BufferedReader(new FileReader(outfile)); Assert.assertEquals(NO_MODULE_DEPENENCIES, br.readLine()); Assert.assertNull(br.readLine()); }
@Test public void testSkipSubsystems() throws Exception { String basedir = "src/test/resources"; String outputname = "target/" + SKIP_SUBSYSTEMS + ".txt"; GenerateModulesDefinition.main( new String[] {SKIP_SUBSYSTEMS, "", basedir, "org.jboss.osgi.framework", outputname}); File outfile = new File(outputname); Assert.assertTrue("File exists: " + outfile, outfile.exists()); BufferedReader br = new BufferedReader(new FileReader(outfile)); Assert.assertEquals("org/jboss/osgi/framework/main/**", br.readLine()); Assert.assertEquals("org/osgi/core/main/**", br.readLine()); Assert.assertNull(br.readLine()); }