Skip to content

Commit 3ef78ad

Browse files
Activate rest api for Eclipse Store in complexDemo
1 parent 18a48bf commit 3ef78ad

File tree

5 files changed

+36
-15
lines changed

5 files changed

+36
-15
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
# 2.4.1
2+
3+
* Updated EclipseStore to v2.1.0
4+
* Added EclipseStore-Rest-API to tests (storage-restservice-springboot)
5+
16
# 2.4.0
27

38
* Updated org.springframework.boot.version to v3.4.0
@@ -8,6 +13,7 @@
813

914
* Auto-Fix problems with adding ids to entities with existing data store.
1015

16+
~~~~
1117
# 2.3.0
1218
1319
* Add support for shutting down the storage during application shutdown

spring-data-eclipse-store-demo/src/main/java/software/xdev/spring/data/eclipse/store/demo/complex/ComplexConfiguration.java

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,12 @@
1010
import org.eclipse.store.storage.embedded.types.EmbeddedStorageFoundation;
1111
import org.eclipse.store.storage.embedded.types.EmbeddedStorageManager;
1212
import org.eclipse.store.storage.restadapter.types.StorageRestAdapter;
13-
import org.eclipse.store.storage.restservice.spring.boot.types.configuration.StoreDataRestServiceProperties;
14-
import org.eclipse.store.storage.restservice.spring.boot.types.rest.StoreDataRestController;
1513
import org.eclipse.store.storage.types.Storage;
1614
import org.springframework.beans.factory.ObjectProvider;
1715
import org.springframework.beans.factory.annotation.Autowired;
1816
import org.springframework.boot.autoconfigure.transaction.TransactionManagerCustomizers;
1917
import org.springframework.context.annotation.Bean;
18+
import org.springframework.context.annotation.ComponentScan;
2019
import org.springframework.context.annotation.Configuration;
2120
import org.springframework.context.annotation.DependsOn;
2221
import org.springframework.transaction.PlatformTransactionManager;
@@ -25,6 +24,7 @@
2524
import software.xdev.spring.data.eclipse.store.repository.config.EnableEclipseStoreRepositories;
2625

2726

27+
@ComponentScan({"org.eclipse.store.storage.restservice.spring.boot.types.rest"})
2828
@Configuration
2929
@EnableEclipseStoreRepositories
3030
public class ComplexConfiguration extends EclipseStoreClientConfiguration
@@ -59,25 +59,16 @@ public EmbeddedStorageFoundation<?> createEmbeddedStorageFoundation()
5959
storageFoundation.getConnectionFoundation().setClassLoaderProvider(this.getClassLoaderProvider());
6060
return storageFoundation;
6161
}
62-
62+
6363
@Bean
6464
@DependsOn({"embeddedStorageFoundationFactory"})
6565
public Map<String, StorageRestAdapter> storageRestAdapters(final Map<String, EmbeddedStorageManager> storages)
6666
{
6767
return Map.of(
68-
"default", StorageRestAdapter.New(this.storageInstance.getInstanceOfStorageManager())
68+
"defaultStorageManager", StorageRestAdapter.New(this.storageInstance.getInstanceOfStorageManager())
6969
);
7070
}
7171

72-
@Bean
73-
@DependsOn({"embeddedStorageFoundationFactory"})
74-
public StoreDataRestController storageDataRestController(
75-
final Map<String, StorageRestAdapter> storageRestAdapters,
76-
final StoreDataRestServiceProperties properties)
77-
{
78-
return new StoreDataRestController(storageRestAdapters, properties);
79-
}
80-
8172
/**
8273
* Overriding {@link #transactionManager(ObjectProvider)} only to add the {@link Bean}-Annotation.
8374
*/

spring-data-eclipse-store-demo/src/main/resources/application.properties

Lines changed: 0 additions & 1 deletion
This file was deleted.

spring-data-eclipse-store-demo/src/test/java/software/xdev/spring/data/eclipse/store/demo/complex/ComplexDemoApplicationTest.java

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,31 @@
11
package software.xdev.spring.data.eclipse.store.demo.complex;
22

3+
import static org.assertj.core.api.AssertionsForClassTypes.assertThat;
4+
35
import java.io.File;
46

57
import org.junit.jupiter.api.BeforeAll;
68
import org.junit.jupiter.api.Test;
79
import org.springframework.beans.factory.annotation.Autowired;
810
import org.springframework.boot.test.context.SpringBootTest;
11+
import org.springframework.boot.test.web.client.TestRestTemplate;
12+
import org.springframework.boot.test.web.server.LocalServerPort;
913

1014
import software.xdev.spring.data.eclipse.store.demo.TestUtil;
1115
import software.xdev.spring.data.eclipse.store.repository.config.EclipseStoreClientConfiguration;
1216

1317

14-
@SpringBootTest(classes = ComplexDemoApplication.class)
18+
@SpringBootTest(
19+
classes = ComplexDemoApplication.class,
20+
webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT
21+
)
1522
class ComplexDemoApplicationTest
1623
{
24+
@LocalServerPort
25+
private int port;
26+
@Autowired
27+
private TestRestTemplate restTemplate;
28+
1729
private final EclipseStoreClientConfiguration configuration;
1830

1931
@Autowired
@@ -34,4 +46,15 @@ void checkPossibilityToSimplyStartAndRestartApplication()
3446
this.configuration.getStorageInstance().stop();
3547
ComplexDemoApplication.main(new String[]{});
3648
}
49+
50+
@Test
51+
void restEndpoint()
52+
{
53+
assertThat(
54+
this.restTemplate.getForObject(
55+
"http://localhost:" + this.port + "/store-data/default/root",
56+
String.class
57+
)
58+
).contains("ROOT");
59+
}
3760
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
server:
2+
port: 0

0 commit comments

Comments
 (0)