Skip to content

Commit d295a8e

Browse files
author
arjan
committed
Initial amount of extras samples and units tests. WIP
1 parent 5dddc4c commit d295a8e

File tree

175 files changed

+32789
-23
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

175 files changed

+32789
-23
lines changed

Diff for: .gitignore

+103
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
# Directories #
2+
build/
3+
bin/
4+
target/
5+
libs/
6+
tmp/
7+
node_modules/
8+
jaxws/jaxws-client/src/main/
9+
10+
# OS Files #
11+
.DS_Store
12+
13+
*.class
14+
15+
# Package Files #
16+
*.jar
17+
*.war
18+
*.ear
19+
*.db
20+
rebel.xml
21+
22+
######################
23+
# Windows
24+
######################
25+
26+
# Windows image file caches
27+
Thumbs.db
28+
29+
# Folder config file
30+
Desktop.ini
31+
32+
######################
33+
# OSX
34+
######################
35+
36+
.DS_Store
37+
.svn
38+
39+
# Thumbnails
40+
._*
41+
42+
# Files that might appear on external disk
43+
.Spotlight-V100
44+
.Trashes
45+
46+
######################
47+
# NetBeans
48+
######################
49+
nbproject/
50+
build/
51+
nbbuild/
52+
dist/
53+
nbdist/
54+
nbactions.xml
55+
nb-configuration.xml
56+
57+
######################
58+
# IDEA
59+
######################
60+
*.iml
61+
*.ipr
62+
*.iws
63+
.idea/
64+
atlassian-ide-plugin.xml
65+
66+
67+
######################
68+
# Eclipse
69+
######################
70+
71+
*.pydevproject
72+
.project
73+
.metadata
74+
*.tmp
75+
*.bak
76+
*.swp
77+
*~.nib
78+
local.properties
79+
.classpath
80+
.settings/
81+
.loadpath
82+
83+
# External tool builders
84+
.externalToolBuilders/
85+
86+
# Locally stored "Eclipse launch configurations"
87+
*.launch
88+
89+
# CDT-specific
90+
.cproject
91+
92+
# PDT-specific
93+
.buildpath
94+
95+
# Testing environment specific
96+
derby.log
97+
98+
99+
######################
100+
# Liberty tools
101+
######################
102+
103+
.factorypath

Diff for: LICENSE

+277-21
Large diffs are not rendered by default.

Diff for: README.md

+38-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,38 @@
1-
# javaee-extras
2-
Samples demonstrating Java EE interacting with various external technologies
1+
# Java EE Extras Samples #
2+
3+
This project consists of Java EE Extras Samples and unit tests. They are categorized in different directories, one for each technology.
4+
5+
The extras project focuses on the interaction of Java EE with external technologies as well as on alternatives for various testing frameworks.
6+
7+
Where the Java EE 7 and Java EE 8 samples projects are quite strict on limiting the amount of alternatives that are used for any test, this project has no such limitations. Tests can be written in any (JVM) language such as Groovy, Scala, JRuby, Kotlin, etc, using any (unit) test framework and helpers such as JUnit, TestNg, Arquillian, Cargo, Cactus, contain tests that exercise application server specific functionality, contain tests that exercise framework specific functionality such as the Jersey specific MVC, MyFaces specific features, and all combinations and permutations of the above.
8+
9+
**Note**: The project currently does not run out of the box. PRs are welcome to fix this.
10+
11+
There are 6 profiles to choose a browser to test on:
12+
13+
* ``browser-firefox``
14+
15+
To run tests on Mozilla Firefox. If its binary is installed in the usual place, no additional information is required.
16+
17+
* ``browser-chrome``
18+
19+
To run tests on Google Chrome. Need to pass a ``-Darq.extension.webdriver.chromeDriverBinary`` property
20+
pointing to a ``chromedriver`` binary.
21+
22+
* ``browser-ie``
23+
24+
To run tests on Internet Explorer. Need to pass a ``-Darq.extension.webdriver.ieDriverBinary`` property
25+
pointing to a ``IEDriverServer.exe``.
26+
27+
* ``browser-safari``
28+
29+
To run tests on Safari. If its binary is installed in the usual place, no additional information is required.
30+
31+
* ``browser-opera``
32+
33+
To run tests on Opera. Need to pass a ``-Darq.extension.webdriver.opera.binary`` property pointing to a Opera executable.
34+
35+
* ``browser-phantomjs``
36+
37+
To run tests on headless browser PhantomJS. If you do not specify the path of phantomjs binary via
38+
``-Dphantomjs.binary.path`` property, it will be downloaded automatically.

Diff for: angularjs/package.json

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"name": "jax-rs-angularjs",
3+
"version": "0.1.0",
4+
"description": "Angular JS consuming REST services",
5+
"engines": {
6+
"node": "~0.10"
7+
},
8+
"main": "web-server.js",
9+
"dependencies": {
10+
},
11+
"devDependencies": {
12+
"http-proxy": "0.10.3",
13+
"karma": "0.10.2",
14+
"karma-coverage": "0.1.0",
15+
"karma-jasmine": "0.1.3",
16+
"karma-junit-reporter": "0.1.0",
17+
"karma-spec-reporter": "0.0.5",
18+
"karma-ng-scenario": "0.1.0"
19+
},
20+
"scripts": {
21+
"test": "karma start src/test/javascript/karma.conf.js --browsers PhantomJS --singleRun true"
22+
},
23+
"repository": {
24+
"type": "git",
25+
"url": "https://github.com/javaee-samples/javaee7-samples.git"
26+
},
27+
"author": "Bernard Labno"
28+
}

Diff for: angularjs/pom.xml

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
3+
<modelVersion>4.0.0</modelVersion>
4+
5+
<parent>
6+
<artifactId>jaxrs</artifactId>
7+
<groupId>org.javaee7</groupId>
8+
<version>1.0-SNAPSHOT</version>
9+
<relativePath>../pom.xml</relativePath>
10+
</parent>
11+
<artifactId>jaxrs-angularjs</artifactId>
12+
<packaging>war</packaging>
13+
<name>Java EE 7 Sample: jaxrs - angularjs</name>
14+
<description>Angular JS consuming REST services</description>
15+
16+
<dependencies>
17+
<dependency>
18+
<groupId>org.jboss.arquillian.extension</groupId>
19+
<artifactId>arquillian-persistence-impl</artifactId>
20+
<version>1.0.0.Alpha6</version>
21+
<scope>test</scope>
22+
</dependency>
23+
<dependency>
24+
<groupId>org.jboss.arquillian.extension</groupId>
25+
<artifactId>arquillian-rest-client-api</artifactId>
26+
<version>1.0.0.Alpha1</version>
27+
<scope>test</scope>
28+
</dependency>
29+
<dependency>
30+
<groupId>org.jboss.arquillian.extension</groupId>
31+
<artifactId>arquillian-rest-client-impl-3x</artifactId>
32+
<version>1.0.0.Alpha1</version>
33+
<scope>test</scope>
34+
</dependency>
35+
<dependency>
36+
<groupId>org.jboss.arquillian.graphene</groupId>
37+
<artifactId>graphene-webdriver</artifactId>
38+
<version>2.0.0.Final</version>
39+
<type>pom</type>
40+
<scope>test</scope>
41+
</dependency>
42+
</dependencies>
43+
44+
<profiles>
45+
<profile>
46+
<id>wildfly-swarm</id>
47+
<dependencies>
48+
<dependency>
49+
<groupId>com.h2database</groupId>
50+
<artifactId>h2</artifactId>
51+
</dependency>
52+
</dependencies>
53+
</profile>
54+
</profiles>
55+
</project>

Diff for: angularjs/src/main/java/com/example/domain/Note.java

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
package com.example.domain;
2+
3+
import javax.persistence.Entity;
4+
import javax.persistence.GeneratedValue;
5+
import javax.persistence.Id;
6+
7+
@Entity
8+
public class Note {
9+
10+
@GeneratedValue
11+
@Id
12+
private Long id;
13+
14+
private String summary;
15+
16+
private String title;
17+
18+
public Long getId()
19+
{
20+
return id;
21+
}
22+
23+
public void setId(Long id)
24+
{
25+
this.id = id;
26+
}
27+
28+
public String getSummary()
29+
{
30+
return summary;
31+
}
32+
33+
public void setSummary(String summary)
34+
{
35+
this.summary = summary;
36+
}
37+
38+
public String getTitle()
39+
{
40+
return title;
41+
}
42+
43+
public void setTitle(String title)
44+
{
45+
this.title = title;
46+
}
47+
}
+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package com.example.rest;
2+
3+
import javax.ws.rs.ApplicationPath;
4+
import javax.ws.rs.core.Application;
5+
6+
@ApplicationPath("/rest")
7+
public class NoteApp extends Application {
8+
9+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package com.example.rest;
2+
3+
import com.example.domain.Note;
4+
5+
import javax.ws.rs.DELETE;
6+
import javax.ws.rs.GET;
7+
import javax.ws.rs.POST;
8+
import javax.ws.rs.Path;
9+
import javax.ws.rs.PathParam;
10+
import java.util.List;
11+
12+
@Path("/note")
13+
public interface NoteResource {
14+
15+
@GET
16+
@Path("/")
17+
List<Note> getNotes();
18+
19+
@DELETE
20+
@Path("/{id}")
21+
void removeNote(@PathParam("id") Long noteId);
22+
23+
@POST
24+
@Path("/")
25+
Note saveNote(Note note);
26+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
package com.example.rest;
2+
3+
import com.example.domain.Note;
4+
5+
import javax.ejb.Stateless;
6+
import javax.persistence.EntityManager;
7+
import javax.persistence.NoResultException;
8+
import javax.persistence.PersistenceContext;
9+
import java.util.List;
10+
11+
@Stateless
12+
public class NoteResourceImpl implements NoteResource {
13+
14+
@PersistenceContext
15+
private EntityManager entityManager;
16+
17+
@Override
18+
public List<Note> getNotes()
19+
{
20+
return entityManager.createQuery("from Note order by id", Note.class).getResultList();
21+
}
22+
23+
@Override
24+
public void removeNote(Long noteId)
25+
{
26+
final Note note = entityManager.find(Note.class, noteId);
27+
if (null == note) {
28+
throw new NoResultException("No note with id " + noteId + " found");
29+
}
30+
entityManager.remove(note);
31+
}
32+
33+
@Override
34+
public Note saveNote(Note note)
35+
{
36+
entityManager.persist(note);
37+
return note;
38+
}
39+
}
+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
4+
5+
<persistence-unit name="test">
6+
<jta-data-source>java:jboss/datasources/ExampleDS</jta-data-source>
7+
<properties>
8+
<property name="hibernate.hbm2ddl.auto" value="create-drop"/>
9+
</properties>
10+
</persistence-unit>
11+
12+
</persistence>

Diff for: angularjs/src/main/resources/import.sql

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
insert into note (id,title,summary) values (nextval('hibernate_sequence'),'Hello','First note');
2+
insert into note (id,title,summary) values (nextval('hibernate_sequence'),'Good bye','Another note');

Diff for: angularjs/src/main/webapp/api-settings.jsp

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<%@ page contentType="script/javascript;charset=UTF-8" language="java" %>
2+
window.applicationContextPath="<%=request.getContextPath()%>";

0 commit comments

Comments
 (0)