File tree 3 files changed +32
-5
lines changed
testing/src/test/java/com/thenaglecode/core
3 files changed +32
-5
lines changed Original file line number Diff line number Diff line change 17
17
import javax .persistence .EntityManager ;
18
18
import javax .persistence .PersistenceContext ;
19
19
20
+ import java .util .HashSet ;
21
+ import java .util .Set ;
22
+
20
23
import static junit .framework .Assert .assertNotNull ;
21
24
22
25
/**
@@ -40,6 +43,8 @@ public class SecurityTests {
40
43
"user"
41
44
};
42
45
46
+ private static final Set <User > USERS = new HashSet <>();
47
+
43
48
@ EJB
44
49
TransactionUtil txUtil ;
45
50
@@ -59,11 +64,11 @@ public static JavaArchive createDeployment() {
59
64
60
65
@ Before
61
66
public void init () {
62
- deleteData ();
63
- insertData ();
67
+ deleteAllUsers ();
68
+ insertTestUsersData ();
64
69
}
65
70
66
- private void deleteData () {
71
+ private void deleteAllUsers () {
67
72
txUtil .wrapInTx (new TransactionUtil .Invokable () {
68
73
@ Override
69
74
public void invoke () {
@@ -72,7 +77,7 @@ public void invoke() {
72
77
});
73
78
}
74
79
75
- private void insertData () {
80
+ private void insertTestUsersData () {
76
81
txUtil .wrapInTx (new TransactionUtil .Invokable () {
77
82
@ Override
78
83
public void invoke () {
@@ -81,7 +86,10 @@ public void invoke() {
81
86
for (String username : USER_NAMES ) {
82
87
users [i ++] = new User (username );
83
88
}
84
- for (User user : users ) em .persist (user );
89
+ for (User user : users ) {
90
+ em .persist (user );
91
+ USERS .add (user );
92
+ }
85
93
}
86
94
});
87
95
}
Original file line number Diff line number Diff line change 1
1
<?xml version =" 1.0" encoding =" UTF-8" ?>
2
2
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule=" true" type =" JAVA_MODULE" version =" 4" >
3
+ <component name =" FacetManager" >
4
+ <facet type =" web" name =" Web" >
5
+ <configuration >
6
+ <descriptors >
7
+ <deploymentDescriptor name =" web.xml" url =" file://$MODULE_DIR$/src/main/webapp/WEB-INF/web.xml" />
8
+ </descriptors >
9
+ <webroots >
10
+ <root url =" file://$MODULE_DIR$/src/main/webapp" relative =" /" />
11
+ </webroots >
12
+ <sourceRoots >
13
+ <root url =" file://$MODULE_DIR$/src/main/java" />
14
+ <root url =" file://$MODULE_DIR$/src/main/resources" />
15
+ </sourceRoots >
16
+ </configuration >
17
+ </facet >
18
+ </component >
3
19
<component name =" NewModuleRootManager" LANGUAGE_LEVEL =" JDK_1_7" inherit-compiler-output =" false" >
4
20
<output url =" file://$MODULE_DIR$/target/classes" />
5
21
<output-test url =" file://$MODULE_DIR$/target/test-classes" />
You can’t perform that action at this time.
0 commit comments