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

Commit

Permalink
merging develop to master
Browse files Browse the repository at this point in the history
  • Loading branch information
Sarmokadam committed Feb 9, 2018
2 parents 0435123 + e02be0e commit 7a8c621
Show file tree
Hide file tree
Showing 74 changed files with 1,676 additions and 122 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,37 +2,38 @@

import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.boot.test.TestRestTemplate;
import org.springframework.boot.test.WebIntegrationTest;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
import org.springframework.web.client.RestTemplate;

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

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

@SuppressWarnings("javadoc")
@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = AsyncTestApp.class)
@WebIntegrationTest
/**
* Test class for Devonfw Async module
*
*/
@SpringBootTest(classes = AsyncTestApp.class, webEnvironment = WebEnvironment.RANDOM_PORT)
public class AsyncTest extends ComponentTest {

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

@Value("${devonfw.async.timeout.status}")
int errorCode;

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

private RestTemplate restTemplate;

@Before
public void init() {

this.restTemplate = new TestRestTemplate();
this.restTemplate = new RestTemplate();
}

@Test
Expand All @@ -49,8 +50,12 @@ public void timeoutTest() {

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

}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.capgemini.devonfw.module.composeredis.config;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand All @@ -21,7 +22,7 @@
*
*/

@Configuration
@Configuration("composeredis")
@ComponentScan(basePackages = { "com.capgemini.devonfw.module.composeredis" })
public class ModuleConfig {
private static final Logger LOG = LoggerFactory.getLogger(ModuleConfig.class);
Expand Down Expand Up @@ -103,27 +104,32 @@ public String getRedisUri() {
*/
private String getConnectionUriFromCloud(String vcapServices) {

String serviceUri = "";
JSONObject jsonObj = new JSONObject(vcapServices);
JSONArray jsonArray;

LOG.debug("jsonObj: {}", jsonObj);

if (jsonObj.has(this.serviceName)) {
jsonArray = jsonObj.getJSONArray(this.serviceName);
// Transform the JSONArray to JSONObject because JSONArray can't find by string key
jsonObj = jsonArray.toJSONObject(new JSONArray().put(this.serviceName));
jsonObj = jsonObj.getJSONObject(this.serviceName);
LOG.debug("compose-for-redis: {}", jsonObj);

if (jsonObj.has(CREDENTIALS_KEY)) {
JSONObject credentials = jsonObj.getJSONObject(CREDENTIALS_KEY);
LOG.debug("credentials: {}", credentials);
serviceUri = credentials.getString(URI_KEY);
try {
String serviceUri = "";
JSONObject jsonObj = new JSONObject(vcapServices);
JSONArray jsonArray;

LOG.debug("jsonObj: {}", jsonObj);

if (jsonObj.has(this.serviceName)) {
jsonArray = jsonObj.getJSONArray(this.serviceName);
// Transform the JSONArray to JSONObject because JSONArray can't find by string key
jsonObj = jsonArray.toJSONObject(new JSONArray().put(this.serviceName));
jsonObj = jsonObj.getJSONObject(this.serviceName);
LOG.debug("compose-for-redis: {}", jsonObj);

if (jsonObj.has(CREDENTIALS_KEY)) {
JSONObject credentials = jsonObj.getJSONObject(CREDENTIALS_KEY);
LOG.debug("credentials: {}", credentials);
serviceUri = credentials.getString(URI_KEY);
}
}
}

return serviceUri;
return serviceUri;
} catch (JSONException e) {
LOG.error(e.getMessage());
return null;
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,9 @@
import org.junit.Assume;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.boot.test.context.SpringBootTest;

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

Expand All @@ -28,8 +26,7 @@
*
* @author mestevee
*/
@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = com.capgemini.devonfw.module.composeredis.SpringBootApp.class)
@SpringBootTest(classes = com.capgemini.devonfw.module.composeredis.SpringBootApp.class)
public class LettuceManagementImplIntegrationTest extends ComponentTest {

private static final Logger LOG = LoggerFactory.getLogger(LettuceManagementImplIntegrationTest.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,13 @@
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Matchers;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.boot.test.context.SpringBootTest;

import com.lambdaworks.redis.RedisConnection;

Expand All @@ -33,8 +31,7 @@
*
* @author mestevee
*/
@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = com.capgemini.devonfw.module.composeredis.SpringBootApp.class)
@SpringBootTest(classes = com.capgemini.devonfw.module.composeredis.SpringBootApp.class)
public class LettuceManagementImplTest extends ComponentTest {

private static final Logger LOG = LoggerFactory.getLogger(LettuceManagementImplTest.class);
Expand Down
6 changes: 4 additions & 2 deletions modules/i18n/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -229,10 +229,12 @@
<version>2.10.4</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-ws</artifactId>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-ws</artifactId>
<version>1.4.7.RELEASE</version>
</dependency>


<dependency>
<groupId>com.mysema.querydsl</groupId>
<artifactId>querydsl-apt</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.security.SecurityAutoConfiguration;
import org.springframework.boot.autoconfigure.security.SecurityFilterAutoConfiguration;
import org.springframework.boot.orm.jpa.EntityScan;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;

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

//@SpringBootApplication(exclude = { SecurityAutoConfiguration.class, SecurityFilterAutoConfiguration.class })
@SpringBootApplication(exclude = { EndpointAutoConfiguration.class, SecurityAutoConfiguration.class,
SecurityFilterAutoConfiguration.class })
@EntityScan(basePackages = { "com.capgemini.devonfw.module" }, basePackageClasses = { I18nRestServiceImpl.class })
@ComponentScan(basePackages = { "com.capgemini.devonfw.module" }, basePackageClasses = { I18nRestServiceImpl.class })
@EnableGlobalMethodSecurity(jsr250Enabled = true)
public class I18nModuleApp {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import org.junit.Test;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.boot.test.context.SpringBootTest;

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

Expand All @@ -14,7 +14,7 @@
* @author kugawand
* @since 2.0.0
*/
@SpringApplicationConfiguration(classes = I18nTestApp.class)
@SpringBootTest(classes = I18nTestApp.class)
public class I18nImplTest extends ComponentTest {

@Value("${i18n.mmm.enabled}")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* Spring Boot auto-configuration for Integration module
*
*/
@Configuration
@Configuration("integration")
@EnableIntegration
@ComponentScan(basePackages = { "com.capgemini.devonfw.module.integration" })
@IntegrationComponentScan(basePackages = { "com.capgemini.devonfw.module.integration.common" })
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.test.context.TestPropertySource;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.junit4.SpringRunner;

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.test.context.TestPropertySource;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.junit4.SpringRunner;

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.test.context.TestPropertySource;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.junit4.SpringRunner;

import com.capgemini.devonfw.module.base.IntegrationTestApp;
import com.capgemini.devonfw.module.integration.common.api.Integration;
Expand All @@ -21,8 +21,8 @@
* Tests the out-of-the-box simple communication channel
*
*/
@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = IntegrationTestApp.class)
@RunWith(SpringRunner.class)
@SpringBootTest(classes = IntegrationTestApp.class)
@TestPropertySource(locations = "classpath:onedirectiontest.properties")
public class DefaultSimpleFlowTest extends ComponentTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.test.context.TestPropertySource;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.junit4.SpringRunner;

import com.capgemini.devonfw.module.base.IntegrationTestApp;
import com.capgemini.devonfw.module.integration.common.api.Integration;
Expand All @@ -24,8 +24,8 @@
* Tests the out-of-the-box simple communication channel sending also headers
*
*/
@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = IntegrationTestApp.class)
@RunWith(SpringRunner.class)
@SpringBootTest(classes = IntegrationTestApp.class)
@TestPropertySource(locations = "classpath:onedirectiontest.properties")
public class DefaultSimpleFlowWithHeadersTest extends ComponentTest {
@Inject
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,12 @@
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.test.context.TestPropertySource;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import com.capgemini.devonfw.module.base.IntegrationTestApp;
import com.capgemini.devonfw.module.integration.common.api.Integration;
Expand All @@ -32,8 +30,7 @@
* Tests the new communication channels programmatically created.
*
*/
@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = IntegrationTestApp.class)
@SpringBootTest(classes = IntegrationTestApp.class)
@TestPropertySource(locations = "classpath:integration.properties")
public class NewChannelsTest extends ComponentTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,17 @@

<dependencies>

<dependency>
<!-- <dependency>
<groupId>com.capgemini.devonfw.microservices</groupId>
<artifactId>microservices</artifactId>
<version>^devonfw.version^</version>
</dependency> -->
<!-- Changed for starter project -->
<dependency>
<artifactId>devonfw-microservices-starter</artifactId>
<groupId>com.capgemini.devonfw.starter</groupId>
<version>^devonfw.version^</version>
</dependency>

<dependency>
<groupId>io.oasp.java.modules</groupId>
<artifactId>oasp4j-batch</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion modules/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<description>Reusable modules of the Open Application Standard Platform for Java (OASP4J).</description>

<modules>
<module>foo</module>
<!-- <module>foo</module> -->
<module>reporting</module>
<module>i18n</module>
<module>winauth-ad</module>
Expand Down
Loading

0 comments on commit 7a8c621

Please sign in to comment.