use of com.github.mjeanroy.junit.servers.client.impl.okhttp3.OkHttpClient in project cumulocity-lora by SoftwareAG.
the class ActilityConnector method init.
@Override
protected void init() {
HttpLoggingInterceptor interceptor = new HttpLoggingInterceptor();
interceptor.setLevel(HttpLoggingInterceptor.Level.BODY);
OkHttpClient dxClient = new OkHttpClient.Builder().addInterceptor(new DXAdminJWTInterceptor(properties.getProperty("username"), properties.getProperty("password"))).addInterceptor(interceptor).build();
String url = properties.getProperty("url");
OkHttpClient client = new OkHttpClient.Builder().addInterceptor(interceptor).build();
Retrofit core = new Retrofit.Builder().client(dxClient).baseUrl(url + "/thingpark/dx/core/latest/api/").addConverterFactory(JacksonConverterFactory.create()).build();
Retrofit admin = new Retrofit.Builder().baseUrl(url + "/iot-flow/v1/").client(client).addConverterFactory(JacksonConverterFactory.create()).build();
actilityCoreService = core.create(ActilityCoreService.class);
actilityAdminService = admin.create(ActilityAdminService.class);
}
use of com.github.mjeanroy.junit.servers.client.impl.okhttp3.OkHttpClient in project cumulocity-lora by SoftwareAG.
the class LoriotConnector method init.
@Override
protected void init() {
OkHttpClient okHttpClient = new OkHttpClient.Builder().addInterceptor(new APIKeyInterceptor()).build();
Retrofit retrofit = new Retrofit.Builder().client(okHttpClient).baseUrl(getProperties().getProperty("url")).addConverterFactory(JacksonConverterFactory.create()).build();
loriotService = retrofit.create(LoriotService.class);
}
use of com.github.mjeanroy.junit.servers.client.impl.okhttp3.OkHttpClient in project java-sdk by dapr.
the class DaprHttpClientTest method setUp.
@Before
public void setUp() {
mockInterceptor = new MockInterceptor(Behavior.UNORDERED);
okHttpClient = new OkHttpClient.Builder().addInterceptor(mockInterceptor).build();
}
use of com.github.mjeanroy.junit.servers.client.impl.okhttp3.OkHttpClient in project java-sdk by dapr.
the class DaprHttpBuilderTest method getOkHttpClient.
private static OkHttpClient getOkHttpClient(DaprHttp daprHttp) throws Exception {
Field httpClientField = DaprHttp.class.getDeclaredField("httpClient");
httpClientField.setAccessible(true);
OkHttpClient okHttpClient = (OkHttpClient) httpClientField.get(daprHttp);
assertNotNull(okHttpClient);
return okHttpClient;
}
use of com.github.mjeanroy.junit.servers.client.impl.okhttp3.OkHttpClient in project java-sdk by dapr.
the class DaprPreviewClientHttpTest method setUp.
@Before
public void setUp() {
mockInterceptor = new MockInterceptor(Behavior.UNORDERED);
okHttpClient = new OkHttpClient.Builder().addInterceptor(mockInterceptor).build();
daprHttp = new DaprHttp(Properties.SIDECAR_IP.get(), 3000, okHttpClient);
daprPreviewClientHttp = new DaprClientHttp(daprHttp);
}
Aggregations