added getTarget() to api bean

This commit is contained in:
2021-06-03 22:47:37 -04:00
parent 9e3ec85ee0
commit faa3d499f6
2 changed files with 9 additions and 7 deletions

View File

@@ -2,6 +2,7 @@ package com.inteligr8.alfresco.acs;
import javax.ws.rs.client.Client;
import javax.ws.rs.client.ClientBuilder;
import javax.ws.rs.client.WebTarget;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@@ -26,4 +27,9 @@ public class AcsClient {
return client;
}
public WebTarget getTarget() {
return this.getClient()
.target(this.config.getBaseUrl());
}
}

View File

@@ -38,14 +38,10 @@ public class ConnectionClientIT {
@Autowired
private AcsClient client;
@Autowired
private AcsClientConfiguration config;
@Test
//@EnabledIf("hostExists")
public void testDiscovery() {
Client client = this.client.getClient();
WebTarget target = client.target(this.config.getBaseUrl());
WebTarget target = this.client.getTarget();
DiscoveryApi api = WebResourceFactory.newResource(DiscoveryApi.class, target);
RepositoryInfo repoInfo = api.getRepositoryInformation().getEntry().getRepository();
@@ -55,9 +51,9 @@ public class ConnectionClientIT {
}
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()
.build();