1.1 --- a/ko-archetype-test/pom.xml Wed Mar 26 18:28:26 2014 +0100
1.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1.3 @@ -1,58 +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.netbeans.html</groupId>
1.9 - <artifactId>pom</artifactId>
1.10 - <version>0.8-SNAPSHOT</version>
1.11 - </parent>
1.12 - <groupId>org.netbeans.html</groupId>
1.13 - <artifactId>ko-archetype-test</artifactId>
1.14 - <version>0.8-SNAPSHOT</version>
1.15 - <name>Knockout 4 Java 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 - <build>
1.22 - <plugins>
1.23 - <plugin>
1.24 - <artifactId>maven-failsafe-plugin</artifactId>
1.25 - <version>2.16</version>
1.26 - <executions>
1.27 - <execution>
1.28 - <goals>
1.29 - <goal>integration-test</goal>
1.30 - <goal>verify</goal>
1.31 - </goals>
1.32 - </execution>
1.33 - </executions>
1.34 - </plugin>
1.35 - </plugins>
1.36 - </build>
1.37 - <dependencies>
1.38 - <dependency>
1.39 - <groupId>org.apidesign.html</groupId>
1.40 - <artifactId>knockout4j-archetype</artifactId>
1.41 - <version>${project.version}</version>
1.42 - </dependency>
1.43 - <dependency>
1.44 - <groupId>org.testng</groupId>
1.45 - <artifactId>testng</artifactId>
1.46 - <scope>test</scope>
1.47 - </dependency>
1.48 - <dependency>
1.49 - <groupId>org.apache.maven.shared</groupId>
1.50 - <artifactId>maven-verifier</artifactId>
1.51 - <version>1.4</version>
1.52 - <scope>test</scope>
1.53 - </dependency>
1.54 - <dependency>
1.55 - <groupId>${project.groupId}</groupId>
1.56 - <artifactId>ko4j</artifactId>
1.57 - <version>${project.version}</version>
1.58 - <scope>provided</scope>
1.59 - </dependency>
1.60 - </dependencies>
1.61 -</project>
2.1 --- a/ko-archetype-test/src/test/java/org/netbeans/html/archetype/test/ArchetypeVersionIT.java Wed Mar 26 18:28:26 2014 +0100
2.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
2.3 @@ -1,128 +0,0 @@
2.4 -/**
2.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
2.6 - *
2.7 - * Copyright 2013-2014 Oracle and/or its affiliates. All rights reserved.
2.8 - *
2.9 - * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
2.10 - * Other names may be trademarks of their respective owners.
2.11 - *
2.12 - * The contents of this file are subject to the terms of either the GNU
2.13 - * General Public License Version 2 only ("GPL") or the Common
2.14 - * Development and Distribution License("CDDL") (collectively, the
2.15 - * "License"). You may not use this file except in compliance with the
2.16 - * License. You can obtain a copy of the License at
2.17 - * http://www.netbeans.org/cddl-gplv2.html
2.18 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
2.19 - * specific language governing permissions and limitations under the
2.20 - * License. When distributing the software, include this License Header
2.21 - * Notice in each file and include the License file at
2.22 - * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
2.23 - * particular file as subject to the "Classpath" exception as provided
2.24 - * by Oracle in the GPL Version 2 section of the License file that
2.25 - * accompanied this code. If applicable, add the following below the
2.26 - * License Header, with the fields enclosed by brackets [] replaced by
2.27 - * your own identifying information:
2.28 - * "Portions Copyrighted [year] [name of copyright owner]"
2.29 - *
2.30 - * Contributor(s):
2.31 - *
2.32 - * The Original Software is NetBeans. The Initial Developer of the Original
2.33 - * Software is Oracle. Portions Copyright 2013-2014 Oracle. All Rights Reserved.
2.34 - *
2.35 - * If you wish your version of this file to be governed by only the CDDL
2.36 - * or only the GPL Version 2, indicate your decision by adding
2.37 - * "[Contributor] elects to include this software in this distribution
2.38 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
2.39 - * single choice of license, a recipient has the option to distribute
2.40 - * your version of this file under either the CDDL, the GPL Version 2 or
2.41 - * to extend the choice of license to its licensees as provided above.
2.42 - * However, if you add GPL Version 2 code and therefore, elected the GPL
2.43 - * Version 2 license, then the option applies only if the new code is
2.44 - * made subject to such option by the copyright holder.
2.45 - */
2.46 -package org.netbeans.html.archetype.test;
2.47 -
2.48 -import java.io.IOException;
2.49 -import java.net.URL;
2.50 -import javax.xml.XMLConstants;
2.51 -import javax.xml.parsers.DocumentBuilderFactory;
2.52 -import javax.xml.parsers.ParserConfigurationException;
2.53 -import javax.xml.xpath.XPathConstants;
2.54 -import javax.xml.xpath.XPathExpression;
2.55 -import javax.xml.xpath.XPathExpressionException;
2.56 -import javax.xml.xpath.XPathFactory;
2.57 -import javax.xml.xpath.XPathFactoryConfigurationException;
2.58 -import org.testng.annotations.Test;
2.59 -import static org.testng.Assert.*;
2.60 -import org.testng.annotations.BeforeClass;
2.61 -import org.w3c.dom.Document;
2.62 -import org.w3c.dom.NodeList;
2.63 -import org.xml.sax.SAXException;
2.64 -
2.65 -/**
2.66 - *
2.67 - * @author Jaroslav Tulach <jtulach@netbeans.org>
2.68 - */
2.69 -public class ArchetypeVersionIT {
2.70 - private String version;
2.71 -
2.72 - public ArchetypeVersionIT() {
2.73 - }
2.74 -
2.75 - @BeforeClass public void readCurrentVersion() throws Exception {
2.76 - version = findCurrentVersion();
2.77 - assertFalse(version.isEmpty(), "There should be some version string");
2.78 - }
2.79 -
2.80 -
2.81 - @Test public void testComparePomDepsVersions() throws Exception {
2.82 - final ClassLoader l = ArchetypeVersionIT.class.getClassLoader();
2.83 - URL r = l.getResource("archetype-resources/pom.xml");
2.84 - assertNotNull(r, "Archetype pom found");
2.85 -
2.86 - final XPathFactory fact = XPathFactory.newInstance();
2.87 - XPathExpression xp2 = fact.newXPath().compile(
2.88 - "//properties/net.java.html.version/text()"
2.89 - );
2.90 -
2.91 - Document dom = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(r.openStream());
2.92 - String arch = (String) xp2.evaluate(dom, XPathConstants.STRING);
2.93 -
2.94 - assertEquals(arch, version, "net.java.html.json dependency needs to be on latest version");
2.95 - }
2.96 -
2.97 - @Test public void testNbActions() throws Exception {
2.98 - final ClassLoader l = ArchetypeVersionIT.class.getClassLoader();
2.99 - URL r = l.getResource("archetype-resources/nbactions.xml");
2.100 - assertNotNull(r, "Archetype nb file found");
2.101 -
2.102 - final XPathFactory fact = XPathFactory.newInstance();
2.103 - XPathExpression xp2 = fact.newXPath().compile(
2.104 - "//goal/text()"
2.105 - );
2.106 -
2.107 - Document dom = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(r.openStream());
2.108 - NodeList goals = (NodeList) xp2.evaluate(dom, XPathConstants.NODESET);
2.109 -
2.110 - for (int i = 0; i < goals.getLength(); i++) {
2.111 - String s = goals.item(i).getTextContent();
2.112 - if (s.contains("netbeans")) {
2.113 - assertFalse(s.matches(".*netbeans.*[0-9].*"), "No numbers: " + s);
2.114 - }
2.115 - }
2.116 - }
2.117 -
2.118 - static String findCurrentVersion() throws XPathExpressionException, IOException, ParserConfigurationException, SAXException, XPathFactoryConfigurationException {
2.119 - final ClassLoader l = ArchetypeVersionIT.class.getClassLoader();
2.120 - URL u = l.getResource("META-INF/maven/org.apidesign.html/knockout4j-archetype/pom.xml");
2.121 - assertNotNull(u, "Own pom found: " + System.getProperty("java.class.path"));
2.122 -
2.123 - final XPathFactory fact = XPathFactory.newInstance();
2.124 - fact.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
2.125 -
2.126 - XPathExpression xp = fact.newXPath().compile("project/version/text()");
2.127 -
2.128 - Document dom = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(u.openStream());
2.129 - return xp.evaluate(dom);
2.130 - }
2.131 -}
3.1 --- a/ko-archetype-test/src/test/java/org/netbeans/html/archetype/test/VerifyArchetypeIT.java Wed Mar 26 18:28:26 2014 +0100
3.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
3.3 @@ -1,99 +0,0 @@
3.4 -/**
3.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3.6 - *
3.7 - * Copyright 2013-2014 Oracle and/or its affiliates. All rights reserved.
3.8 - *
3.9 - * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
3.10 - * Other names may be trademarks of their respective owners.
3.11 - *
3.12 - * The contents of this file are subject to the terms of either the GNU
3.13 - * General Public License Version 2 only ("GPL") or the Common
3.14 - * Development and Distribution License("CDDL") (collectively, the
3.15 - * "License"). You may not use this file except in compliance with the
3.16 - * License. You can obtain a copy of the License at
3.17 - * http://www.netbeans.org/cddl-gplv2.html
3.18 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
3.19 - * specific language governing permissions and limitations under the
3.20 - * License. When distributing the software, include this License Header
3.21 - * Notice in each file and include the License file at
3.22 - * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
3.23 - * particular file as subject to the "Classpath" exception as provided
3.24 - * by Oracle in the GPL Version 2 section of the License file that
3.25 - * accompanied this code. If applicable, add the following below the
3.26 - * License Header, with the fields enclosed by brackets [] replaced by
3.27 - * your own identifying information:
3.28 - * "Portions Copyrighted [year] [name of copyright owner]"
3.29 - *
3.30 - * Contributor(s):
3.31 - *
3.32 - * The Original Software is NetBeans. The Initial Developer of the Original
3.33 - * Software is Oracle. Portions Copyright 2013-2014 Oracle. All Rights Reserved.
3.34 - *
3.35 - * If you wish your version of this file to be governed by only the CDDL
3.36 - * or only the GPL Version 2, indicate your decision by adding
3.37 - * "[Contributor] elects to include this software in this distribution
3.38 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
3.39 - * single choice of license, a recipient has the option to distribute
3.40 - * your version of this file under either the CDDL, the GPL Version 2 or
3.41 - * to extend the choice of license to its licensees as provided above.
3.42 - * However, if you add GPL Version 2 code and therefore, elected the GPL
3.43 - * Version 2 license, then the option applies only if the new code is
3.44 - * made subject to such option by the copyright holder.
3.45 - */
3.46 -package org.netbeans.html.archetype.test;
3.47 -
3.48 -import java.io.File;
3.49 -import java.util.Properties;
3.50 -import org.apache.maven.it.Verifier;
3.51 -import org.testng.annotations.Test;
3.52 -import static org.testng.Assert.*;
3.53 -
3.54 -/**
3.55 - *
3.56 - * @author Jaroslav Tulach <jtulach@netbeans.org>
3.57 - */
3.58 -public class VerifyArchetypeIT {
3.59 - @Test public void projectCompiles() throws Exception {
3.60 - final File dir = new File("target/tests/fxcompile/").getAbsoluteFile();
3.61 - generateFromArchetype(dir);
3.62 -
3.63 - File created = new File(dir, "o-a-test");
3.64 - assertTrue(created.isDirectory(), "Project created");
3.65 - assertTrue(new File(created, "pom.xml").isFile(), "Pom file is in there");
3.66 -
3.67 - Verifier v = new Verifier(created.getAbsolutePath());
3.68 - v.executeGoal("verify");
3.69 -
3.70 - v.verifyErrorFreeLog();
3.71 -
3.72 - for (String l : v.loadFile(v.getBasedir(), v.getLogFileName(), false)) {
3.73 - if (l.contains("j2js")) {
3.74 - fail("No pre-compilaton:\n" + l);
3.75 - }
3.76 - }
3.77 -
3.78 - v.verifyTextInLog("fxcompile/o-a-test/target/o-a-test-1.0-SNAPSHOT-html.java.net.zip");
3.79 - }
3.80 -
3.81 - private Verifier generateFromArchetype(final File dir, String... params) throws Exception {
3.82 - Verifier v = new Verifier(dir.getAbsolutePath());
3.83 - v.setAutoclean(false);
3.84 - v.setLogFileName("generate.log");
3.85 - v.deleteDirectory("");
3.86 - dir.mkdirs();
3.87 - Properties sysProp = v.getSystemProperties();
3.88 - sysProp.put("groupId", "org.someuser.test");
3.89 - sysProp.put("artifactId", "o-a-test");
3.90 - sysProp.put("package", "org.someuser.test.oat");
3.91 - sysProp.put("archetypeGroupId", "org.apidesign.html");
3.92 - sysProp.put("archetypeArtifactId", "knockout4j-archetype");
3.93 - sysProp.put("archetypeVersion", ArchetypeVersionIT.findCurrentVersion());
3.94 -
3.95 - for (String p : params) {
3.96 - v.addCliOption(p);
3.97 - }
3.98 - v.executeGoal("archetype:generate");
3.99 - v.verifyErrorFreeLog();
3.100 - return v;
3.101 - }
3.102 -}
4.1 --- a/ko-archetype/pom.xml Wed Mar 26 18:28:26 2014 +0100
4.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
4.3 @@ -1,57 +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 - <groupId>org.netbeans.html</groupId>
4.9 - <artifactId>pom</artifactId>
4.10 - <version>0.8-SNAPSHOT</version>
4.11 - </parent>
4.12 - <groupId>org.apidesign.html</groupId>
4.13 - <artifactId>knockout4j-archetype</artifactId>
4.14 - <version>0.8-SNAPSHOT</version>
4.15 - <packaging>jar</packaging>
4.16 - <name>Knockout 4 Java 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 and
4.21 - Java 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-resources-plugin</artifactId>
4.44 - <version>2.6</version>
4.45 - <configuration>
4.46 - <escapeString>\</escapeString>
4.47 - <target>1.6</target>
4.48 - </configuration>
4.49 - </plugin>
4.50 - <plugin>
4.51 - <artifactId>maven-javadoc-plugin</artifactId>
4.52 - <version>2.9</version>
4.53 - <configuration>
4.54 - <subpackages />
4.55 - <skip>true</skip>
4.56 - </configuration>
4.57 - </plugin>
4.58 - </plugins>
4.59 - </build>
4.60 -</project>
5.1 --- a/ko-archetype/src/main/java/org/netbeans/html/archetype/package-info.java Wed Mar 26 18:28:26 2014 +0100
5.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
5.3 @@ -1,43 +0,0 @@
5.4 -/**
5.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
5.6 - *
5.7 - * Copyright 2013-2014 Oracle and/or its affiliates. All rights reserved.
5.8 - *
5.9 - * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
5.10 - * Other names may be trademarks of their respective owners.
5.11 - *
5.12 - * The contents of this file are subject to the terms of either the GNU
5.13 - * General Public License Version 2 only ("GPL") or the Common
5.14 - * Development and Distribution License("CDDL") (collectively, the
5.15 - * "License"). You may not use this file except in compliance with the
5.16 - * License. You can obtain a copy of the License at
5.17 - * http://www.netbeans.org/cddl-gplv2.html
5.18 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
5.19 - * specific language governing permissions and limitations under the
5.20 - * License. When distributing the software, include this License Header
5.21 - * Notice in each file and include the License file at
5.22 - * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
5.23 - * particular file as subject to the "Classpath" exception as provided
5.24 - * by Oracle in the GPL Version 2 section of the License file that
5.25 - * accompanied this code. If applicable, add the following below the
5.26 - * License Header, with the fields enclosed by brackets [] replaced by
5.27 - * your own identifying information:
5.28 - * "Portions Copyrighted [year] [name of copyright owner]"
5.29 - *
5.30 - * Contributor(s):
5.31 - *
5.32 - * The Original Software is NetBeans. The Initial Developer of the Original
5.33 - * Software is Oracle. Portions Copyright 2013-2014 Oracle. All Rights Reserved.
5.34 - *
5.35 - * If you wish your version of this file to be governed by only the CDDL
5.36 - * or only the GPL Version 2, indicate your decision by adding
5.37 - * "[Contributor] elects to include this software in this distribution
5.38 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
5.39 - * single choice of license, a recipient has the option to distribute
5.40 - * your version of this file under either the CDDL, the GPL Version 2 or
5.41 - * to extend the choice of license to its licensees as provided above.
5.42 - * However, if you add GPL Version 2 code and therefore, elected the GPL
5.43 - * Version 2 license, then the option applies only if the new code is
5.44 - * made subject to such option by the copyright holder.
5.45 - */
5.46 -package org.netbeans.html.archetype;
6.1 --- a/ko-archetype/src/main/resources/META-INF/maven/archetype-metadata.xml Wed Mar 26 18:28:26 2014 +0100
6.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
6.3 @@ -1,43 +0,0 @@
6.4 -<?xml version="1.0" encoding="UTF-8"?>
6.5 -<archetype-descriptor name="Knockout4Java Example">
6.6 - <fileSets>
6.7 - <fileSet filtered="true" packaged="true">
6.8 - <directory>src/main/java</directory>
6.9 - <includes>
6.10 - <include>**/*.java</include>
6.11 - </includes>
6.12 - </fileSet>
6.13 - <fileSet filtered="true" packaged="false">
6.14 - <directory>src/main/webapp/pages</directory>
6.15 - <includes>
6.16 - <include>**/*.xhtml</include>
6.17 - <include>**/*.html</include>
6.18 - <include>**/*.css</include>
6.19 - </includes>
6.20 - </fileSet>
6.21 - <fileSet filtered="true" packaged="true">
6.22 - <directory>src/test/java</directory>
6.23 - <includes>
6.24 - <include>**/*Test.java</include>
6.25 - </includes>
6.26 - </fileSet>
6.27 - <fileSet filtered="true" packaged="false">
6.28 - <directory>src/main/assembly</directory>
6.29 - <includes>
6.30 - <include>**/*.xml</include>
6.31 - </includes>
6.32 - </fileSet>
6.33 - <fileSet filtered="false" packaged="false">
6.34 - <directory></directory>
6.35 - <includes>
6.36 - <include>nbactions*.xml</include>
6.37 - </includes>
6.38 - </fileSet>
6.39 - <fileSet filtered="true" packaged="false">
6.40 - <directory>assembly</directory>
6.41 - <includes>
6.42 - <include>html.java.net-assembly.xml</include>
6.43 - </includes>
6.44 - </fileSet>
6.45 - </fileSets>
6.46 -</archetype-descriptor>
6.47 \ No newline at end of file
7.1 --- a/ko-archetype/src/main/resources/archetype-resources/nbactions.xml Wed Mar 26 18:28:26 2014 +0100
7.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
7.3 @@ -1,20 +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>process-classes</goal>
7.10 - <goal>exec:java</goal>
7.11 - </goals>
7.12 - </action>
7.13 - <action>
7.14 - <actionName>debug</actionName>
7.15 - <goals>
7.16 - <goal>process-classes</goal>
7.17 - <goal>exec:java</goal>
7.18 - </goals>
7.19 - <properties>
7.20 - <jpda.listen>maven</jpda.listen>
7.21 - </properties>
7.22 - </action>
7.23 -</actions>
8.1 --- a/ko-archetype/src/main/resources/archetype-resources/pom.xml Wed Mar 26 18:28:26 2014 +0100
8.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
8.3 @@ -1,170 +0,0 @@
8.4 -<?xml version="1.0"?>
8.5 -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
8.6 - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
8.7 - <modelVersion>4.0.0</modelVersion>
8.8 -
8.9 - <groupId>\${groupId}</groupId>
8.10 - <artifactId>\${artifactId}</artifactId>
8.11 - <version>\${version}</version>
8.12 - <packaging>jar</packaging>
8.13 -
8.14 - <name>\${artifactId}</name>
8.15 -
8.16 - <repositories>
8.17 - <repository>
8.18 - <id>java.net</id>
8.19 - <name>Java.net</name>
8.20 - <url>https://maven.java.net/content/repositories/releases/</url>
8.21 - <snapshots>
8.22 - <enabled>true</enabled>
8.23 - </snapshots>
8.24 - </repository>
8.25 - <repository>
8.26 - <id>netbeans</id>
8.27 - <name>NetBeans</name>
8.28 - <url>http://bits.netbeans.org/maven2/</url>
8.29 - </repository>
8.30 - </repositories>
8.31 - <pluginRepositories>
8.32 - <pluginRepository>
8.33 - <id>java.net</id>
8.34 - <name>Java.net</name>
8.35 - <url>https://maven.java.net/content/repositories/releases/</url>
8.36 - <snapshots>
8.37 - <enabled>true</enabled>
8.38 - </snapshots>
8.39 - </pluginRepository>
8.40 - </pluginRepositories>
8.41 -
8.42 - <properties>
8.43 - <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
8.44 - <net.java.html.version>${project.version}</net.java.html.version>
8.45 - <netbeans.compile.on.save>none</netbeans.compile.on.save>
8.46 - </properties>
8.47 - <build>
8.48 - <plugins>
8.49 - <plugin>
8.50 - <groupId>org.netbeans.html</groupId>
8.51 - <artifactId>html4j-maven-plugin</artifactId>
8.52 - <version>${net.java.html.version}</version>
8.53 - <executions>
8.54 - <execution>
8.55 - <id>js-classes</id>
8.56 - <goals>
8.57 - <goal>process-js-annotations</goal>
8.58 - </goals>
8.59 - </execution>
8.60 - </executions>
8.61 - </plugin>
8.62 - <plugin>
8.63 - <groupId>org.apache.maven.plugins</groupId>
8.64 - <artifactId>maven-compiler-plugin</artifactId>
8.65 - <version>2.3.2</version>
8.66 - <configuration>
8.67 - <source>1.7</source>
8.68 - <target>1.7</target>
8.69 - </configuration>
8.70 - </plugin>
8.71 - <plugin>
8.72 - <groupId>org.apache.maven.plugins</groupId>
8.73 - <artifactId>maven-jar-plugin</artifactId>
8.74 - <version>2.4</version>
8.75 - <configuration>
8.76 - <archive>
8.77 - <manifest>
8.78 - <mainClass>\${package}.Main</mainClass>
8.79 - <addClasspath>true</addClasspath>
8.80 - <classpathPrefix>lib/</classpathPrefix>
8.81 - </manifest>
8.82 - </archive>
8.83 - </configuration>
8.84 - </plugin>
8.85 - <plugin>
8.86 - <groupId>org.codehaus.mojo</groupId>
8.87 - <artifactId>exec-maven-plugin</artifactId>
8.88 - <version>1.2.1</version>
8.89 - <configuration>
8.90 - <systemProperties>
8.91 - <systemProperty>
8.92 - <key>browser.rootdir</key>
8.93 - <value>\${basedir}/src/main/webapp/</value>
8.94 - </systemProperty>
8.95 - </systemProperties>
8.96 - <mainClass>\${package}.Main</mainClass>
8.97 - </configuration>
8.98 - </plugin>
8.99 - <plugin>
8.100 - <artifactId>maven-assembly-plugin</artifactId>
8.101 - <version>2.4</version>
8.102 - <executions>
8.103 - <execution>
8.104 - <id>distro-assembly</id>
8.105 - <phase>package</phase>
8.106 - <goals>
8.107 - <goal>single</goal>
8.108 - </goals>
8.109 - <configuration>
8.110 - <descriptors>
8.111 - <descriptor>src/main/assembly/html.java.net.xml</descriptor>
8.112 - </descriptors>
8.113 - </configuration>
8.114 - </execution>
8.115 - </executions>
8.116 - </plugin>
8.117 - </plugins>
8.118 - </build>
8.119 - <dependencies>
8.120 - <dependency>
8.121 - <groupId>org.netbeans.html</groupId>
8.122 - <artifactId>net.java.html.json</artifactId>
8.123 - <version>\${net.java.html.version}</version>
8.124 - </dependency>
8.125 - <dependency>
8.126 - <groupId>org.netbeans.html</groupId>
8.127 - <artifactId>net.java.html.boot</artifactId>
8.128 - <version>\${net.java.html.version}</version>
8.129 - </dependency>
8.130 - <dependency>
8.131 - <groupId>org.netbeans.html</groupId>
8.132 - <artifactId>ko4j</artifactId>
8.133 - <version>\${net.java.html.version}</version>
8.134 - <scope>runtime</scope>
8.135 - </dependency>
8.136 - <dependency>
8.137 - <groupId>org.netbeans.html</groupId>
8.138 - <artifactId>net.java.html.boot.fx</artifactId>
8.139 - <version>\${net.java.html.version}</version>
8.140 - <scope>runtime</scope>
8.141 - </dependency>
8.142 - <dependency>
8.143 - <groupId>org.testng</groupId>
8.144 - <artifactId>testng</artifactId>
8.145 - <version>6.7</version>
8.146 - <scope>test</scope>
8.147 - </dependency>
8.148 - </dependencies>
8.149 - <profiles>
8.150 - <profile>
8.151 - <id>jdk18</id>
8.152 - <activation>
8.153 - <jdk>1.8</jdk>
8.154 - </activation>
8.155 - <build>
8.156 - <plugins>
8.157 - <plugin>
8.158 - <groupId>org.apache.maven.plugins</groupId>
8.159 - <artifactId>maven-compiler-plugin</artifactId>
8.160 - <version>2.3.2</version>
8.161 - <configuration>
8.162 - <source>1.7</source>
8.163 - <target>1.8</target>
8.164 - <compilerArguments>
8.165 - <profile>compact1</profile>
8.166 - </compilerArguments>
8.167 - </configuration>
8.168 - </plugin>
8.169 - </plugins>
8.170 - </build>
8.171 - </profile>
8.172 - </profiles>
8.173 -</project>
9.1 --- a/ko-archetype/src/main/resources/archetype-resources/src/main/assembly/html.java.net.xml Wed Mar 26 18:28:26 2014 +0100
9.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
9.3 @@ -1,32 +0,0 @@
9.4 -<?xml version="1.0"?>
9.5 -<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9.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">
9.7 -
9.8 - <id>html.java.net</id>
9.9 - <formats>
9.10 - <format>zip</format>
9.11 - </formats>
9.12 - <baseDirectory>${project.build.finalName}-app</baseDirectory>
9.13 - <dependencySets>
9.14 - <dependencySet>
9.15 - <useProjectArtifact>false</useProjectArtifact>
9.16 - <scope>runtime</scope>
9.17 - <outputDirectory>lib</outputDirectory>
9.18 - </dependencySet>
9.19 - </dependencySets>
9.20 - <files>
9.21 - <file>
9.22 - <source>${project.build.directory}/${project.build.finalName}.jar</source>
9.23 - <outputDirectory>/</outputDirectory>
9.24 - </file>
9.25 - </files>
9.26 - <fileSets>
9.27 - <fileSet>
9.28 - <directory>src/main/webapp/</directory>
9.29 - <outputDirectory>/</outputDirectory>
9.30 - <includes>
9.31 - <include>pages/**</include>
9.32 - </includes>
9.33 - </fileSet>
9.34 - </fileSets>
9.35 -</assembly>
9.36 \ No newline at end of file
10.1 --- a/ko-archetype/src/main/resources/archetype-resources/src/main/java/DataModel.java Wed Mar 26 18:28:26 2014 +0100
10.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
10.3 @@ -1,45 +0,0 @@
10.4 -package ${package};
10.5 -
10.6 -import net.java.html.json.ComputedProperty;
10.7 -import net.java.html.json.Function;
10.8 -import net.java.html.json.Model;
10.9 -import net.java.html.json.Property;
10.10 -
10.11 -/** Model annotation generates class Data with
10.12 - * one message property, boolean property and read only words property
10.13 - */
10.14 -@Model(className = "Data", properties = {
10.15 - @Property(name = "message", type = String.class),
10.16 - @Property(name = "on", type = boolean.class)
10.17 -})
10.18 -final class DataModel {
10.19 - @ComputedProperty static java.util.List<String> words(String message) {
10.20 - String[] arr = new String[6];
10.21 - String[] words = message == null ? new String[0] : message.split(" ", 6);
10.22 - for (int i = 0; i < 6; i++) {
10.23 - arr[i] = words.length > i ? words[i] : "!";
10.24 - }
10.25 - return java.util.Arrays.asList(arr);
10.26 - }
10.27 -
10.28 - @Function static void turnOn(Data model) {
10.29 - model.setOn(true);
10.30 - }
10.31 -
10.32 - @Function static void turnOff(final Data model) {
10.33 - confirmByUser("Really turn off?", new Runnable() {
10.34 - @Override
10.35 - public void run() {
10.36 - model.setOn(false);
10.37 - }
10.38 - });
10.39 - }
10.40 -
10.41 - /** Shows direct interaction with JavaScript */
10.42 - @net.java.html.js.JavaScriptBody(
10.43 - args = { "msg", "callback" },
10.44 - javacall = true,
10.45 - body = "alert(msg); callback.@java.lang.Runnable::run()();"
10.46 - )
10.47 - static native void confirmByUser(String msg, Runnable callback);
10.48 -}
11.1 --- a/ko-archetype/src/main/resources/archetype-resources/src/main/java/Main.java Wed Mar 26 18:28:26 2014 +0100
11.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
11.3 @@ -1,27 +0,0 @@
11.4 -package ${package};
11.5 -
11.6 -import net.java.html.boot.BrowserBuilder;
11.7 -
11.8 -public final class Main {
11.9 - private Main() {
11.10 - }
11.11 -
11.12 - public static void main(String... args) throws Exception {
11.13 - BrowserBuilder.newBrowser().
11.14 - loadPage("pages/index.html").
11.15 - loadClass(Main.class).
11.16 - invoke("onPageLoad", args).
11.17 - showAndWait();
11.18 - System.exit(0);
11.19 - }
11.20 -
11.21 - /**
11.22 - * Called when the page is ready.
11.23 - */
11.24 - public static void onPageLoad(String... args) throws Exception {
11.25 - Data d = new Data();
11.26 - d.setMessage("Hello World from HTML and Java!");
11.27 - d.applyBindings();
11.28 - }
11.29 -
11.30 -}
12.1 --- a/ko-archetype/src/main/resources/archetype-resources/src/main/webapp/pages/index.html Wed Mar 26 18:28:26 2014 +0100
12.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
12.3 @@ -1,58 +0,0 @@
12.4 -<!DOCTYPE html>
12.5 -<html>
12.6 - <head>
12.7 - <title></title>
12.8 - <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
12.9 -
12.10 - <style type="text/css">
12.11 - @-webkit-keyframes spin {
12.12 - 0% { -webkit-transform: rotate(0deg); }
12.13 - 100% { -webkit-transform: rotate(360deg); }
12.14 - }
12.15 -
12.16 - .rotate {
12.17 - -webkit-animation-name: spin;
12.18 - -webkit-animation-duration: 3s;
12.19 - -webkit-animation-iteration-count: infinite;
12.20 - -webkit-animation-direction: alternate;
12.21 - }
12.22 -
12.23 - #scene {
12.24 - position: relative;
12.25 - top: 60px;
12.26 - text-align: center;
12.27 - }
12.28 -
12.29 - #words span {
12.30 - border: 1px solid #ccc;
12.31 - background: rgba(255,255,155,0.8);
12.32 - text-align: center;
12.33 - font-size: 30px;
12.34 - -webkit-box-shadow: inset 0 0 40px rgba(0,0,0,0.4);
12.35 - position: absolute;
12.36 - }
12.37 -
12.38 - #words span:nth-child(1) { left: 45%; top: 0px; }
12.39 - #words span:nth-child(2) { left: 25%; top: 100px; }
12.40 - #words span:nth-child(3) { left: 65%; top: 100px; }
12.41 - #words span:nth-child(4) { left: 10%; top: 200px; }
12.42 - #words span:nth-child(5) { left: 45%; top: 200px; }
12.43 - #words span:nth-child(6) { left: 80%; top: 200px; }
12.44 -
12.45 - </style>
12.46 -
12.47 - </head>
12.48 - <body>
12.49 - <h1>Words Demo</h1>
12.50 - <input data-bind="value: message, valueUpdate: 'afterkeydown'" size="80">
12.51 - <br>
12.52 - <button data-bind="enable: !on(), click: $root.turnOn">Start</button>
12.53 - <button data-bind="enable: on, click: $root.turnOff">Stop</button>
12.54 -
12.55 - <div id="scene">
12.56 - <span id="words" data-bind="foreach: words">
12.57 - <span data-bind="text: $data, css: { 'rotate' : $root.on } "></span>
12.58 - </span>
12.59 - </div>
12.60 - </body>
12.61 -</html>
13.1 --- a/ko-archetype/src/main/resources/archetype-resources/src/test/java/DataModelTest.java Wed Mar 26 18:28:26 2014 +0100
13.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
13.3 @@ -1,16 +0,0 @@
13.4 -package ${package};
13.5 -
13.6 -import static org.testng.Assert.*;
13.7 -import org.testng.annotations.Test;
13.8 -
13.9 -public class DataModelTest {
13.10 - @Test public void areHelloWorldTwoWords() {
13.11 - Data model = new Data();
13.12 - model.setMessage("Hello World!");
13.13 -
13.14 - java.util.List<String> arr = model.getWords();
13.15 - assertEquals(arr.size(), 6, "Six words always");
13.16 - assertEquals("Hello", arr.get(0), "Hello is the first word");
13.17 - assertEquals("World!", arr.get(1), "World is the second word");
13.18 - }
13.19 -}
14.1 --- a/ko-archetype/src/main/resources/archetype-resources/src/test/java/JsInteractionTest.java Wed Mar 26 18:28:26 2014 +0100
14.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
14.3 @@ -1,103 +0,0 @@
14.4 -package ${package};
14.5 -
14.6 -import java.io.Closeable;
14.7 -import java.io.Reader;
14.8 -import java.net.URL;
14.9 -import java.util.ArrayList;
14.10 -import java.util.List;
14.11 -import javax.script.Invocable;
14.12 -import javax.script.ScriptEngine;
14.13 -import javax.script.ScriptEngineManager;
14.14 -import javax.script.ScriptException;
14.15 -import org.apidesign.html.boot.spi.Fn;
14.16 -import static org.testng.Assert.assertEquals;
14.17 -import org.testng.annotations.AfterMethod;
14.18 -import org.testng.annotations.BeforeMethod;
14.19 -import org.testng.annotations.Test;
14.20 -
14.21 -/** Tests for behavior of @JavaScriptBody methods. Set your JavaScript
14.22 - * environment up (for example define <code>alert</code> or use some
14.23 - * emulation library like <em>env.js</em>), register script presenter
14.24 - * and then you can call methods that deal with JavaScript in your tests.
14.25 - */
14.26 -public class JsInteractionTest {
14.27 - private Closeable jsEngine;
14.28 - @BeforeMethod public void initializeJSEngine() throws Exception {
14.29 - jsEngine = Fn.activate(new ScriptPresenter());
14.30 - }
14.31 -
14.32 - @AfterMethod public void shutdownJSEngine() throws Exception {
14.33 - jsEngine.close();
14.34 - }
14.35 -
14.36 - @Test public void testCallbackFromJavaScript() throws Exception {
14.37 - class R implements Runnable {
14.38 - int called;
14.39 -
14.40 - @Override
14.41 - public void run() {
14.42 - called++;
14.43 - }
14.44 - }
14.45 - R callback = new R();
14.46 -
14.47 - DataModel.confirmByUser("Hello", callback);
14.48 -
14.49 - assertEquals(callback.called, 1, "One immediate callback");
14.50 - }
14.51 -
14.52 - private static class ScriptPresenter implements Fn.Presenter {
14.53 - private final ScriptEngine eng;
14.54 -
14.55 - public ScriptPresenter() throws ScriptException {
14.56 - eng = new ScriptEngineManager().getEngineByName("javascript");
14.57 - eng.eval("function alert(msg) { Packages.java.lang.System.out.println(msg); };");
14.58 - }
14.59 -
14.60 - @Override
14.61 - public Fn defineFn(String code, String... names) {
14.62 - StringBuilder sb = new StringBuilder();
14.63 - sb.append("(function() {");
14.64 - sb.append(" return function(");
14.65 - String sep = "";
14.66 - for (String n : names) {
14.67 - sb.append(sep).append(n);
14.68 - sep = ",";
14.69 - }
14.70 - sb.append(") {\n");
14.71 - sb.append(code);
14.72 - sb.append("};");
14.73 - sb.append("})()");
14.74 -
14.75 - final Object fn;
14.76 - try {
14.77 - fn = eng.eval(sb.toString());
14.78 - } catch (ScriptException ex) {
14.79 - throw new IllegalStateException(ex);
14.80 - }
14.81 - return new Fn(this) {
14.82 - @Override
14.83 - public Object invoke(Object thiz, Object... args) throws Exception {
14.84 - List<Object> all = new ArrayList<Object>(args.length + 1);
14.85 - all.add(thiz == null ? fn : thiz);
14.86 - for (int i = 0; i < args.length; i++) {
14.87 - all.add(args[i]);
14.88 - }
14.89 - Object ret = ((Invocable)eng).invokeMethod(fn, "call", all.toArray()); // NOI18N
14.90 - return fn.equals(ret) ? null : thiz;
14.91 - }
14.92 - };
14.93 - }
14.94 -
14.95 - @Override
14.96 - public void displayPage(URL page, Runnable onPageLoad) {
14.97 - // not really displaying anything
14.98 - onPageLoad.run();
14.99 - }
14.100 -
14.101 - @Override
14.102 - public void loadScript(Reader code) throws Exception {
14.103 - eng.eval(code);
14.104 - }
14.105 - }
14.106 -}
15.1 --- a/pom.xml Wed Mar 26 18:28:26 2014 +0100
15.2 +++ b/pom.xml Wed Mar 26 18:40:04 2014 +0100
15.3 @@ -22,8 +22,6 @@
15.4 <modules>
15.5 <module>json</module>
15.6 <module>json-tck</module>
15.7 - <module>ko-archetype</module>
15.8 - <module>ko-archetype-test</module>
15.9 <module>ko4j</module>
15.10 <module>sound</module>
15.11 <module>context</module>
15.12 @@ -95,7 +93,6 @@
15.13 <excludes>
15.14 <exclude>*</exclude>
15.15 <exclude>.*/**</exclude>
15.16 - <exclude>ko-archetype/src/main/resources/**</exclude>
15.17 <exclude>ko4j/src/main/resources/org/netbeans/html/ko4j/knockout*.js</exclude>
15.18 <exclude>src/main/javadoc/resources/teavm.js</exclude>
15.19 </excludes>