added getTarget() to api bean
This commit is contained in:
@@ -2,6 +2,7 @@ package com.inteligr8.alfresco.acs;
|
|||||||
|
|
||||||
import javax.ws.rs.client.Client;
|
import javax.ws.rs.client.Client;
|
||||||
import javax.ws.rs.client.ClientBuilder;
|
import javax.ws.rs.client.ClientBuilder;
|
||||||
|
import javax.ws.rs.client.WebTarget;
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
@@ -26,4 +27,9 @@ public class AcsClient {
|
|||||||
return client;
|
return client;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public WebTarget getTarget() {
|
||||||
|
return this.getClient()
|
||||||
|
.target(this.config.getBaseUrl());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -38,14 +38,10 @@ public class ConnectionClientIT {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private AcsClient client;
|
private AcsClient client;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private AcsClientConfiguration config;
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
//@EnabledIf("hostExists")
|
//@EnabledIf("hostExists")
|
||||||
public void testDiscovery() {
|
public void testDiscovery() {
|
||||||
Client client = this.client.getClient();
|
WebTarget target = this.client.getTarget();
|
||||||
WebTarget target = client.target(this.config.getBaseUrl());
|
|
||||||
DiscoveryApi api = WebResourceFactory.newResource(DiscoveryApi.class, target);
|
DiscoveryApi api = WebResourceFactory.newResource(DiscoveryApi.class, target);
|
||||||
RepositoryInfo repoInfo = api.getRepositoryInformation().getEntry().getRepository();
|
RepositoryInfo repoInfo = api.getRepositoryInformation().getEntry().getRepository();
|
||||||
|
|
||||||
@@ -55,9 +51,9 @@ public class ConnectionClientIT {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean hostExists() {
|
public boolean hostExists() {
|
||||||
String baseUrl = this.config.getBaseUrl();
|
URI uri = this.client.getTarget().getUri();
|
||||||
|
|
||||||
HttpRequest request = HttpRequest.newBuilder(URI.create(baseUrl))
|
HttpRequest request = HttpRequest.newBuilder(uri)
|
||||||
.GET()
|
.GET()
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user