Skip to content

Commit 8640330

Browse files
author
eugenp
committed
cleanup work in preparation for search battery of tests
1 parent f9b189e commit 8640330

21 files changed

Lines changed: 199 additions & 114 deletions

‎eclipse/BUILD.launch‎

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2-
<launchConfiguration type="org.eclipse.m2e.Maven2LaunchConfigurationType">
3-
<booleanAttribute key="M2_DEBUG_OUTPUT" value="false"/>
4-
<stringAttribute key="M2_GOALS" value="clean install"/>
5-
<booleanAttribute key="M2_NON_RECURSIVE" value="false"/>
6-
<booleanAttribute key="M2_OFFLINE" value="false"/>
7-
<stringAttribute key="M2_PROFILES" value=""/>
8-
<listAttribute key="M2_PROPERTIES">
9-
<listEntry value="target=dev"/>
10-
<listEntry value="persistenceTarget=mysql"/>
11-
</listAttribute>
12-
<stringAttribute key="M2_RUNTIME" value="C:\opt\maven\apache-maven-3.0.4"/>
13-
<booleanAttribute key="M2_SKIP_TESTS" value="true"/>
14-
<booleanAttribute key="M2_UPDATE_SNAPSHOTS" value="false"/>
15-
<booleanAttribute key="M2_WORKSPACE_RESOLUTION" value="false"/>
16-
<stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="${workspace_loc:/rest}"/>
17-
</launchConfiguration>
1+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2+
<launchConfiguration type="org.eclipse.m2e.Maven2LaunchConfigurationType">
3+
<booleanAttribute key="M2_DEBUG_OUTPUT" value="false"/>
4+
<stringAttribute key="M2_GOALS" value="clean install"/>
5+
<booleanAttribute key="M2_NON_RECURSIVE" value="false"/>
6+
<booleanAttribute key="M2_OFFLINE" value="false"/>
7+
<stringAttribute key="M2_PROFILES" value=""/>
8+
<listAttribute key="M2_PROPERTIES">
9+
<listEntry value="target=dev"/>
10+
<listEntry value="persistenceTarget=test"/>
11+
</listAttribute>
12+
<stringAttribute key="M2_RUNTIME" value="/opt/maven/instances/apache-maven-3.0.4"/>
13+
<booleanAttribute key="M2_SKIP_TESTS" value="false"/>
14+
<booleanAttribute key="M2_UPDATE_SNAPSHOTS" value="false"/>
15+
<booleanAttribute key="M2_WORKSPACE_RESOLUTION" value="false"/>
16+
<stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="${workspace_loc:/rest}"/>
17+
</launchConfiguration>

‎eclipse/GENERATE_ADT_STUFF.launch‎

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2-
<launchConfiguration type="org.eclipse.m2e.Maven2LaunchConfigurationType">
3-
<booleanAttribute key="M2_DEBUG_OUTPUT" value="false"/>
4-
<stringAttribute key="M2_GOALS" value="generate-sources"/>
5-
<booleanAttribute key="M2_NON_RECURSIVE" value="false"/>
6-
<booleanAttribute key="M2_OFFLINE" value="false"/>
7-
<stringAttribute key="M2_PROFILES" value=""/>
8-
<listAttribute key="M2_PROPERTIES">
9-
<listEntry value="target=dev"/>
10-
<listEntry value="persistenceTarget=mysql"/>
11-
</listAttribute>
12-
<stringAttribute key="M2_RUNTIME" value="C:\opt\maven\apache-maven-3.0.4"/>
13-
<booleanAttribute key="M2_SKIP_TESTS" value="true"/>
14-
<booleanAttribute key="M2_UPDATE_SNAPSHOTS" value="false"/>
15-
<booleanAttribute key="M2_WORKSPACE_RESOLUTION" value="false"/>
16-
<stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="${workspace_loc:/rest}"/>
17-
</launchConfiguration>
1+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2+
<launchConfiguration type="org.eclipse.m2e.Maven2LaunchConfigurationType">
3+
<booleanAttribute key="M2_DEBUG_OUTPUT" value="false"/>
4+
<stringAttribute key="M2_GOALS" value="generate-sources"/>
5+
<booleanAttribute key="M2_NON_RECURSIVE" value="false"/>
6+
<booleanAttribute key="M2_OFFLINE" value="false"/>
7+
<stringAttribute key="M2_PROFILES" value=""/>
8+
<listAttribute key="M2_PROPERTIES">
9+
<listEntry value="target=dev"/>
10+
<listEntry value="persistenceTarget=oracle"/>
11+
</listAttribute>
12+
<stringAttribute key="M2_RUNTIME" value="/opt/maven/instances/apache-maven-3.0.4"/>
13+
<booleanAttribute key="M2_SKIP_TESTS" value="true"/>
14+
<booleanAttribute key="M2_UPDATE_SNAPSHOTS" value="false"/>
15+
<booleanAttribute key="M2_WORKSPACE_RESOLUTION" value="false"/>
16+
<stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="${workspace_loc:/rest}"/>
17+
</launchConfiguration>

‎eclipse/INTEGRATION-BUILD.launch‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
<stringAttribute key="M2_PROFILES" value="integration"/>
88
<listAttribute key="M2_PROPERTIES">
99
<listEntry value="target=dev"/>
10-
<listEntry value="persistenceTarget=h2"/>
1110
</listAttribute>
1211
<stringAttribute key="M2_RUNTIME" value="/opt/maven/instances/apache-maven-3.0.4"/>
1312
<booleanAttribute key="M2_SKIP_TESTS" value="false"/>

‎eclipse/INTEGRATION-SINGLE.launch‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
22
<launchConfiguration type="org.eclipse.jdt.junit.launchconfig">
33
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
4-
<listEntry value="/rest/src/test/java/org/rest/sec/util/ConstructQueryStringUnitTest.java"/>
4+
<listEntry value="/rest/src/test/java/org/rest/test/suite/SpringIntegrationTest.java"/>
55
</listAttribute>
66
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
77
<listEntry value="1"/>
@@ -15,7 +15,7 @@
1515
<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
1616
<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
1717
<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="org.eclipse.m2e.launchconfig.classpathProvider"/>
18-
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.rest.sec.util.ConstructQueryStringUnitTest"/>
18+
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.rest.test.suite.SpringIntegrationTest"/>
1919
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="rest"/>
2020
<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.m2e.launchconfig.sourcepathProvider"/>
2121
</launchConfiguration>

‎eclipse/RUN.launch‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2+
<launchConfiguration type="org.eclipse.m2e.Maven2LaunchConfigurationType">
3+
<booleanAttribute key="M2_DEBUG_OUTPUT" value="false"/>
4+
<stringAttribute key="M2_GOALS" value="cargo:run"/>
5+
<booleanAttribute key="M2_NON_RECURSIVE" value="false"/>
6+
<booleanAttribute key="M2_OFFLINE" value="false"/>
7+
<stringAttribute key="M2_PROFILES" value=""/>
8+
<listAttribute key="M2_PROPERTIES">
9+
<listEntry value="target=dev"/>
10+
</listAttribute>
11+
<stringAttribute key="M2_RUNTIME" value="/opt/maven/instances/apache-maven-3.0.4"/>
12+
<booleanAttribute key="M2_SKIP_TESTS" value="false"/>
13+
<booleanAttribute key="M2_UPDATE_SNAPSHOTS" value="false"/>
14+
<booleanAttribute key="M2_WORKSPACE_RESOLUTION" value="false"/>
15+
<stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="${workspace_loc:/rest}"/>
16+
</launchConfiguration>

‎pom.xml‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,9 @@
311311
<container>
312312
<containerId>jetty7x</containerId>
313313
<type>embedded</type>
314+
<systemProperties>
315+
<persistenceTarget>cargo</persistenceTarget>
316+
</systemProperties>
314317
</container>
315318
<configuration>
316319
<properties>
@@ -554,7 +557,7 @@
554557
<enabled>true</enabled>
555558
</snapshots>
556559
</repository>
557-
560+
558561
<repository>
559562
<id>apache-snapshot</id>
560563
<name>Apache Maven Snapshot Repository</name>

‎src/main/resources/contextConfig.xml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
<context:property-placeholder
77
location="
8-
classpath*:*persistence-${persistenceTarget}.properties,
8+
classpath*:*persistence-${persistenceTarget:h2}.properties,
99
classpath*:*env-${target}.properties,
1010
classpath*:*web-${target}.properties" />
1111

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Connection information
2+
jdbc.driverClassName=org.h2.Driver
3+
jdbc.url=jdbc:h2:mem:rest_cargo_01;DB_CLOSE_DELAY=-1
4+
5+
6+
# hibernate.X
7+
hibernate.dialect=org.hibernate.dialect.H2Dialect
8+
hibernate.show_sql=false
9+
hibernate.hbm2ddl.auto=create-drop
10+
11+
# persistence.X
12+
jpa.generateDdl=true

src/test/java/org/rest/persistence/AbstractServiceSearchPersistenceIntegrationTest.java renamed to src/test/java/org/rest/persistence/AbstractSearchPersistenceIntegrationTest.java

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -17,40 +17,40 @@
1717
import org.rest.util.IDUtils;
1818

1919
@SuppressWarnings( "unchecked" )
20-
public abstract class AbstractServiceSearchPersistenceIntegrationTest< T extends INameableEntity >{
20+
public abstract class AbstractSearchPersistenceIntegrationTest< T extends INameableEntity >{
2121

2222
// search/filter
2323

2424
@Test
2525
public final void whenSearchByNameIsPerformed_thenNoExceptions(){
26-
final T existingEntity = getService().create( createNewEntity() );
26+
final T existingEntity = getAPI().create( createNewEntity() );
2727

2828
// When
2929
final ImmutableTriple< String, ClientOperation, String > nameConstraint = new ImmutableTriple< String, ClientOperation, String >( NAME, ClientOperation.EQ, existingEntity.getName() );
30-
getService().search( nameConstraint );
30+
getAPI().search( nameConstraint );
3131
}
3232

3333
// search - by id
3434

3535
@Test
3636
public final void givenEntityWithIdExists_whenSearchByIdIsPerformed_thenResultIsFound(){
37-
final T existingEntity = getService().create( createNewEntity() );
37+
final T existingEntity = getAPI().create( createNewEntity() );
3838

3939
// When
4040
final ImmutableTriple< String, ClientOperation, Long > idConstraint = new ImmutableTriple< String, ClientOperation, Long >( ID, ClientOperation.EQ, existingEntity.getId() );
41-
final List< T > searchResults = getService().search( idConstraint );
41+
final List< T > searchResults = getAPI().search( idConstraint );
4242

4343
// Then
4444
assertThat( searchResults, hasItem( existingEntity ) );
4545
}
4646

4747
@Test
4848
public final void givenEntityWithIdDoesNotExist_whenSearchByIdIsPerformed_thenResultIsNotFound(){
49-
final T existingEntity = getService().create( createNewEntity() );
49+
final T existingEntity = getAPI().create( createNewEntity() );
5050

5151
// When
5252
final ImmutableTriple< String, ClientOperation, Long > idConstraint = new ImmutableTriple< String, ClientOperation, Long >( ID, ClientOperation.EQ, IDUtils.randomPositiveLong() );
53-
final List< T > searchResults = getService().search( idConstraint );
53+
final List< T > searchResults = getAPI().search( idConstraint );
5454

5555
// Then
5656
assertThat( searchResults, not( hasItem( existingEntity ) ) );
@@ -60,36 +60,36 @@ public final void givenEntityWithIdDoesNotExist_whenSearchByIdIsPerformed_thenRe
6060

6161
@Test
6262
public final void givenEntityWithNameExists_whenSearchByNameIsPerformed_thenResultIsFound(){
63-
final T existingEntity = getService().create( createNewEntity() );
63+
final T existingEntity = getAPI().create( createNewEntity() );
6464

6565
// When
6666
final ImmutableTriple< String, ClientOperation, String > nameConstraint = new ImmutableTriple< String, ClientOperation, String >( NAME, ClientOperation.EQ, existingEntity.getName() );
67-
final List< T > searchResults = getService().search( nameConstraint );
67+
final List< T > searchResults = getAPI().search( nameConstraint );
6868

6969
// Then
7070
assertThat( searchResults, hasItem( existingEntity ) );
7171
}
7272

7373
@Test
7474
public final void givenEntityWithNameDoesNotExist_whenSearchByNameIsPerformed_thenResultIsNotFound(){
75-
final T existingEntity = getService().create( createNewEntity() );
75+
final T existingEntity = getAPI().create( createNewEntity() );
7676

7777
// When
7878
final ImmutableTriple< String, ClientOperation, String > nameConstraint = new ImmutableTriple< String, ClientOperation, String >( NAME, ClientOperation.EQ, randomAlphabetic( 8 ) );
79-
final List< T > searchResults = getService().search( nameConstraint );
79+
final List< T > searchResults = getAPI().search( nameConstraint );
8080

8181
// Then
8282
assertThat( searchResults, not( hasItem( existingEntity ) ) );
8383
}
8484

8585
@Test
8686
public final void givenEntitiesExists_whenSearchByNegatedNameIsPerformed_thenResultsAreCorrect(){
87-
final T existingEntity1 = getService().create( createNewEntity() );
88-
final T existingEntity2 = getService().create( createNewEntity() );
87+
final T existingEntity1 = getAPI().create( createNewEntity() );
88+
final T existingEntity2 = getAPI().create( createNewEntity() );
8989

9090
// When
9191
final ImmutableTriple< String, ClientOperation, String > nameConstraint = new ImmutableTriple< String, ClientOperation, String >( NAME, ClientOperation.EQ, existingEntity1.getName() );
92-
final List< T > searchResults = getService().search( nameConstraint );
92+
final List< T > searchResults = getAPI().search( nameConstraint );
9393

9494
// Then
9595
assertThat( searchResults, hasItem( existingEntity1 ) );
@@ -100,38 +100,38 @@ public final void givenEntitiesExists_whenSearchByNegatedNameIsPerformed_thenRes
100100

101101
@Test
102102
public final void givenEntityExists_whenSearchIsPerformedByIdAndName_thenResultIsFound(){
103-
final T existingEntity = getService().create( createNewEntity() );
103+
final T existingEntity = getAPI().create( createNewEntity() );
104104

105105
// When
106106
final ImmutableTriple< String, ClientOperation, String > nameConstraint = new ImmutableTriple< String, ClientOperation, String >( NAME, ClientOperation.EQ, existingEntity.getName() );
107107
final ImmutableTriple< String, ClientOperation, Long > idConstraint = new ImmutableTriple< String, ClientOperation, Long >( ID, ClientOperation.EQ, existingEntity.getId() );
108-
final List< T > searchResults = getService().search( nameConstraint, idConstraint );
108+
final List< T > searchResults = getAPI().search( nameConstraint, idConstraint );
109109

110110
// Then
111111
assertThat( searchResults, hasItem( existingEntity ) );
112112
}
113113

114114
@Test
115115
public final void givenEntityExists_whenSearchIsPerformedByIncorrectIdAndCorrectName_thenResultIsNotFound(){
116-
final T existingEntity = getService().create( createNewEntity() );
116+
final T existingEntity = getAPI().create( createNewEntity() );
117117

118118
// When
119119
final ImmutableTriple< String, ClientOperation, String > nameConstraint = new ImmutableTriple< String, ClientOperation, String >( NAME, ClientOperation.EQ, existingEntity.getName() );
120120
final ImmutableTriple< String, ClientOperation, Long > idConstraint = new ImmutableTriple< String, ClientOperation, Long >( ID, ClientOperation.EQ, IDUtils.randomPositiveLong() );
121-
final List< T > searchResults = getService().search( nameConstraint, idConstraint );
121+
final List< T > searchResults = getAPI().search( nameConstraint, idConstraint );
122122

123123
// Then
124124
assertThat( searchResults, not( hasItem( existingEntity ) ) );
125125
}
126126

127127
@Test
128128
public final void givenEntityExists_whenSearchIsPerformedByCorrectIdAndIncorrectName_thenResultIsNotFound(){
129-
final T existingEntity = getService().create( createNewEntity() );
129+
final T existingEntity = getAPI().create( createNewEntity() );
130130

131131
// When
132132
final ImmutableTriple< String, ClientOperation, String > nameConstraint = new ImmutableTriple< String, ClientOperation, String >( NAME, ClientOperation.EQ, randomAlphabetic( 8 ) );
133133
final ImmutableTriple< String, ClientOperation, Long > idConstraint = new ImmutableTriple< String, ClientOperation, Long >( ID, ClientOperation.EQ, existingEntity.getId() );
134-
final List< T > searchResults = getService().search( nameConstraint, idConstraint );
134+
final List< T > searchResults = getAPI().search( nameConstraint, idConstraint );
135135

136136
// Then
137137
assertThat( searchResults, not( hasItem( existingEntity ) ) );
@@ -141,12 +141,12 @@ public final void givenEntityExists_whenSearchIsPerformedByCorrectIdAndIncorrect
141141

142142
@Test
143143
public final void whenSearchByNegatedNameIsPerformed_thenResultsAreFound(){
144-
final T existingEntity1 = getService().create( createNewEntity() );
145-
final T existingEntity2 = getService().create( createNewEntity() );
144+
final T existingEntity1 = getAPI().create( createNewEntity() );
145+
final T existingEntity2 = getAPI().create( createNewEntity() );
146146

147147
// When
148148
final ImmutableTriple< String, ClientOperation, String > nameConstraint = new ImmutableTriple< String, ClientOperation, String >( NAME, ClientOperation.NEG_EQ, existingEntity1.getName() );
149-
final List< T > searchResults = getService().search( nameConstraint );
149+
final List< T > searchResults = getAPI().search( nameConstraint );
150150

151151
// Then
152152
assertThat( searchResults, not( hasItem( existingEntity1 ) ) );
@@ -155,12 +155,12 @@ public final void whenSearchByNegatedNameIsPerformed_thenResultsAreFound(){
155155

156156
@Test
157157
public final void whenSearchByNegatedIdIsPerformed_thenResultsAreFound(){
158-
final T existingEntity1 = getService().create( createNewEntity() );
159-
final T existingEntity2 = getService().create( createNewEntity() );
158+
final T existingEntity1 = getAPI().create( createNewEntity() );
159+
final T existingEntity2 = getAPI().create( createNewEntity() );
160160

161161
// When
162162
final ImmutableTriple< String, ClientOperation, Long > idConstraint = new ImmutableTriple< String, ClientOperation, Long >( ID, ClientOperation.NEG_EQ, existingEntity1.getId() );
163-
final List< T > searchResults = getService().search( idConstraint );
163+
final List< T > searchResults = getAPI().search( idConstraint );
164164

165165
// Then
166166
assertThat( searchResults, not( hasItem( existingEntity1 ) ) );
@@ -169,7 +169,7 @@ public final void whenSearchByNegatedIdIsPerformed_thenResultsAreFound(){
169169

170170
// template method
171171

172-
protected abstract IService< T > getService();
172+
protected abstract IService< T > getAPI();
173173

174174
protected abstract T createNewEntity();
175175

0 commit comments

Comments
 (0)