1.1 --- a/.hgtags Tue Jan 21 08:54:40 2014 +0100
1.2 +++ b/.hgtags Fri Jan 24 05:33:52 2014 +0100
1.3 @@ -8,3 +8,4 @@
1.4 3e5e3c96f9f13bc1487c46e050a6d545c427d945 release-0.6
1.5 53634fd10e30d0fcfd8d05a2bdf2df36c50ee237 netbeans_base
1.6 da6c0d295eed1c309ce108f70df158c5b4ef09aa release-0.7
1.7 +4f02ac8ef70a698fccada74cfeb43fede65fd8bf release-0.7.1
2.1 Binary file json/src/main/java/net/java/html/json/doc-files/html4j.png has changed
3.1 --- a/json/src/main/java/net/java/html/json/package.html Tue Jan 21 08:54:40 2014 +0100
3.2 +++ b/json/src/main/java/net/java/html/json/package.html Fri Jan 24 05:33:52 2014 +0100
3.3 @@ -48,8 +48,11 @@
3.4 This API allows you to write your application logic in Java and
3.5 present it using modern HTML rendering technologies like
3.6 <a href="http://knockoutjs.com">Knockout</a>
3.7 - <img src="doc-files/html4j.png">.
3.8 + and communicate with
3.9 + a server via <a href="OnReceive.html">REST</a> or
3.10 + <a href="doc-files/websockets.html">WebSocket</a>s.
3.11 </p>
3.12 + <img src="doc-files/html4j.png">
3.13 <p>
3.14 Use <a href="Model.html">@Model</a> annotation to define one or more
3.15 model classes with <a href="Property.html">properties</a>. Don't waste
3.16 @@ -67,9 +70,17 @@
3.17 You don't have bother with JavaScript. All your application logic is in
3.18 Java. The necessary JavaScript needed for the HTML bindings remains hidden
3.19 as an implementation detail of communication between the generated model
3.20 - class(es) and appropriate technology bridge (like artifact with id <code>ko-fx</code>
3.21 - and group id <code>org.netbeans.html</code>).
3.22 + class(es) and appropriate technology bridge. For example
3.23 + the <code>ko4j</code> module:
3.24 </p>
3.25 + <pre>
3.26 +<dependency>
3.27 + <groupId>org.netbeans.html</groupId>
3.28 + <artifactId>ko4j</artifactId>
3.29 + <scope>runtime</scope>
3.30 +</dependency>
3.31 + </pre>
3.32 +
3.33 <p>
3.34 The model classes can be used for JSON based server communication. Just
3.35 use <a href="OnReceive.html">@OnReceive</a> annotation to define a communication
3.36 @@ -83,7 +94,7 @@
3.37 <dependency>
3.38 <groupId>org.glassfish.jersey.media</groupId>
3.39 <artifactId>html-json</artifactId>
3.40 - <version>2.1</version>
3.41 + <version>2.6</version> <-- or 2.6-SNAPSHOT until it gets released -->
3.42 <scope>runtime</scope>
3.43 </dependency>
3.44 </pre>
3.45 @@ -94,11 +105,4 @@
3.46 <a href="Function.html">@Function</a> annotation to define handlers
3.47 to be invoked from the HTML elements.
3.48 </p>
3.49 - <script type="text/javascript">
3.50 - var arr = document.getElementsByTagName("img");
3.51 - if (arr.length === 2) {
3.52 - arr[0].style.visibility = 'hidden';
3.53 - arr[0].height = 0;
3.54 - }
3.55 - </script>
3.56 </body>
4.1 --- a/json/src/test/java/org/netbeans/html/json/impl/JSONListTest.java Tue Jan 21 08:54:40 2014 +0100
4.2 +++ b/json/src/test/java/org/netbeans/html/json/impl/JSONListTest.java Fri Jan 24 05:33:52 2014 +0100
4.3 @@ -45,9 +45,11 @@
4.4 import java.util.HashMap;
4.5 import java.util.Map;
4.6 import net.java.html.BrwsrCtx;
4.7 +import net.java.html.json.Model;
4.8 import net.java.html.json.Models;
4.9 import net.java.html.json.People;
4.10 import net.java.html.json.Person;
4.11 +import net.java.html.json.Property;
4.12 import net.java.html.json.Sex;
4.13 import org.apidesign.html.context.spi.Contexts;
4.14 import org.apidesign.html.json.spi.FunctionBinding;
4.15 @@ -61,6 +63,9 @@
4.16 *
4.17 * @author Jaroslav Tulach <jtulach@netbeans.org>
4.18 */
4.19 +@Model(className = "JSNLst", properties = {
4.20 + @Property(name = "names", type = String.class, array = true)
4.21 +})
4.22 public class JSONListTest implements Technology<Object> {
4.23 private boolean replaceArray;
4.24 private final Map<String,PropertyBinding> bindings = new HashMap<String,PropertyBinding>();
4.25 @@ -151,6 +156,11 @@
4.26
4.27 assertEquals(pb.getValue(), this, "I am the model of the array");
4.28 }
4.29 +
4.30 + @Test public void toStringOnArrayOfStrings() {
4.31 + JSNLst l = new JSNLst("Jarda", "Jirka", "Parda");
4.32 + assertEquals(l.toString(), "{\"names\":[\"Jarda\",\"Jirka\",\"Parda\"]}", "Properly quoted");
4.33 + }
4.34
4.35 @Override
4.36 public Object wrapModel(Object model) {
5.1 --- a/ko-archetype-test/pom.xml Tue Jan 21 08:54:40 2014 +0100
5.2 +++ b/ko-archetype-test/pom.xml Fri Jan 24 05:33:52 2014 +0100
5.3 @@ -15,6 +15,22 @@
5.4 <properties>
5.5 <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
5.6 </properties>
5.7 + <build>
5.8 + <plugins>
5.9 + <plugin>
5.10 + <artifactId>maven-failsafe-plugin</artifactId>
5.11 + <version>2.16</version>
5.12 + <executions>
5.13 + <execution>
5.14 + <goals>
5.15 + <goal>integration-test</goal>
5.16 + <goal>verify</goal>
5.17 + </goals>
5.18 + </execution>
5.19 + </executions>
5.20 + </plugin>
5.21 + </plugins>
5.22 + </build>
5.23 <dependencies>
5.24 <dependency>
5.25 <groupId>org.apidesign.html</groupId>
6.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
6.2 +++ b/ko-archetype-test/src/test/java/org/netbeans/html/archetype/test/ArchetypeVersionIT.java Fri Jan 24 05:33:52 2014 +0100
6.3 @@ -0,0 +1,128 @@
6.4 +/**
6.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
6.6 + *
6.7 + * Copyright 2013-2013 Oracle and/or its affiliates. All rights reserved.
6.8 + *
6.9 + * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
6.10 + * Other names may be trademarks of their respective owners.
6.11 + *
6.12 + * The contents of this file are subject to the terms of either the GNU
6.13 + * General Public License Version 2 only ("GPL") or the Common
6.14 + * Development and Distribution License("CDDL") (collectively, the
6.15 + * "License"). You may not use this file except in compliance with the
6.16 + * License. You can obtain a copy of the License at
6.17 + * http://www.netbeans.org/cddl-gplv2.html
6.18 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
6.19 + * specific language governing permissions and limitations under the
6.20 + * License. When distributing the software, include this License Header
6.21 + * Notice in each file and include the License file at
6.22 + * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
6.23 + * particular file as subject to the "Classpath" exception as provided
6.24 + * by Oracle in the GPL Version 2 section of the License file that
6.25 + * accompanied this code. If applicable, add the following below the
6.26 + * License Header, with the fields enclosed by brackets [] replaced by
6.27 + * your own identifying information:
6.28 + * "Portions Copyrighted [year] [name of copyright owner]"
6.29 + *
6.30 + * Contributor(s):
6.31 + *
6.32 + * The Original Software is NetBeans. The Initial Developer of the Original
6.33 + * Software is Oracle. Portions Copyright 2013-2013 Oracle. All Rights Reserved.
6.34 + *
6.35 + * If you wish your version of this file to be governed by only the CDDL
6.36 + * or only the GPL Version 2, indicate your decision by adding
6.37 + * "[Contributor] elects to include this software in this distribution
6.38 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
6.39 + * single choice of license, a recipient has the option to distribute
6.40 + * your version of this file under either the CDDL, the GPL Version 2 or
6.41 + * to extend the choice of license to its licensees as provided above.
6.42 + * However, if you add GPL Version 2 code and therefore, elected the GPL
6.43 + * Version 2 license, then the option applies only if the new code is
6.44 + * made subject to such option by the copyright holder.
6.45 + */
6.46 +package org.netbeans.html.archetype.test;
6.47 +
6.48 +import java.io.IOException;
6.49 +import java.net.URL;
6.50 +import javax.xml.XMLConstants;
6.51 +import javax.xml.parsers.DocumentBuilderFactory;
6.52 +import javax.xml.parsers.ParserConfigurationException;
6.53 +import javax.xml.xpath.XPathConstants;
6.54 +import javax.xml.xpath.XPathExpression;
6.55 +import javax.xml.xpath.XPathExpressionException;
6.56 +import javax.xml.xpath.XPathFactory;
6.57 +import javax.xml.xpath.XPathFactoryConfigurationException;
6.58 +import org.testng.annotations.Test;
6.59 +import static org.testng.Assert.*;
6.60 +import org.testng.annotations.BeforeClass;
6.61 +import org.w3c.dom.Document;
6.62 +import org.w3c.dom.NodeList;
6.63 +import org.xml.sax.SAXException;
6.64 +
6.65 +/**
6.66 + *
6.67 + * @author Jaroslav Tulach <jtulach@netbeans.org>
6.68 + */
6.69 +public class ArchetypeVersionIT {
6.70 + private String version;
6.71 +
6.72 + public ArchetypeVersionIT() {
6.73 + }
6.74 +
6.75 + @BeforeClass public void readCurrentVersion() throws Exception {
6.76 + version = findCurrentVersion();
6.77 + assertFalse(version.isEmpty(), "There should be some version string");
6.78 + }
6.79 +
6.80 +
6.81 + @Test public void testComparePomDepsVersions() throws Exception {
6.82 + final ClassLoader l = ArchetypeVersionIT.class.getClassLoader();
6.83 + URL r = l.getResource("archetype-resources/pom.xml");
6.84 + assertNotNull(r, "Archetype pom found");
6.85 +
6.86 + final XPathFactory fact = XPathFactory.newInstance();
6.87 + XPathExpression xp2 = fact.newXPath().compile(
6.88 + "//properties/net.java.html.version/text()"
6.89 + );
6.90 +
6.91 + Document dom = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(r.openStream());
6.92 + String arch = (String) xp2.evaluate(dom, XPathConstants.STRING);
6.93 +
6.94 + assertEquals(arch, version, "net.java.html.json dependency needs to be on latest version");
6.95 + }
6.96 +
6.97 + @Test public void testNbActions() throws Exception {
6.98 + final ClassLoader l = ArchetypeVersionIT.class.getClassLoader();
6.99 + URL r = l.getResource("archetype-resources/nbactions.xml");
6.100 + assertNotNull(r, "Archetype nb file found");
6.101 +
6.102 + final XPathFactory fact = XPathFactory.newInstance();
6.103 + XPathExpression xp2 = fact.newXPath().compile(
6.104 + "//goal/text()"
6.105 + );
6.106 +
6.107 + Document dom = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(r.openStream());
6.108 + NodeList goals = (NodeList) xp2.evaluate(dom, XPathConstants.NODESET);
6.109 +
6.110 + for (int i = 0; i < goals.getLength(); i++) {
6.111 + String s = goals.item(i).getTextContent();
6.112 + if (s.contains("netbeans")) {
6.113 + assertFalse(s.matches(".*netbeans.*[0-9].*"), "No numbers: " + s);
6.114 + }
6.115 + }
6.116 + }
6.117 +
6.118 + static String findCurrentVersion() throws XPathExpressionException, IOException, ParserConfigurationException, SAXException, XPathFactoryConfigurationException {
6.119 + final ClassLoader l = ArchetypeVersionIT.class.getClassLoader();
6.120 + URL u = l.getResource("META-INF/maven/org.apidesign.html/knockout4j-archetype/pom.xml");
6.121 + assertNotNull(u, "Own pom found: " + System.getProperty("java.class.path"));
6.122 +
6.123 + final XPathFactory fact = XPathFactory.newInstance();
6.124 + fact.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
6.125 +
6.126 + XPathExpression xp = fact.newXPath().compile("project/version/text()");
6.127 +
6.128 + Document dom = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(u.openStream());
6.129 + return xp.evaluate(dom);
6.130 + }
6.131 +}
7.1 --- a/ko-archetype-test/src/test/java/org/netbeans/html/archetype/test/ArchetypeVersionTest.java Tue Jan 21 08:54:40 2014 +0100
7.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
7.3 @@ -1,128 +0,0 @@
7.4 -/**
7.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
7.6 - *
7.7 - * Copyright 2013-2013 Oracle and/or its affiliates. All rights reserved.
7.8 - *
7.9 - * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
7.10 - * Other names may be trademarks of their respective owners.
7.11 - *
7.12 - * The contents of this file are subject to the terms of either the GNU
7.13 - * General Public License Version 2 only ("GPL") or the Common
7.14 - * Development and Distribution License("CDDL") (collectively, the
7.15 - * "License"). You may not use this file except in compliance with the
7.16 - * License. You can obtain a copy of the License at
7.17 - * http://www.netbeans.org/cddl-gplv2.html
7.18 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
7.19 - * specific language governing permissions and limitations under the
7.20 - * License. When distributing the software, include this License Header
7.21 - * Notice in each file and include the License file at
7.22 - * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
7.23 - * particular file as subject to the "Classpath" exception as provided
7.24 - * by Oracle in the GPL Version 2 section of the License file that
7.25 - * accompanied this code. If applicable, add the following below the
7.26 - * License Header, with the fields enclosed by brackets [] replaced by
7.27 - * your own identifying information:
7.28 - * "Portions Copyrighted [year] [name of copyright owner]"
7.29 - *
7.30 - * Contributor(s):
7.31 - *
7.32 - * The Original Software is NetBeans. The Initial Developer of the Original
7.33 - * Software is Oracle. Portions Copyright 2013-2013 Oracle. All Rights Reserved.
7.34 - *
7.35 - * If you wish your version of this file to be governed by only the CDDL
7.36 - * or only the GPL Version 2, indicate your decision by adding
7.37 - * "[Contributor] elects to include this software in this distribution
7.38 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
7.39 - * single choice of license, a recipient has the option to distribute
7.40 - * your version of this file under either the CDDL, the GPL Version 2 or
7.41 - * to extend the choice of license to its licensees as provided above.
7.42 - * However, if you add GPL Version 2 code and therefore, elected the GPL
7.43 - * Version 2 license, then the option applies only if the new code is
7.44 - * made subject to such option by the copyright holder.
7.45 - */
7.46 -package org.netbeans.html.archetype.test;
7.47 -
7.48 -import java.io.IOException;
7.49 -import java.net.URL;
7.50 -import javax.xml.XMLConstants;
7.51 -import javax.xml.parsers.DocumentBuilderFactory;
7.52 -import javax.xml.parsers.ParserConfigurationException;
7.53 -import javax.xml.xpath.XPathConstants;
7.54 -import javax.xml.xpath.XPathExpression;
7.55 -import javax.xml.xpath.XPathExpressionException;
7.56 -import javax.xml.xpath.XPathFactory;
7.57 -import javax.xml.xpath.XPathFactoryConfigurationException;
7.58 -import org.testng.annotations.Test;
7.59 -import static org.testng.Assert.*;
7.60 -import org.testng.annotations.BeforeClass;
7.61 -import org.w3c.dom.Document;
7.62 -import org.w3c.dom.NodeList;
7.63 -import org.xml.sax.SAXException;
7.64 -
7.65 -/**
7.66 - *
7.67 - * @author Jaroslav Tulach <jtulach@netbeans.org>
7.68 - */
7.69 -public class ArchetypeVersionTest {
7.70 - private String version;
7.71 -
7.72 - public ArchetypeVersionTest() {
7.73 - }
7.74 -
7.75 - @BeforeClass public void readCurrentVersion() throws Exception {
7.76 - version = findCurrentVersion();
7.77 - assertFalse(version.isEmpty(), "There should be some version string");
7.78 - }
7.79 -
7.80 -
7.81 - @Test public void testComparePomDepsVersions() throws Exception {
7.82 - final ClassLoader l = ArchetypeVersionTest.class.getClassLoader();
7.83 - URL r = l.getResource("archetype-resources/pom.xml");
7.84 - assertNotNull(r, "Archetype pom found");
7.85 -
7.86 - final XPathFactory fact = XPathFactory.newInstance();
7.87 - XPathExpression xp2 = fact.newXPath().compile(
7.88 - "//properties/net.java.html.version/text()"
7.89 - );
7.90 -
7.91 - Document dom = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(r.openStream());
7.92 - String arch = (String) xp2.evaluate(dom, XPathConstants.STRING);
7.93 -
7.94 - assertEquals(arch, version, "net.java.html.json dependency needs to be on latest version");
7.95 - }
7.96 -
7.97 - @Test public void testNbActions() throws Exception {
7.98 - final ClassLoader l = ArchetypeVersionTest.class.getClassLoader();
7.99 - URL r = l.getResource("archetype-resources/nbactions.xml");
7.100 - assertNotNull(r, "Archetype nb file found");
7.101 -
7.102 - final XPathFactory fact = XPathFactory.newInstance();
7.103 - XPathExpression xp2 = fact.newXPath().compile(
7.104 - "//goal/text()"
7.105 - );
7.106 -
7.107 - Document dom = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(r.openStream());
7.108 - NodeList goals = (NodeList) xp2.evaluate(dom, XPathConstants.NODESET);
7.109 -
7.110 - for (int i = 0; i < goals.getLength(); i++) {
7.111 - String s = goals.item(i).getTextContent();
7.112 - if (s.contains("netbeans")) {
7.113 - assertFalse(s.matches(".*netbeans.*[0-9].*"), "No numbers: " + s);
7.114 - }
7.115 - }
7.116 - }
7.117 -
7.118 - static String findCurrentVersion() throws XPathExpressionException, IOException, ParserConfigurationException, SAXException, XPathFactoryConfigurationException {
7.119 - final ClassLoader l = ArchetypeVersionTest.class.getClassLoader();
7.120 - URL u = l.getResource("META-INF/maven/org.apidesign.html/knockout4j-archetype/pom.xml");
7.121 - assertNotNull(u, "Own pom found: " + System.getProperty("java.class.path"));
7.122 -
7.123 - final XPathFactory fact = XPathFactory.newInstance();
7.124 - fact.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
7.125 -
7.126 - XPathExpression xp = fact.newXPath().compile("project/version/text()");
7.127 -
7.128 - Document dom = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(u.openStream());
7.129 - return xp.evaluate(dom);
7.130 - }
7.131 -}
8.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
8.2 +++ b/ko-archetype-test/src/test/java/org/netbeans/html/archetype/test/VerifyArchetypeIT.java Fri Jan 24 05:33:52 2014 +0100
8.3 @@ -0,0 +1,99 @@
8.4 +/**
8.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
8.6 + *
8.7 + * Copyright 2013-2013 Oracle and/or its affiliates. All rights reserved.
8.8 + *
8.9 + * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
8.10 + * Other names may be trademarks of their respective owners.
8.11 + *
8.12 + * The contents of this file are subject to the terms of either the GNU
8.13 + * General Public License Version 2 only ("GPL") or the Common
8.14 + * Development and Distribution License("CDDL") (collectively, the
8.15 + * "License"). You may not use this file except in compliance with the
8.16 + * License. You can obtain a copy of the License at
8.17 + * http://www.netbeans.org/cddl-gplv2.html
8.18 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
8.19 + * specific language governing permissions and limitations under the
8.20 + * License. When distributing the software, include this License Header
8.21 + * Notice in each file and include the License file at
8.22 + * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
8.23 + * particular file as subject to the "Classpath" exception as provided
8.24 + * by Oracle in the GPL Version 2 section of the License file that
8.25 + * accompanied this code. If applicable, add the following below the
8.26 + * License Header, with the fields enclosed by brackets [] replaced by
8.27 + * your own identifying information:
8.28 + * "Portions Copyrighted [year] [name of copyright owner]"
8.29 + *
8.30 + * Contributor(s):
8.31 + *
8.32 + * The Original Software is NetBeans. The Initial Developer of the Original
8.33 + * Software is Oracle. Portions Copyright 2013-2013 Oracle. All Rights Reserved.
8.34 + *
8.35 + * If you wish your version of this file to be governed by only the CDDL
8.36 + * or only the GPL Version 2, indicate your decision by adding
8.37 + * "[Contributor] elects to include this software in this distribution
8.38 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
8.39 + * single choice of license, a recipient has the option to distribute
8.40 + * your version of this file under either the CDDL, the GPL Version 2 or
8.41 + * to extend the choice of license to its licensees as provided above.
8.42 + * However, if you add GPL Version 2 code and therefore, elected the GPL
8.43 + * Version 2 license, then the option applies only if the new code is
8.44 + * made subject to such option by the copyright holder.
8.45 + */
8.46 +package org.netbeans.html.archetype.test;
8.47 +
8.48 +import java.io.File;
8.49 +import java.util.Properties;
8.50 +import org.apache.maven.it.Verifier;
8.51 +import org.testng.annotations.Test;
8.52 +import static org.testng.Assert.*;
8.53 +
8.54 +/**
8.55 + *
8.56 + * @author Jaroslav Tulach <jtulach@netbeans.org>
8.57 + */
8.58 +public class VerifyArchetypeIT {
8.59 + @Test public void projectCompiles() throws Exception {
8.60 + final File dir = new File("target/tests/fxcompile/").getAbsoluteFile();
8.61 + generateFromArchetype(dir);
8.62 +
8.63 + File created = new File(dir, "o-a-test");
8.64 + assertTrue(created.isDirectory(), "Project created");
8.65 + assertTrue(new File(created, "pom.xml").isFile(), "Pom file is in there");
8.66 +
8.67 + Verifier v = new Verifier(created.getAbsolutePath());
8.68 + v.executeGoal("verify");
8.69 +
8.70 + v.verifyErrorFreeLog();
8.71 +
8.72 + for (String l : v.loadFile(v.getBasedir(), v.getLogFileName(), false)) {
8.73 + if (l.contains("j2js")) {
8.74 + fail("No pre-compilaton:\n" + l);
8.75 + }
8.76 + }
8.77 +
8.78 + v.verifyTextInLog("fxcompile/o-a-test/target/o-a-test-1.0-SNAPSHOT-html.java.net.zip");
8.79 + }
8.80 +
8.81 + private Verifier generateFromArchetype(final File dir, String... params) throws Exception {
8.82 + Verifier v = new Verifier(dir.getAbsolutePath());
8.83 + v.setAutoclean(false);
8.84 + v.setLogFileName("generate.log");
8.85 + v.deleteDirectory("");
8.86 + dir.mkdirs();
8.87 + Properties sysProp = v.getSystemProperties();
8.88 + sysProp.put("groupId", "org.someuser.test");
8.89 + sysProp.put("artifactId", "o-a-test");
8.90 + sysProp.put("package", "org.someuser.test.oat");
8.91 + sysProp.put("archetypeGroupId", "org.apidesign.html");
8.92 + sysProp.put("archetypeArtifactId", "knockout4j-archetype");
8.93 + sysProp.put("archetypeVersion", ArchetypeVersionIT.findCurrentVersion());
8.94 +
8.95 + for (String p : params) {
8.96 + v.addCliOption(p);
8.97 + }
8.98 + v.executeGoal("archetype:generate");
8.99 + v.verifyErrorFreeLog();
8.100 + return v;
8.101 + }
8.102 +}
9.1 --- a/ko-archetype-test/src/test/java/org/netbeans/html/archetype/test/VerifyArchetypeTest.java Tue Jan 21 08:54:40 2014 +0100
9.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
9.3 @@ -1,99 +0,0 @@
9.4 -/**
9.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
9.6 - *
9.7 - * Copyright 2013-2013 Oracle and/or its affiliates. All rights reserved.
9.8 - *
9.9 - * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
9.10 - * Other names may be trademarks of their respective owners.
9.11 - *
9.12 - * The contents of this file are subject to the terms of either the GNU
9.13 - * General Public License Version 2 only ("GPL") or the Common
9.14 - * Development and Distribution License("CDDL") (collectively, the
9.15 - * "License"). You may not use this file except in compliance with the
9.16 - * License. You can obtain a copy of the License at
9.17 - * http://www.netbeans.org/cddl-gplv2.html
9.18 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
9.19 - * specific language governing permissions and limitations under the
9.20 - * License. When distributing the software, include this License Header
9.21 - * Notice in each file and include the License file at
9.22 - * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
9.23 - * particular file as subject to the "Classpath" exception as provided
9.24 - * by Oracle in the GPL Version 2 section of the License file that
9.25 - * accompanied this code. If applicable, add the following below the
9.26 - * License Header, with the fields enclosed by brackets [] replaced by
9.27 - * your own identifying information:
9.28 - * "Portions Copyrighted [year] [name of copyright owner]"
9.29 - *
9.30 - * Contributor(s):
9.31 - *
9.32 - * The Original Software is NetBeans. The Initial Developer of the Original
9.33 - * Software is Oracle. Portions Copyright 2013-2013 Oracle. All Rights Reserved.
9.34 - *
9.35 - * If you wish your version of this file to be governed by only the CDDL
9.36 - * or only the GPL Version 2, indicate your decision by adding
9.37 - * "[Contributor] elects to include this software in this distribution
9.38 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
9.39 - * single choice of license, a recipient has the option to distribute
9.40 - * your version of this file under either the CDDL, the GPL Version 2 or
9.41 - * to extend the choice of license to its licensees as provided above.
9.42 - * However, if you add GPL Version 2 code and therefore, elected the GPL
9.43 - * Version 2 license, then the option applies only if the new code is
9.44 - * made subject to such option by the copyright holder.
9.45 - */
9.46 -package org.netbeans.html.archetype.test;
9.47 -
9.48 -import java.io.File;
9.49 -import java.util.Properties;
9.50 -import org.apache.maven.it.Verifier;
9.51 -import org.testng.annotations.Test;
9.52 -import static org.testng.Assert.*;
9.53 -
9.54 -/**
9.55 - *
9.56 - * @author Jaroslav Tulach <jtulach@netbeans.org>
9.57 - */
9.58 -public class VerifyArchetypeTest {
9.59 - @Test public void projectCompiles() throws Exception {
9.60 - final File dir = new File("target/tests/fxcompile/").getAbsoluteFile();
9.61 - generateFromArchetype(dir);
9.62 -
9.63 - File created = new File(dir, "o-a-test");
9.64 - assertTrue(created.isDirectory(), "Project created");
9.65 - assertTrue(new File(created, "pom.xml").isFile(), "Pom file is in there");
9.66 -
9.67 - Verifier v = new Verifier(created.getAbsolutePath());
9.68 - v.executeGoal("verify");
9.69 -
9.70 - v.verifyErrorFreeLog();
9.71 -
9.72 - for (String l : v.loadFile(v.getBasedir(), v.getLogFileName(), false)) {
9.73 - if (l.contains("j2js")) {
9.74 - fail("No pre-compilaton:\n" + l);
9.75 - }
9.76 - }
9.77 -
9.78 - v.verifyTextInLog("fxcompile/o-a-test/target/o-a-test-1.0-SNAPSHOT-html.java.net.zip");
9.79 - }
9.80 -
9.81 - private Verifier generateFromArchetype(final File dir, String... params) throws Exception {
9.82 - Verifier v = new Verifier(dir.getAbsolutePath());
9.83 - v.setAutoclean(false);
9.84 - v.setLogFileName("generate.log");
9.85 - v.deleteDirectory("");
9.86 - dir.mkdirs();
9.87 - Properties sysProp = v.getSystemProperties();
9.88 - sysProp.put("groupId", "org.someuser.test");
9.89 - sysProp.put("artifactId", "o-a-test");
9.90 - sysProp.put("package", "org.someuser.test.oat");
9.91 - sysProp.put("archetypeGroupId", "org.apidesign.html");
9.92 - sysProp.put("archetypeArtifactId", "knockout4j-archetype");
9.93 - sysProp.put("archetypeVersion", ArchetypeVersionTest.findCurrentVersion());
9.94 -
9.95 - for (String p : params) {
9.96 - v.addCliOption(p);
9.97 - }
9.98 - v.executeGoal("archetype:generate");
9.99 - v.verifyErrorFreeLog();
9.100 - return v;
9.101 - }
9.102 -}