Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,10 @@ This project is licensed under Apache v2.
To run the service locally, go to service/ directory

```
cd service
./start-acs-public.sh
source ./service/start-acs-public.sh
```
The ACS service requires a UAA (User Account and Authentication: https://github.com/cloudfoundry/uaa) service to manage OAuth clients and users used in conjunction with ACS.
When running ACS locally, by default the service is configured to trust the local UAA. You can modify the environment variable ACS_DEFAULT_ISSUER_ID and UAA_CHECK_HEALTH_URL to correspond to your existing UAA.
When running ACS locally, by default the service is configured to trust the local UAA. You can modify the environment variable `ACS_DEFAULT_ISSUER_ID` and `UAA_CHECK_HEALTH_URL` to correspond to your existing UAA.

### How to run UAA locally

Expand All @@ -26,14 +25,12 @@ cd uaa
git checkout releases/3.2.1
./gradlew assemble -x javadoc
./gradlew run -x javadoc --info

```

###Run ACS integration tests
### Run ACS integration tests

The public profile starts UAA and ACS, runs the tests, then stops the ACS and UAA services.

```
cd acs-integration-tests
mvn clean verify -Ppublic
source ./run-integration-tests.sh [-s <maven_settings_file>]
```
47 changes: 29 additions & 18 deletions acs-integration-tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@
<dependency>
<groupId>com.ge.predix</groupId>
<artifactId>acs-service</artifactId>
<version>4.6.6-SNAPSHOT</version>
<version>4.7.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
Expand Down Expand Up @@ -330,6 +330,7 @@
<ZAC_CLIENT_ID>${ZAC_CLIENT_ID}</ZAC_CLIENT_ID>
<ZAC_CLIENT_SECRET>${ZAC_CLIENT_SECRET}</ZAC_CLIENT_SECRET>
<ZAC_UAA_URL>${ZAC_UAA_URL}</ZAC_UAA_URL>
<ACS_UAA_URL>${ACS_UAA_URL}</ACS_UAA_URL>
<ZAC_URL>${ZAC_URL}</ZAC_URL>
<ENABLED_REDIS_HEALTH_CHECK>true</ENABLED_REDIS_HEALTH_CHECK>
<DEPLOYMENT_TYPE>${DEPLOYMENT_TYPE}</DEPLOYMENT_TYPE>
Expand Down Expand Up @@ -499,6 +500,7 @@
<ZAC_CLIENT_ID>${ZAC_CLIENT_ID}</ZAC_CLIENT_ID>
<ZAC_CLIENT_SECRET>${ZAC_CLIENT_SECRET}</ZAC_CLIENT_SECRET>
<ZAC_UAA_URL>${ZAC_UAA_URL}</ZAC_UAA_URL>
<ACS_UAA_URL>${ACS_UAA_URL}</ACS_UAA_URL>
<ZAC_URL>${ZAC_URL}</ZAC_URL>
<ENABLED_REDIS_HEALTH_CHECK>true</ENABLED_REDIS_HEALTH_CHECK>
<DEPLOYMENT_TYPE>${DEPLOYMENT_TYPE}</DEPLOYMENT_TYPE>
Expand Down Expand Up @@ -580,10 +582,10 @@
<systemPropertyVariables>
<ACS_DEFAULT_ISSUER_ID>${ACS_DEFAULT_ISSUER_ID}</ACS_DEFAULT_ISSUER_ID>
<ACS_SERVICE_ID>predix-acs</ACS_SERVICE_ID>
<ACS_URL>http://localhost:8181</ACS_URL>
<ACS_URL>${ACS_URL}</ACS_URL>
<NUREGO_API_URL>${NUREGO_API_URL}</NUREGO_API_URL>
<ZAC_UAA_URL>${ZAC_UAA_URL}</ZAC_UAA_URL>
<ZAC_URL>http://localhost:8888</ZAC_URL>
<ZAC_URL>${ZAC_URL}</ZAC_URL>
<!-- ACS zones (a.k.a tenancies) used for the tests -->
<ZONE1_NAME>${acs.zone.subdomain}</ZONE1_NAME>
<ZONE1_UAA_URL>${ZONE1_UAA_URL}</ZONE1_UAA_URL>
Expand Down Expand Up @@ -642,10 +644,10 @@
<systemPropertyVariables>
<ACS_DEFAULT_ISSUER_ID>${ACS_DEFAULT_ISSUER_ID}</ACS_DEFAULT_ISSUER_ID>
<ACS_SERVICE_ID>predix-acs</ACS_SERVICE_ID>
<ACS_URL>http://localhost:8181</ACS_URL>
<ACS_URL>${ACS_URL}</ACS_URL>
<NUREGO_API_URL>${NUREGO_API_URL}</NUREGO_API_URL>
<ZAC_UAA_URL>${ZAC_UAA_URL}</ZAC_UAA_URL>
<ZAC_URL>http://localhost:8888</ZAC_URL>
<ZAC_URL>${ZAC_URL}</ZAC_URL>
<!-- ACS zones (a.k.a tenancies) used for the tests -->
<ZONE1_NAME>${acs.zone.subdomain}</ZONE1_NAME>
<ZONE1_UAA_URL>${ZONE1_UAA_URL}</ZONE1_UAA_URL>
Expand Down Expand Up @@ -699,8 +701,12 @@
<artifactId>cargo-maven2-plugin</artifactId>
<version>1.4.19</version>
<configuration>
<skip>${maven.test.skip}</skip>
<configuration>
<home>${project.build.directory}/tomcat7x/container</home>
<properties>
<cargo.port.offset>${PORT_OFFSET}</cargo.port.offset>
</properties>
</configuration>
<container>
<containerId>tomcat7x</containerId>
Expand Down Expand Up @@ -748,7 +754,7 @@
<environmentVariables>
<SPRING_PROFILES_ACTIVE>h2,public,simple-cache</SPRING_PROFILES_ACTIVE>
<management.health.redis.enabled>false</management.health.redis.enabled>
<uaaCheckHealthUrl>http://localhost:8080/uaa/healthz</uaaCheckHealthUrl>
<uaaCheckHealthUrl>${ACS_UAA_URL}/healthz</uaaCheckHealthUrl>
<cors.xhr.allowed.headers>Origin,Accept,X-Requested-With,Content-Type,Access-Control-Request-Method, Access-Control-Request-Headers</cors.xhr.allowed.headers>
<cors.xhr.allowed.origins>^.*\.grc-apps\.svc\.ge\.com$,^.*\.predix\.io$</cors.xhr.allowed.origins>
<cors.xhr.allowed.uris>^/v2/api-docs$</cors.xhr.allowed.uris>
Expand All @@ -764,13 +770,13 @@
<parallel>false</parallel>
<!-- <argLine>-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005</argLine> -->
<systemPropertyVariables>
<ACS_URL>http://localhost:8181</ACS_URL>
<ACS_DEFAULT_ISSUER_ID>http://localhost:8080/uaa/oauth/token</ACS_DEFAULT_ISSUER_ID>
<ACS_URL>${ACS_URL}</ACS_URL>
<ACS_DEFAULT_ISSUER_ID>${ACS_UAA_URL}/oauth/token</ACS_DEFAULT_ISSUER_ID>
<ACS_SERVICE_ID>predix-acs</ACS_SERVICE_ID>
<ZONE1_NAME>testzone1</ZONE1_NAME>
<ZONE1_UAA_URL>http://localhost:8080/uaa</ZONE1_UAA_URL>
<ZONE1_UAA_URL>${ACS_UAA_URL}</ZONE1_UAA_URL>
<ZONE2_NAME>testzone2</ZONE2_NAME>
<ZONE2_UAA_URL>http://localhost:8080/uaa</ZONE2_UAA_URL>
<ZONE2_UAA_URL>${ACS_UAA_URL}</ZONE2_UAA_URL>
<ZONE3_NAME>testzone3</ZONE3_NAME>
</systemPropertyVariables>
<suiteXmlFiles>
Expand Down Expand Up @@ -806,8 +812,12 @@
<artifactId>cargo-maven2-plugin</artifactId>
<version>1.4.19</version>
<configuration>
<skip>${maven.test.skip}</skip>
<configuration>
<home>${project.build.directory}/tomcat7x/container</home>
<properties>
<cargo.port.offset>${PORT_OFFSET}</cargo.port.offset>
</properties>
</configuration>
<container>
<containerId>tomcat7x</containerId>
Expand Down Expand Up @@ -855,7 +865,7 @@
<environmentVariables>
<SPRING_PROFILES_ACTIVE>h2,public,simple-cache,titan</SPRING_PROFILES_ACTIVE>
<management.health.redis.enabled>false</management.health.redis.enabled>
<uaaCheckHealthUrl>http://localhost:8080/uaa/healthz</uaaCheckHealthUrl>
<uaaCheckHealthUrl>${ACS_UAA_URL}/healthz</uaaCheckHealthUrl>
<cors.xhr.allowed.headers>Origin,Accept,X-Requested-With,Content-Type,Access-Control-Request-Method, Access-Control-Request-Headers</cors.xhr.allowed.headers>
<cors.xhr.allowed.origins>^.*\.grc-apps\.svc\.ge\.com$,^.*\.predix\.io$</cors.xhr.allowed.origins>
<cors.xhr.allowed.uris>^/v2/api-docs$</cors.xhr.allowed.uris>
Expand All @@ -869,13 +879,13 @@
<parallel>false</parallel>
<skipTests>false</skipTests>
<systemPropertyVariables>
<ACS_URL>http://localhost:8181</ACS_URL>
<ACS_DEFAULT_ISSUER_ID>http://localhost:8080/uaa/oauth/token</ACS_DEFAULT_ISSUER_ID>
<ACS_URL>${ACS_URL}</ACS_URL>
<ACS_DEFAULT_ISSUER_ID>${ACS_UAA_URL}/oauth/token</ACS_DEFAULT_ISSUER_ID>
<ACS_SERVICE_ID>predix-acs</ACS_SERVICE_ID>
<ZONE1_NAME>testzone1</ZONE1_NAME>
<ZONE1_UAA_URL>http://localhost:8080/uaa</ZONE1_UAA_URL>
<ZONE1_UAA_URL>${ACS_UAA_URL}</ZONE1_UAA_URL>
<ZONE2_NAME>testzone2</ZONE2_NAME>
<ZONE2_UAA_URL>http://localhost:8080/uaa</ZONE2_UAA_URL>
<ZONE2_UAA_URL>${ACS_UAA_URL}</ZONE2_UAA_URL>
<ZONE3_NAME>testzone3</ZONE3_NAME>
</systemPropertyVariables>
<suiteXmlFiles>
Expand Down Expand Up @@ -915,11 +925,12 @@
<systemPropertyVariables>
<ACS_DEFAULT_ISSUER_ID>https://${uaa.zone}${uaa.cf.domain}.${cf.base.domain}/oauth/token</ACS_DEFAULT_ISSUER_ID>
<ACS_SERVICE_ID>${acs.service.id}</ACS_SERVICE_ID>
<ACS_URL>https://${acs.appname}.${cf.base.domain}</ACS_URL>
<ACS_URL>${ACS_URL}</ACS_URL>
<CF_BASE_DOMAIN>${cf.base.domain}</CF_BASE_DOMAIN>
<NUREGO_API_KEY>not-used</NUREGO_API_KEY>
<NUREGO_API_URL>not-used</NUREGO_API_URL>
<ZAC_UAA_URL>https://${uaa.cf.domain}.${cf.base.domain}</ZAC_UAA_URL>
<ACS_UAA_URL>https://${uaa.cf.domain}.${cf.base.domain}</ACS_UAA_URL>
<ZAC_URL>https://${zac.cf.domain}.${cf.base.domain}</ZAC_URL>
<!-- ACS zones (a.k.a tenancies) used for the tests -->
<ZONE1_NAME>${acs.zone.subdomain}</ZONE1_NAME>
Expand All @@ -928,9 +939,9 @@
<ZONE2_UAA_URL>not-used</ZONE2_UAA_URL>
<ZONE3_NAME>${acs.zone.subdomain}3</ZONE3_NAME>
<!-- OAuth clients and users used for the tests -->
<ACS_CLIENT_ID>acs-acceptance-test</ACS_CLIENT_ID>
<ACS_CLIENT_ID>${ACS_CLIENT_ID}</ACS_CLIENT_ID>
<ACS_CLIENT_SECRET>${ACS_CLIENT_SECRET}</ACS_CLIENT_SECRET>
<ACS_TEST_USER>acs-acceptance-test-user</ACS_TEST_USER>
<ACS_TEST_USER>${ACS_TEST_USER}</ACS_TEST_USER>
<ACS_TEST_USER_PWD>${ACS_TEST_USER_PWD}</ACS_TEST_USER_PWD>
<APM_CLIENT_ID>not-used</APM_CLIENT_ID>
<APM_CLIENT_SECRET>not-used</APM_CLIENT_SECRET>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
@ContextConfiguration("classpath:acceptance-test-spring-context.xml")
public class ACSAcceptanceIT extends AbstractTestNGSpringContextTests {

@Value("${acsUrl:http://localhost:8181}")
@Value("${ACS_URL}")
private String acsBaseUrl;

private String testZoneSubdomain;
Expand Down Expand Up @@ -96,7 +96,7 @@ public class ACSAcceptanceIT extends AbstractTestNGSpringContextTests {
@Value("${ZONE3_NAME:testzone3}")
private String acsZone3Name;

@Value("${UAA_URL:http://localhost:8080/uaa}")
@Value("${ACS_UAA_URL}")
private String uaaUrl;

private OAuth2RestTemplate acsAdminRestTemplate;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public class PolicyCreationStepsDefinitions {
@Value("${ZONE1_NAME:testzone1}")
private String acsZone1Name;

@Value("${UAA_URL:http://localhost:8080/uaa}")
@Value("${ACS_UAA_URL}")
private String uaaUrl;

@Autowired
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public class PolicyEvaluationStepsDefinitions extends AbstractTestNGSpringContex
@Value("${ZONE1_NAME:testzone1}")
private String acsZone1Name;

@Value("${UAA_URL:http://localhost:8080/uaa}")
@Value("${ACS_UAA_URL}")
private String uaaUrl;

@Autowired
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,13 @@
//Turning checkstyle off because the way these cucumber tests are named do not conform to the checkstyle rules.
public class ZoneEnforcementStepsDefinitions {

@Value("${UAA_URL:http://localhost:8080/uaa}")
@Value("${ACS_UAA_URL}")
private String uaaUrl;

@Value("${zone1UaaUrl:http://localhost:8080/uaa}")
@Value("${zone1UaaUrl:${ACS_UAA_URL}}")
private String zone1UaaBaseUrl;

@Value("${zone2UaaUrl:http://localhost:8080/uaa}")
@Value("${zone2UaaUrl:${ACS_UAA_URL}}")
private String zone2UaaBaseUrl;

@Value("${ZONE1_NAME:testzone1}")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public class ACSCorsFilterIT extends AbstractTestNGSpringContextTests {

private static final String SWAGGER_API = "/v2/api-docs?group=acs";

@Value("${acsUrl:http://localhost:8181}")
@Value("${ACS_URL}")
private String acsBaseUrl;

@Autowired
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public class AccessControlServiceIT extends AbstractTestNGSpringContextTests {
@Value("${ZONE3_NAME:testzone3}")
private String acsZone3Name;

@Value("${UAA_URL:http://localhost:8080/uaa}")
@Value("${ACS_UAA_URL}")
private String uaaUrl;

private String acsUrl;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@
@SuppressWarnings({ "nls" })
public class PolicyEvalCachingWithGraphDBIT extends AbstractTestNGSpringContextTests {

@Value("${ACS_URL:http://localhost:8181}")
@Value("${ACS_URL}")
private String acsUrl;

@Value("${UAA_URL:http://localhost:8080/uaa}")
@Value("${ACS_UAA_URL}")
private String uaaUrl;

private String acsZone1Name;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@ public class PolicyEvaluationCachingIT extends AbstractTestNGSpringContextTests

static final JsonUtils JSON_UTILS = new JsonUtils();

@Value("${acsUrl:http://localhost:8181}")
@Value("${ACS_URL}")
private String acsUrl;

@Value("${UAA_URL:http://localhost:8080/uaa}")
@Value("${ACS_UAA_URL}")
private String uaaUrl;

private String acsZone1Name;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
@Test
public class PrivilegeManagementAccessControlServiceIT extends AbstractTestNGSpringContextTests {

@Value("${zone1UaaUrl:http://localhost:8080/uaa}")
@Value("${zone1UaaUrl:${ACS_UAA_URL}}")
private String zone1UaaBaseUrl;

@Value("${ZONE1_NAME:testzone1}")
Expand All @@ -99,7 +99,7 @@ public class PrivilegeManagementAccessControlServiceIT extends AbstractTestNGSpr
@Autowired
private Environment env;

@Value("${UAA_URL:http://localhost:8080/uaa}")
@Value("${ACS_UAA_URL}")
private String uaaUrl;

private String acsUrl;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public class ACSRestTemplateFactory {
@Value("${zone2AdminClientSecret:zone2AdminClientSecret}")
private String zone2AdminClientSecret;

@Value("${UAA_URL:http://localhost:8080/uaa}/oauth/token")
@Value("${ACS_UAA_URL}/oauth/token")
private String uaaTokenUrl;

public OAuth2RestTemplate getACSTemplateWithPolicyScope() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public class ZoneHelper {
@Value("${ACS_CF_DOMAIN:}")
private String acsCFDomain;

@Value("${acsUrl}")
@Value("${ACS_URL}")
private String acsBaseUrl;

@Value("${ZONE1_NAME:testzone1}")
Expand All @@ -80,7 +80,7 @@ public class ZoneHelper {
@Autowired
private ACSRestTemplateFactory acsRestTemplateFactory;

@Value("${ZAC_URL:http://localhost:8888}")
@Value("${ZAC_URL}")
private String zacUrl;

@Value("${ACS_SERVICE_ID:predix-acs}")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,11 @@
* with the terms and conditions stipulated in the agreement/contract
* under which the software has been supplied.
*/
server.port = 8181
server.port = ${ACS_LOCAL_PORT}

###### Properties used by all tests in this project

acs.zone.header.name=Predix-Zone-Id
acsUrl=${ACS_URL:http://localhost:8181}

# Registered Oauth client for running acceptance test
acsClientId=${ACS_CLIENT_ID:not-used}
Expand Down Expand Up @@ -58,7 +57,7 @@ zac.url=${ZAC_URL:not-used}
zacClientId=${ZAC_CLIENT_ID:not-used}
zacClientSecret=${ZAC_CLIENT_SECRET:not-used}

zone1UaaUrl=${ZONE1_UAA_URL:http://localhost:8080/uaa}
zone2UaaUrl=${ZONE2_UAA_URL:http://localhost:8080/uaa}
zone1UaaUrl=${ZONE1_UAA_URL:${ACS_UAA_URL}}
zone2UaaUrl=${ZONE2_UAA_URL:${ACS_UAA_URL}}

spring.cloud.circuit.breaker.enabled=${ENABLE_CIRCUIT_BREAKER:true}
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
<constructor-arg>
<bean
class="org.springframework.security.oauth2.client.token.grant.client.ClientCredentialsResourceDetails">
<property name="accessTokenUri" value="${ZAC_UAA_TOKEN_URL:${ZAC_UAA_URL:http://localhost:8080/uaa}/oauth/token}" />
<property name="accessTokenUri" value="${ZAC_UAA_TOKEN_URL:${ZAC_UAA_URL}/oauth/token}" />
<property name="clientId" value="${zacClientId}" />
<property name="clientSecret" value="${zacClientSecret}" />
</bean>
Expand Down
Loading