Removing the archetype. Enough to have a shared one at https://github.com/jtulach/html4j-archetype
1.1 --- a/ko/archetype-test/pom.xml Mon Jun 09 09:38:03 2014 +0200
1.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1.3 @@ -1,48 +0,0 @@
1.4 -<?xml version="1.0"?>
1.5 -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
1.6 - <modelVersion>4.0.0</modelVersion>
1.7 - <parent>
1.8 - <groupId>org.apidesign.bck2brwsr</groupId>
1.9 - <artifactId>ko</artifactId>
1.10 - <version>0.9-SNAPSHOT</version>
1.11 - </parent>
1.12 - <groupId>org.apidesign.bck2brwsr</groupId>
1.13 - <artifactId>ko-archetype-test</artifactId>
1.14 - <version>0.9-SNAPSHOT</version>
1.15 - <name>Knockout Bck2Brwsr Archetype Test</name>
1.16 - <url>http://maven.apache.org</url>
1.17 - <description>Verifies the Knockout & net.java.html.json archetype behaves properly.</description>
1.18 - <properties>
1.19 - <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
1.20 - </properties>
1.21 - <dependencies>
1.22 - <dependency>
1.23 - <groupId>${project.groupId}</groupId>
1.24 - <artifactId>knockout4j-archetype</artifactId>
1.25 - <version>${project.version}</version>
1.26 - </dependency>
1.27 - <dependency>
1.28 - <groupId>org.testng</groupId>
1.29 - <artifactId>testng</artifactId>
1.30 - <scope>test</scope>
1.31 - </dependency>
1.32 - <dependency>
1.33 - <groupId>org.apache.maven.shared</groupId>
1.34 - <artifactId>maven-verifier</artifactId>
1.35 - <version>1.4</version>
1.36 - <scope>test</scope>
1.37 - </dependency>
1.38 - <dependency>
1.39 - <groupId>${project.groupId}</groupId>
1.40 - <artifactId>ko-fx</artifactId>
1.41 - <version>${project.version}</version>
1.42 - <scope>provided</scope>
1.43 - </dependency>
1.44 - <dependency>
1.45 - <groupId>${project.groupId}</groupId>
1.46 - <artifactId>ko-bck2brwsr</artifactId>
1.47 - <version>${project.version}</version>
1.48 - <scope>provided</scope>
1.49 - </dependency>
1.50 - </dependencies>
1.51 -</project>
2.1 --- a/ko/archetype-test/src/test/java/org/apidesign/bck2brwsr/ko/archetype/test/ArchetypeVersionTest.java Mon Jun 09 09:38:03 2014 +0200
2.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
2.3 @@ -1,140 +0,0 @@
2.4 -/**
2.5 - * Back 2 Browser Bytecode Translator
2.6 - * Copyright (C) 2012 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
2.7 - *
2.8 - * This program is free software: you can redistribute it and/or modify
2.9 - * it under the terms of the GNU General Public License as published by
2.10 - * the Free Software Foundation, version 2 of the License.
2.11 - *
2.12 - * This program is distributed in the hope that it will be useful,
2.13 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
2.14 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2.15 - * GNU General Public License for more details.
2.16 - *
2.17 - * You should have received a copy of the GNU General Public License
2.18 - * along with this program. Look for COPYING file in the top folder.
2.19 - * If not, see http://opensource.org/licenses/GPL-2.0.
2.20 - */
2.21 -package org.apidesign.bck2brwsr.ko.archetype.test;
2.22 -
2.23 -import java.io.IOException;
2.24 -import java.net.URL;
2.25 -import javax.xml.XMLConstants;
2.26 -import javax.xml.parsers.DocumentBuilderFactory;
2.27 -import javax.xml.parsers.ParserConfigurationException;
2.28 -import javax.xml.xpath.XPathConstants;
2.29 -import javax.xml.xpath.XPathExpression;
2.30 -import javax.xml.xpath.XPathExpressionException;
2.31 -import javax.xml.xpath.XPathFactory;
2.32 -import javax.xml.xpath.XPathFactoryConfigurationException;
2.33 -import org.testng.annotations.Test;
2.34 -import static org.testng.Assert.*;
2.35 -import org.testng.annotations.BeforeClass;
2.36 -import org.w3c.dom.Document;
2.37 -import org.w3c.dom.NodeList;
2.38 -import org.xml.sax.SAXException;
2.39 -
2.40 -/**
2.41 - *
2.42 - * @author Jaroslav Tulach <jtulach@netbeans.org>
2.43 - */
2.44 -public class ArchetypeVersionTest {
2.45 - private String version;
2.46 -
2.47 - public ArchetypeVersionTest() {
2.48 - }
2.49 -
2.50 - @BeforeClass public void readCurrentVersion() throws Exception {
2.51 - version = findCurrentVersion();
2.52 - assertFalse(version.isEmpty(), "There should be some version string");
2.53 - }
2.54 -
2.55 -
2.56 - @Test public void testComparePomDepsVersions() throws Exception {
2.57 - final ClassLoader l = ArchetypeVersionTest.class.getClassLoader();
2.58 - URL r = l.getResource("archetype-resources/pom.xml");
2.59 - assertNotNull(r, "Archetype pom found");
2.60 -
2.61 - final XPathFactory fact = XPathFactory.newInstance();
2.62 - XPathExpression xp2 = fact.newXPath().compile(
2.63 - "//properties/net.java.html.version/text()"
2.64 - );
2.65 -
2.66 - Document dom = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(r.openStream());
2.67 - String arch = (String) xp2.evaluate(dom, XPathConstants.STRING);
2.68 -
2.69 - int snapshot = arch.indexOf("-SNAPSHOT");
2.70 - if (snapshot >= 0) {
2.71 - arch = arch.substring(0, snapshot);
2.72 - }
2.73 -
2.74 - assertTrue(arch.matches("[0-9\\.]+"), "net.java.html.json version seems valid: " + arch);
2.75 - }
2.76 -
2.77 - @Test public void testCheckLauncher() throws Exception {
2.78 - final ClassLoader l = ArchetypeVersionTest.class.getClassLoader();
2.79 - URL r = l.getResource("archetype-resources/pom.xml");
2.80 - assertNotNull(r, "Archetype pom found");
2.81 -
2.82 - final XPathFactory fact = XPathFactory.newInstance();
2.83 - XPathExpression xp2 = fact.newXPath().compile(
2.84 - "//properties/bck2brwsr.launcher.version/text()"
2.85 - );
2.86 -
2.87 - Document dom = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(r.openStream());
2.88 - String arch = (String) xp2.evaluate(dom, XPathConstants.STRING);
2.89 -
2.90 - assertEquals(arch, version, "launcher dependency is on more recent version");
2.91 - }
2.92 -
2.93 - @Test public void testCheckBck2Brwsr() throws Exception {
2.94 - final ClassLoader l = ArchetypeVersionTest.class.getClassLoader();
2.95 - URL r = l.getResource("archetype-resources/pom.xml");
2.96 - assertNotNull(r, "Archetype pom found");
2.97 -
2.98 - final XPathFactory fact = XPathFactory.newInstance();
2.99 - XPathExpression xp2 = fact.newXPath().compile(
2.100 - "//properties/bck2brwsr.version/text()"
2.101 - );
2.102 -
2.103 - Document dom = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(r.openStream());
2.104 - String arch = (String) xp2.evaluate(dom, XPathConstants.STRING);
2.105 -
2.106 - assertEquals(arch, version, "bck2brwsr dependency is on more recent version");
2.107 - }
2.108 -
2.109 - @Test public void testNbActions() throws Exception {
2.110 - final ClassLoader l = ArchetypeVersionTest.class.getClassLoader();
2.111 - URL r = l.getResource("archetype-resources/nbactions.xml");
2.112 - assertNotNull(r, "Archetype nb file found");
2.113 -
2.114 - final XPathFactory fact = XPathFactory.newInstance();
2.115 - XPathExpression xp2 = fact.newXPath().compile(
2.116 - "//goal/text()"
2.117 - );
2.118 -
2.119 - Document dom = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(r.openStream());
2.120 - NodeList goals = (NodeList) xp2.evaluate(dom, XPathConstants.NODESET);
2.121 -
2.122 - for (int i = 0; i < goals.getLength(); i++) {
2.123 - String s = goals.item(i).getTextContent();
2.124 - if (s.contains("apidesign")) {
2.125 - assertFalse(s.matches(".*apidesign.*[0-9].*"), "No numbers: " + s);
2.126 - }
2.127 - }
2.128 - }
2.129 -
2.130 - static String findCurrentVersion() throws XPathExpressionException, IOException, ParserConfigurationException, SAXException, XPathFactoryConfigurationException {
2.131 - final ClassLoader l = ArchetypeVersionTest.class.getClassLoader();
2.132 - URL u = l.getResource("META-INF/maven/org.apidesign.bck2brwsr/knockout4j-archetype/pom.xml");
2.133 - assertNotNull(u, "Own pom found: " + System.getProperty("java.class.path"));
2.134 -
2.135 - final XPathFactory fact = XPathFactory.newInstance();
2.136 - fact.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
2.137 -
2.138 - XPathExpression xp = fact.newXPath().compile("project/version/text()");
2.139 -
2.140 - Document dom = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(u.openStream());
2.141 - return xp.evaluate(dom);
2.142 - }
2.143 -}
3.1 --- a/ko/archetype-test/src/test/java/org/apidesign/bck2brwsr/ko/archetype/test/VerifyArchetypeTest.java Mon Jun 09 09:38:03 2014 +0200
3.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
3.3 @@ -1,133 +0,0 @@
3.4 -/**
3.5 - * Back 2 Browser Bytecode Translator
3.6 - * Copyright (C) 2012 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
3.7 - *
3.8 - * This program is free software: you can redistribute it and/or modify
3.9 - * it under the terms of the GNU General Public License as published by
3.10 - * the Free Software Foundation, version 2 of the License.
3.11 - *
3.12 - * This program is distributed in the hope that it will be useful,
3.13 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
3.14 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3.15 - * GNU General Public License for more details.
3.16 - *
3.17 - * You should have received a copy of the GNU General Public License
3.18 - * along with this program. Look for COPYING file in the top folder.
3.19 - * If not, see http://opensource.org/licenses/GPL-2.0.
3.20 - */
3.21 -package org.apidesign.bck2brwsr.ko.archetype.test;
3.22 -
3.23 -import java.io.File;
3.24 -import java.io.IOException;
3.25 -import java.io.InputStream;
3.26 -import java.util.Properties;
3.27 -import java.util.zip.ZipEntry;
3.28 -import java.util.zip.ZipFile;
3.29 -import org.apache.maven.it.Verifier;
3.30 -import org.testng.annotations.Test;
3.31 -import static org.testng.Assert.*;
3.32 -import org.testng.reporters.Files;
3.33 -
3.34 -/**
3.35 - *
3.36 - * @author Jaroslav Tulach <jtulach@netbeans.org>
3.37 - */
3.38 -public class VerifyArchetypeTest {
3.39 - @Test public void fxBrwsrCompiles() throws Exception {
3.40 - final File dir = new File("target/tests/fxcompile/").getAbsoluteFile();
3.41 - generateFromArchetype(dir);
3.42 -
3.43 - File created = new File(dir, "o-a-test");
3.44 - assertTrue(created.isDirectory(), "Project created");
3.45 - assertTrue(new File(created, "pom.xml").isFile(), "Pom file is in there");
3.46 -
3.47 - Verifier v = new Verifier(created.getAbsolutePath());
3.48 - v.executeGoal("verify");
3.49 -
3.50 - v.verifyErrorFreeLog();
3.51 -
3.52 - for (String l : v.loadFile(v.getBasedir(), v.getLogFileName(), false)) {
3.53 - if (l.contains("j2js")) {
3.54 - fail("No pre-compilaton:\n" + l);
3.55 - }
3.56 - }
3.57 -
3.58 - v.verifyTextInLog("org.apidesign.bck2brwsr.launcher.FXBrwsrLauncher");
3.59 - v.verifyTextInLog("fxcompile/o-a-test/target/o-a-test-1.0-SNAPSHOT-fxbrwsr.zip");
3.60 - }
3.61 -
3.62 - @Test public void bck2BrwsrCompiles() throws Exception {
3.63 - final File dir = new File("target/tests/b2bcompile/").getAbsoluteFile();
3.64 - generateFromArchetype(dir);
3.65 -
3.66 - File created = new File(dir, "o-a-test");
3.67 - assertTrue(created.isDirectory(), "Project created");
3.68 - assertTrue(new File(created, "pom.xml").isFile(), "Pom file is in there");
3.69 -
3.70 - Verifier v = new Verifier(created.getAbsolutePath());
3.71 - Properties sysProp = v.getSystemProperties();
3.72 - if (Boolean.getBoolean("java.awt.headless")) {
3.73 - sysProp.put("java.awt.headless", "true");
3.74 - }
3.75 - v.addCliOption("-Pbck2brwsr");
3.76 - v.executeGoal("verify");
3.77 -
3.78 - v.verifyErrorFreeLog();
3.79 -
3.80 - // no longer does pre-compilation to JavaScript
3.81 - // v.verifyTextInLog("j2js");
3.82 - // uses Bck2BrwsrLauncher
3.83 - v.verifyTextInLog("BaseHTTPLauncher showBrwsr");
3.84 - // building zip:
3.85 - v.verifyTextInLog("b2bcompile/o-a-test/target/o-a-test-1.0-SNAPSHOT-bck2brwsr.zip");
3.86 -
3.87 - for (String l : v.loadFile(v.getBasedir(), v.getLogFileName(), false)) {
3.88 - if (l.contains("fxbrwsr")) {
3.89 - fail("No fxbrwsr:\n" + l);
3.90 - }
3.91 - }
3.92 -
3.93 - File zip = new File(new File(created, "target"), "o-a-test-1.0-SNAPSHOT-bck2brwsr.zip");
3.94 - assertTrue(zip.isFile(), "Zip file with website was created");
3.95 -
3.96 - ZipFile zf = new ZipFile(zip);
3.97 - final ZipEntry index = zf.getEntry("public_html/index.html");
3.98 - assertNotNull(index, "index.html found");
3.99 -
3.100 - String txt = readText(zf.getInputStream(index));
3.101 - final int beg = txt.indexOf("${");
3.102 - if (beg >= 0) {
3.103 - int end = txt.indexOf("}", beg);
3.104 - if (end < beg) {
3.105 - end = txt.length();
3.106 - }
3.107 - fail("No substitutions in index.html. Found: " + txt.substring(beg, end));
3.108 - }
3.109 - }
3.110 -
3.111 - private Verifier generateFromArchetype(final File dir, String... params) throws Exception {
3.112 - Verifier v = new Verifier(dir.getAbsolutePath());
3.113 - v.setAutoclean(false);
3.114 - v.setLogFileName("generate.log");
3.115 - v.deleteDirectory("");
3.116 - dir.mkdirs();
3.117 - Properties sysProp = v.getSystemProperties();
3.118 - sysProp.put("groupId", "org.apidesign.test");
3.119 - sysProp.put("artifactId", "o-a-test");
3.120 - sysProp.put("package", "org.apidesign.test.oat");
3.121 - sysProp.put("archetypeGroupId", "org.apidesign.bck2brwsr");
3.122 - sysProp.put("archetypeArtifactId", "knockout4j-archetype");
3.123 - sysProp.put("archetypeVersion", ArchetypeVersionTest.findCurrentVersion());
3.124 -
3.125 - for (String p : params) {
3.126 - v.addCliOption(p);
3.127 - }
3.128 - v.executeGoal("archetype:generate");
3.129 - v.verifyErrorFreeLog();
3.130 - return v;
3.131 - }
3.132 -
3.133 - private static String readText(InputStream is) throws IOException {
3.134 - return Files.readFile(is);
3.135 - }
3.136 -}
4.1 --- a/ko/archetype/pom.xml Mon Jun 09 09:38:03 2014 +0200
4.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
4.3 @@ -1,58 +0,0 @@
4.4 -<?xml version="1.0" encoding="UTF-8"?>
4.5 -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4.6 - <modelVersion>4.0.0</modelVersion>
4.7 - <parent>
4.8 - <artifactId>ko</artifactId>
4.9 - <groupId>org.apidesign.bck2brwsr</groupId>
4.10 - <version>0.9-SNAPSHOT</version>
4.11 - </parent>
4.12 - <groupId>org.apidesign.bck2brwsr</groupId>
4.13 - <artifactId>knockout4j-archetype</artifactId>
4.14 - <version>0.9-SNAPSHOT</version>
4.15 - <packaging>jar</packaging>
4.16 - <name>Knockout Bck2Brwsr Maven Archetype</name>
4.17 - <description>
4.18 - HTML page with Knockout.js bindings driven by application model
4.19 - written in Java. Use your favorite language to code. Use
4.20 - HTML as a lightweight rendering toolkit. Deploy using JavaFX or
4.21 - bck2brwsr virtual machine.
4.22 - </description>
4.23 - <build>
4.24 - <resources>
4.25 - <resource>
4.26 - <directory>src/main/resources</directory>
4.27 - <filtering>true</filtering>
4.28 - <includes>
4.29 - <include>**/pom.xml</include>
4.30 - </includes>
4.31 - </resource>
4.32 - <resource>
4.33 - <directory>src/main/resources</directory>
4.34 - <filtering>false</filtering>
4.35 - <excludes>
4.36 - <exclude>**/pom.xml</exclude>
4.37 - </excludes>
4.38 - </resource>
4.39 - </resources>
4.40 - <plugins>
4.41 - <plugin>
4.42 - <groupId>org.apache.maven.plugins</groupId>
4.43 - <artifactId>maven-compiler-plugin</artifactId>
4.44 - <version>2.3.2</version>
4.45 - <configuration>
4.46 - <source>1.6</source>
4.47 - <target>1.6</target>
4.48 - </configuration>
4.49 - </plugin>
4.50 - <plugin>
4.51 - <groupId>org.apache.maven.plugins</groupId>
4.52 - <artifactId>maven-resources-plugin</artifactId>
4.53 - <version>2.6</version>
4.54 - <configuration>
4.55 - <escapeString>\</escapeString>
4.56 - <target>1.6</target>
4.57 - </configuration>
4.58 - </plugin>
4.59 - </plugins>
4.60 - </build>
4.61 -</project>
5.1 --- a/ko/archetype/src/main/java/org/apidesign/bck2brwsr/ko/archetype/package-info.java Mon Jun 09 09:38:03 2014 +0200
5.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
5.3 @@ -1,18 +0,0 @@
5.4 -/**
5.5 - * Back 2 Browser Bytecode Translator
5.6 - * Copyright (C) 2012 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
5.7 - *
5.8 - * This program is free software: you can redistribute it and/or modify
5.9 - * it under the terms of the GNU General Public License as published by
5.10 - * the Free Software Foundation, version 2 of the License.
5.11 - *
5.12 - * This program is distributed in the hope that it will be useful,
5.13 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
5.14 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5.15 - * GNU General Public License for more details.
5.16 - *
5.17 - * You should have received a copy of the GNU General Public License
5.18 - * along with this program. Look for COPYING file in the top folder.
5.19 - * If not, see http://opensource.org/licenses/GPL-2.0.
5.20 - */
5.21 -package org.apidesign.bck2brwsr.ko.archetype;
6.1 --- a/ko/archetype/src/main/resources/META-INF/maven/archetype-metadata.xml Mon Jun 09 09:38:03 2014 +0200
6.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
6.3 @@ -1,63 +0,0 @@
6.4 -<?xml version="1.0" encoding="UTF-8"?>
6.5 -<!--
6.6 -
6.7 - Back 2 Browser Bytecode Translator
6.8 - Copyright (C) 2012 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
6.9 -
6.10 - This program is free software: you can redistribute it and/or modify
6.11 - it under the terms of the GNU General Public License as published by
6.12 - the Free Software Foundation, version 2 of the License.
6.13 -
6.14 - This program is distributed in the hope that it will be useful,
6.15 - but WITHOUT ANY WARRANTY; without even the implied warranty of
6.16 - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6.17 - GNU General Public License for more details.
6.18 -
6.19 - You should have received a copy of the GNU General Public License
6.20 - along with this program. Look for COPYING file in the top folder.
6.21 - If not, see http://opensource.org/licenses/GPL-2.0.
6.22 -
6.23 --->
6.24 -<archetype-descriptor name="FX/Bck2Brwsr Example">
6.25 - <fileSets>
6.26 - <fileSet filtered="true" packaged="true">
6.27 - <directory>src/main/java</directory>
6.28 - <includes>
6.29 - <include>**/*.java</include>
6.30 - </includes>
6.31 - </fileSet>
6.32 - <fileSet filtered="true" packaged="false">
6.33 - <directory>src/main/webapp/pages</directory>
6.34 - <includes>
6.35 - <include>**/*.xhtml</include>
6.36 - <include>**/*.html</include>
6.37 - <include>**/*.css</include>
6.38 - </includes>
6.39 - </fileSet>
6.40 - <fileSet filtered="true" packaged="true">
6.41 - <directory>src/test/java</directory>
6.42 - <includes>
6.43 - <include>**/*Test.java</include>
6.44 - </includes>
6.45 - </fileSet>
6.46 - <fileSet filtered="true" packaged="false">
6.47 - <directory>src/main/assembly</directory>
6.48 - <includes>
6.49 - <include>**/*.xml</include>
6.50 - </includes>
6.51 - </fileSet>
6.52 - <fileSet filtered="false" packaged="false">
6.53 - <directory></directory>
6.54 - <includes>
6.55 - <include>nbactions*.xml</include>
6.56 - </includes>
6.57 - </fileSet>
6.58 - <fileSet filtered="true" packaged="false">
6.59 - <directory>assembly</directory>
6.60 - <includes>
6.61 - <include>fxbrwsr-assembly.xml</include>
6.62 - <include>bck2brwsr-assembly.xml</include>
6.63 - </includes>
6.64 - </fileSet>
6.65 - </fileSets>
6.66 -</archetype-descriptor>
6.67 \ No newline at end of file
7.1 --- a/ko/archetype/src/main/resources/archetype-resources/nbactions-bck2brwsr.xml Mon Jun 09 09:38:03 2014 +0200
7.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
7.3 @@ -1,14 +0,0 @@
7.4 -<?xml version="1.0" encoding="UTF-8"?>
7.5 -<actions>
7.6 - <action>
7.7 - <actionName>run</actionName>
7.8 - <goals>
7.9 - <goal>package</goal>
7.10 - <goal>bck2brwsr:brwsr</goal>
7.11 - </goals>
7.12 - <properties>
7.13 - <skipTests>true</skipTests>
7.14 - <bck2brwsr.obfuscationlevel>NONE</bck2brwsr.obfuscationlevel>
7.15 - </properties>
7.16 - </action>
7.17 -</actions>
8.1 --- a/ko/archetype/src/main/resources/archetype-resources/nbactions-fxbrwsr.xml Mon Jun 09 09:38:03 2014 +0200
8.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
8.3 @@ -1,20 +0,0 @@
8.4 -<?xml version="1.0" encoding="UTF-8"?>
8.5 -<actions>
8.6 - <action>
8.7 - <actionName>run</actionName>
8.8 - <goals>
8.9 - <goal>process-classes</goal>
8.10 - <goal>bck2brwsr:brwsr</goal>
8.11 - </goals>
8.12 - </action>
8.13 - <action>
8.14 - <actionName>debug</actionName>
8.15 - <goals>
8.16 - <goal>process-classes</goal>
8.17 - <goal>bck2brwsr:brwsr</goal>
8.18 - </goals>
8.19 - <properties>
8.20 - <jpda.listen>maven</jpda.listen>
8.21 - </properties>
8.22 - </action>
8.23 -</actions>
9.1 --- a/ko/archetype/src/main/resources/archetype-resources/nbactions.xml Mon Jun 09 09:38:03 2014 +0200
9.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
9.3 @@ -1,20 +0,0 @@
9.4 -<?xml version="1.0" encoding="UTF-8"?>
9.5 -<actions>
9.6 - <action>
9.7 - <actionName>run</actionName>
9.8 - <goals>
9.9 - <goal>process-classes</goal>
9.10 - <goal>bck2brwsr:brwsr</goal>
9.11 - </goals>
9.12 - </action>
9.13 - <action>
9.14 - <actionName>debug</actionName>
9.15 - <goals>
9.16 - <goal>process-classes</goal>
9.17 - <goal>bck2brwsr:brwsr</goal>
9.18 - </goals>
9.19 - <properties>
9.20 - <jpda.listen>maven</jpda.listen>
9.21 - </properties>
9.22 - </action>
9.23 -</actions>
10.1 --- a/ko/archetype/src/main/resources/archetype-resources/pom.xml Mon Jun 09 09:38:03 2014 +0200
10.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
10.3 @@ -1,283 +0,0 @@
10.4 -<?xml version="1.0"?>
10.5 -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10.6 - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
10.7 - <modelVersion>4.0.0</modelVersion>
10.8 -
10.9 - <groupId>\${groupId}</groupId>
10.10 - <artifactId>\${artifactId}</artifactId>
10.11 - <version>\${version}</version>
10.12 - <packaging>jar</packaging>
10.13 -
10.14 - <name>\${artifactId}</name>
10.15 -
10.16 - <repositories>
10.17 - <repository>
10.18 - <id>java.net</id>
10.19 - <name>Java.net</name>
10.20 - <url>https://maven.java.net/content/repositories/releases/</url>
10.21 - <snapshots>
10.22 - <enabled>true</enabled>
10.23 - </snapshots>
10.24 - </repository>
10.25 - <repository>
10.26 - <id>netbeans</id>
10.27 - <name>NetBeans</name>
10.28 - <url>http://bits.netbeans.org/maven2/</url>
10.29 - </repository>
10.30 - </repositories>
10.31 - <pluginRepositories>
10.32 - <pluginRepository>
10.33 - <id>java.net</id>
10.34 - <name>Java.net</name>
10.35 - <url>https://maven.java.net/content/repositories/releases/</url>
10.36 - <snapshots>
10.37 - <enabled>true</enabled>
10.38 - </snapshots>
10.39 - </pluginRepository>
10.40 - </pluginRepositories>
10.41 -
10.42 - <properties>
10.43 - <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
10.44 - <net.java.html.version>${net.java.html.version}</net.java.html.version>
10.45 - <bck2brwsr.version>${project.version}</bck2brwsr.version>
10.46 - <bck2brwsr.launcher.version>${project.version}</bck2brwsr.launcher.version>
10.47 - <bck2brwsr.obfuscationlevel>MINIMAL</bck2brwsr.obfuscationlevel>
10.48 - <brwsr.startpage>pages/index.html</brwsr.startpage>
10.49 - <netbeans.compile.on.save>none</netbeans.compile.on.save>
10.50 - </properties>
10.51 - <build>
10.52 - <plugins>
10.53 - <plugin>
10.54 - <groupId>org.apidesign.bck2brwsr</groupId>
10.55 - <artifactId>bck2brwsr-maven-plugin</artifactId>
10.56 - <version>\${bck2brwsr.launcher.version}</version>
10.57 - <executions>
10.58 - <execution>
10.59 - <goals>
10.60 - <goal>brwsr</goal>
10.61 - </goals>
10.62 - </execution>
10.63 - </executions>
10.64 - <configuration>
10.65 - <directory>\${basedir}/src/main/webapp/</directory>
10.66 - <startpage>${brwsr.startpage}</startpage>
10.67 - <launcher>${brwsr}</launcher>
10.68 - </configuration>
10.69 - </plugin>
10.70 - <plugin>
10.71 - <groupId>org.netbeans.html</groupId>
10.72 - <artifactId>html4j-maven-plugin</artifactId>
10.73 - <version>${net.java.html.version}</version>
10.74 - <executions>
10.75 - <execution>
10.76 - <id>js-classes</id>
10.77 - <goals>
10.78 - <goal>process-js-annotations</goal>
10.79 - </goals>
10.80 - </execution>
10.81 - </executions>
10.82 - </plugin>
10.83 - <plugin>
10.84 - <groupId>org.apache.maven.plugins</groupId>
10.85 - <artifactId>maven-compiler-plugin</artifactId>
10.86 - <version>2.3.2</version>
10.87 - <configuration>
10.88 - <source>1.7</source>
10.89 - <target>1.7</target>
10.90 - </configuration>
10.91 - </plugin>
10.92 - <plugin>
10.93 - <groupId>org.apache.maven.plugins</groupId>
10.94 - <artifactId>maven-surefire-plugin</artifactId>
10.95 - <version>2.14.1</version>
10.96 - <configuration>
10.97 - <systemPropertyVariables>
10.98 - <vmtest.brwsrs>\${brwsr}</vmtest.brwsrs>
10.99 - </systemPropertyVariables>
10.100 - </configuration>
10.101 - </plugin>
10.102 - <plugin>
10.103 - <groupId>org.apache.maven.plugins</groupId>
10.104 - <artifactId>maven-jar-plugin</artifactId>
10.105 - <version>2.4</version>
10.106 - <configuration>
10.107 - <archive>
10.108 - <manifest>
10.109 - <addClasspath>true</addClasspath>
10.110 - <classpathPrefix>lib/</classpathPrefix>
10.111 - </manifest>
10.112 - </archive>
10.113 - </configuration>
10.114 - </plugin>
10.115 - <plugin>
10.116 - <groupId>org.apache.maven.plugins</groupId>
10.117 - <artifactId>maven-deploy-plugin</artifactId>
10.118 - <version>2.7</version>
10.119 - <configuration>
10.120 - <skip>true</skip>
10.121 - </configuration>
10.122 - </plugin>
10.123 - </plugins>
10.124 - </build>
10.125 -
10.126 - <dependencies>
10.127 - <dependency>
10.128 - <groupId>org.testng</groupId>
10.129 - <artifactId>testng</artifactId>
10.130 - <version>6.7</version>
10.131 - <scope>test</scope>
10.132 - </dependency>
10.133 - <dependency>
10.134 - <groupId>org.apidesign.bck2brwsr</groupId>
10.135 - <artifactId>launcher.http</artifactId>
10.136 - <version>\${bck2brwsr.launcher.version}</version>
10.137 - <scope>test</scope>
10.138 - </dependency>
10.139 - <dependency>
10.140 - <groupId>org.apidesign.bck2brwsr</groupId>
10.141 - <artifactId>vmtest</artifactId>
10.142 - <version>\${bck2brwsr.version}</version>
10.143 - <scope>test</scope>
10.144 - </dependency>
10.145 - <dependency>
10.146 - <groupId>org.netbeans.html</groupId>
10.147 - <artifactId>net.java.html.json</artifactId>
10.148 - <version>\${net.java.html.version}</version>
10.149 - <type>jar</type>
10.150 - </dependency>
10.151 - <dependency>
10.152 - <groupId>org.netbeans.html</groupId>
10.153 - <artifactId>net.java.html.boot</artifactId>
10.154 - <version>\${net.java.html.version}</version>
10.155 - <type>jar</type>
10.156 - </dependency>
10.157 - </dependencies>
10.158 - <profiles>
10.159 - <profile>
10.160 - <id>fxbrwsr</id>
10.161 - <activation>
10.162 - <activeByDefault>true</activeByDefault>
10.163 - </activation>
10.164 - <properties>
10.165 - <brwsr>fxbrwsr</brwsr>
10.166 - </properties>
10.167 - <build>
10.168 - <plugins>
10.169 - <plugin>
10.170 - <groupId>org.apache.maven.plugins</groupId>
10.171 - <artifactId>maven-jar-plugin</artifactId>
10.172 - <version>2.4</version>
10.173 - <configuration>
10.174 - <archive>
10.175 - <manifest>
10.176 - <mainClass>org.apidesign.bck2brwsr.launcher.FXBrwsrLauncher</mainClass>
10.177 - <addClasspath>true</addClasspath>
10.178 - <classpathPrefix>lib/</classpathPrefix>
10.179 - </manifest>
10.180 - <manifestEntries>
10.181 - <StartPage>\${brwsr.startpage}</StartPage>
10.182 - </manifestEntries>
10.183 - </archive>
10.184 - </configuration>
10.185 - </plugin>
10.186 - <plugin>
10.187 - <artifactId>maven-assembly-plugin</artifactId>
10.188 - <version>2.4</version>
10.189 - <executions>
10.190 - <execution>
10.191 - <id>distro-assembly</id>
10.192 - <phase>package</phase>
10.193 - <goals>
10.194 - <goal>single</goal>
10.195 - </goals>
10.196 - <configuration>
10.197 - <descriptors>
10.198 - <descriptor>src/main/assembly/fxbrwsr.xml</descriptor>
10.199 - </descriptors>
10.200 - </configuration>
10.201 - </execution>
10.202 - </executions>
10.203 - </plugin>
10.204 - </plugins>
10.205 - </build>
10.206 - <dependencies>
10.207 - <dependency>
10.208 - <groupId>org.netbeans.html</groupId>
10.209 - <artifactId>ko4j</artifactId>
10.210 - <version>\${net.java.html.version}</version>
10.211 - </dependency>
10.212 - <dependency>
10.213 - <groupId>org.apidesign.bck2brwsr</groupId>
10.214 - <artifactId>launcher.fx</artifactId>
10.215 - <version>\${bck2brwsr.launcher.version}</version>
10.216 - <scope>runtime</scope>
10.217 - </dependency>
10.218 - </dependencies>
10.219 - </profile>
10.220 - <profile>
10.221 - <id>bck2brwsr</id>
10.222 - <activation>
10.223 - <property>
10.224 - <name>brwsr</name>
10.225 - <value>bck2brwsr</value>
10.226 - </property>
10.227 - </activation>
10.228 - <build>
10.229 - <plugins>
10.230 - <plugin>
10.231 - <groupId>org.apache.maven.plugins</groupId>
10.232 - <artifactId>maven-compiler-plugin</artifactId>
10.233 - <configuration>
10.234 - <compilerArguments>
10.235 - <bootclasspath>netbeans.ignore.jdk.bootclasspath</bootclasspath>
10.236 - </compilerArguments>
10.237 - <testExcludes>
10.238 - <exclude>**/JsInteractionTest*</exclude>
10.239 - </testExcludes>
10.240 - </configuration>
10.241 - </plugin>
10.242 - <plugin>
10.243 - <artifactId>maven-assembly-plugin</artifactId>
10.244 - <version>2.4</version>
10.245 - <executions>
10.246 - <execution>
10.247 - <id>distro-assembly</id>
10.248 - <phase>package</phase>
10.249 - <goals>
10.250 - <goal>single</goal>
10.251 - </goals>
10.252 - <configuration>
10.253 - <descriptors>
10.254 - <descriptor>src/main/assembly/bck2brwsr.xml</descriptor>
10.255 - </descriptors>
10.256 - </configuration>
10.257 - </execution>
10.258 - </executions>
10.259 - </plugin>
10.260 - </plugins>
10.261 - </build>
10.262 - <dependencies>
10.263 - <dependency>
10.264 - <groupId>org.apidesign.bck2brwsr</groupId>
10.265 - <artifactId>emul</artifactId>
10.266 - <version>\${bck2brwsr.version}</version>
10.267 - <classifier>rt</classifier>
10.268 - </dependency>
10.269 - <dependency>
10.270 - <groupId>org.apidesign.bck2brwsr</groupId>
10.271 - <artifactId>ko-bck2brwsr</artifactId>
10.272 - <version>\${bck2brwsr.version}</version>
10.273 - <scope>runtime</scope>
10.274 - </dependency>
10.275 - <dependency>
10.276 - <groupId>org.apidesign.bck2brwsr</groupId>
10.277 - <artifactId>vm4brwsr</artifactId>
10.278 - <classifier>js</classifier>
10.279 - <type>zip</type>
10.280 - <version>\${bck2brwsr.version}</version>
10.281 - <scope>provided</scope>
10.282 - </dependency>
10.283 - </dependencies>
10.284 - </profile>
10.285 - </profiles>
10.286 -</project>
11.1 --- a/ko/archetype/src/main/resources/archetype-resources/src/main/assembly/bck2brwsr.xml Mon Jun 09 09:38:03 2014 +0200
11.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
11.3 @@ -1,43 +0,0 @@
11.4 -<?xml version="1.0"?>
11.5 -<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
11.6 - xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
11.7 -
11.8 - <id>bck2brwsr</id>
11.9 - <formats>
11.10 - <format>zip</format>
11.11 - </formats>
11.12 - <baseDirectory>public_html</baseDirectory>
11.13 - <dependencySets>
11.14 - <dependencySet>
11.15 - <useProjectArtifact>false</useProjectArtifact>
11.16 - <scope>runtime</scope>
11.17 - <outputDirectory>lib</outputDirectory>
11.18 - <includes>
11.19 - <include>*:jar</include>
11.20 - <include>*:rt</include>
11.21 - </includes>
11.22 - </dependencySet>
11.23 - <dependencySet>
11.24 - <useProjectArtifact>false</useProjectArtifact>
11.25 - <scope>provided</scope>
11.26 - <includes>
11.27 - <include>*:js</include>
11.28 - </includes>
11.29 - <unpack>true</unpack>
11.30 - <outputDirectory>/</outputDirectory>
11.31 - </dependencySet>
11.32 - </dependencySets>
11.33 - <fileSets>
11.34 - <fileSet>
11.35 - <directory>src/main/webapp/pages</directory>
11.36 - <outputDirectory>/</outputDirectory>
11.37 - <filtered>true</filtered>
11.38 - </fileSet>
11.39 - </fileSets>
11.40 - <files>
11.41 - <file>
11.42 - <source>${project.build.directory}/${project.build.finalName}.jar</source>
11.43 - <outputDirectory>/</outputDirectory>
11.44 - </file>
11.45 - </files>
11.46 -</assembly>
11.47 \ No newline at end of file
12.1 --- a/ko/archetype/src/main/resources/archetype-resources/src/main/assembly/fxbrwsr.xml Mon Jun 09 09:38:03 2014 +0200
12.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
12.3 @@ -1,33 +0,0 @@
12.4 -<?xml version="1.0"?>
12.5 -<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
12.6 - xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
12.7 -
12.8 - <id>fxbrwsr</id>
12.9 - <formats>
12.10 - <format>zip</format>
12.11 - </formats>
12.12 - <baseDirectory>${project.build.finalName}-fxbrwsr</baseDirectory>
12.13 - <dependencySets>
12.14 - <dependencySet>
12.15 - <useProjectArtifact>false</useProjectArtifact>
12.16 - <scope>runtime</scope>
12.17 - <outputDirectory>lib</outputDirectory>
12.18 - </dependencySet>
12.19 - </dependencySets>
12.20 - <files>
12.21 - <file>
12.22 - <source>${project.build.directory}/${project.build.finalName}.jar</source>
12.23 - <outputDirectory>/</outputDirectory>
12.24 - </file>
12.25 - </files>
12.26 - <fileSets>
12.27 - <fileSet>
12.28 - <directory>src/main/webapp/</directory>
12.29 - <outputDirectory>/</outputDirectory>
12.30 - <includes>
12.31 - <include>pages/**</include>
12.32 - </includes>
12.33 - <filtered>true</filtered>
12.34 - </fileSet>
12.35 - </fileSets>
12.36 -</assembly>
12.37 \ No newline at end of file
13.1 --- a/ko/archetype/src/main/resources/archetype-resources/src/main/java/DataModel.java Mon Jun 09 09:38:03 2014 +0200
13.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
13.3 @@ -1,45 +0,0 @@
13.4 -package ${package};
13.5 -
13.6 -import net.java.html.json.ComputedProperty;
13.7 -import net.java.html.json.Function;
13.8 -import net.java.html.json.Model;
13.9 -import net.java.html.json.Property;
13.10 -
13.11 -/** Model annotation generates class Data with
13.12 - * one message property, boolean property and read only words property
13.13 - */
13.14 -@Model(className = "Data", properties = {
13.15 - @Property(name = "message", type = String.class),
13.16 - @Property(name = "on", type = boolean.class)
13.17 -})
13.18 -final class DataModel {
13.19 - @ComputedProperty static java.util.List<String> words(String message) {
13.20 - String[] arr = new String[6];
13.21 - String[] words = message == null ? new String[0] : message.split(" ", 6);
13.22 - for (int i = 0; i < 6; i++) {
13.23 - arr[i] = words.length > i ? words[i] : "!";
13.24 - }
13.25 - return java.util.Arrays.asList(arr);
13.26 - }
13.27 -
13.28 - @Function static void turnOn(Data model) {
13.29 - model.setOn(true);
13.30 - }
13.31 -
13.32 - @Function static void turnOff(final Data model) {
13.33 - confirmByUser("Really turn off?", new Runnable() {
13.34 - @Override
13.35 - public void run() {
13.36 - model.setOn(false);
13.37 - }
13.38 - });
13.39 - }
13.40 -
13.41 - /** Shows direct interaction with JavaScript */
13.42 - @net.java.html.js.JavaScriptBody(
13.43 - args = { "msg", "callback" },
13.44 - javacall = true,
13.45 - body = "alert(msg); callback.@java.lang.Runnable::run()();"
13.46 - )
13.47 - static native void confirmByUser(String msg, Runnable callback);
13.48 -}
14.1 --- a/ko/archetype/src/main/resources/archetype-resources/src/main/java/Main.java Mon Jun 09 09:38:03 2014 +0200
14.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
14.3 @@ -1,15 +0,0 @@
14.4 -package ${package};
14.5 -
14.6 -public final class Main {
14.7 - private Main() {
14.8 - }
14.9 -
14.10 - /**
14.11 - * Called when the page is ready.
14.12 - */
14.13 - static {
14.14 - Data d = new Data();
14.15 - d.setMessage("Hello World from HTML and Java!");
14.16 - d.applyBindings();
14.17 - }
14.18 -}
15.1 --- a/ko/archetype/src/main/resources/archetype-resources/src/main/webapp/pages/index.html Mon Jun 09 09:38:03 2014 +0200
15.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
15.3 @@ -1,72 +0,0 @@
15.4 -<!DOCTYPE html>
15.5 -<html>
15.6 - <head>
15.7 - <title></title>
15.8 - <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
15.9 -
15.10 - <style type="text/css">
15.11 - @-webkit-keyframes spin {
15.12 - 0% { -webkit-transform: rotate(0deg); }
15.13 - 100% { -webkit-transform: rotate(360deg); }
15.14 - }
15.15 - @keyframes spin {
15.16 - 0% { transform: rotate(0deg); }
15.17 - 100% { transform: rotate(360deg); }
15.18 - }
15.19 -
15.20 - .rotate {
15.21 - -webkit-animation-name: spin;
15.22 - -webkit-animation-duration: 3s;
15.23 - -webkit-animation-iteration-count: infinite;
15.24 - -webkit-animation-direction: alternate;
15.25 -
15.26 - animation-name: spin;
15.27 - animation-duration: 3s;
15.28 - animation-iteration-count: infinite;
15.29 - animation-direction: alternate;
15.30 - }
15.31 -
15.32 - #scene {
15.33 - position: relative;
15.34 - top: 60px;
15.35 - text-align: center;
15.36 - }
15.37 -
15.38 - #words span {
15.39 - border: 1px solid #ccc;
15.40 - background: rgba(255,255,155,0.8);
15.41 - text-align: center;
15.42 - font-size: 30px;
15.43 - -webkit-box-shadow: inset 0 0 40px rgba(0,0,0,0.4);
15.44 - position: absolute;
15.45 - }
15.46 -
15.47 - #words span:nth-child(1) { left: 45%; top: 0px; }
15.48 - #words span:nth-child(2) { left: 25%; top: 100px; }
15.49 - #words span:nth-child(3) { left: 65%; top: 100px; }
15.50 - #words span:nth-child(4) { left: 10%; top: 200px; }
15.51 - #words span:nth-child(5) { left: 45%; top: 200px; }
15.52 - #words span:nth-child(6) { left: 80%; top: 200px; }
15.53 -
15.54 - </style>
15.55 -
15.56 - </head>
15.57 - <body>
15.58 - <h1>Words Demo</h1>
15.59 - <input data-bind="value: message, valueUpdate: 'afterkeydown'" size="80">
15.60 - <br>
15.61 - <button data-bind="enable: !on(), click: $root.turnOn">Start</button>
15.62 - <button data-bind="enable: on, click: $root.turnOff">Stop</button>
15.63 -
15.64 - <div id="scene">
15.65 - <span id="words" data-bind="foreach: words">
15.66 - <span data-bind="text: $data, css: { 'rotate' : $root.on } "></span>
15.67 - </span>
15.68 - </div>
15.69 - <script type="text/javascript" src="bck2brwsr.js"></script>
15.70 - <script>
15.71 - var vm = bck2brwsr('${project.build.finalName}.jar');
15.72 - vm.loadClass('${package}.Main');
15.73 - </script>
15.74 - </body>
15.75 -</html>
16.1 --- a/ko/archetype/src/main/resources/archetype-resources/src/test/java/DataModelTest.java Mon Jun 09 09:38:03 2014 +0200
16.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
16.3 @@ -1,16 +0,0 @@
16.4 -package ${package};
16.5 -
16.6 -import static org.testng.Assert.*;
16.7 -import org.testng.annotations.Test;
16.8 -
16.9 -public class DataModelTest {
16.10 - @Test public void areHelloWorldTwoWords() {
16.11 - Data model = new Data();
16.12 - model.setMessage("Hello World!");
16.13 -
16.14 - java.util.List<String> arr = model.getWords();
16.15 - assertEquals(arr.size(), 6, "Six words always");
16.16 - assertEquals("Hello", arr.get(0), "Hello is the first word");
16.17 - assertEquals("World!", arr.get(1), "World is the second word");
16.18 - }
16.19 -}
17.1 --- a/ko/archetype/src/main/resources/archetype-resources/src/test/java/InconsistencyTest.java Mon Jun 09 09:38:03 2014 +0200
17.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
17.3 @@ -1,38 +0,0 @@
17.4 -package ${package};
17.5 -
17.6 -import org.apidesign.bck2brwsr.vmtest.Compare;
17.7 -import org.apidesign.bck2brwsr.vmtest.VMTest;
17.8 -import org.testng.annotations.Factory;
17.9 -
17.10 -/** Bck2brwsr cares about compatibility with real Java. Whatever API is
17.11 - * supported by bck2brwsr, it needs to behave the same way as when running
17.12 - * in HotSpot VM.
17.13 - * <p>
17.14 - * There can be bugs, however. To help us fix them, we kindly ask you to
17.15 - * write an "inconsistency" test. A test that compares behavior of the API
17.16 - * between real VM and bck2brwsr VM. This class is skeleton of such test.
17.17 - */
17.18 -public class InconsistencyTest {
17.19 - /** A method to demonstrate inconsistency between bck2brwsr and HotSpot.
17.20 - * Make calls to an API that behaves strangely, return some result at
17.21 - * the end. No need to use any <code>assert</code>.
17.22 - *
17.23 - * @return value to compare between HotSpot and bck2brwsr
17.24 - */
17.25 - @Compare
17.26 - public int checkStringHashCode() throws Exception {
17.27 - return "Is string hashCode the same?".hashCode();
17.28 - }
17.29 -
17.30 - /** Factory method that creates a three tests for each method annotated with
17.31 - * {@link org.apidesign.bck2brwsr.vmtest.Compare}. One executes the code in
17.32 - * HotSpot, one in Rhino and the last one compares the results.
17.33 - *
17.34 - * @see org.apidesign.bck2brwsr.vmtest.VMTest
17.35 - */
17.36 - @Factory
17.37 - public static Object[] create() {
17.38 - return VMTest.create(InconsistencyTest.class);
17.39 - }
17.40 -
17.41 -}
18.1 --- a/ko/archetype/src/main/resources/archetype-resources/src/test/java/IntegrationTest.java Mon Jun 09 09:38:03 2014 +0200
18.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
18.3 @@ -1,31 +0,0 @@
18.4 -package ${package};
18.5 -
18.6 -import org.apidesign.bck2brwsr.vmtest.BrwsrTest;
18.7 -import org.apidesign.bck2brwsr.vmtest.HtmlFragment;
18.8 -import org.apidesign.bck2brwsr.vmtest.VMTest;
18.9 -import org.testng.annotations.Factory;
18.10 -
18.11 -/** Sometimes it is useful to run tests inside of the real browser.
18.12 - * To do that just annotate your method with {@link org.apidesign.bck2brwsr.vmtest.BrwsrTest}
18.13 - * and that is it. If your code references elements on the HTML page,
18.14 - * you can pass in an {@link org.apidesign.bck2brwsr.vmtest.HtmlFragment} which
18.15 - * will be made available on the page before your test starts.
18.16 - */
18.17 -public class IntegrationTest {
18.18 -
18.19 - /** Write to testing code here. Use <code>assert</code> (but not TestNG's
18.20 - * Assert, as TestNG is not compiled with target 1.6 yet).
18.21 - */
18.22 - @HtmlFragment(
18.23 - "<h1>Put this snippet on the HTML page</h1>\n"
18.24 - )
18.25 - @BrwsrTest
18.26 - public void runThisTestInABrowser() {
18.27 - }
18.28 -
18.29 - @Factory
18.30 - public static Object[] create() {
18.31 - return VMTest.create(IntegrationTest.class);
18.32 - }
18.33 -
18.34 -}
19.1 --- a/ko/archetype/src/main/resources/archetype-resources/src/test/java/JsInteractionTest.java Mon Jun 09 09:38:03 2014 +0200
19.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
19.3 @@ -1,103 +0,0 @@
19.4 -package ${package};
19.5 -
19.6 -import java.io.Closeable;
19.7 -import java.io.Reader;
19.8 -import java.net.URL;
19.9 -import java.util.ArrayList;
19.10 -import java.util.List;
19.11 -import javax.script.Invocable;
19.12 -import javax.script.ScriptEngine;
19.13 -import javax.script.ScriptEngineManager;
19.14 -import javax.script.ScriptException;
19.15 -import org.apidesign.html.boot.spi.Fn;
19.16 -import static org.testng.Assert.assertEquals;
19.17 -import org.testng.annotations.AfterMethod;
19.18 -import org.testng.annotations.BeforeMethod;
19.19 -import org.testng.annotations.Test;
19.20 -
19.21 -/** Tests for behavior of @JavaScriptBody methods. Set your JavaScript
19.22 - * environment up (for example define <code>alert</code> or use some
19.23 - * emulation library like <em>env.js</em>), register script presenter
19.24 - * and then you can call methods that deal with JavaScript in your tests.
19.25 - */
19.26 -public class JsInteractionTest {
19.27 - private Closeable jsEngine;
19.28 - @BeforeMethod public void initializeJSEngine() throws Exception {
19.29 - jsEngine = Fn.activate(new ScriptPresenter());
19.30 - }
19.31 -
19.32 - @AfterMethod public void shutdownJSEngine() throws Exception {
19.33 - jsEngine.close();
19.34 - }
19.35 -
19.36 - @Test public void testCallbackFromJavaScript() throws Exception {
19.37 - class R implements Runnable {
19.38 - int called;
19.39 -
19.40 - @Override
19.41 - public void run() {
19.42 - called++;
19.43 - }
19.44 - }
19.45 - R callback = new R();
19.46 -
19.47 - DataModel.confirmByUser("Hello", callback);
19.48 -
19.49 - assertEquals(callback.called, 1, "One immediate callback");
19.50 - }
19.51 -
19.52 - private static class ScriptPresenter implements Fn.Presenter {
19.53 - private final ScriptEngine eng;
19.54 -
19.55 - public ScriptPresenter() throws ScriptException {
19.56 - eng = new ScriptEngineManager().getEngineByName("javascript");
19.57 - eng.eval("function alert(msg) { Packages.java.lang.System.out.println(msg); };");
19.58 - }
19.59 -
19.60 - @Override
19.61 - public Fn defineFn(String code, String... names) {
19.62 - StringBuilder sb = new StringBuilder();
19.63 - sb.append("(function() {");
19.64 - sb.append(" return function(");
19.65 - String sep = "";
19.66 - for (String n : names) {
19.67 - sb.append(sep).append(n);
19.68 - sep = ",";
19.69 - }
19.70 - sb.append(") {\n");
19.71 - sb.append(code);
19.72 - sb.append("};");
19.73 - sb.append("})()");
19.74 -
19.75 - final Object fn;
19.76 - try {
19.77 - fn = eng.eval(sb.toString());
19.78 - } catch (ScriptException ex) {
19.79 - throw new IllegalStateException(ex);
19.80 - }
19.81 - return new Fn(this) {
19.82 - @Override
19.83 - public Object invoke(Object thiz, Object... args) throws Exception {
19.84 - List<Object> all = new ArrayList<Object>(args.length + 1);
19.85 - all.add(thiz == null ? fn : thiz);
19.86 - for (int i = 0; i < args.length; i++) {
19.87 - all.add(args[i]);
19.88 - }
19.89 - Object ret = ((Invocable)eng).invokeMethod(fn, "call", all.toArray()); // NOI18N
19.90 - return fn.equals(ret) ? null : thiz;
19.91 - }
19.92 - };
19.93 - }
19.94 -
19.95 - @Override
19.96 - public void displayPage(URL page, Runnable onPageLoad) {
19.97 - // not really displaying anything
19.98 - onPageLoad.run();
19.99 - }
19.100 -
19.101 - @Override
19.102 - public void loadScript(Reader code) throws Exception {
19.103 - eng.eval(code);
19.104 - }
19.105 - }
19.106 -}
20.1 --- a/ko/pom.xml Mon Jun 09 09:38:03 2014 +0200
20.2 +++ b/ko/pom.xml Mon Jun 09 09:39:59 2014 +0200
20.3 @@ -12,8 +12,6 @@
20.4 <version>0.9-SNAPSHOT</version>
20.5 </parent>
20.6 <modules>
20.7 - <module>archetype</module>
20.8 - <module>archetype-test</module>
20.9 <module>bck2brwsr</module>
20.10 <module>fx</module>
20.11 </modules>