Verifies the compilation and test execution works on both profiles: fxbrwsr as well as bck2brwsr
1.1 --- a/ko-archetype-test/src/test/java/org/apidesign/html/archetype/test/VerifyArchetypeTest.java Mon May 13 14:25:37 2013 +0200
1.2 +++ b/ko-archetype-test/src/test/java/org/apidesign/html/archetype/test/VerifyArchetypeTest.java Mon May 13 14:53:16 2013 +0200
1.3 @@ -43,11 +43,50 @@
1.4 v.executeGoal("verify");
1.5
1.6 v.verifyErrorFreeLog();
1.7 +
1.8 + for (String l : v.loadFile(v.getBasedir(), v.getLogFileName(), false)) {
1.9 + if (l.contains("j2js")) {
1.10 + fail("No pre-compilaton:\n" + l);
1.11 + }
1.12 + }
1.13 +
1.14 + v.verifyTextInLog("org.apidesign.bck2brwsr.launcher.FXBrwsrLauncher");
1.15 + v.verifyTextInLog("fxcompile/o-a-test/target/o-a-test-1.0-SNAPSHOT-fxbrwsr.zip");
1.16 + }
1.17 +
1.18 + @Test public void bck2BrwsrCompiles() throws Exception {
1.19 + final File dir = new File("target/tests/b2bcompile/").getAbsoluteFile();
1.20 + generateFromArchetype(dir);
1.21 +
1.22 + File created = new File(dir, "o-a-test");
1.23 + assertTrue(created.isDirectory(), "Project created");
1.24 + assertTrue(new File(created, "pom.xml").isFile(), "Pom file is in there");
1.25 +
1.26 + Verifier v = new Verifier(created.getAbsolutePath());
1.27 + v.addCliOption("-Pbck2brwsr");
1.28 + v.executeGoal("verify");
1.29 +
1.30 + v.verifyErrorFreeLog();
1.31 +
1.32 + // does pre-compilation to JavaScript
1.33 + v.verifyTextInLog("j2js");
1.34 + // uses Bck2BrwsrLauncher
1.35 + v.verifyTextInLog("org.apidesign.bck2brwsr.launcher.Bck2BrwsrLauncher stopServerAndBrwsr");
1.36 + // building zip:
1.37 + v.verifyTextInLog("b2bcompile/o-a-test/target/o-a-test-1.0-SNAPSHOT-bck2brwsr.zip");
1.38 +
1.39 + for (String l : v.loadFile(v.getBasedir(), v.getLogFileName(), false)) {
1.40 + if (l.contains("fxbrwsr")) {
1.41 + fail("No fxbrwsr:\n" + l);
1.42 + }
1.43 + }
1.44 +
1.45 }
1.46
1.47 - private Verifier generateFromArchetype(final File dir) throws Exception {
1.48 + private Verifier generateFromArchetype(final File dir, String... params) throws Exception {
1.49 Verifier v = new Verifier(dir.getAbsolutePath());
1.50 v.setAutoclean(false);
1.51 + v.setLogFileName("generate.log");
1.52 v.deleteDirectory("");
1.53 dir.mkdirs();
1.54 Properties sysProp = v.getSystemProperties();
1.55 @@ -57,6 +96,10 @@
1.56 sysProp.put("archetypeGroupId", "org.apidesign.html");
1.57 sysProp.put("archetypeArtifactId", "knockout4j-archetype");
1.58 sysProp.put("archetypeVersion", ArchetypeVersionTest.findCurrentVersion());
1.59 +
1.60 + for (String p : params) {
1.61 + v.addCliOption(p);
1.62 + }
1.63 v.executeGoal("archetype:generate");
1.64 v.verifyErrorFreeLog();
1.65 return v;