Skip to content

Instantly share code, notes, and snippets.

@qmx
Created March 9, 2012 16:33
Show Gist options
  • Save qmx/2007380 to your computer and use it in GitHub Desktop.
Save qmx/2007380 to your computer and use it in GitHub Desktop.
From fd510995c4fc4a4da865fc85b88a18f7a48afd1c Mon Sep 17 00:00:00 2001
From: Douglas Campos <[email protected]>
Date: Fri, 9 Mar 2012 13:33:10 -0300
Subject: [PATCH] expected
---
.../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 +-
.../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 +++++++
8 files changed, 84 insertions(+), 22 deletions(-)
mode change 100644 => 100755 src/main/webapp/js/libs/yepnope.1.0.2-min.js
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/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