org.cloudfoundry.client.lib.CloudFoundryClient Java Examples
The following examples show how to use
org.cloudfoundry.client.lib.CloudFoundryClient.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: LoggregatorSourceTests.java From spring-cloud-stream-app-starters with Apache License 2.0 | 6 votes |
@Bean public CloudFoundryClient cloudFoundryClient() { CloudFoundryClient mockClient = mock(CloudFoundryClient.class); doAnswer(new Answer<Void>() { @Override public Void answer(InvocationOnMock invocation) throws Throwable { ApplicationLogListener listener = invocation.getArgumentAt(1, ApplicationLogListener.class); listener.onMessage(new ApplicationLog("foo", "hello", new Date(1), ApplicationLog.MessageType.STDOUT, "srcN", "srcID")); listener.onComplete(); return null; } }).when(mockClient).streamLogs(eq("foo"), any(ApplicationLogListener.class)); return mockClient; }
Example #2
Source File: PreferencePage.java From XPagesExtensionLibrary with Apache License 2.0 | 6 votes |
@Override public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { String msg = StringUtil.format("Testing connection to \"{0}\"...", _server); // $NLX-PreferencePage.Testingconnectionto0-1$ monitor.beginTask(msg, IProgressMonitor.UNKNOWN); try { CloudCredentials credentials = new CloudCredentials(_userName, _password); CloudFoundryClient client = new CloudFoundryClient(credentials, URI.create(_server).toURL()); client.login(); } catch (Throwable e) { throw new InvocationTargetException(e); } if (monitor.isCanceled()) { throw new InterruptedException(); } }
Example #3
Source File: LoggregatorSourceConfiguration.java From spring-cloud-stream-app-starters with Apache License 2.0 | 5 votes |
@Bean public LoggregatorMessageSource loggregatorMessageSource( @Qualifier(Source.OUTPUT) MessageChannel source, CloudFoundryClient cloudFoundryClient) { return new LoggregatorMessageSource( this.loggregatorSourceProperties.getApplicationName(), cloudFoundryClient, source); }
Example #4
Source File: LoggregatorMessageSource.java From spring-cloud-stream-app-starters with Apache License 2.0 | 5 votes |
protected LoggregatorMessageSource( String applicationName, CloudFoundryClient cloudFoundryClient, MessageChannel out) { super(); this.applicationName = applicationName; this.cloudFoundryClient = cloudFoundryClient; setOutputChannel(out); }
Example #5
Source File: DeployJob.java From XPagesExtensionLibrary with Apache License 2.0 | 5 votes |
private static void uploadApplication(CloudFoundryClient client, String appName, File file) throws Exception { if (file.isDirectory()) { File zipFile = File.createTempFile("bluemix", ".zip"); // $NON-NLS-1$ $NON-NLS-2$ BluemixZipUtil.zipDirectory(file.getPath(), zipFile.getPath()); client.uploadApplication(appName, zipFile); zipFile.delete(); } else if (file.isFile()) { client.uploadApplication(appName, file); } }
Example #6
Source File: DeployJob.java From XPagesExtensionLibrary with Apache License 2.0 | 5 votes |
public static boolean isApplicationRunning(CloudFoundryClient client, String appName) { InstancesInfo infos = client.getApplicationInstances(appName); if (infos != null) { for (InstanceInfo info :infos.getInstances()) { if (info.getState() != InstanceState.RUNNING) { return false; } } // All instances are running return true; } // No instance info - app not running return false; }
Example #7
Source File: CloudFoundryPaasLocationLiveTest.java From SeaCloudsPlatform with Apache License 2.0 | 5 votes |
public void testClientSetUpPerLocationInstance() { cloudFoundryPaasLocation.setUpClient(); CloudFoundryClient client1 = cloudFoundryPaasLocation.getCloudFoundryClient(); cloudFoundryPaasLocation.setUpClient(); CloudFoundryClient client2 = cloudFoundryPaasLocation.getCloudFoundryClient(); assertEquals(client1, client2); }
Example #8
Source File: LoggregatorSourceTestConfiguration.java From spring-cloud-stream-app-starters with Apache License 2.0 | 4 votes |
@Bean public CloudFoundryClient cloudFoundryClient() { return mock(CloudFoundryClient.class); }
Example #9
Source File: PaasEntityCloudFoundryDriver.java From SeaCloudsPlatform with Apache License 2.0 | 4 votes |
protected CloudFoundryClient getClient(){ setUpClient(); return client; }
Example #10
Source File: CloudFoundryPaasLocation.java From SeaCloudsPlatform with Apache License 2.0 | 4 votes |
public CloudFoundryClient getCloudFoundryClient() { return client; }