Created
March 9, 2012 16:36
-
-
Save qmx/2007392 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 5a95c6ba5362422448d64d604ed4c1bab00591b5 Mon Sep 17 00:00:00 2001 | |
From: Douglas Campos <[email protected]> | |
Date: Fri, 9 Mar 2012 13:33:10 -0300 | |
Subject: [PATCH] expected | |
--- | |
pom.xml | 61 ++++++++----------- | |
src/etc/license.txt | 14 +++++ | |
.../as/quickstarts/html5_mobile/model/Member.java | 2 +- | |
.../html5_mobile/rest/JaxRsActivator.java | 2 +- | |
.../html5_mobile/rest/MemberService.java | 2 +- | |
.../quickstarts/html5_mobile/util/Resources.java | 2 +- | |
src/main/webapp/WEB-INF/wro.properties | 1 + | |
.../html5_mobile/test/MemberRegistrationTest.java | 4 +- | |
src/test/qunit/index.html | 24 +++++++- | |
src/test/qunit/test/test.js | 52 +++++++++++++---- | |
src/test/resources/arquillian.xml | 18 ++++++ | |
11 files changed, 125 insertions(+), 57 deletions(-) | |
create mode 100644 src/etc/license.txt | |
create mode 100644 src/main/webapp/WEB-INF/wro.properties | |
mode change 100644 => 100755 src/main/webapp/js/libs/yepnope.1.0.2-min.js | |
diff --git a/pom.xml b/pom.xml | |
index 884d30f..00d4ac8 100644 | |
--- a/pom.xml | |
+++ b/pom.xml | |
@@ -1,33 +1,29 @@ | |
-<?xml version="1.0" encoding="UTF-8"?> | |
+<?xml version="1.0" encoding="UTF-8" standalone="no"?> | |
<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/maven-v4_0_0.xsd"> | |
<modelVersion>4.0.0</modelVersion> | |
- <groupId>org.jboss.as.quickstarts</groupId> | |
- <artifactId>jboss-as-kitchensink-html5-mobile</artifactId> | |
- <version>1.0-SNAPSHOT</version> | |
+ <groupId>org.jboss.as.quickstarts</groupId> | |
+ <artifactId>jboss-as-kitchensink-html5-mobile</artifactId> | |
+ <version>1.0.0-SNAPSHOT</version> | |
<packaging>war</packaging> | |
- <name>jboss-as-kitchensink-html5-mobile</name> | |
+ <name>JBoss AS Quickstarts: AeroGear HTML5/Mobile</name> | |
<description>An AeroGear and Java EE 6 HTML5 mobile web application for use with JBoss.</description> | |
+ | |
<url>http://jboss.org/aerogear</url> | |
<properties> | |
- <!-- Explicitly declaring the source encoding eliminates the following | |
- message: --> | |
- <!-- [WARNING] Using platform encoding (UTF-8 actually) to copy filtered | |
- resources, i.e. build is platform dependent! --> | |
+ <!-- Explicitly declaring the source encoding eliminates the following message: --> | |
+ <!-- [WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent! --> | |
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | |
- | |
+ | |
<!-- Timestamp format for the maven.build.timestamp property --> | |
- <!-- You can reference property in pom.xml or filtered resources (must | |
- enable third-party plugin if using Maven < 2.1) --> | |
- <javaee6.bom.version>1.0.0.M3</javaee6.bom.version> | |
- <!-- Alternatively, comment out the above line, and un-comment the line below to | |
- use version 3.0.0.Beta1-redhat-1 which is a release certified | |
- to work with JBoss EAP 6. It requires you have access to the JBoss EAP 6 maven repository. --> | |
- <!-- | |
- <javaee6.bom.version>3.0.0.Beta1-redhat-1</javaee6.bom.version> | |
- --> | |
+ <!-- You can reference property in pom.xml or filtered resources (must enable third-party plugin if using Maven < 2.1) --> | |
+ | |
+ <!-- Define the version of JBoss' Java EE 6 APIs we want to import. Any dependencies from org.jboss.spec will have their | |
+ version defined by this BOM --> | |
+ <javaee6.bom.version>1.0.0.M3</javaee6.bom.version> | |
+ | |
<wro4j.version>1.4.4</wro4j.version> | |
</properties> | |
@@ -41,11 +37,13 @@ | |
<dependencyManagement> | |
<dependencies> | |
- <!-- JBoss distributes a complete set of Java EE 6 APIs including | |
- a Bill of Materials (BOM). A BOM specifies the versions of a "stack" (or | |
- a collection) of artifacts. We use this here so that we always get the correct | |
- versions of artifacts. Here we use the jboss-javaee-web-6.0 stack (you can | |
- read this as the JBoss stack of the Java EE Web Profile 6 APIs) --> | |
+ | |
+ <!-- JBoss distributes a complete set of Java EE 6 APIs including a Bill of Materials (BOM). A BOM specifies the versions | |
+ of a "stack" (or a collection) of artifacts. We use this here so that we always get the correct versions of artifacts. Here we use | |
+ the jboss-javaee-6.0 stack (you can read this as the JBoss stack of the Java EE 6 APIs) --> | |
+ | |
+ <!--adding Hibernate Community projects including Hibernate ORM, Hibernate Search and Hibernate Validator. | |
+ see https://github.com/jboss/jboss-bom/tree/master/jboss-javaee-6.0-with-hibernate --> | |
<dependency> | |
<groupId>org.jboss.bom</groupId> | |
<artifactId>jboss-javaee-6.0-with-hibernate</artifactId> | |
@@ -66,7 +64,7 @@ | |
</dependency> | |
</dependencies> | |
</dependencyManagement> | |
- | |
+ | |
<dependencies> | |
<!-- First declare the APIs we depend on and need for compilation. All of them are provided by JBoss --> | |
@@ -119,12 +117,6 @@ | |
<groupId>org.hibernate</groupId> | |
<artifactId>hibernate-validator</artifactId> | |
<scope>provided</scope> | |
- <exclusions> | |
- <exclusion> | |
- <groupId>org.slf4j</groupId> | |
- <artifactId>slf4j-api</artifactId> | |
- </exclusion> | |
- </exclusions> | |
</dependency> | |
<!-- Now we declare any tools needed --> | |
@@ -188,7 +180,7 @@ | |
<artifactId>jboss-as-maven-plugin</artifactId> | |
<version>7.1.0.Final</version> | |
</plugin> | |
- | |
+ | |
<plugin> | |
<groupId>com.mycila.maven-license-plugin</groupId> | |
<artifactId>maven-license-plugin</artifactId> | |
@@ -211,7 +203,7 @@ | |
</plugin> | |
</plugins> | |
</build> | |
- | |
+ | |
<profiles> | |
<profile> | |
<!-- The default profile skips all tests, though you can tune it to run just unit tests based on a custom pattern --> | |
@@ -402,7 +394,6 @@ | |
</dependency> | |
</dependencies> | |
</profile> | |
- | |
</profiles> | |
- | |
+ | |
</project> | |
diff --git a/src/etc/license.txt b/src/etc/license.txt | |
new file mode 100644 | |
index 0000000..bb95e25 | |
--- /dev/null | |
+++ b/src/etc/license.txt | |
@@ -0,0 +1,14 @@ | |
+JBoss, Home of Professional Open Source | |
+Copyright ${year}, Red Hat, Inc., and individual contributors | |
+by the @authors tag. See the copyright.txt in the distribution for a | |
+full listing of individual contributors. | |
+ | |
+Licensed under the Apache License, Version 2.0 (the "License"); | |
+you may not use this file except in compliance with the License. | |
+You may obtain a copy of the License at | |
+http://www.apache.org/licenses/LICENSE-2.0 | |
+Unless required by applicable law or agreed to in writing, software | |
+distributed under the License is distributed on an "AS IS" BASIS, | |
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
+See the License for the specific language governing permissions and | |
+limitations under the License. | |
\ No newline at end of file | |
diff --git a/src/main/java/org/jboss/as/quickstarts/html5_mobile/model/Member.java b/src/main/java/org/jboss/as/quickstarts/html5_mobile/model/Member.java | |
index 52d06cf..cd187c4 100644 | |
--- a/src/main/java/org/jboss/as/quickstarts/html5_mobile/model/Member.java | |
+++ b/src/main/java/org/jboss/as/quickstarts/html5_mobile/model/Member.java | |
@@ -1,4 +1,3 @@ | |
-package org.jboss.as.quickstarts.html5_mobile.model; | |
/** | |
* JBoss, Home of Professional Open Source | |
* Copyright 2012, Red Hat, Inc., and individual contributors | |
@@ -15,6 +14,7 @@ package org.jboss.as.quickstarts.html5_mobile.model; | |
* See the License for the specific language governing permissions and | |
* limitations under the License. | |
*/ | |
+package org.jboss.as.quickstarts.html5_mobile.model; | |
import java.io.Serializable; | |
diff --git a/src/main/java/org/jboss/as/quickstarts/html5_mobile/rest/JaxRsActivator.java b/src/main/java/org/jboss/as/quickstarts/html5_mobile/rest/JaxRsActivator.java | |
index 52014a4..32d4ddd 100644 | |
--- a/src/main/java/org/jboss/as/quickstarts/html5_mobile/rest/JaxRsActivator.java | |
+++ b/src/main/java/org/jboss/as/quickstarts/html5_mobile/rest/JaxRsActivator.java | |
@@ -1,4 +1,3 @@ | |
-package org.jboss.as.quickstarts.html5_mobile.rest; | |
/** | |
* JBoss, Home of Professional Open Source | |
* Copyright 2012, Red Hat, Inc., and individual contributors | |
@@ -15,6 +14,7 @@ package org.jboss.as.quickstarts.html5_mobile.rest; | |
* See the License for the specific language governing permissions and | |
* limitations under the License. | |
*/ | |
+package org.jboss.as.quickstarts.html5_mobile.rest; | |
import javax.ws.rs.ApplicationPath; | |
import javax.ws.rs.core.Application; | |
diff --git a/src/main/java/org/jboss/as/quickstarts/html5_mobile/rest/MemberService.java b/src/main/java/org/jboss/as/quickstarts/html5_mobile/rest/MemberService.java | |
index ccc1449..36b2163 100644 | |
--- a/src/main/java/org/jboss/as/quickstarts/html5_mobile/rest/MemberService.java | |
+++ b/src/main/java/org/jboss/as/quickstarts/html5_mobile/rest/MemberService.java | |
@@ -1,4 +1,3 @@ | |
-package org.jboss.as.quickstarts.html5_mobile.rest; | |
/** | |
* JBoss, Home of Professional Open Source | |
* Copyright 2012, Red Hat, Inc., and individual contributors | |
@@ -15,6 +14,7 @@ package org.jboss.as.quickstarts.html5_mobile.rest; | |
* See the License for the specific language governing permissions and | |
* limitations under the License. | |
*/ | |
+package org.jboss.as.quickstarts.html5_mobile.rest; | |
import java.util.HashMap; | |
import java.util.HashSet; | |
diff --git a/src/main/java/org/jboss/as/quickstarts/html5_mobile/util/Resources.java b/src/main/java/org/jboss/as/quickstarts/html5_mobile/util/Resources.java | |
index 3c9026d..d3c00ec 100644 | |
--- a/src/main/java/org/jboss/as/quickstarts/html5_mobile/util/Resources.java | |
+++ b/src/main/java/org/jboss/as/quickstarts/html5_mobile/util/Resources.java | |
@@ -1,4 +1,3 @@ | |
-package org.jboss.as.quickstarts.html5_mobile.util; | |
/** | |
* JBoss, Home of Professional Open Source | |
* Copyright 2012, Red Hat, Inc., and individual contributors | |
@@ -15,6 +14,7 @@ package org.jboss.as.quickstarts.html5_mobile.util; | |
* See the License for the specific language governing permissions and | |
* limitations under the License. | |
*/ | |
+package org.jboss.as.quickstarts.html5_mobile.util; | |
import java.util.logging.Logger; | |
diff --git a/src/main/webapp/WEB-INF/wro.properties b/src/main/webapp/WEB-INF/wro.properties | |
new file mode 100644 | |
index 0000000..b0e96ab | |
--- /dev/null | |
+++ b/src/main/webapp/WEB-INF/wro.properties | |
@@ -0,0 +1 @@ | |
+preProcessors=uglifyJs,cssMinJawr | |
diff --git a/src/main/webapp/js/libs/yepnope.1.0.2-min.js b/src/main/webapp/js/libs/yepnope.1.0.2-min.js | |
old mode 100644 | |
new mode 100755 | |
diff --git a/src/test/java/org/jboss/as/quickstarts/html5_mobile/test/MemberRegistrationTest.java b/src/test/java/org/jboss/as/quickstarts/html5_mobile/test/MemberRegistrationTest.java | |
index 0bac347..7ba46ba 100644 | |
--- a/src/test/java/org/jboss/as/quickstarts/html5_mobile/test/MemberRegistrationTest.java | |
+++ b/src/test/java/org/jboss/as/quickstarts/html5_mobile/test/MemberRegistrationTest.java | |
@@ -1,4 +1,3 @@ | |
-package org.jboss.as.quickstarts.html5_mobile.test; | |
/** | |
* JBoss, Home of Professional Open Source | |
* Copyright 2012, Red Hat, Inc., and individual contributors | |
@@ -15,6 +14,7 @@ package org.jboss.as.quickstarts.html5_mobile.test; | |
* See the License for the specific language governing permissions and | |
* limitations under the License. | |
*/ | |
+package org.jboss.as.quickstarts.html5_mobile.test; | |
import static org.junit.Assert.assertEquals; | |
import static org.junit.Assert.assertNotNull; | |
@@ -49,7 +49,7 @@ public class MemberRegistrationTest { | |
public static Archive<?> createTestArchive() { | |
return ShrinkWrap.create(WebArchive.class, "test.war") | |
.addClasses(Member.class, MemberService.class, Resources.class) | |
- .addAsResource("META-INF/persistence.xml", "META-INF/persistence.xml") | |
+ .addAsResource("META-INF/persistence.xml", "META-INF/persistence.xml") | |
.addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml"); | |
} | |
diff --git a/src/test/qunit/index.html b/src/test/qunit/index.html | |
index 717cf1a..5deb930 100644 | |
--- a/src/test/qunit/index.html | |
+++ b/src/test/qunit/index.html | |
@@ -1,3 +1,21 @@ | |
+<!-- | |
+ | |
+ JBoss, Home of Professional Open Source | |
+ Copyright 2012, Red Hat, Inc., and individual contributors | |
+ by the @authors tag. See the copyright.txt in the distribution for a | |
+ full listing of individual contributors. | |
+ | |
+ Licensed under the Apache License, Version 2.0 (the "License"); | |
+ you may not use this file except in compliance with the License. | |
+ You may obtain a copy of the License at | |
+ http://www.apache.org/licenses/LICENSE-2.0 | |
+ Unless required by applicable law or agreed to in writing, software | |
+ distributed under the License is distributed on an "AS IS" BASIS, | |
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
+ See the License for the specific language governing permissions and | |
+ limitations under the License. | |
+ | |
+--> | |
<!DOCTYPE html> | |
<!-- | |
@@ -11,12 +29,12 @@ the tests for the HTML5/Mobile application. | |
<title>HTML5 Test Suite</title> | |
<link rel="stylesheet" href="qunit/qunit.css" type="text/css" media="screen"> | |
- <script type="text/javascript" src="../../main/webapp/resources/js/jquery-1.6.4.js"></script> | |
+ <script type="text/javascript" src="../../main/webapp/js/libs/jquery-1.6.4.js"></script> | |
<script type="text/javascript" src="qunit/qunit.js"></script> | |
<!-- The js file to be tested --> | |
- <script type="text/javascript" src="../../main/webapp/resources/js/underscore-min.js"></script> | |
- <script type="text/javascript" src="../../main/webapp/resources/js/app.js"></script> | |
+ <script type="text/javascript" src="../../main/webapp/js/libs/underscore-min.js"></script> | |
+ <script type="text/javascript" src="../../main/webapp/js/app.js"></script> | |
<!-- The js file that contains the tests --> | |
<script type="text/javascript" src="test/test.js"></script> | |
diff --git a/src/test/qunit/test/test.js b/src/test/qunit/test/test.js | |
index df23aea..3707ab9 100644 | |
--- a/src/test/qunit/test/test.js | |
+++ b/src/test/qunit/test/test.js | |
@@ -1,39 +1,65 @@ | |
/* | |
+ * JBoss, Home of Professional Open Source | |
+ * Copyright 2012, Red Hat, Inc., and individual contributors | |
+ * by the @authors tag. See the copyright.txt in the distribution for a | |
+ * full listing of individual contributors. | |
+ * | |
+ * Licensed under the Apache License, Version 2.0 (the "License"); | |
+ * you may not use this file except in compliance with the License. | |
+ * You may obtain a copy of the License at | |
+ * http://www.apache.org/licenses/LICENSE-2.0 | |
+ * Unless required by applicable law or agreed to in writing, software | |
+ * distributed under the License is distributed on an "AS IS" BASIS, | |
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
+ * See the License for the specific language governing permissions and | |
+ * limitations under the License. | |
+ */ | |
+/* | |
Unit tests that cover basic functionality of app.js. | |
*/ | |
module('Member Row Construction'); | |
test('Build 2 Member Rows', function() { | |
- expect(1); | |
+ expect(1); | |
- var members = [{"email": "[email protected]", "id": 1, "name": "Jane Doe", "phoneNumber": "12312312311"},{"email": "[email protected]", "id": 0, "name": "John Doe", "phoneNumber": "2125551212"}]; | |
+ var members = [{"email": "[email protected]", "id": 1, "name": "Jane Doe", "phoneNumber": "12312312311"},{"email": "[email protected]", "id": 0, "name": "John Doe", "phoneNumber": "2125551212"}]; | |
- var html = buildMemberRows(members); | |
- var length = $(html).length; | |
- ok(length == 2, 'Number of rows built: ' + length); | |
+ var html = buildMemberRows(members); | |
+ | |
+ ok($(html).length == 2, 'Number of rows built: ' + length); | |
}); | |
test('Build 0 member Rows', function() { | |
- expect(1); | |
+ expect(1); | |
- var members = []; | |
+ var members = []; | |
- var html = buildMemberRows(members); | |
+ var html = buildMemberRows(members); | |
- ok(html == '', 'Created no rows for empty members'); | |
+ ok($(html).length == 0, 'Created no rows for empty members'); | |
}); | |
module('Member Restful Calls'); | |
-test('Request current member list', function() { | |
- ok(1==1,"TODO"); | |
+asyncTest('Request current member list', function() { | |
+ expect(1); | |
+ | |
+ $.ajax({ | |
+ url: "http://localhost:8080/jboss-as-kitchensink-html5-mobile/rest/members/json", | |
+ dataType: "jsonp", | |
+ jsonp: "jsonpcallback", | |
+ success: function(data) { | |
+ ok($(data).length, "Initial member returned"); | |
+ start(); | |
+ } | |
+ }); | |
}); | |
test('Register a new member', function() { | |
- ok(1==1,"TODO"); | |
+ ok(1==1,"TODO"); | |
}); | |
test('Register a member with a duplicate email', function() { | |
- ok(1==1,"TODO"); | |
+ ok(1==1,"TODO"); | |
}); | |
\ No newline at end of file | |
diff --git a/src/test/resources/arquillian.xml b/src/test/resources/arquillian.xml | |
index 42e2783..2d13146 100644 | |
--- a/src/test/resources/arquillian.xml | |
+++ b/src/test/resources/arquillian.xml | |
@@ -1,4 +1,22 @@ | |
<?xml version="1.0" encoding="UTF-8"?> | |
+<!-- | |
+ | |
+ JBoss, Home of Professional Open Source | |
+ Copyright 2012, Red Hat, Inc., and individual contributors | |
+ by the @authors tag. See the copyright.txt in the distribution for a | |
+ full listing of individual contributors. | |
+ | |
+ Licensed under the Apache License, Version 2.0 (the "License"); | |
+ you may not use this file except in compliance with the License. | |
+ You may obtain a copy of the License at | |
+ http://www.apache.org/licenses/LICENSE-2.0 | |
+ Unless required by applicable law or agreed to in writing, software | |
+ distributed under the License is distributed on an "AS IS" BASIS, | |
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
+ See the License for the specific language governing permissions and | |
+ limitations under the License. | |
+ | |
+--> | |
<arquillian xmlns="http://jboss.org/schema/arquillian" | |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:schemaLocation="http://jboss.org/schema/arquillian | |
-- | |
1.7.5.4 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment