Skip to content

Commit 06e8b64

Browse files
Revert "Refactored tests"
This reverts commit 7ec280c.
1 parent 7ec280c commit 06e8b64

File tree

113 files changed

+302
-235
lines changed

Some content is hidden

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

113 files changed

+302
-235
lines changed

spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/Lazy.java renamed to spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/IsolatedTestAnnotations.java

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,24 +13,26 @@
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.repository;
16+
package software.xdev.spring.data.eclipse.store.integration.isolated;
17+
18+
import static org.springframework.test.annotation.DirtiesContext.ClassMode.BEFORE_EACH_TEST_METHOD;
1719

18-
import java.lang.annotation.Documented;
1920
import java.lang.annotation.ElementType;
2021
import java.lang.annotation.Retention;
2122
import java.lang.annotation.RetentionPolicy;
2223
import java.lang.annotation.Target;
2324

24-
import org.springframework.data.annotation.QueryAnnotation;
25+
import org.junit.jupiter.api.extension.ExtendWith;
26+
import org.springframework.test.annotation.DirtiesContext;
27+
import org.springframework.test.context.ContextConfiguration;
28+
import org.springframework.test.context.junit.jupiter.SpringExtension;
2529

2630

27-
/**
28-
* TODO
29-
*/
3031
@Retention(RetentionPolicy.RUNTIME)
31-
@Target({ElementType.FIELD, ElementType.ANNOTATION_TYPE})
32-
@Documented
33-
@QueryAnnotation
34-
public @interface Lazy
32+
@Target(ElementType.TYPE)
33+
@ExtendWith(SpringExtension.class)
34+
@ContextConfiguration(classes = {IsolatedTestConfiguration.class})
35+
@DirtiesContext(classMode = BEFORE_EACH_TEST_METHOD)
36+
public @interface IsolatedTestAnnotations
3537
{
3638
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
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;
17+
18+
import static org.eclipse.store.storage.embedded.types.EmbeddedStorage.Foundation;
19+
20+
import java.io.IOException;
21+
import java.nio.file.Path;
22+
23+
import org.eclipse.store.storage.embedded.types.EmbeddedStorageFoundation;
24+
import org.eclipse.store.storage.types.Storage;
25+
import org.springframework.context.annotation.Configuration;
26+
import org.springframework.context.event.ContextClosedEvent;
27+
import org.springframework.context.event.ContextRefreshedEvent;
28+
import org.springframework.context.event.EventListener;
29+
import org.springframework.util.FileSystemUtils;
30+
31+
import software.xdev.spring.data.eclipse.store.helper.StorageDirectoryNameProvider;
32+
import software.xdev.spring.data.eclipse.store.repository.config.EclipseStoreClientConfiguration;
33+
import software.xdev.spring.data.eclipse.store.repository.config.EnableEclipseStoreRepositories;
34+
35+
36+
@Configuration
37+
@EnableEclipseStoreRepositories(
38+
value = "software.xdev.spring.data.eclipse.store.integration.isolated",
39+
clientConfigurationClass = IsolatedTestConfiguration.class)
40+
public class IsolatedTestConfiguration extends EclipseStoreClientConfiguration
41+
{
42+
private final String storageDirectory = StorageDirectoryNameProvider.getNewStorageDirectoryPath();
43+
44+
@Override
45+
public EmbeddedStorageFoundation<?> createEmbeddedStorageFoundation()
46+
{
47+
return Foundation(Storage.Configuration(Storage.FileProvider(Path.of(this.storageDirectory))));
48+
}
49+
50+
@EventListener
51+
public void handleContextRefresh(final ContextRefreshedEvent event)
52+
{
53+
// Init with empty root object
54+
this.getStorageInstance().clearData();
55+
}
56+
57+
@EventListener
58+
public void handleContextClosed(final ContextClosedEvent event) throws IOException
59+
{
60+
// End with empty root object
61+
this.getStorageInstance().clearData();
62+
this.getStorageInstance().stop();
63+
FileSystemUtils.deleteRecursively(Path.of(this.storageDirectory));
64+
}
65+
}
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,28 +13,28 @@
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.tests.keywords;
16+
package software.xdev.spring.data.eclipse.store.integration.isolated.tests.keywords;
1717

1818
import org.junit.jupiter.api.Assertions;
1919
import org.junit.jupiter.api.Disabled;
2020
import org.junit.jupiter.api.Test;
2121
import org.springframework.beans.factory.annotation.Autowired;
2222

2323
import software.xdev.spring.data.eclipse.store.helper.TestUtil;
24-
import software.xdev.spring.data.eclipse.store.integration.DefaultTestAnnotations;
25-
import software.xdev.spring.data.eclipse.store.integration.TestConfiguration;
24+
import software.xdev.spring.data.eclipse.store.integration.isolated.IsolatedTestAnnotations;
25+
import software.xdev.spring.data.eclipse.store.integration.isolated.IsolatedTestConfiguration;
2626

2727

2828
/**
2929
* These tests should show that all or most of the following keywords are available in this library: <a
3030
* href="https://docs.spring.io/spring-data/jpa/reference/repositories/query-keywords-reference.html">Repository query
3131
* keywords</a>
3232
*/
33-
@DefaultTestAnnotations
33+
@IsolatedTestAnnotations
3434
class KeywordsTest
3535
{
3636
@Autowired
37-
private TestConfiguration configuration;
37+
private IsolatedTestConfiguration configuration;
3838

3939
@Test
4040
@Disabled("For now we don't need 'existsBy'")
Lines changed: 1 addition & 1 deletion
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.tests.keywords;
16+
package software.xdev.spring.data.eclipse.store.integration.isolated.tests.keywords;
1717

1818
import jakarta.persistence.GeneratedValue;
1919
import jakarta.persistence.GenerationType;
Lines changed: 1 addition & 1 deletion
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.tests.keywords;
16+
package software.xdev.spring.data.eclipse.store.integration.isolated.tests.keywords;
1717

1818
import org.springframework.data.repository.Repository;
1919

Lines changed: 1 addition & 1 deletion
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.tests.special.types;
16+
package software.xdev.spring.data.eclipse.store.integration.isolated.tests.special.types;
1717

1818
import java.math.BigDecimal;
1919

Lines changed: 1 addition & 1 deletion
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.tests.special.types;
16+
package software.xdev.spring.data.eclipse.store.integration.isolated.tests.special.types;
1717

1818
import software.xdev.spring.data.eclipse.store.repository.interfaces.EclipseStoreRepository;
1919

Lines changed: 1 addition & 1 deletion
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.tests.special.types;
16+
package software.xdev.spring.data.eclipse.store.integration.isolated.tests.special.types;
1717

1818
import java.math.BigInteger;
1919

Lines changed: 1 addition & 1 deletion
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.tests.special.types;
16+
package software.xdev.spring.data.eclipse.store.integration.isolated.tests.special.types;
1717

1818
import software.xdev.spring.data.eclipse.store.repository.interfaces.EclipseStoreRepository;
1919

Lines changed: 1 addition & 1 deletion
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.tests.special.types;
16+
package software.xdev.spring.data.eclipse.store.integration.isolated.tests.special.types;
1717

1818
import java.util.Calendar;
1919

Lines changed: 1 addition & 1 deletion
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.tests.special.types;
16+
package software.xdev.spring.data.eclipse.store.integration.isolated.tests.special.types;
1717

1818
import software.xdev.spring.data.eclipse.store.repository.interfaces.EclipseStoreRepository;
1919

Lines changed: 1 addition & 1 deletion
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.tests.special.types;
16+
package software.xdev.spring.data.eclipse.store.integration.isolated.tests.special.types;
1717

1818
import java.util.Objects;
1919

Lines changed: 1 addition & 1 deletion
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.tests.special.types;
16+
package software.xdev.spring.data.eclipse.store.integration.isolated.tests.special.types;
1717

1818
import java.util.Date;
1919

Lines changed: 1 addition & 1 deletion
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.tests.special.types;
16+
package software.xdev.spring.data.eclipse.store.integration.isolated.tests.special.types;
1717

1818
import software.xdev.spring.data.eclipse.store.repository.interfaces.EclipseStoreRepository;
1919

Lines changed: 1 addition & 1 deletion
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.tests.special.types;
16+
package software.xdev.spring.data.eclipse.store.integration.isolated.tests.special.types;
1717

1818
import java.util.EnumMap;
1919

Lines changed: 1 addition & 1 deletion
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.tests.special.types;
16+
package software.xdev.spring.data.eclipse.store.integration.isolated.tests.special.types;
1717

1818
import software.xdev.spring.data.eclipse.store.repository.interfaces.EclipseStoreRepository;
1919

Lines changed: 1 addition & 1 deletion
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.tests.special.types;
16+
package software.xdev.spring.data.eclipse.store.integration.isolated.tests.special.types;
1717

1818
import java.util.EnumSet;
1919

Lines changed: 1 addition & 1 deletion
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.tests.special.types;
16+
package software.xdev.spring.data.eclipse.store.integration.isolated.tests.special.types;
1717

1818
import software.xdev.spring.data.eclipse.store.repository.interfaces.EclipseStoreRepository;
1919

Lines changed: 1 addition & 1 deletion
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.tests.special.types;
16+
package software.xdev.spring.data.eclipse.store.integration.isolated.tests.special.types;
1717

1818
import org.eclipse.serializer.reference.Lazy;
1919

Lines changed: 1 addition & 1 deletion
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.tests.special.types;
16+
package software.xdev.spring.data.eclipse.store.integration.isolated.tests.special.types;
1717

1818
import software.xdev.spring.data.eclipse.store.repository.interfaces.EclipseStoreRepository;
1919

Lines changed: 1 addition & 1 deletion
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.tests.special.types;
16+
package software.xdev.spring.data.eclipse.store.integration.isolated.tests.special.types;
1717

1818
import java.util.List;
1919

Lines changed: 1 addition & 1 deletion
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.tests.special.types;
16+
package software.xdev.spring.data.eclipse.store.integration.isolated.tests.special.types;
1717

1818
import software.xdev.spring.data.eclipse.store.repository.interfaces.EclipseStoreRepository;
1919

Lines changed: 1 addition & 1 deletion
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.tests.special.types;
16+
package software.xdev.spring.data.eclipse.store.integration.isolated.tests.special.types;
1717

1818
import java.time.LocalDate;
1919

Lines changed: 1 addition & 1 deletion
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.tests.special.types;
16+
package software.xdev.spring.data.eclipse.store.integration.isolated.tests.special.types;
1717

1818
import software.xdev.spring.data.eclipse.store.repository.interfaces.EclipseStoreRepository;
1919

Lines changed: 1 addition & 1 deletion
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.tests.special.types;
16+
package software.xdev.spring.data.eclipse.store.integration.isolated.tests.special.types;
1717

1818
import java.time.LocalDateTime;
1919

Lines changed: 1 addition & 1 deletion
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.tests.special.types;
16+
package software.xdev.spring.data.eclipse.store.integration.isolated.tests.special.types;
1717

1818
import software.xdev.spring.data.eclipse.store.repository.interfaces.EclipseStoreRepository;
1919

Lines changed: 1 addition & 1 deletion
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.tests.special.types;
16+
package software.xdev.spring.data.eclipse.store.integration.isolated.tests.special.types;
1717

1818
import java.time.LocalTime;
1919

Lines changed: 1 addition & 1 deletion
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.tests.special.types;
16+
package software.xdev.spring.data.eclipse.store.integration.isolated.tests.special.types;
1717

1818
import software.xdev.spring.data.eclipse.store.repository.interfaces.EclipseStoreRepository;
1919

Lines changed: 1 addition & 1 deletion
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.tests.special.types;
16+
package software.xdev.spring.data.eclipse.store.integration.isolated.tests.special.types;
1717

1818
import java.util.Map;
1919

Lines changed: 1 addition & 1 deletion
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.tests.special.types;
16+
package software.xdev.spring.data.eclipse.store.integration.isolated.tests.special.types;
1717

1818
import software.xdev.spring.data.eclipse.store.repository.interfaces.EclipseStoreRepository;
1919

Lines changed: 1 addition & 1 deletion
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.tests.special.types;
16+
package software.xdev.spring.data.eclipse.store.integration.isolated.tests.special.types;
1717

1818
import java.util.Optional;
1919

Lines changed: 1 addition & 1 deletion
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.tests.special.types;
16+
package software.xdev.spring.data.eclipse.store.integration.isolated.tests.special.types;
1717

1818
import software.xdev.spring.data.eclipse.store.repository.interfaces.EclipseStoreRepository;
1919

0 commit comments

Comments
 (0)