Skip to content

Instantly share code, notes, and snippets.

@qmx
Created March 9, 2012 19:57
Show Gist options
  • Save qmx/2008343 to your computer and use it in GitHub Desktop.
Save qmx/2008343 to your computer and use it in GitHub Desktop.
From 2adb81b66ca8de36ea567a2ac9981f486da37ceb Mon Sep 17 00:00:00 2001
From: Douglas Campos <[email protected]>
Date: Fri, 9 Mar 2012 16:43:17 -0300
Subject: [PATCH] from quickstart
---
.gitignore | 11 +-
LICENSE.txt | 202 ++++++++++++++++++++
README.md | 69 +++++--
SERVICES.md | 123 ++++++++++++
pom.xml | 61 +++----
src/etc/license.txt | 14 ++
.../html5_mobile/util/JSONPRequestFilter.java | 4 +-
src/main/webapp/WEB-INF/wro.xml | 18 ++
src/main/webapp/tmpl/member.tmpl | 18 --
.../html5_mobile/test/MemberRegistrationTest.java | 2 +-
src/test/qunit/index.html | 24 ++-
src/test/qunit/test/test.js | 52 ++++--
src/test/resources/arquillian.xml | 18 ++
13 files changed, 518 insertions(+), 98 deletions(-)
create mode 100644 LICENSE.txt
create mode 100644 SERVICES.md
create mode 100644 src/etc/license.txt
mode change 100644 => 100755 src/main/webapp/js/libs/yepnope.1.0.2-min.js
diff --git a/.gitignore b/.gitignore
index 3a53e65..b83d222 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,10 +1 @@
-*~
-.classpath
-.project
-target
-.settings
-.DS_Store
-.faces-config.xml.jsfdia
-MANIFEST.MF
-.idea
-*.iml
+/target/
diff --git a/LICENSE.txt b/LICENSE.txt
new file mode 100644
index 0000000..d645695
--- /dev/null
+++ b/LICENSE.txt
@@ -0,0 +1,202 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ 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.
diff --git a/README.md b/README.md
index 449624f..23d6e7d 100644
--- a/README.md
+++ b/README.md
@@ -1,5 +1,6 @@
-jboss-as-kitchensink-html5-mobile
-========================
+kitchensink-html5-mobile: Example AeroGear Application Using Multiple HTML5, Mobile & JAX-RS Technologies
+=========================================================================================================
+Author: Jay Balunas
What is it?
-----------
@@ -14,7 +15,7 @@ you get your feet wet with database access in enterprise Java.
This application is built using a technique called Plain Old HTML5 (POH5). This uses a pure HTML
client that interacts with with the application server via restful end-points (JAX-RS). This
application also uses some of the latest HTML5 features and advanced JAX-RS. And since testing
-is just as important with POH5 as it is server side core this application also uses QUnit to show
+is just as important with POH5 as it is server side, this application uses QUnit to show
you how to unit test your JavaScript.
What is a modern web application without mobile web support? This application also integrates
@@ -29,9 +30,9 @@ System requirements
All you need to build this project is Java 6.0 (Java SDK 1.6) or better, Maven
3.0 or better.
-The application this project produces is designed to be run on JBoss AS 7+ or EAP 6+.
+The application this project produces is designed to be run on JBoss AS 7 or JBoss Enterprise Application Platform 6.
-An HTML5 compatible browser such as Chrome 14+, Safari 5+, Firefox 5+, or IE 9+ are
+An HTML5 compatible browser such as Chrome, Safari 5+, Firefox 5+, or IE 9+ are
required. and note that some behaviors will vary slightly (ex. validations) based on browser support,
especially IE 9.
@@ -43,6 +44,8 @@ With the prerequisites out of the way, you're ready to build and deploy.
Deploying the application
-------------------------
+
+### Deploying locally
First you need to start the JBoss container. To do this, run
@@ -68,16 +71,39 @@ You can now deploy the artifact by executing the following command:
mvn jboss-as:deploy
-This will deploy `target/jboss-as-kitchensink-html5-mobile`.
-
-The application will be running at the following URL <http://localhost:8080/jboss-as-kitchensink-html5-mobile/>.
+The client application will be running at the following URL <http://localhost:8080/jboss-as-kitchensink-html5-mobile/>.
To undeploy run this command:
mvn jboss-as:undeploy
You can also start the JBoss container and deploy the project using JBoss Tools. See the
-Getting Started Guide for Developers for more information.
+<a href="https://docs.jboss.org/author/display/AS71/Getting+Started+Developing+Applications+Guide" title="Getting Started Developing Applications Guide">Getting Started Developing Applications Guide</a>
+for more information.
+
+### Deploying to OpenShift
+
+You can also deploy the application directly to OpenShift, Red Hat's cloud based PaaS offering, follow the instructions [here](https://community.jboss.org/wiki/DeployingHTML5ApplicationsToOpenshift)
+
+Minification
+============================
+
+By default, the project uses the [wro4j](http://code.google.com/p/wro4j/) plugin,
+which provides the ability to concatenate, validate and minify JavaScript and CSS
+files. These minified files, as well as their unmodified versions are deployed with
+the project.
+
+With just a few quick changes to the project, you can link to the minified versions
+of your JavaScript and CSS files.
+
+First, in the <project-root>/src/main/webapp/index.html file, search for
+references to minification and comment or uncomment the appropriate lines.
+
+Finally, wro4j runs in the compile phase so any standard build command like package,
+install, etc. will trigger it. The plugin is in a profile with an id of "minify" so
+you will want to specify that profile in your maven build. For example:
+
+ mvn clean package jboss-as:deploy -Pminify
Running the Arquillian tests
============================
@@ -95,12 +121,14 @@ test goal with the following profile activated:
Running the QUnit tests
============================
-QUnit is a JavaScript unit testing framework used and built by jQuery.This
-application include a set of QUnit tests in order to verify JavaScript that
-is core to this HTML5 application. Executing QUnit test cases is quite easy.
-Simply load the following HTML is a browser.
+QUnit is a JavaScript unit testing framework used and built by jQuery. This
+application includes a set of QUnit tests in order to verify JavaScript that
+is core to this HTML5 application. Executing QUnit test cases is quite easy. First,
+make sure the server is running and the project has been deployed as some of the
+tests will be testing the functionality of the services. Then, simply load the
+following HTML in the browser you wish to test.
- <app-root>/src/test/qunit/index.html
+ <project-root>/src/test/qunit/index.html
For more information on QUnit tests see http://docs.jquery.com/QUnit
@@ -112,9 +140,9 @@ If you created the project using the Maven archetype wizard in your IDE
already have an IDE project.
Detailed instructions for using Eclipse / JBoss Tools with are provided in the
-Getting Started Guide for Developers.
+<a href="https://docs.jboss.org/author/display/AS71/Getting+Started+Developing+Applications+Guide" title="Getting Started Developing Applications Guide">Getting Started Developing Applications Guide</a>.
-If you created the project from the commandline using archetype:generate, then
+If you created the project from the command line using archetype:generate, then
you need to import the project into your IDE. If you are using NetBeans 6.8 or
IntelliJ IDEA 9, then all you have to do is open the project as an existing
project. Both of these IDEs recognize Maven projects natively.
@@ -129,3 +157,12 @@ them.
mvn dependency:sources
mvn dependency:resolve -Dclassifier=javadoc
+
+Development notes
+=================
+
+Copyright headers
+-----------------
+
+To update the copyright headers, just run `mvn license:format -Dyear=<current year>`
+
diff --git a/SERVICES.md b/SERVICES.md
new file mode 100644
index 0000000..58d74cb
--- /dev/null
+++ b/SERVICES.md
@@ -0,0 +1,123 @@
+kitchensink-html5-mobile: JAX-RS Services Documentation
+=======================================================
+Author: Jay Balunas
+
+This example supports various RESTFul end points which also includes JSONP support for cross domain requests.
+
+By default the base URL for services is `/jboss-as-kitchensink-html5-mobile/rest`.
+
+MemberService End Points
+------------------------
+
+### List all members
+#### /rest/members
+
+* Request type: GET
+* Return type: XML
+* Response example:
+
+```xml
+<?xml version="1.0" encoding="UTF-8"standalone="yes"?>
+<collection>
+ <member>
+ <email>[email protected]</email>
+ <id>1</id>
+ <name>Jane Smith</name>
+ <phoneNumber>2125551212</phoneNumber>
+ </member>
+ <member>
+ <email>[email protected]</email>
+ <id>0</id>
+ <name>John Smith</name>
+ <phoneNumber>2125551212</phoneNumber>
+ </member>
+</collection>
+```
+
+#### /rest/members/json
+
+* Request type: GET
+* Return type: JSON
+* Response example:
+
+```javascript
+[{"id":1,"name":"Jane Smith","email":"[email protected]","phoneNumber":"2125551212"},{"id":0,"name":"John Smith","email":"[email protected]","phoneNumber":"2125551212"}]
+```
+
+### Create a new members
+
+#### /rest/members
+
+* Request type: POST
+* Request type: application/x-www-form-urlencoded
+* Request parameters: name, email, phoneNumber
+* Return type: JSON
+* Response example:
+ * Success: 200 OK
+ * Validation error: Collection of `<field name>:<error msg>` for each error
+
+```JavaScript
+{"phoneNumber":"10-12 Numbers","email":"Invalid format"}
+```
+
+#### /rest/members/new?name=&email=&phoneNumber=
+* Request type: GET
+* Query parameters: name, email, phoneNumber
+* Return type: JSON
+* Response example: See POST example above
+ * Note: JSONP requests do not support error responses
+
+### Get one member by ID
+
+#### /rest/members/\<id>
+* Request type: GET
+* Return type: XML
+* Response example:
+
+```xml
+<?xml version="1.0" encoding="UTF-8"standalone="yes"?>
+<member>
+ <email>[email protected]</email>
+ <id>0</id>
+ <name>John Smith</name>
+ <phoneNumber>2125551212</phoneNumber>
+</member>
+```
+
+#### /rest/members/\<id>/json
+* Request type: GET
+* Return type: JSON
+* Response example:
+
+```javascript
+{"id":0,"name":"John Smith","email":"[email protected]","phoneNumber":"2125551212"}
+```
+
+JSONP Support
+-------------
+
+[JSONP](http://en.wikipedia.org/wiki/JSONP) is a technique for allowing cross domain requests from services. It pads (what the "P" stands for) the service response with a JavaScript callback function that can then access the data on the client.
+
+In order for a request to be padded the following things must be true:
+
+* The request is one of the GET JSON request from above
+ * POST requests are not support for JSONP requests
+* A query parameter named *jsonpcallback* is defined
+ * The value of this parameter is the method that will be defined in the padding
+
+For example:
+
+ http://\<domain:port>/jboss-as-kitchensink-html5-mobile/rest/members/json?jsonpcallback=mycallback
+
+See jQuery's documentation for client access examples:
+
+* http://api.jquery.com/jQuery.getJSON/
+* http://api.jquery.com/jQuery.ajax/
+
+__Validation Error Handling__
+
+When using JSONP requests error responses are not supported. This is a known issue with JSONP, and has to do with how JSONP requests are sent to the server using \<script> tags. In the case of a validation issue, or error the success callback will not be thrown, and most client libraries (specifically jquery) will not be able to call the error callback either. There are some workarounds and options, but typically they are limited. See your specific client library for more information.
+
+__Security Considerations__
+
+Before using JSONP in your system be aware of some potential security issues that are possible. There are two primary concerns, cross-site request forgery, and script tag manipulation. This example show one way to add a layer of security, by only processing JSONP requests with "safe" characters, it makes it more difficult for a site to injects harmful scripts into the return. You should always consider this and other aspects of security when exposing services in this way. See the [JSON wiki](http://en.wikipedia.org/wiki/JSONP) for more information.
diff --git a/pom.xml b/pom.xml
index f5ae1fb..2ab1979 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.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>
@@ -213,7 +205,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 -->
@@ -404,7 +396,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/util/JSONPRequestFilter.java b/src/main/java/org/jboss/as/quickstarts/html5_mobile/util/JSONPRequestFilter.java
index 3382dbb..dc3542a 100644
--- a/src/main/java/org/jboss/as/quickstarts/html5_mobile/util/JSONPRequestFilter.java
+++ b/src/main/java/org/jboss/as/quickstarts/html5_mobile/util/JSONPRequestFilter.java
@@ -1,6 +1,6 @@
-/*
+/**
* JBoss, Home of Professional Open Source
- * Copyright ${year}, Red Hat, Inc., and individual contributors
+ * 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.
*
diff --git a/src/main/webapp/WEB-INF/wro.xml b/src/main/webapp/WEB-INF/wro.xml
index ddfb45f..1c0eb46 100644
--- a/src/main/webapp/WEB-INF/wro.xml
+++ b/src/main/webapp/WEB-INF/wro.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.
+
+-->
<groups xmlns="http://www.isdc.ro/wro"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.isdc.ro/wro wro.xsd">
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/main/webapp/tmpl/member.tmpl b/src/main/webapp/tmpl/member.tmpl
index a12b3be..cd8ec2f 100644
--- a/src/main/webapp/tmpl/member.tmpl
+++ b/src/main/webapp/tmpl/member.tmpl
@@ -1,21 +1,3 @@
-<!--
-
- 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.
-
--->
<script type="text/template" id="member-tmpl">
<% _.each(members, function(member) { %>
<tr class="member">
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 6be4a4f..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
@@ -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