Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRyan D. Brooks2021-01-19 18:48:36 +0000
committerRyan D. Brooks2021-01-22 06:03:11 +0000
commitd91a0f847c05926e239ff1746b5ad7bee3a360be (patch)
tree6b56abcfdc7e8e3aba21dcdc0eddafc9dcd46e1b
parent77f9c0dae3d69dcd91d35b1a63990a21fe19347f (diff)
downloadorg.eclipse.osee-d91a0f847c05926e239ff1746b5ad7bee3a360be.tar.gz
org.eclipse.osee-d91a0f847c05926e239ff1746b5ad7bee3a360be.tar.xz
org.eclipse.osee-d91a0f847c05926e239ff1746b5ad7bee3a360be.zip
refactor[TW18625]: Remove gratuitous usage of JaxRsClient
-rw-r--r--plugins/org.eclipse.osee.ats.rest/META-INF/MANIFEST.MF7
-rw-r--r--plugins/org.eclipse.osee.client.integration.tests/META-INF/MANIFEST.MF2
-rw-r--r--plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/AttributeResourceTest.java16
-rw-r--r--plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/IntegerAttributeTest.java18
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/action/WasIsCompareEditorAction.java12
-rw-r--r--plugins/org.eclipse.osee.orcs.rest.client/META-INF/MANIFEST.MF1
-rw-r--r--plugins/org.eclipse.osee.orcs.rest.client/src/org/eclipse/osee/orcs/rest/client/OseeClient.java5
-rw-r--r--plugins/org.eclipse.osee.orcs.rest.client/src/org/eclipse/osee/orcs/rest/client/internal/OseeClientImpl.java39
8 files changed, 29 insertions, 71 deletions
diff --git a/plugins/org.eclipse.osee.ats.rest/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.ats.rest/META-INF/MANIFEST.MF
index 8a6b773e161..9a263248d15 100644
--- a/plugins/org.eclipse.osee.ats.rest/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.osee.ats.rest/META-INF/MANIFEST.MF
@@ -31,14 +31,14 @@ Import-Package: com.fasterxml.jackson.core,
org.eclipse.osee.ats.core.task,
org.eclipse.osee.ats.core.users,
org.eclipse.osee.ats.core.util,
- org.eclipse.osee.define.rest.importing.operations,
- org.eclipse.osee.define.rest.importing.parsers,
- org.eclipse.osee.define.rest.importing.resolvers,
org.eclipse.osee.ats.core.util.chart,
org.eclipse.osee.ats.core.workdef,
org.eclipse.osee.ats.core.workflow,
org.eclipse.osee.ats.core.workflow.state,
org.eclipse.osee.ats.core.workflow.transition,
+ org.eclipse.osee.define.rest.importing.operations,
+ org.eclipse.osee.define.rest.importing.parsers,
+ org.eclipse.osee.define.rest.importing.resolvers,
org.eclipse.osee.framework.core,
org.eclipse.osee.framework.core.data,
org.eclipse.osee.framework.core.enums,
@@ -56,7 +56,6 @@ Import-Package: com.fasterxml.jackson.core,
org.eclipse.osee.framework.jdk.core.util.io.xml,
org.eclipse.osee.framework.logging,
org.eclipse.osee.jaxrs,
- org.eclipse.osee.jaxrs.client,
org.eclipse.osee.jaxrs.mvc,
org.eclipse.osee.jdbc,
org.eclipse.osee.logger,
diff --git a/plugins/org.eclipse.osee.client.integration.tests/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.client.integration.tests/META-INF/MANIFEST.MF
index bd0c3a0c569..a65de823d4b 100644
--- a/plugins/org.eclipse.osee.client.integration.tests/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.osee.client.integration.tests/META-INF/MANIFEST.MF
@@ -14,6 +14,7 @@ Import-Package: javax.ws.rs.client,
org.eclipse.osee.client.demo,
org.eclipse.osee.client.test.framework,
org.eclipse.osee.framework.access,
+ org.eclipse.osee.framework.core,
org.eclipse.osee.framework.core.access,
org.eclipse.osee.framework.core.applicability,
org.eclipse.osee.framework.core.client,
@@ -46,7 +47,6 @@ Import-Package: javax.ws.rs.client,
org.eclipse.osee.framework.ui.plugin,
org.eclipse.osee.framework.ui.plugin.util,
org.eclipse.osee.framework.ui.swt,
- org.eclipse.osee.jaxrs.client,
org.eclipse.osee.jdbc,
org.eclipse.osee.orcs.rest.client,
org.eclipse.osee.orcs.rest.model,
diff --git a/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/AttributeResourceTest.java b/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/AttributeResourceTest.java
index 153be1fda21..1e8b6a68029 100644
--- a/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/AttributeResourceTest.java
+++ b/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/AttributeResourceTest.java
@@ -15,14 +15,10 @@ package org.eclipse.osee.client.integration.tests.integration.skynet.core;
import static org.eclipse.osee.client.demo.DemoChoice.OSEE_CLIENT_DEMO;
import static org.eclipse.osee.framework.core.enums.DemoBranches.SAW_Bld_2;
-import java.net.URI;
import java.util.List;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.UriBuilder;
import org.eclipse.osee.client.test.framework.OseeClientIntegrationRule;
import org.eclipse.osee.client.test.framework.OseeLogMonitorRule;
import org.eclipse.osee.client.test.framework.TestInfo;
-import org.eclipse.osee.framework.core.client.OseeClientProperties;
import org.eclipse.osee.framework.core.data.IOseeBranch;
import org.eclipse.osee.framework.core.data.TransactionId;
import org.eclipse.osee.framework.core.enums.CoreArtifactTypes;
@@ -30,7 +26,7 @@ import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
import org.eclipse.osee.framework.skynet.core.artifact.ArtifactTypeManager;
import org.eclipse.osee.framework.skynet.core.artifact.BranchManager;
-import org.eclipse.osee.jaxrs.client.JaxRsClient;
+import org.eclipse.osee.framework.ui.skynet.internal.ServiceUtil;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
@@ -69,7 +65,7 @@ public class AttributeResourceTest {
testString));
TransactionId txId = newArtifact.persist(getClass().getSimpleName());
List<Integer> attrIds = newArtifact.getAttributeIds(CoreAttributeTypes.WordTemplateContent);
- String output = loadAttributeValue(attrIds.get(0), txId, newArtifact);
+ String output = ServiceUtil.getOseeClient().loadAttributeValue(attrIds.get(0), txId, newArtifact);
Assert.assertTrue(output.trim().equals(testString));
}
@@ -79,12 +75,4 @@ public class AttributeResourceTest {
BranchManager.purgeBranch(workingBranch);
}
}
-
- private String loadAttributeValue(int attrId, TransactionId transactionId, Artifact artifact) {
- String appServer = OseeClientProperties.getOseeApplicationServer();
- URI uri = UriBuilder.fromUri(appServer).path("orcs").path("branch").path(artifact.getBranch().getIdString()).path(
- "artifact").path(artifact.getIdString()).path("attribute").path(String.valueOf(attrId)).path("version").path(
- String.valueOf(transactionId)).path("text").build();
- return JaxRsClient.newClient().target(uri).request(MediaType.TEXT_PLAIN).get(String.class);
- }
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/IntegerAttributeTest.java b/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/IntegerAttributeTest.java
index bfa5ce781fb..61b366dd611 100644
--- a/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/IntegerAttributeTest.java
+++ b/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/IntegerAttributeTest.java
@@ -15,14 +15,10 @@ package org.eclipse.osee.client.integration.tests.integration.skynet.core;
import static org.eclipse.osee.client.demo.DemoChoice.OSEE_CLIENT_DEMO;
import static org.eclipse.osee.framework.core.enums.DemoBranches.SAW_Bld_2;
-import java.net.URI;
import java.util.List;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.UriBuilder;
import org.eclipse.osee.client.test.framework.OseeClientIntegrationRule;
import org.eclipse.osee.client.test.framework.OseeLogMonitorRule;
import org.eclipse.osee.client.test.framework.TestInfo;
-import org.eclipse.osee.framework.core.client.OseeClientProperties;
import org.eclipse.osee.framework.core.data.IOseeBranch;
import org.eclipse.osee.framework.core.data.TransactionId;
import org.eclipse.osee.framework.core.enums.CoreArtifactTypes;
@@ -30,7 +26,7 @@ import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
import org.eclipse.osee.framework.skynet.core.artifact.ArtifactTypeManager;
import org.eclipse.osee.framework.skynet.core.artifact.BranchManager;
-import org.eclipse.osee.jaxrs.client.JaxRsClient;
+import org.eclipse.osee.framework.ui.skynet.internal.ServiceUtil;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
@@ -65,7 +61,7 @@ public class IntegerAttributeTest {
newArtifact.setSoleAttributeValue(CoreAttributeTypes.CircuitBreakerId, "50");
TransactionId txId = newArtifact.persist(getClass().getSimpleName());
List<Integer> attrIds = newArtifact.getAttributeIds(CoreAttributeTypes.CircuitBreakerId);
- String output = loadAttributeValue(attrIds.get(0), txId, newArtifact);
+ String output = ServiceUtil.getOseeClient().loadAttributeValue(attrIds.get(0), txId, newArtifact);
Assert.assertTrue(output.equals("50"));
}
@@ -75,7 +71,7 @@ public class IntegerAttributeTest {
newArtifact.setSoleAttributeValue(CoreAttributeTypes.CircuitBreakerId, 50);
TransactionId txId = newArtifact.persist(getClass().getSimpleName());
List<Integer> attrIds = newArtifact.getAttributeIds(CoreAttributeTypes.CircuitBreakerId);
- String output = loadAttributeValue(attrIds.get(0), txId, newArtifact);
+ String output = ServiceUtil.getOseeClient().loadAttributeValue(attrIds.get(0), txId, newArtifact);
Assert.assertTrue(output.equals("50"));
}
@@ -85,12 +81,4 @@ public class IntegerAttributeTest {
BranchManager.purgeBranch(workingBranch);
}
}
-
- private String loadAttributeValue(int attrId, TransactionId transactionId, Artifact artifact) {
- String appServer = OseeClientProperties.getOseeApplicationServer();
- URI uri = UriBuilder.fromUri(appServer).path("orcs").path("branch").path(artifact.getBranch().getIdString()).path(
- "artifact").path(artifact.getIdString()).path("attribute").path(String.valueOf(attrId)).path("version").path(
- String.valueOf(transactionId)).path("text").build();
- return JaxRsClient.newClient().target(uri).request(MediaType.TEXT_PLAIN).get(String.class);
- }
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/action/WasIsCompareEditorAction.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/action/WasIsCompareEditorAction.java
index d901d68f75c..03903a51a11 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/action/WasIsCompareEditorAction.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/action/WasIsCompareEditorAction.java
@@ -13,16 +13,12 @@
package org.eclipse.osee.framework.ui.skynet.action;
-import java.net.URI;
import java.util.List;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.UriBuilder;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionProvider;
import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.osee.framework.core.client.OseeClientProperties;
import org.eclipse.osee.framework.core.data.AttributeId;
import org.eclipse.osee.framework.core.data.BranchId;
import org.eclipse.osee.framework.core.data.TransactionId;
@@ -39,8 +35,8 @@ import org.eclipse.osee.framework.ui.skynet.FrameworkImage;
import org.eclipse.osee.framework.ui.skynet.commandHandlers.Handlers;
import org.eclipse.osee.framework.ui.skynet.compare.CompareHandler;
import org.eclipse.osee.framework.ui.skynet.compare.CompareItem;
+import org.eclipse.osee.framework.ui.skynet.internal.ServiceUtil;
import org.eclipse.osee.framework.ui.swt.ImageManager;
-import org.eclipse.osee.jaxrs.client.JaxRsClient;
import org.eclipse.osee.jdbc.JdbcStatement;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPage;
@@ -141,11 +137,7 @@ public class WasIsCompareEditorAction extends Action {
}
protected String loadAttributeValue(AttributeId attrId, TransactionId transactionId, Artifact artifact) {
- String appServer = OseeClientProperties.getOseeApplicationServer();
- URI uri = UriBuilder.fromUri(appServer).path("orcs").path("branch").path(artifact.getBranch().getIdString()).path(
- "artifact").path(artifact.getIdString()).path("attribute").path(String.valueOf(attrId)).path("version").path(
- String.valueOf(transactionId)).path("text").build();
- return JaxRsClient.newClient().target(uri).request(MediaType.TEXT_PLAIN).get(String.class);
+ return ServiceUtil.getOseeClient().loadAttributeValue(attrId.getIdIntValue(), transactionId, artifact);
}
protected static ISelectionProvider getSelectionProvider() {
diff --git a/plugins/org.eclipse.osee.orcs.rest.client/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.orcs.rest.client/META-INF/MANIFEST.MF
index 6e95d3a068d..420dec256b2 100644
--- a/plugins/org.eclipse.osee.orcs.rest.client/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.osee.orcs.rest.client/META-INF/MANIFEST.MF
@@ -20,7 +20,6 @@ Import-Package: javax.ws.rs,
org.eclipse.osee.framework.jdk.core.util,
org.eclipse.osee.framework.server.ide.api,
org.eclipse.osee.framework.server.ide.api.client,
- org.eclipse.osee.jaxrs.client,
org.eclipse.osee.orcs.rest.model,
org.eclipse.osee.orcs.rest.model.search.artifact
Export-Package: org.eclipse.osee.orcs.rest.client
diff --git a/plugins/org.eclipse.osee.orcs.rest.client/src/org/eclipse/osee/orcs/rest/client/OseeClient.java b/plugins/org.eclipse.osee.orcs.rest.client/src/org/eclipse/osee/orcs/rest/client/OseeClient.java
index 1183da124d7..8f324da01cf 100644
--- a/plugins/org.eclipse.osee.orcs.rest.client/src/org/eclipse/osee/orcs/rest/client/OseeClient.java
+++ b/plugins/org.eclipse.osee.orcs.rest.client/src/org/eclipse/osee/orcs/rest/client/OseeClient.java
@@ -17,7 +17,9 @@ import org.eclipse.osee.activity.api.ActivityLogEndpoint;
import org.eclipse.osee.define.api.DataRightsEndpoint;
import org.eclipse.osee.define.api.DefineBranchEndpointApi;
import org.eclipse.osee.define.api.RenderEndpoint;
+import org.eclipse.osee.framework.core.data.ArtifactToken;
import org.eclipse.osee.framework.core.data.BranchId;
+import org.eclipse.osee.framework.core.data.TransactionId;
import org.eclipse.osee.framework.server.ide.api.SessionEndpoint;
import org.eclipse.osee.framework.server.ide.api.client.ClientEndpoint;
import org.eclipse.osee.orcs.rest.model.ApplicabilityEndpoint;
@@ -72,4 +74,7 @@ public interface OseeClient {
SessionEndpoint getSessionEndpoint();
+ @Deprecated
+ String loadAttributeValue(Integer attrId, TransactionId transactionId, ArtifactToken artifact);
+
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.orcs.rest.client/src/org/eclipse/osee/orcs/rest/client/internal/OseeClientImpl.java b/plugins/org.eclipse.osee.orcs.rest.client/src/org/eclipse/osee/orcs/rest/client/internal/OseeClientImpl.java
index f6dde464417..e8d6f9ff5d0 100644
--- a/plugins/org.eclipse.osee.orcs.rest.client/src/org/eclipse/osee/orcs/rest/client/internal/OseeClientImpl.java
+++ b/plugins/org.eclipse.osee.orcs.rest.client/src/org/eclipse/osee/orcs/rest/client/internal/OseeClientImpl.java
@@ -13,25 +13,23 @@
package org.eclipse.osee.orcs.rest.client.internal;
-import java.net.URI;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
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.activity.api.ActivityLogEndpoint;
import org.eclipse.osee.define.api.DataRightsEndpoint;
import org.eclipse.osee.define.api.DefineBranchEndpointApi;
import org.eclipse.osee.define.api.RenderEndpoint;
import org.eclipse.osee.framework.core.JaxRsApi;
+import org.eclipse.osee.framework.core.data.ArtifactToken;
import org.eclipse.osee.framework.core.data.BranchId;
+import org.eclipse.osee.framework.core.data.TransactionId;
import org.eclipse.osee.framework.jdk.core.util.Conditions;
-import org.eclipse.osee.framework.jdk.core.util.Strings;
import org.eclipse.osee.framework.server.ide.api.SessionEndpoint;
import org.eclipse.osee.framework.server.ide.api.client.ClientEndpoint;
-import org.eclipse.osee.jaxrs.client.JaxRsClient;
-import org.eclipse.osee.jaxrs.client.JaxRsWebTarget;
import org.eclipse.osee.orcs.rest.client.OseeClient;
import org.eclipse.osee.orcs.rest.client.QueryBuilder;
import org.eclipse.osee.orcs.rest.client.internal.search.PredicateFactory;
@@ -62,9 +60,6 @@ import org.eclipse.osee.orcs.rest.model.search.artifact.SearchResult;
public class OseeClientImpl implements OseeClient, QueryExecutor {
private PredicateFactory predicateFactory;
- private volatile JaxRsClient client;
- private volatile URI orcsUri;
- private UriBuilder searchUriBuilder;
private JaxRsApi jaxRsApi;
public void setJaxRsApi(JaxRsApi jaxRsApi) {
@@ -73,28 +68,12 @@ public class OseeClientImpl implements OseeClient, QueryExecutor {
public void start(Map<String, Object> properties) {
predicateFactory = new PredicateFactoryImpl();
- update(properties);
}
public void stop() {
- client = null;
- orcsUri = null;
predicateFactory = null;
}
- public void update(Map<String, Object> properties) {
- client = JaxRsClient.newBuilder().properties(properties).build();
- String address = properties != null ? (String) properties.get(OSEE_APPLICATION_SERVER) : null;
- if (address == null) {
- address =
- System.getProperty(OSEE_APPLICATION_SERVER, org.eclipse.osee.framework.core.data.OseeClient.DEFAULT_URL);
- }
- if (Strings.isValid(address)) {
- orcsUri = UriBuilder.fromUri(address).path("orcs").build();
- searchUriBuilder = UriBuilder.fromUri(address).path("orcs/branch/{branch-uuid}/artifact/search/v1");
- }
- }
-
@Override
public QueryBuilder createQueryBuilder(BranchId branch) {
QueryOptions options = new QueryOptions();
@@ -127,9 +106,9 @@ public class OseeClientImpl implements OseeClient, QueryExecutor {
}
SearchRequest params = new SearchRequest(branch, predicates, requestType, fromTx, includeDeleted);
- JaxRsWebTarget resource = client.target(searchUriBuilder.build(branch.getIdString()));
+ WebTarget target = jaxRsApi.newTarget("orcs/branch/" + branch.getIdString() + "/artifact/search/v1");
+ return target.request(MediaType.APPLICATION_JSON_TYPE).post(Entity.json(params), SearchResponse.class);
- return resource.request(MediaType.APPLICATION_JSON_TYPE).post(Entity.json(params), SearchResponse.class);
}
@Override
@@ -223,4 +202,12 @@ public class OseeClientImpl implements OseeClient, QueryExecutor {
public SessionEndpoint getSessionEndpoint() {
return jaxRsApi.newProxy("ide", SessionEndpoint.class);
}
+
+ @Override
+ public String loadAttributeValue(Integer attrId, TransactionId transactionId, ArtifactToken artifact) {
+ String url = String.format("orcs/branch/%s/artifact/%s/attribute/%s/version/%s/text",
+ artifact.getBranchIdString(), artifact.getIdString(), attrId, transactionId.getIdString());
+ WebTarget target = jaxRsApi.newTarget(url);
+ return target.request(MediaType.TEXT_PLAIN).get(String.class);
+ }
} \ No newline at end of file

Back to the top