This commit is contained in:
Stefan Saroiu 2018-03-19 12:56:42 -07:00 коммит произвёл Stefan Saroiu
Родитель 535bb5e375
Коммит 0699e60b00
1 изменённых файлов: 40 добавлений и 0 удалений

Просмотреть файл

@ -0,0 +1,40 @@
package com.microsoft.test.embeddedsocial;
import com.microsoft.embeddedsocial.autorest.BuildsOperations;
import com.microsoft.embeddedsocial.autorest.EmbeddedSocialClientImpl;
import com.microsoft.embeddedsocial.autorest.models.BuildsCurrentResponse;
/**
* Created by ssaroiu on 2/28/2018.
*
* Simple example of making a single synchronous call to ES
*/
public class SyncTest {
// State to make the asynchronous getBuildsCurrent call
private BuildsOperations buildsOperations;
// Initializes an http client, retrofit, and an ES client for autorest
public SyncTest(String ESUrl)
{
EmbeddedSocialClientImpl esClient = new EmbeddedSocialClientImpl(ESUrl);
buildsOperations = esClient.getBuildsOperations();
}
// Makes a single synchronous call to getBuildsCurrent
public void run() {
String apiVersion = "N/A";
try {
BuildsCurrentResponse buildsCurrent = buildsOperations.getBuildsCurrent().getBody();
apiVersion = buildsCurrent.getServiceApiVersion();
}
catch(Exception e)
{
System.err.println("Call to Embedded Social failed with exception: " + e.getMessage());
}
System.out.println("Synchronous call to ES completed. Returned API version: " + apiVersion);
}
}