feature: Update for removal of JaxRsClient
Change-Id: I3465dc362c14469ec7cd9f628a543cf199b79468
diff --git a/org.eclipse.osee.ote.master.rest.client/META-INF/MANIFEST.MF b/org.eclipse.osee.ote.master.rest.client/META-INF/MANIFEST.MF
index c510ce8..fc35038 100644
--- a/org.eclipse.osee.ote.master.rest.client/META-INF/MANIFEST.MF
+++ b/org.eclipse.osee.ote.master.rest.client/META-INF/MANIFEST.MF
@@ -13,10 +13,10 @@
javax.ws.rs;version="2.0.0",
javax.ws.rs.client;version="2.0.0",
javax.ws.rs.core;version="2.0.0",
+ org.eclipse.osee.framework.core,
org.eclipse.osee.framework.jdk.core.type,
org.eclipse.osee.framework.logging,
org.eclipse.osee.jaxrs,
- org.eclipse.osee.jaxrs.client,
org.eclipse.osee.ote.master.rest.model
Export-Package: org.eclipse.osee.ote.master.rest.client
Service-Component: OSGI-INF/*.xml
diff --git a/org.eclipse.osee.ote.master.rest.client/OSGI-INF/ote.master.rest.client.xml b/org.eclipse.osee.ote.master.rest.client/OSGI-INF/ote.master.rest.client.xml
index 6c2a6e5..b076c6f 100644
--- a/org.eclipse.osee.ote.master.rest.client/OSGI-INF/ote.master.rest.client.xml
+++ b/org.eclipse.osee.ote.master.rest.client/OSGI-INF/ote.master.rest.client.xml
@@ -4,4 +4,5 @@
<service>
<provide interface="org.eclipse.osee.ote.master.rest.client.OTEMasterServer"/>
</service>
+ <reference bind="bindJaxRsApi" cardinality="1..1" interface="org.eclipse.osee.framework.core.JaxRsApi" name="jaxRsApi" policy="static"/>
</scr:component>
diff --git a/org.eclipse.osee.ote.master.rest.client/src/org/eclipse/osee/ote/master/rest/client/internal/AddServer.java b/org.eclipse.osee.ote.master.rest.client/src/org/eclipse/osee/ote/master/rest/client/internal/AddServer.java
index afba074..cc08be8 100644
--- a/org.eclipse.osee.ote.master.rest.client/src/org/eclipse/osee/ote/master/rest/client/internal/AddServer.java
+++ b/org.eclipse.osee.ote.master.rest.client/src/org/eclipse/osee/ote/master/rest/client/internal/AddServer.java
@@ -1,27 +1,22 @@
package org.eclipse.osee.ote.master.rest.client.internal;
-import java.net.HttpURLConnection;
import java.net.URI;
import java.util.concurrent.Callable;
-import java.util.logging.Level;
-
import javax.ws.rs.client.Entity;
+import javax.ws.rs.client.WebTarget;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriBuilder;
-
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.jaxrs.client.JaxRsClient;
-import org.eclipse.osee.jaxrs.client.JaxRsWebTarget;
+import org.eclipse.osee.framework.core.JaxRsApi;
import org.eclipse.osee.ote.master.rest.client.OTEMasterServerResult;
import org.eclipse.osee.ote.master.rest.model.OTEServer;
public class AddServer implements Callable<OTEMasterServerResult> {
- private final JaxRsClient webClientProvider;
+ private final JaxRsApi webClientProvider;
private final OTEServer server;
private final URI uri;
- public AddServer(JaxRsClient webClientProvider, URI uri, OTEServer server) {
+ public AddServer(JaxRsApi webClientProvider, URI uri, OTEServer server) {
this.webClientProvider = webClientProvider;
this.uri = uri;
this.server = server;
@@ -31,11 +26,11 @@
public OTEMasterServerResult call() throws Exception {
OTEMasterServerResult result = new OTEMasterServerResult();
try {
- URI targetUri =
- UriBuilder.fromUri(uri).path(OTEMasterServerImpl.CONTEXT_NAME).path(OTEMasterServerImpl.CONTEXT_SERVERS).build();
+ URI targetUri = UriBuilder.fromUri(uri).path(OTEMasterServerImpl.CONTEXT_NAME).path(
+ OTEMasterServerImpl.CONTEXT_SERVERS).build();
- if(HttpUtil.canConnect(targetUri)){
- JaxRsWebTarget target = webClientProvider.target(targetUri);
+ if (HttpUtil.canConnect(targetUri)) {
+ WebTarget target = webClientProvider.newTargetUrl(targetUri.toString());
javax.ws.rs.client.Invocation.Builder builder = target.request(MediaType.APPLICATION_XML);
builder.post(Entity.xml(server));
} else {
@@ -43,7 +38,6 @@
}
} catch (Throwable th) {
result.setSuccess(false);
- // result.setThrowable(th);
}
return result;
}
diff --git a/org.eclipse.osee.ote.master.rest.client/src/org/eclipse/osee/ote/master/rest/client/internal/GetAvailableServers.java b/org.eclipse.osee.ote.master.rest.client/src/org/eclipse/osee/ote/master/rest/client/internal/GetAvailableServers.java
index 57bc86f..48ba69b 100644
--- a/org.eclipse.osee.ote.master.rest.client/src/org/eclipse/osee/ote/master/rest/client/internal/GetAvailableServers.java
+++ b/org.eclipse.osee.ote.master.rest.client/src/org/eclipse/osee/ote/master/rest/client/internal/GetAvailableServers.java
@@ -4,29 +4,30 @@
import java.util.concurrent.Callable;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriBuilder;
-import org.eclipse.osee.jaxrs.client.JaxRsClient;
+import org.eclipse.osee.framework.core.JaxRsApi;
import org.eclipse.osee.ote.master.rest.client.OTEMasterServerAvailableNodes;
import org.eclipse.osee.ote.master.rest.model.OTEServer;
public class GetAvailableServers implements Callable<OTEMasterServerAvailableNodes> {
- private final JaxRsClient webClientProvider;
+ private final JaxRsApi webClientProvider;
private final URI uri;
- public GetAvailableServers(JaxRsClient webClientProvider, URI uri) {
+ public GetAvailableServers(JaxRsApi webClientProvider, URI uri) {
this.webClientProvider = webClientProvider;
this.uri = uri;
}
@Override
public OTEMasterServerAvailableNodes call() throws Exception {
- URI targetUri =
- UriBuilder.fromUri(uri).path(OTEMasterServerImpl.CONTEXT_NAME).path(OTEMasterServerImpl.CONTEXT_SERVERS).build();
+ URI targetUri = UriBuilder.fromUri(uri).path(OTEMasterServerImpl.CONTEXT_NAME).path(
+ OTEMasterServerImpl.CONTEXT_SERVERS).build();
OTEMasterServerAvailableNodes result = new OTEMasterServerAvailableNodes();
try {
OTEServer[] servers =
- webClientProvider.target(targetUri).request(MediaType.APPLICATION_XML).get(OTEServer[].class);
+ webClientProvider.newTargetUrl(targetUri.toString()).request(MediaType.APPLICATION_XML).get(
+ OTEServer[].class);
result.setServers(servers);
result.setSuccess(true);
} catch (Throwable th) {
diff --git a/org.eclipse.osee.ote.master.rest.client/src/org/eclipse/osee/ote/master/rest/client/internal/OTEMasterServerImpl.java b/org.eclipse.osee.ote.master.rest.client/src/org/eclipse/osee/ote/master/rest/client/internal/OTEMasterServerImpl.java
index 2a5e334..4b455e0 100644
--- a/org.eclipse.osee.ote.master.rest.client/src/org/eclipse/osee/ote/master/rest/client/internal/OTEMasterServerImpl.java
+++ b/org.eclipse.osee.ote.master.rest.client/src/org/eclipse/osee/ote/master/rest/client/internal/OTEMasterServerImpl.java
@@ -6,8 +6,7 @@
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import java.util.concurrent.ThreadFactory;
-
-import org.eclipse.osee.jaxrs.client.JaxRsClient;
+import org.eclipse.osee.framework.core.JaxRsApi;
import org.eclipse.osee.ote.master.rest.client.OTEMasterServer;
import org.eclipse.osee.ote.master.rest.client.OTEMasterServerAvailableNodes;
import org.eclipse.osee.ote.master.rest.client.OTEMasterServerResult;
@@ -18,9 +17,13 @@
static final String CONTEXT_NAME = "otemaster";
static final String CONTEXT_SERVERS = "servers";
- private volatile JaxRsClient client;
+ private volatile JaxRsApi jaxRsApi;
private ExecutorService executor;
+ public void bindJaxRsApi(JaxRsApi jaxRsApi) {
+ this.jaxRsApi = jaxRsApi;
+ }
+
public void start(Map<String, Object> props) {
executor = Executors.newCachedThreadPool(new ThreadFactory() {
@Override
@@ -31,33 +34,28 @@
return th;
}
});
- update(props);
}
public void stop() {
if (executor != null) {
executor.shutdown();
}
- client = null;
- }
-
- public void update(Map<String, Object> props) {
- client = JaxRsClient.newBuilder().properties(props).build();
+ jaxRsApi = null;
}
@Override
public Future<OTEMasterServerAvailableNodes> getAvailableServers(URI uri) {
- return executor.submit(new GetAvailableServers(client, uri));
+ return executor.submit(new GetAvailableServers(jaxRsApi, uri));
}
@Override
public Future<OTEMasterServerResult> addServer(URI uri, OTEServer server) {
- return executor.submit(new AddServer(client, uri, server));
+ return executor.submit(new AddServer(jaxRsApi, uri, server));
}
@Override
public Future<OTEMasterServerResult> removeServer(URI uri, OTEServer server) {
- return executor.submit(new RemoveServer(client, uri, server));
+ return executor.submit(new RemoveServer(jaxRsApi, uri, server));
}
}
diff --git a/org.eclipse.osee.ote.master.rest.client/src/org/eclipse/osee/ote/master/rest/client/internal/RemoveServer.java b/org.eclipse.osee.ote.master.rest.client/src/org/eclipse/osee/ote/master/rest/client/internal/RemoveServer.java
index b91f43f..76e599d 100644
--- a/org.eclipse.osee.ote.master.rest.client/src/org/eclipse/osee/ote/master/rest/client/internal/RemoveServer.java
+++ b/org.eclipse.osee.ote.master.rest.client/src/org/eclipse/osee/ote/master/rest/client/internal/RemoveServer.java
@@ -1,24 +1,19 @@
package org.eclipse.osee.ote.master.rest.client.internal;
-import java.net.HttpURLConnection;
import java.net.URI;
import java.util.concurrent.Callable;
-import java.util.logging.Level;
-
import javax.ws.rs.core.UriBuilder;
-
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.jaxrs.client.JaxRsClient;
+import org.eclipse.osee.framework.core.JaxRsApi;
import org.eclipse.osee.ote.master.rest.client.OTEMasterServerResult;
import org.eclipse.osee.ote.master.rest.model.OTEServer;
public class RemoveServer implements Callable<OTEMasterServerResult> {
- private final JaxRsClient webClientProvider;
+ private final JaxRsApi webClientProvider;
private final OTEServer server;
private final URI uri;
- public RemoveServer(JaxRsClient webClientProvider, URI uri, OTEServer server) {
+ public RemoveServer(JaxRsApi webClientProvider, URI uri, OTEServer server) {
this.webClientProvider = webClientProvider;
this.uri = uri;
this.server = server;
@@ -28,14 +23,14 @@
public OTEMasterServerResult call() throws Exception {
OTEMasterServerResult result = new OTEMasterServerResult();
try {
- URI mainTarget =
- UriBuilder.fromUri(uri).path(OTEMasterServerImpl.CONTEXT_NAME).path(OTEMasterServerImpl.CONTEXT_SERVERS).build();
- URI targetUri =
- UriBuilder.fromUri(uri).path(OTEMasterServerImpl.CONTEXT_NAME).path(OTEMasterServerImpl.CONTEXT_SERVERS).path(server.getUUID().toString()).build();
- if(HttpUtil.canConnect(mainTarget)){
- webClientProvider.target(targetUri).request().delete();
+ URI mainTarget = UriBuilder.fromUri(uri).path(OTEMasterServerImpl.CONTEXT_NAME).path(
+ OTEMasterServerImpl.CONTEXT_SERVERS).build();
+ URI targetUri = UriBuilder.fromUri(uri).path(OTEMasterServerImpl.CONTEXT_NAME).path(
+ OTEMasterServerImpl.CONTEXT_SERVERS).path(server.getUUID().toString()).build();
+ if (HttpUtil.canConnect(mainTarget)) {
+ webClientProvider.newTargetUrl(targetUri.toString()).request().delete();
} else {
- result.setSuccess(false);
+ result.setSuccess(false);
}
} catch (Throwable th) {
result.setSuccess(false);
diff --git a/org.eclipse.osee.ote.rest.client/META-INF/MANIFEST.MF b/org.eclipse.osee.ote.rest.client/META-INF/MANIFEST.MF
index c921b96..50fcf1d 100644
--- a/org.eclipse.osee.ote.rest.client/META-INF/MANIFEST.MF
+++ b/org.eclipse.osee.ote.rest.client/META-INF/MANIFEST.MF
@@ -11,6 +11,7 @@
javax.ws.rs.core;version="2.0.0",
org.apache.commons.lang.time,
org.eclipse.core.net.proxy,
+ org.eclipse.osee.framework.core,
org.eclipse.osee.framework.core.data,
org.eclipse.osee.framework.core.enums,
org.eclipse.osee.framework.core.exception,
@@ -20,7 +21,6 @@
org.eclipse.osee.framework.jdk.core.util,
org.eclipse.osee.framework.jdk.core.util.network,
org.eclipse.osee.framework.logging,
- org.eclipse.osee.jaxrs.client,
org.eclipse.osee.ote.classserver,
org.eclipse.osee.ote.core
Export-Package: org.eclipse.osee.ote.rest.client
diff --git a/org.eclipse.osee.ote.rest.client/OSGI-INF/ote.client.xml b/org.eclipse.osee.ote.rest.client/OSGI-INF/ote.client.xml
index 239d148..99022a8 100644
--- a/org.eclipse.osee.ote.rest.client/OSGI-INF/ote.client.xml
+++ b/org.eclipse.osee.ote.rest.client/OSGI-INF/ote.client.xml
@@ -4,4 +4,5 @@
<service>
<provide interface="org.eclipse.osee.ote.rest.client.OteClient"/>
</service>
+ <reference bind="bindJaxRsApi" cardinality="1..1" interface="org.eclipse.osee.framework.core.JaxRsApi" name="jaxRsApi" policy="static"/>
</scr:component>
diff --git a/org.eclipse.osee.ote.rest.client/src/org/eclipse/osee/ote/rest/client/internal/ConfigureOteServer.java b/org.eclipse.osee.ote.rest.client/src/org/eclipse/osee/ote/rest/client/internal/ConfigureOteServer.java
index 397fb3e..54fad81 100644
--- a/org.eclipse.osee.ote.rest.client/src/org/eclipse/osee/ote/rest/client/internal/ConfigureOteServer.java
+++ b/org.eclipse.osee.ote.rest.client/src/org/eclipse/osee/ote/rest/client/internal/ConfigureOteServer.java
@@ -4,14 +4,12 @@
import java.net.InetAddress;
import java.net.URI;
import java.util.List;
-
import javax.ws.rs.client.Entity;
+import javax.ws.rs.client.WebTarget;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriBuilder;
-
+import org.eclipse.osee.framework.core.JaxRsApi;
import org.eclipse.osee.framework.jdk.core.util.network.PortUtil;
-import org.eclipse.osee.jaxrs.client.JaxRsClient;
-import org.eclipse.osee.jaxrs.client.JaxRsWebTarget;
import org.eclipse.osee.ote.classserver.HeadlessClassServer;
import org.eclipse.osee.ote.core.BundleInfo;
import org.eclipse.osee.ote.rest.client.Progress;
@@ -26,12 +24,12 @@
private final URI uri;
private List<File> jars;
private final Progress progress;
- private final JaxRsClient factory;
+ private final JaxRsApi factory;
private OTEJobStatus status;
private HeadlessClassServer classServer;
private OTEConfiguration configuration;
- public ConfigureOteServer(URI uri, List<File> jars, Progress progress, JaxRsClient factory) {
+ public ConfigureOteServer(URI uri, List<File> jars, Progress progress, JaxRsApi factory) {
super(progress);
this.uri = uri;
this.jars = jars;
@@ -39,7 +37,7 @@
this.factory = factory;
}
- public ConfigureOteServer(URI uri, OTEConfiguration configuration, Progress progress, JaxRsClient factory) {
+ public ConfigureOteServer(URI uri, OTEConfiguration configuration, Progress progress, JaxRsApi factory) {
super(progress);
this.uri = uri;
this.configuration = configuration;
@@ -68,7 +66,7 @@
private void waitForJobComplete() throws Exception {
URI jobUri = status.getUpdatedJobStatus().toURI();
- final JaxRsWebTarget service = factory.target(jobUri);
+ final WebTarget service = factory.newTargetUrl(jobUri.toString());
while (!status.isJobComplete()) {
Thread.sleep(POLLING_RATE);
@@ -96,19 +94,19 @@
localConfiguration.addItem(item);
}
OTEConfiguration currentConfig =
- factory.target(targetUri).request(MediaType.APPLICATION_JSON).get(OTEConfiguration.class);
+ factory.newTargetUrl(targetUri.toString()).request(MediaType.APPLICATION_JSON).get(OTEConfiguration.class);
if (currentConfig.equals(localConfiguration)) {
OTEJobStatus status = new OTEJobStatus();
status.setSuccess(true);
status.setJobComplete(true);
return status;
} else {
- return factory.target(targetUri).request(MediaType.APPLICATION_JSON).post(Entity.xml(localConfiguration),
- OTEJobStatus.class);
+ return factory.newTargetUrl(targetUri.toString()).request(MediaType.APPLICATION_JSON).post(
+ Entity.xml(localConfiguration), OTEJobStatus.class);
}
} else {
- return factory.target(targetUri).request(MediaType.APPLICATION_JSON).post(Entity.xml(configuration),
- OTEJobStatus.class);
+ return factory.newTargetUrl(targetUri.toString()).request(MediaType.APPLICATION_JSON).post(
+ Entity.xml(configuration), OTEJobStatus.class);
}
}
}
diff --git a/org.eclipse.osee.ote.rest.client/src/org/eclipse/osee/ote/rest/client/internal/GetOteServerFile.java b/org.eclipse.osee.ote.rest.client/src/org/eclipse/osee/ote/rest/client/internal/GetOteServerFile.java
index afd6b20..a571167 100644
--- a/org.eclipse.osee.ote.rest.client/src/org/eclipse/osee/ote/rest/client/internal/GetOteServerFile.java
+++ b/org.eclipse.osee.ote.rest.client/src/org/eclipse/osee/ote/rest/client/internal/GetOteServerFile.java
@@ -8,8 +8,8 @@
import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.Status;
import javax.ws.rs.core.UriBuilder;
+import org.eclipse.osee.framework.core.JaxRsApi;
import org.eclipse.osee.framework.jdk.core.util.Lib;
-import org.eclipse.osee.jaxrs.client.JaxRsClient;
import org.eclipse.osee.ote.rest.client.Progress;
public class GetOteServerFile extends BaseClientCallable<Progress> {
@@ -18,10 +18,10 @@
private final String filePath;
@SuppressWarnings("unused")
private final Progress progress;
- private final JaxRsClient factory;
+ private final JaxRsApi factory;
private final File destination;
- public GetOteServerFile(URI uri, File destination, String filePath, Progress progress, JaxRsClient factory) {
+ public GetOteServerFile(URI uri, File destination, String filePath, Progress progress, JaxRsApi factory) {
super(progress);
this.uri = uri;
this.filePath = filePath;
@@ -34,7 +34,7 @@
public void doWork() throws Exception {
URI targetUri = UriBuilder.fromUri(uri).path("ote").path("file").queryParam("path", filePath).build();
- Response response = factory.target(targetUri).request(MediaType.APPLICATION_XML).get();
+ Response response = factory.newTargetUrl(targetUri.toString()).request(MediaType.APPLICATION_XML).get();
if (response.getStatus() == Status.OK.getStatusCode()) {
InputStream is = (InputStream) response.getEntity();
FileOutputStream fos = new FileOutputStream(destination);
diff --git a/org.eclipse.osee.ote.rest.client/src/org/eclipse/osee/ote/rest/client/internal/OteClientImpl.java b/org.eclipse.osee.ote.rest.client/src/org/eclipse/osee/ote/rest/client/internal/OteClientImpl.java
index bc9ded8..23bae05 100644
--- a/org.eclipse.osee.ote.rest.client/src/org/eclipse/osee/ote/rest/client/internal/OteClientImpl.java
+++ b/org.eclipse.osee.ote.rest.client/src/org/eclipse/osee/ote/rest/client/internal/OteClientImpl.java
@@ -21,7 +21,7 @@
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import java.util.concurrent.ThreadFactory;
-import org.eclipse.osee.jaxrs.client.JaxRsClient;
+import org.eclipse.osee.framework.core.JaxRsApi;
import org.eclipse.osee.ote.rest.client.OTECacheItem;
import org.eclipse.osee.ote.rest.client.OteClient;
import org.eclipse.osee.ote.rest.client.Progress;
@@ -35,7 +35,11 @@
public class OteClientImpl implements OteClient {
private ExecutorService executor;
- private volatile JaxRsClient client;
+ private volatile JaxRsApi jaxRsApi;
+
+ public void bindJaxRsApi(JaxRsApi jaxRsApi) {
+ this.jaxRsApi = jaxRsApi;
+ }
public void start(Map<String, Object> props) {
executor = Executors.newCachedThreadPool(new ThreadFactory() {
@@ -47,43 +51,38 @@
return th;
}
});
- update(props);
}
public void stop() {
if (executor != null) {
executor.shutdown();
}
- client = null;
- }
-
- public void update(Map<String, Object> props) {
- client = JaxRsClient.newBuilder().properties(props).build();
+ jaxRsApi = null;
}
@Override
public Future<Progress> getFile(URI uri, File destination, String filePath, final Progress progress) {
- return executor.submit(new GetOteServerFile(uri, destination, filePath, progress, client));
+ return executor.submit(new GetOteServerFile(uri, destination, filePath, progress, jaxRsApi));
}
@Override
public Future<Progress> configureServerEnvironment(URI uri, List<File> jars, final Progress progress) {
- return executor.submit(new ConfigureOteServer(uri, jars, progress, client));
+ return executor.submit(new ConfigureOteServer(uri, jars, progress, jaxRsApi));
}
@Override
public Future<Progress> updateServerJarCache(URI uri, String baseJarURL, List<OTECacheItem> jars, Progress progress) {
- return executor.submit(new PrepareOteServerFile(uri, baseJarURL, jars, progress, client));
+ return executor.submit(new PrepareOteServerFile(uri, baseJarURL, jars, progress, jaxRsApi));
}
@Override
public Future<ProgressWithCancel> runTest(URI uri, OTETestRun tests, Progress progress) {
- return executor.submit(new RunTests(uri, tests, progress, client));
+ return executor.submit(new RunTests(uri, tests, progress, jaxRsApi));
}
@Override
public Future<Progress> configureServerEnvironment(URI uri, OTEConfiguration configuration, Progress progress) {
- return executor.submit(new ConfigureOteServer(uri, configuration, progress, client));
+ return executor.submit(new ConfigureOteServer(uri, configuration, progress, jaxRsApi));
}
}
diff --git a/org.eclipse.osee.ote.rest.client/src/org/eclipse/osee/ote/rest/client/internal/PrepareOteServerFile.java b/org.eclipse.osee.ote.rest.client/src/org/eclipse/osee/ote/rest/client/internal/PrepareOteServerFile.java
index 59a4a1d..9d38d64 100644
--- a/org.eclipse.osee.ote.rest.client/src/org/eclipse/osee/ote/rest/client/internal/PrepareOteServerFile.java
+++ b/org.eclipse.osee.ote.rest.client/src/org/eclipse/osee/ote/rest/client/internal/PrepareOteServerFile.java
@@ -3,10 +3,10 @@
import java.net.URI;
import java.util.List;
import javax.ws.rs.client.Entity;
+import javax.ws.rs.client.WebTarget;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriBuilder;
-import org.eclipse.osee.jaxrs.client.JaxRsClient;
-import org.eclipse.osee.jaxrs.client.JaxRsWebTarget;
+import org.eclipse.osee.framework.core.JaxRsApi;
import org.eclipse.osee.ote.rest.client.OTECacheItem;
import org.eclipse.osee.ote.rest.client.Progress;
import org.eclipse.osee.ote.rest.model.OTEConfiguration;
@@ -20,11 +20,11 @@
private final URI uri;
private final List<OTECacheItem> jars;
private final Progress progress;
- private final JaxRsClient factory;
+ private final JaxRsApi factory;
private OTEJobStatus status;
private final String baseJarURL;
- public PrepareOteServerFile(URI uri, String baseJarURL, List<OTECacheItem> jars, Progress progress, JaxRsClient factory) {
+ public PrepareOteServerFile(URI uri, String baseJarURL, List<OTECacheItem> jars, Progress progress, JaxRsApi factory) {
super(progress);
this.uri = uri;
this.jars = jars;
@@ -48,7 +48,7 @@
private void waitForJobComplete() throws Exception {
URI jobUri = status.getUpdatedJobStatus().toURI();
- JaxRsWebTarget service = factory.target(jobUri);
+ WebTarget service = factory.newTargetUrl(jobUri.toString());
while (!status.isJobComplete()) {
Thread.sleep(POLLING_RATE);
@@ -72,8 +72,8 @@
configuration.addItem(item);
}
URI targetUri = UriBuilder.fromUri(uri).path("ote").path("cache").build();
- return factory.target(targetUri).request(MediaType.APPLICATION_JSON).post(Entity.json(configuration),
- OTEJobStatus.class);
+ return factory.newTargetUrl(targetUri.toString()).request(MediaType.APPLICATION_JSON).post(
+ Entity.json(configuration), OTEJobStatus.class);
}
}
diff --git a/org.eclipse.osee.ote.rest.client/src/org/eclipse/osee/ote/rest/client/internal/RunTests.java b/org.eclipse.osee.ote.rest.client/src/org/eclipse/osee/ote/rest/client/internal/RunTests.java
index f28be59..cb9e012 100644
--- a/org.eclipse.osee.ote.rest.client/src/org/eclipse/osee/ote/rest/client/internal/RunTests.java
+++ b/org.eclipse.osee.ote.rest.client/src/org/eclipse/osee/ote/rest/client/internal/RunTests.java
@@ -6,8 +6,8 @@
import javax.ws.rs.client.Entity;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriBuilder;
+import org.eclipse.osee.framework.core.JaxRsApi;
import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.jaxrs.client.JaxRsClient;
import org.eclipse.osee.ote.rest.client.Progress;
import org.eclipse.osee.ote.rest.client.ProgressWithCancel;
import org.eclipse.osee.ote.rest.model.OTEJobStatus;
@@ -18,11 +18,11 @@
private final URI uri;
private final OTETestRun tests;
private final Progress progress;
- private final JaxRsClient factory;
+ private final JaxRsApi factory;
private OTEJobStatus status;
private String id;
- public RunTests(URI uri, OTETestRun tests, Progress progress, JaxRsClient factory) {
+ public RunTests(URI uri, OTETestRun tests, Progress progress, JaxRsApi factory) {
this.uri = uri;
this.tests = tests;
this.progress = progress;
@@ -41,8 +41,8 @@
public boolean cancelSingle() {
URI targetUri = UriBuilder.fromUri(uri).path("ote").path("run").path("{run-id}").build(id);
try {
- OTEJobStatus cancelStatus =
- factory.target(targetUri).request(MediaType.APPLICATION_JSON).put(Entity.json(""), OTEJobStatus.class);
+ OTEJobStatus cancelStatus = factory.newTargetUrl(targetUri.toString()).request(MediaType.APPLICATION_JSON).put(
+ Entity.json(""), OTEJobStatus.class);
return cancelStatus.isSuccess();
} catch (Exception e) {
OseeLog.log(getClass(), Level.SEVERE, e);
@@ -52,7 +52,8 @@
private OTEJobStatus sendCommand() throws Exception {
URI targetUri = UriBuilder.fromUri(uri).path("ote").path("run").build();
- return factory.target(targetUri).request(MediaType.APPLICATION_JSON).post(Entity.json(tests), OTEJobStatus.class);
+ return factory.newTargetUrl(targetUri.toString()).request(MediaType.APPLICATION_JSON).post(Entity.json(tests),
+ OTEJobStatus.class);
}
@Override
@@ -61,7 +62,7 @@
try {
OTEJobStatus cancelStatus =
- factory.target(targetUri).request(MediaType.APPLICATION_JSON).delete(OTEJobStatus.class);
+ factory.newTargetUrl(targetUri.toString()).request(MediaType.APPLICATION_JSON).delete(OTEJobStatus.class);
return cancelStatus.isSuccess();
} catch (Exception e) {
OseeLog.log(getClass(), Level.SEVERE, e);