Skip to content
This repository was archived by the owner on Jul 30, 2020. It is now read-only.

Commit 7a8c621

Browse files
author
Sarmokadam
committed
merging develop to master
2 parents 0435123 + e02be0e commit 7a8c621

74 files changed

Lines changed: 1676 additions & 122 deletions

File tree

Some content is hidden

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

modules/async/src/test/java/com/capgemini/devonfw/module/base/async/AsyncTest.java

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,37 +2,38 @@
22

33
import org.junit.Before;
44
import org.junit.Test;
5-
import org.junit.runner.RunWith;
65
import org.slf4j.Logger;
76
import org.slf4j.LoggerFactory;
87
import org.springframework.beans.factory.annotation.Value;
9-
import org.springframework.boot.test.SpringApplicationConfiguration;
10-
import org.springframework.boot.test.TestRestTemplate;
11-
import org.springframework.boot.test.WebIntegrationTest;
12-
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
8+
import org.springframework.boot.test.context.SpringBootTest;
9+
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
1310
import org.springframework.web.client.RestTemplate;
1411

1512
import com.capgemini.devonfw.module.base.AsyncTestApp;
1613

1714
import io.oasp.module.test.common.base.ComponentTest;
1815

19-
@SuppressWarnings("javadoc")
20-
@RunWith(SpringJUnit4ClassRunner.class)
21-
@SpringApplicationConfiguration(classes = AsyncTestApp.class)
22-
@WebIntegrationTest
16+
/**
17+
* Test class for Devonfw Async module
18+
*
19+
*/
20+
@SpringBootTest(classes = AsyncTestApp.class, webEnvironment = WebEnvironment.RANDOM_PORT)
2321
public class AsyncTest extends ComponentTest {
2422

2523
@Value("${local.server.port}")
2624
int port;
2725

26+
@Value("${devonfw.async.timeout.status}")
27+
int errorCode;
28+
2829
private static final Logger LOG = LoggerFactory.getLogger(AsyncTest.class);
2930

3031
private RestTemplate restTemplate;
3132

3233
@Before
3334
public void init() {
3435

35-
this.restTemplate = new TestRestTemplate();
36+
this.restTemplate = new RestTemplate();
3637
}
3738

3839
@Test
@@ -49,8 +50,12 @@ public void timeoutTest() {
4950

5051
String url = "http://localhost:" + this.port + "/test/timeout";
5152
LOG.info("Test Request: " + url);
52-
String response = this.restTemplate.getForObject(url, String.class);
53-
assertThat(response).isEqualTo("Timeout");
53+
try {
54+
String response = this.restTemplate.getForObject(url, String.class);
55+
} catch (Exception e) {
56+
assertThat(e.getClass()).isEqualTo(org.springframework.web.client.HttpServerErrorException.class);
57+
assertThat(Integer.parseInt(e.getMessage().split(" ")[0])).isEqualTo(this.errorCode);
58+
}
5459

5560
}
5661
}

modules/compose-redis/src/main/java/com/capgemini/devonfw/module/composeredis/config/ModuleConfig.java

Lines changed: 26 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.capgemini.devonfw.module.composeredis.config;
22

33
import org.json.JSONArray;
4+
import org.json.JSONException;
45
import org.json.JSONObject;
56
import org.slf4j.Logger;
67
import org.slf4j.LoggerFactory;
@@ -21,7 +22,7 @@
2122
*
2223
*/
2324

24-
@Configuration
25+
@Configuration("composeredis")
2526
@ComponentScan(basePackages = { "com.capgemini.devonfw.module.composeredis" })
2627
public class ModuleConfig {
2728
private static final Logger LOG = LoggerFactory.getLogger(ModuleConfig.class);
@@ -103,27 +104,32 @@ public String getRedisUri() {
103104
*/
104105
private String getConnectionUriFromCloud(String vcapServices) {
105106

106-
String serviceUri = "";
107-
JSONObject jsonObj = new JSONObject(vcapServices);
108-
JSONArray jsonArray;
109-
110-
LOG.debug("jsonObj: {}", jsonObj);
111-
112-
if (jsonObj.has(this.serviceName)) {
113-
jsonArray = jsonObj.getJSONArray(this.serviceName);
114-
// Transform the JSONArray to JSONObject because JSONArray can't find by string key
115-
jsonObj = jsonArray.toJSONObject(new JSONArray().put(this.serviceName));
116-
jsonObj = jsonObj.getJSONObject(this.serviceName);
117-
LOG.debug("compose-for-redis: {}", jsonObj);
118-
119-
if (jsonObj.has(CREDENTIALS_KEY)) {
120-
JSONObject credentials = jsonObj.getJSONObject(CREDENTIALS_KEY);
121-
LOG.debug("credentials: {}", credentials);
122-
serviceUri = credentials.getString(URI_KEY);
107+
try {
108+
String serviceUri = "";
109+
JSONObject jsonObj = new JSONObject(vcapServices);
110+
JSONArray jsonArray;
111+
112+
LOG.debug("jsonObj: {}", jsonObj);
113+
114+
if (jsonObj.has(this.serviceName)) {
115+
jsonArray = jsonObj.getJSONArray(this.serviceName);
116+
// Transform the JSONArray to JSONObject because JSONArray can't find by string key
117+
jsonObj = jsonArray.toJSONObject(new JSONArray().put(this.serviceName));
118+
jsonObj = jsonObj.getJSONObject(this.serviceName);
119+
LOG.debug("compose-for-redis: {}", jsonObj);
120+
121+
if (jsonObj.has(CREDENTIALS_KEY)) {
122+
JSONObject credentials = jsonObj.getJSONObject(CREDENTIALS_KEY);
123+
LOG.debug("credentials: {}", credentials);
124+
serviceUri = credentials.getString(URI_KEY);
125+
}
123126
}
124-
}
125127

126-
return serviceUri;
128+
return serviceUri;
129+
} catch (JSONException e) {
130+
LOG.error(e.getMessage());
131+
return null;
132+
}
127133
}
128134

129135
}

modules/compose-redis/src/test/java/com/capgemini/devonfw/module/composeredis/common/impl/LettuceManagementImplIntegrationTest.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,9 @@
1313
import org.junit.Assume;
1414
import org.junit.BeforeClass;
1515
import org.junit.Test;
16-
import org.junit.runner.RunWith;
1716
import org.slf4j.Logger;
1817
import org.slf4j.LoggerFactory;
19-
import org.springframework.boot.test.SpringApplicationConfiguration;
20-
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
18+
import org.springframework.boot.test.context.SpringBootTest;
2119

2220
import com.capgemini.devonfw.module.composeredis.common.api.LettuceManagement;
2321

@@ -28,8 +26,7 @@
2826
*
2927
* @author mestevee
3028
*/
31-
@RunWith(SpringJUnit4ClassRunner.class)
32-
@SpringApplicationConfiguration(classes = com.capgemini.devonfw.module.composeredis.SpringBootApp.class)
29+
@SpringBootTest(classes = com.capgemini.devonfw.module.composeredis.SpringBootApp.class)
3330
public class LettuceManagementImplIntegrationTest extends ComponentTest {
3431

3532
private static final Logger LOG = LoggerFactory.getLogger(LettuceManagementImplIntegrationTest.class);

modules/compose-redis/src/test/java/com/capgemini/devonfw/module/composeredis/common/impl/LettuceManagementImplTest.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,13 @@
1414
import org.junit.Before;
1515
import org.junit.BeforeClass;
1616
import org.junit.Test;
17-
import org.junit.runner.RunWith;
1817
import org.mockito.InjectMocks;
1918
import org.mockito.Matchers;
2019
import org.mockito.Mock;
2120
import org.mockito.MockitoAnnotations;
2221
import org.slf4j.Logger;
2322
import org.slf4j.LoggerFactory;
24-
import org.springframework.boot.test.SpringApplicationConfiguration;
25-
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
23+
import org.springframework.boot.test.context.SpringBootTest;
2624

2725
import com.lambdaworks.redis.RedisConnection;
2826

@@ -33,8 +31,7 @@
3331
*
3432
* @author mestevee
3533
*/
36-
@RunWith(SpringJUnit4ClassRunner.class)
37-
@SpringApplicationConfiguration(classes = com.capgemini.devonfw.module.composeredis.SpringBootApp.class)
34+
@SpringBootTest(classes = com.capgemini.devonfw.module.composeredis.SpringBootApp.class)
3835
public class LettuceManagementImplTest extends ComponentTest {
3936

4037
private static final Logger LOG = LoggerFactory.getLogger(LettuceManagementImplTest.class);

modules/i18n/pom.xml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,10 +229,12 @@
229229
<version>2.10.4</version>
230230
</dependency>
231231
<dependency>
232-
<groupId>org.springframework.boot</groupId>
233-
<artifactId>spring-boot-starter-ws</artifactId>
232+
<groupId>org.springframework.boot</groupId>
233+
<artifactId>spring-boot-starter-ws</artifactId>
234+
<version>1.4.7.RELEASE</version>
234235
</dependency>
235236

237+
236238
<dependency>
237239
<groupId>com.mysema.querydsl</groupId>
238240
<artifactId>querydsl-apt</artifactId>

modules/i18n/src/main/java/com/capgemini/devonfw/module/i18n/common/I18nModuleApp.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@
55
import org.springframework.boot.autoconfigure.SpringBootApplication;
66
import org.springframework.boot.autoconfigure.security.SecurityAutoConfiguration;
77
import org.springframework.boot.autoconfigure.security.SecurityFilterAutoConfiguration;
8-
import org.springframework.boot.orm.jpa.EntityScan;
8+
import org.springframework.context.annotation.ComponentScan;
99
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
1010

1111
import com.capgemini.devonfw.module.i18n.service.impl.rest.I18nRestServiceImpl;
1212

1313
//@SpringBootApplication(exclude = { SecurityAutoConfiguration.class, SecurityFilterAutoConfiguration.class })
1414
@SpringBootApplication(exclude = { EndpointAutoConfiguration.class, SecurityAutoConfiguration.class,
1515
SecurityFilterAutoConfiguration.class })
16-
@EntityScan(basePackages = { "com.capgemini.devonfw.module" }, basePackageClasses = { I18nRestServiceImpl.class })
16+
@ComponentScan(basePackages = { "com.capgemini.devonfw.module" }, basePackageClasses = { I18nRestServiceImpl.class })
1717
@EnableGlobalMethodSecurity(jsr250Enabled = true)
1818
public class I18nModuleApp {
1919

modules/i18n/src/test/java/com/capgemini/devonfw/module/i18n/logic/impl/I18nImplTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import org.junit.Test;
44
import org.springframework.beans.factory.annotation.Value;
5-
import org.springframework.boot.test.SpringApplicationConfiguration;
5+
import org.springframework.boot.test.context.SpringBootTest;
66

77
import com.capgemini.devonfw.module.i18n.common.I18nTestApp;
88

@@ -14,7 +14,7 @@
1414
* @author kugawand
1515
* @since 2.0.0
1616
*/
17-
@SpringApplicationConfiguration(classes = I18nTestApp.class)
17+
@SpringBootTest(classes = I18nTestApp.class)
1818
public class I18nImplTest extends ComponentTest {
1919

2020
@Value("${i18n.mmm.enabled}")

modules/integration/src/main/java/com/capgemini/devonfw/module/integration/configuration/ModuleConfig.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* Spring Boot auto-configuration for Integration module
1010
*
1111
*/
12-
@Configuration
12+
@Configuration("integration")
1313
@EnableIntegration
1414
@ComponentScan(basePackages = { "com.capgemini.devonfw.module.integration" })
1515
@IntegrationComponentScan(basePackages = { "com.capgemini.devonfw.module.integration.common" })

modules/integration/src/test/java/com/capgemini/devonfw/module/base/integration/DefaultAsyncFlowTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@
1111
import org.slf4j.LoggerFactory;
1212
import org.springframework.beans.factory.annotation.Autowired;
1313
import org.springframework.beans.factory.annotation.Qualifier;
14-
import org.springframework.boot.test.SpringApplicationConfiguration;
14+
import org.springframework.boot.test.context.SpringBootTest;
1515
import org.springframework.context.ConfigurableApplicationContext;
1616
import org.springframework.test.context.TestPropertySource;
17-
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
17+
import org.springframework.test.context.junit4.SpringRunner;
1818

1919
import com.capgemini.devonfw.module.base.IntegrationTestApp;
2020
import com.capgemini.devonfw.module.integration.common.api.Integration;
@@ -26,8 +26,8 @@
2626
* Tests the out-of-the-box asynchronous request-reply communication channel
2727
*
2828
*/
29-
@RunWith(SpringJUnit4ClassRunner.class)
30-
@SpringApplicationConfiguration(classes = IntegrationTestApp.class)
29+
@RunWith(SpringRunner.class)
30+
@SpringBootTest(classes = IntegrationTestApp.class)
3131
@TestPropertySource(locations = "classpath:asynctest.properties")
3232
public class DefaultAsyncFlowTest extends ComponentTest {
3333

modules/integration/src/test/java/com/capgemini/devonfw/module/base/integration/DefaultRequestReplyFlowTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010
import org.junit.Test;
1111
import org.junit.runner.RunWith;
1212
import org.springframework.beans.factory.annotation.Autowired;
13-
import org.springframework.boot.test.SpringApplicationConfiguration;
13+
import org.springframework.boot.test.context.SpringBootTest;
1414
import org.springframework.context.ConfigurableApplicationContext;
1515
import org.springframework.test.context.TestPropertySource;
16-
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
16+
import org.springframework.test.context.junit4.SpringRunner;
1717

1818
import com.capgemini.devonfw.module.base.IntegrationTestApp;
1919
import com.capgemini.devonfw.module.integration.common.api.Integration;
@@ -25,8 +25,8 @@
2525
* Tests the out-of-the-box request-reply communication channel
2626
*
2727
*/
28-
@RunWith(SpringJUnit4ClassRunner.class)
29-
@SpringApplicationConfiguration(classes = IntegrationTestApp.class)
28+
@RunWith(SpringRunner.class)
29+
@SpringBootTest(classes = IntegrationTestApp.class)
3030
@TestPropertySource(locations = "classpath:requestreplytest.properties")
3131
public class DefaultRequestReplyFlowTest extends ComponentTest {
3232

0 commit comments

Comments
 (0)