Added checkstyle

This commit is contained in:
Marcin Grzejszczak
2019-02-05 15:21:41 +01:00
parent 7867256b90
commit 004e83b1e8
45 changed files with 848 additions and 620 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2013-2015 the original author or authors.
* Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,6 +18,7 @@ package org.springframework.cloud.cloudfoundry.sample;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@@ -26,22 +27,19 @@ import org.springframework.cloud.cloudfoundry.discovery.EnableCloudFoundryClient
import org.springframework.context.annotation.Bean;
/**
* This example uses the Spring Cloud {@code DiscoveryClient} abstraction to list all services
* available to the application. It should deployed to a Cloud Foundry organization and space that
* has other applications deployed to it.
* This example uses the Spring Cloud {@code DiscoveryClient} abstraction to list all
* services available to the application. It should deployed to a Cloud Foundry
* organization and space that has other applications deployed to it.
*
* There is a sample file in the project root called {@code hi-service.groovy} which can be
* deployed using the {@code spring} CLI and the {@code cf} CLI that works appropriately for
* this example.
* There is a sample file in the project root called {@code hi-service.groovy} which can
* be deployed using the {@code spring} CLI and the {@code cf} CLI that works
* appropriately for this example.
*
* Either modify this application's {@code application.yml} configuration file to provide credentials
* and other information for the Cloud Foundry the app is deployed to, or set the following
* environment variables on the application (using {@code cf set-env}):
* Either modify this application's {@code application.yml} configuration file to provide
* credentials and other information for the Cloud Foundry the app is deployed to, or set
* the following environment variables on the application (using {@code cf set-env}):
*
* * {@code CF_USERNAME}
* * {@code CF_PASSWORD}
* * {@code CF_ORG}
* * {@code CF_SPACE}
* * {@code CF_USERNAME} * {@code CF_PASSWORD} * {@code CF_ORG} * {@code CF_SPACE}
*
* @author Josh Long
* @author Spencer Gibb
@@ -59,10 +57,11 @@ public class CloudFoundryApplication {
@Bean
CommandLineRunner demo(CloudFoundryDiscoveryClient discoveryClient) {
Log log = LogFactory.getLog(getClass());
return args ->
discoveryClient.getServices().forEach(svc -> {
log.info("service = " + svc);
discoveryClient.getInstances(svc).forEach(si -> log.info("\tinstance = " + si));
});
return args -> discoveryClient.getServices().forEach(svc -> {
log.info("service = " + svc);
discoveryClient.getInstances(svc)
.forEach(si -> log.info("\tinstance = " + si));
});
}
}

View File

@@ -1,9 +1,9 @@
spring:
application:
name: test-app
cloud:
cloudfoundry:
username: ${CF_USERNAME:starbuxman@gmail.com}
password: ${CF_PASSWORD:xxxx}
org: ${CF_ORG:}
space: ${CF_SPACE:}
application:
name: test-app
cloud:
cloudfoundry:
username: ${CF_USERNAME:starbuxman@gmail.com}
password: ${CF_PASSWORD:xxxx}
org: ${CF_ORG:}
space: ${CF_SPACE:}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2013-2015 the original author or authors.
* Copyright 2013-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -13,11 +13,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.cloud.cloudfoundry.sample;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;