@@ -207,7 +207,7 @@ public void setUp() throws Exception {
207
207
connectedClient = new CloudFoundryClient (new CloudCredentials (CCNG_USER_EMAIL , CCNG_USER_PASS ),
208
208
cloudControllerUrl , CCNG_USER_ORG , CCNG_USER_SPACE , httpProxyConfiguration , CCNG_API_SSL );
209
209
connectedClient .login ();
210
- defaultDomainName = getDefaultDomain ( connectedClient .getDomains () ).getName ();
210
+ defaultDomainName = connectedClient .getDefaultDomain ( ).getName ();
211
211
212
212
// Optimization to avoid redoing the work already done is tearDown()
213
213
if (!tearDownComplete ) {
@@ -279,7 +279,7 @@ public void checkByteManrulesAndInJvmProxyAssertMechanisms() {
279
279
HttpHost proxy = new HttpHost ("127.0.0.1" , inJvmProxyPort );
280
280
commonsFactory .getHttpClient ().getParams ().setParameter (ConnRoutePNames .DEFAULT_PROXY , proxy );
281
281
restTemplate .setRequestFactory (requestFactory );
282
- restTemplate .execute (CCNG_API_URL + "/info" , HttpMethod .GET ,null , null );
282
+ restTemplate .execute (CCNG_API_URL + "/info" , HttpMethod .GET , null , null );
283
283
284
284
//then executes fines, and the jetty proxy indeed received one request
285
285
assertEquals ("expected network calls to make it through the inJvmProxy." , 1 , nbInJvmProxyRcvReqs .get ());
@@ -999,40 +999,40 @@ public void getLogs() throws Exception {
999
999
1000
1000
@ Test
1001
1001
public void streamLogs () throws Exception {
1002
- String appName = namespacedAppName ("simple_logs" );
1003
- CloudApplication app = createAndUploadAndStartSimpleSpringApp (appName );
1004
- boolean pass = getInstanceInfosWithTimeout (appName , 1 , true );
1005
- assertTrue ("Couldn't get the right application state" , pass );
1006
-
1007
- AccumulatingApplicationLogListener testListener = new AccumulatingApplicationLogListener ();
1008
- connectedClient .streamRecentLogs (appName , testListener );
1009
-
1010
- int attempt = 0 ;
1011
- do {
1012
- if (testListener .logs .size () > 0 ) {
1013
- break ;
1014
- }
1015
- Thread .sleep (1000 );
1016
- } while (attempt < 20 );
1017
- assertTrue ("Failed to see recent logs" , testListener .logs .size () > 0 );
1018
-
1019
- testListener .logs .clear ();
1020
- connectedClient .streamLogs (appName , testListener );
1021
- String appUri = "http://" + app .getUris ().get (0 );
1022
- RestTemplate appTemplate = new RestTemplate ();
1023
- attempt = 0 ;
1024
- do {
1025
- // no need to sleep, visiting the app uri should be sufficient
1026
- try {
1027
- appTemplate .getForObject (appUri , String .class );
1028
- } catch (HttpClientErrorException ex ) {
1029
- // ignore
1030
- }
1031
- if (testListener .logs .size () > 0 ) {
1032
- break ;
1033
- }
1034
- } while (attempt < 20 );
1035
- assertTrue ("Failed to stream normal log" , testListener .logs .size () > 0 );
1002
+ String appName = namespacedAppName ("simple_logs" );
1003
+ CloudApplication app = createAndUploadAndStartSimpleSpringApp (appName );
1004
+ boolean pass = getInstanceInfosWithTimeout (appName , 1 , true );
1005
+ assertTrue ("Couldn't get the right application state" , pass );
1006
+
1007
+ AccumulatingApplicationLogListener testListener = new AccumulatingApplicationLogListener ();
1008
+ connectedClient .streamRecentLogs (appName , testListener );
1009
+
1010
+ int attempt = 0 ;
1011
+ do {
1012
+ if (testListener .logs .size () > 0 ) {
1013
+ break ;
1014
+ }
1015
+ Thread .sleep (1000 );
1016
+ } while (attempt < 20 );
1017
+ assertTrue ("Failed to see recent logs" , testListener .logs .size () > 0 );
1018
+
1019
+ testListener .logs .clear ();
1020
+ connectedClient .streamLogs (appName , testListener );
1021
+ String appUri = "http://" + app .getUris ().get (0 );
1022
+ RestTemplate appTemplate = new RestTemplate ();
1023
+ attempt = 0 ;
1024
+ do {
1025
+ // no need to sleep, visiting the app uri should be sufficient
1026
+ try {
1027
+ appTemplate .getForObject (appUri , String .class );
1028
+ } catch (HttpClientErrorException ex ) {
1029
+ // ignore
1030
+ }
1031
+ if (testListener .logs .size () > 0 ) {
1032
+ break ;
1033
+ }
1034
+ } while (attempt < 20 );
1035
+ assertTrue ("Failed to stream normal log" , testListener .logs .size () > 0 );
1036
1036
}
1037
1037
1038
1038
@ Test
@@ -1260,8 +1260,7 @@ public void bindAndUnbindService() throws IOException {
1260
1260
1261
1261
@ Test
1262
1262
public void defaultDomainFound () throws Exception {
1263
- List <CloudDomain > domains = connectedClient .getSharedDomains ();
1264
- assertNotNull (getDefaultDomain (domains ));
1263
+ assertNotNull (connectedClient .getDefaultDomain ());
1265
1264
}
1266
1265
1267
1266
@ Test
@@ -1270,7 +1269,7 @@ public void getDomains() {
1270
1269
1271
1270
List <CloudDomain > allDomains = connectedClient .getDomains ();
1272
1271
1273
- assertNotNull (getDefaultDomain ( allDomains ));
1272
+ assertNotNull (getDomainNamed ( defaultDomainName , allDomains ));
1274
1273
assertNotNull (getDomainNamed (TEST_DOMAIN , allDomains ));
1275
1274
}
1276
1275
@@ -1295,7 +1294,6 @@ private void assertDomainInList(List<CloudDomain> domains) {
1295
1294
}
1296
1295
1297
1296
private void assertDomainNotInList (List <CloudDomain > domains ) {
1298
- assertTrue (domains .size () >= 1 );
1299
1297
assertNull (getDomainNamed (TEST_DOMAIN , domains ));
1300
1298
}
1301
1299
@@ -1351,7 +1349,7 @@ public void appsWithRoutesAreCounted() throws IOException {
1351
1349
1352
1350
@ Test
1353
1351
public void infoAvailableWithoutLoggingIn () throws Exception {
1354
- CloudFoundryClient infoClient = new CloudFoundryClient (new URL (CCNG_API_URL ), httpProxyConfiguration );
1352
+ CloudFoundryClient infoClient = new CloudFoundryClient (new URL (CCNG_API_URL ), httpProxyConfiguration , CCNG_API_SSL );
1355
1353
CloudInfo info = infoClient .getCloudInfo ();
1356
1354
assertNotNull (info .getName ());
1357
1355
assertNotNull (info .getSupport ());
@@ -1811,15 +1809,6 @@ private CloudDomain getDomainNamed(String domainName, List<CloudDomain> domains)
1811
1809
return null ;
1812
1810
}
1813
1811
1814
- private CloudDomain getDefaultDomain (List <CloudDomain > domains ) {
1815
- for (CloudDomain domain : domains ) {
1816
- if (domain .getOwner ().getName ().equals ("none" )) {
1817
- return domain ;
1818
- }
1819
- }
1820
- return null ;
1821
- }
1822
-
1823
1812
private String computeAppUrl (String appName ) {
1824
1813
return appName + "." + defaultDomainName ;
1825
1814
}
@@ -1865,18 +1854,18 @@ public boolean onProgress(String status) {
1865
1854
}
1866
1855
1867
1856
private class AccumulatingApplicationLogListener implements ApplicationLogListener {
1868
- private List <ApplicationLog > logs = new ArrayList <ApplicationLog >();
1869
-
1870
- public void onMessage (ApplicationLog log ) {
1871
- logs .add (log );
1872
- }
1873
-
1874
- public void onError (Throwable exception ) {
1875
- fail (exception .getMessage ());
1876
- }
1877
-
1878
- public void onComplete () {
1879
- }
1880
-
1857
+ private List <ApplicationLog > logs = new ArrayList <ApplicationLog >();
1858
+
1859
+ public void onMessage (ApplicationLog log ) {
1860
+ logs .add (log );
1861
+ }
1862
+
1863
+ public void onError (Throwable exception ) {
1864
+ fail (exception .getMessage ());
1865
+ }
1866
+
1867
+ public void onComplete () {
1868
+ }
1869
+
1881
1870
}
1882
1871
}
0 commit comments