Skip to content

Commit 98cc37c

Browse files
Refactored tests
1 parent 06e8b64 commit 98cc37c

25 files changed

Lines changed: 132 additions & 105 deletions

spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/TestConfiguration.java renamed to spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/TestConfiguration.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16-
package software.xdev.spring.data.eclipse.store.integration.shared;
16+
package software.xdev.spring.data.eclipse.store.integration;
1717

1818
import static org.eclipse.store.storage.embedded.types.EmbeddedStorage.Foundation;
1919

@@ -30,13 +30,9 @@
3030

3131
import software.xdev.spring.data.eclipse.store.helper.StorageDirectoryNameProvider;
3232
import software.xdev.spring.data.eclipse.store.repository.config.EclipseStoreClientConfiguration;
33-
import software.xdev.spring.data.eclipse.store.repository.config.EnableEclipseStoreRepositories;
3433

3534

3635
@Configuration
37-
@EnableEclipseStoreRepositories(
38-
value = "software.xdev.spring.data.eclipse.store.integration.shared",
39-
clientConfigurationClass = TestConfiguration.class)
4036
public class TestConfiguration extends EclipseStoreClientConfiguration
4137
{
4238
private final String storageDirectory = StorageDirectoryNameProvider.getNewStorageDirectoryPath();

spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/IsolatedTestAnnotations.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,12 @@
2424

2525
import org.junit.jupiter.api.extension.ExtendWith;
2626
import org.springframework.test.annotation.DirtiesContext;
27-
import org.springframework.test.context.ContextConfiguration;
2827
import org.springframework.test.context.junit.jupiter.SpringExtension;
2928

3029

3130
@Retention(RetentionPolicy.RUNTIME)
3231
@Target(ElementType.TYPE)
3332
@ExtendWith(SpringExtension.class)
34-
@ContextConfiguration(classes = {IsolatedTestConfiguration.class})
3533
@DirtiesContext(classMode = BEFORE_EACH_TEST_METHOD)
3634
public @interface IsolatedTestAnnotations
3735
{

spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/IsolatedTestConfiguration.java

Lines changed: 0 additions & 65 deletions
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/**
2+
* The repositories of these tests are seperated from each other. That means that e.g. the
3+
* {@link software.xdev.spring.data.eclipse.store.integration.isolated.tests.special.types.TypesTest} can't access the
4+
* {@link software.xdev.spring.data.eclipse.store.integration.isolated.tests.keywords.MinimalRepository}.
5+
*/
6+
package software.xdev.spring.data.eclipse.store.integration.isolated;

spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/keywords/KeywordsTest.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@
1919
import org.junit.jupiter.api.Disabled;
2020
import org.junit.jupiter.api.Test;
2121
import org.springframework.beans.factory.annotation.Autowired;
22+
import org.springframework.test.context.ContextConfiguration;
2223

2324
import software.xdev.spring.data.eclipse.store.helper.TestUtil;
2425
import software.xdev.spring.data.eclipse.store.integration.isolated.IsolatedTestAnnotations;
25-
import software.xdev.spring.data.eclipse.store.integration.isolated.IsolatedTestConfiguration;
2626

2727

2828
/**
@@ -31,10 +31,11 @@
3131
* keywords</a>
3232
*/
3333
@IsolatedTestAnnotations
34+
@ContextConfiguration(classes = {KeywordsTestConfiguration.class})
3435
class KeywordsTest
3536
{
3637
@Autowired
37-
private IsolatedTestConfiguration configuration;
38+
private KeywordsTestConfiguration configuration;
3839

3940
@Test
4041
@Disabled("For now we don't need 'existsBy'")
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/*
2+
* Copyright © 2023 XDEV Software (https://xdev.software)
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package software.xdev.spring.data.eclipse.store.integration.isolated.tests.keywords;
17+
18+
import org.springframework.context.annotation.Configuration;
19+
20+
import software.xdev.spring.data.eclipse.store.integration.TestConfiguration;
21+
import software.xdev.spring.data.eclipse.store.repository.config.EnableEclipseStoreRepositories;
22+
23+
24+
@Configuration
25+
@EnableEclipseStoreRepositories(clientConfigurationClass = KeywordsTestConfiguration.class)
26+
public class KeywordsTestConfiguration extends TestConfiguration
27+
{
28+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/*
2+
* Copyright © 2023 XDEV Software (https://xdev.software)
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package software.xdev.spring.data.eclipse.store.integration.isolated.tests.special.types;
17+
18+
import org.springframework.context.annotation.Configuration;
19+
20+
import software.xdev.spring.data.eclipse.store.integration.TestConfiguration;
21+
import software.xdev.spring.data.eclipse.store.repository.config.EnableEclipseStoreRepositories;
22+
23+
24+
@Configuration
25+
@EnableEclipseStoreRepositories(clientConfigurationClass = SpecialTypesTestConfiguration.class)
26+
public class SpecialTypesTestConfiguration extends TestConfiguration
27+
{
28+
}

spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/TypesTest.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,16 @@
2626
import org.junit.jupiter.params.provider.MethodSource;
2727
import org.springframework.beans.factory.annotation.Autowired;
2828
import org.springframework.context.ApplicationContext;
29+
import org.springframework.test.context.ContextConfiguration;
2930

3031
import software.xdev.spring.data.eclipse.store.exceptions.DataTypeNotSupportedException;
3132
import software.xdev.spring.data.eclipse.store.helper.TestUtil;
3233
import software.xdev.spring.data.eclipse.store.integration.isolated.IsolatedTestAnnotations;
33-
import software.xdev.spring.data.eclipse.store.integration.isolated.IsolatedTestConfiguration;
3434
import software.xdev.spring.data.eclipse.store.repository.interfaces.EclipseStoreRepository;
3535

3636

3737
@IsolatedTestAnnotations
38+
@ContextConfiguration(classes = {SpecialTypesTestConfiguration.class})
3839
class TypesTest
3940
{
4041
public static final String TYPES_DATA_SOURCE =
@@ -45,7 +46,7 @@ class TypesTest
4546
+ ".TypesData#generateNotWorkingData";
4647

4748
@Autowired
48-
private IsolatedTestConfiguration configuration;
49+
private SpecialTypesTestConfiguration configuration;
4950

5051
@ParameterizedTest
5152
@MethodSource(TYPES_DATA_SOURCE)

spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/shared/DefaultTestAnnotations.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
@Retention(RetentionPolicy.RUNTIME)
3232
@Target(ElementType.TYPE)
3333
@ExtendWith(SpringExtension.class)
34-
@ContextConfiguration(classes = {TestConfiguration.class})
34+
@ContextConfiguration(classes = {SharedTestConfiguration.class})
3535
@DirtiesContext(classMode = BEFORE_EACH_TEST_METHOD)
3636
public @interface DefaultTestAnnotations
3737
{
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/*
2+
* Copyright © 2023 XDEV Software (https://xdev.software)
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package software.xdev.spring.data.eclipse.store.integration.shared;
17+
18+
import org.springframework.context.annotation.Configuration;
19+
20+
import software.xdev.spring.data.eclipse.store.integration.TestConfiguration;
21+
import software.xdev.spring.data.eclipse.store.repository.config.EnableEclipseStoreRepositories;
22+
23+
24+
@Configuration
25+
@EnableEclipseStoreRepositories(
26+
value = "software.xdev.spring.data.eclipse.store.integration.shared",
27+
clientConfigurationClass = SharedTestConfiguration.class)
28+
public class SharedTestConfiguration extends TestConfiguration
29+
{
30+
}

0 commit comments

Comments
 (0)