Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--features/org.eclipse.osee.client.ote.feature/feature.xml29
-rw-r--r--features/org.eclipse.osee.disposition.feature/feature.xml1
-rw-r--r--features/org.eclipse.osee.external.feature/feature.xml148
-rw-r--r--features/org.eclipse.osee.x.core.external.feature/feature.xml172
-rw-r--r--features/org.eclipse.osee.x.core.feature/feature.xml5
-rw-r--r--plugins/org.eclipse.osee.account.rest.client/META-INF/MANIFEST.MF16
-rw-r--r--plugins/org.eclipse.osee.account.rest.client/src/org/eclipse/osee/account/rest/client/AccountClientStandaloneSetup.java8
-rw-r--r--plugins/org.eclipse.osee.account.rest.client/src/org/eclipse/osee/account/rest/client/internal/AccountClientImpl.java259
-rw-r--r--plugins/org.eclipse.osee.account.rest.client/src/org/eclipse/osee/account/rest/client/internal/AccountClientModule.java54
-rw-r--r--plugins/org.eclipse.osee.account.rest.test/META-INF/MANIFEST.MF4
-rw-r--r--plugins/org.eclipse.osee.account.rest.test/pom.xml5
-rw-r--r--plugins/org.eclipse.osee.account.rest.test/src/org/eclipse/osee/account/rest/internal/AccountResourceTest.java4
-rw-r--r--plugins/org.eclipse.osee.account.rest/src/org/eclipse/osee/account/rest/internal/AccountApplication.java3
-rw-r--r--plugins/org.eclipse.osee.account.rest/src/org/eclipse/osee/account/rest/internal/AccountResource.java4
-rw-r--r--plugins/org.eclipse.osee.account.rest/src/org/eclipse/osee/account/rest/internal/AccountsResource.java2
-rw-r--r--plugins/org.eclipse.osee.ats/META-INF/MANIFEST.MF1
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/config/AtsConfigurationUtil.java20
-rw-r--r--plugins/org.eclipse.osee.disposition.rest.test/META-INF/MANIFEST.MF4
-rw-r--r--plugins/org.eclipse.osee.disposition.rest.test/pom.xml3
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/ArtifactQuery.java13
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/ArtifactQueryBuilder.java7
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/QueryBuilderArtifact.java2
-rw-r--r--plugins/org.eclipse.osee.jaxrs.client.test/.classpath7
-rw-r--r--plugins/org.eclipse.osee.jaxrs.client.test/.project28
-rw-r--r--plugins/org.eclipse.osee.jaxrs.client.test/META-INF/MANIFEST.MF16
-rw-r--r--plugins/org.eclipse.osee.jaxrs.client.test/build.properties4
-rw-r--r--plugins/org.eclipse.osee.jaxrs.client.test/pom.xml30
-rw-r--r--plugins/org.eclipse.osee.jaxrs.client.test/src/org/eclipse/osee/jaxrs/client/JaxRsClientBuilderTest.java551
-rw-r--r--plugins/org.eclipse.osee.jaxrs.client.test/src/org/eclipse/osee/jaxrs/client/JaxRsClientTest.java115
-rw-r--r--plugins/org.eclipse.osee.jaxrs.client.test/src/org/eclipse/osee/jaxrs/client/JaxRsClientTestSuite.java24
-rw-r--r--plugins/org.eclipse.osee.jaxrs.client.test/src/org/eclipse/osee/jaxrs/client/internal/JaxRsClientInternalTestSuite.java24
-rw-r--r--plugins/org.eclipse.osee.jaxrs.client.test/src/org/eclipse/osee/jaxrs/client/internal/ext/CxfJaxRsClientConfiguratorTest.java409
-rw-r--r--plugins/org.eclipse.osee.jaxrs.client.test/src/org/eclipse/osee/jaxrs/client/internal/ext/JaxRsClientExtTestSuite.java24
-rw-r--r--plugins/org.eclipse.osee.jaxrs.client/META-INF/MANIFEST.MF41
-rw-r--r--plugins/org.eclipse.osee.jaxrs.client/src/org/eclipse/osee/jaxrs/client/JaxRsClient.java244
-rw-r--r--plugins/org.eclipse.osee.jaxrs.client/src/org/eclipse/osee/jaxrs/client/JaxRsClientConfig.java437
-rw-r--r--plugins/org.eclipse.osee.jaxrs.client/src/org/eclipse/osee/jaxrs/client/JaxRsClientConstants.java106
-rw-r--r--plugins/org.eclipse.osee.jaxrs.client/src/org/eclipse/osee/jaxrs/client/JaxRsClientFactory.java47
-rw-r--r--plugins/org.eclipse.osee.jaxrs.client/src/org/eclipse/osee/jaxrs/client/JaxRsClientUtils.java65
-rw-r--r--plugins/org.eclipse.osee.jaxrs.client/src/org/eclipse/osee/jaxrs/client/JaxRsExceptions.java145
-rw-r--r--plugins/org.eclipse.osee.jaxrs.client/src/org/eclipse/osee/jaxrs/client/internal/JaxRsClientConfigurator.java36
-rw-r--r--plugins/org.eclipse.osee.jaxrs.client/src/org/eclipse/osee/jaxrs/client/internal/JaxRsClientImpl.java134
-rw-r--r--plugins/org.eclipse.osee.jaxrs.client/src/org/eclipse/osee/jaxrs/client/internal/JaxRsClientRuntime.java43
-rw-r--r--plugins/org.eclipse.osee.jaxrs.client/src/org/eclipse/osee/jaxrs/client/internal/StandaloneModule.java54
-rw-r--r--plugins/org.eclipse.osee.jaxrs.client/src/org/eclipse/osee/jaxrs/client/internal/ext/CxfJaxRsClientConfigurator.java237
-rw-r--r--plugins/org.eclipse.osee.jaxrs.client/src/org/eclipse/osee/jaxrs/client/internal/ext/CxfJaxRsClientFactory.java85
-rw-r--r--plugins/org.eclipse.osee.jaxrs.client/src/org/eclipse/osee/jaxrs/client/internal/ext/GenericResponseExceptionMapper.java29
-rw-r--r--plugins/org.eclipse.osee.jaxrs.server.test/pom.xml7
-rw-r--r--plugins/org.eclipse.osee.jaxrs.server.test/src/org/eclipse/osee/jaxrs/server/internal/filters/SecurityContextProviderImplTest.java39
-rw-r--r--plugins/org.eclipse.osee.jaxrs.server/META-INF/MANIFEST.MF43
-rw-r--r--plugins/org.eclipse.osee.jaxrs.server/OSGI-INF/jaxrs.application.registry.xml3
-rw-r--r--plugins/org.eclipse.osee.jaxrs.server/OSGI-INF/jaxrs.factory.xml10
-rw-r--r--plugins/org.eclipse.osee.jaxrs.server/src/org/eclipse/osee/jaxrs/server/internal/applications/AbstractJaxRsContainer.java4
-rw-r--r--plugins/org.eclipse.osee.jaxrs.server/src/org/eclipse/osee/jaxrs/server/internal/applications/JaxRsApplicationRegistry.java22
-rw-r--r--plugins/org.eclipse.osee.jaxrs.server/src/org/eclipse/osee/jaxrs/server/internal/ext/CxfJaxRsFactory.java264
-rw-r--r--plugins/org.eclipse.osee.jaxrs.server/src/org/eclipse/osee/jaxrs/server/internal/ext/JerseyJaxRsFactory.java210
-rw-r--r--plugins/org.eclipse.osee.jaxrs.server/src/org/eclipse/osee/jaxrs/server/internal/ext/JerseyWadlGeneratorConfig.java139
-rw-r--r--plugins/org.eclipse.osee.jaxrs.server/src/org/eclipse/osee/jaxrs/server/internal/filters/SecureResourceFilterFactory.java61
-rw-r--r--plugins/org.eclipse.osee.jaxrs.server/src/org/eclipse/osee/jaxrs/server/internal/filters/SecurityContextFilter.java21
-rw-r--r--plugins/org.eclipse.osee.jaxrs.server/src/org/eclipse/osee/jaxrs/server/internal/filters/SecurityContextProvider.java4
-rw-r--r--plugins/org.eclipse.osee.jaxrs.server/src/org/eclipse/osee/jaxrs/server/internal/filters/SecurityContextProviderImpl.java18
-rw-r--r--plugins/org.eclipse.osee.jaxrs.server/src/org/eclipse/osee/jaxrs/server/internal/resources/ApplicationResource.java2
-rw-r--r--plugins/org.eclipse.osee.jaxrs.server/src/org/eclipse/osee/jaxrs/server/internal/resources/ServicesResource.java96
-rw-r--r--plugins/org.eclipse.osee.jaxrs/META-INF/MANIFEST.MF5
-rw-r--r--plugins/org.eclipse.osee.jaxrs/src/org/eclipse/osee/jaxrs/JacksonFeature.java114
-rw-r--r--plugins/org.eclipse.osee.jaxrs/src/org/eclipse/osee/jaxrs/JaxRsConstants.java24
-rw-r--r--plugins/org.eclipse.osee.jaxrs/src/org/eclipse/osee/jaxrs/OseeWebApplicationException.java4
-rw-r--r--plugins/org.eclipse.osee.orcs.rest.client/META-INF/MANIFEST.MF12
-rw-r--r--plugins/org.eclipse.osee.orcs.rest.client/src/org/eclipse/osee/orcs/rest/client/OseeClientStandaloneSetup.java8
-rw-r--r--plugins/org.eclipse.osee.orcs.rest.client/src/org/eclipse/osee/orcs/rest/client/internal/OrcsClientModule.java73
-rw-r--r--plugins/org.eclipse.osee.orcs.rest.client/src/org/eclipse/osee/orcs/rest/client/internal/OseeClientImpl.java49
-rw-r--r--plugins/org.eclipse.osee.orcs.rest.client/src/org/eclipse/osee/orcs/rest/client/internal/search/QueryExecutorV1.java34
-rw-r--r--plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/ArtifactSearchResource.java49
-rw-r--r--plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/ArtifactsResource.java7
-rw-r--r--plugins/org.eclipse.osee.ote.core/META-INF/MANIFEST.MF10
-rw-r--r--plugins/org.eclipse.osee.ote.master.rest.client/META-INF/MANIFEST.MF6
-rw-r--r--plugins/org.eclipse.osee.ote.master.rest.client/src/org/eclipse/osee/ote/master/rest/client/internal/AddServer.java10
-rw-r--r--plugins/org.eclipse.osee.ote.master.rest.client/src/org/eclipse/osee/ote/master/rest/client/internal/GetAvailableServers.java8
-rw-r--r--plugins/org.eclipse.osee.ote.master.rest.client/src/org/eclipse/osee/ote/master/rest/client/internal/OTEMasterServerImpl.java3
-rw-r--r--plugins/org.eclipse.osee.ote.master.rest.client/src/org/eclipse/osee/ote/master/rest/client/internal/RemoveServer.java10
-rw-r--r--plugins/org.eclipse.osee.ote.rest.client/META-INF/MANIFEST.MF10
-rw-r--r--plugins/org.eclipse.osee.ote.rest.client/src/org/eclipse/osee/ote/rest/client/internal/ConfigureOteServer.java20
-rw-r--r--plugins/org.eclipse.osee.ote.rest.client/src/org/eclipse/osee/ote/rest/client/internal/GetOteServerFile.java16
-rw-r--r--plugins/org.eclipse.osee.ote.rest.client/src/org/eclipse/osee/ote/rest/client/internal/OteClientImpl.java3
-rw-r--r--plugins/org.eclipse.osee.ote.rest.client/src/org/eclipse/osee/ote/rest/client/internal/PrepareOteServerFile.java13
-rw-r--r--plugins/org.eclipse.osee.ote.rest.client/src/org/eclipse/osee/ote/rest/client/internal/RunTests.java22
-rw-r--r--plugins/org.eclipse.osee.x.core.parent/pom.xml3
-rw-r--r--plugins/org.eclipse.osee.x.server.integration.tests/META-INF/MANIFEST.MF16
-rw-r--r--plugins/org.eclipse.osee.x.server.integration.tests/pom.xml18
-rw-r--r--plugins/org.eclipse.osee.x.server.integration.tests/src/org/eclipse/osee/x/server/integration/tests/performance/IntegrationUtil.java3
90 files changed, 3675 insertions, 1517 deletions
diff --git a/features/org.eclipse.osee.client.ote.feature/feature.xml b/features/org.eclipse.osee.client.ote.feature/feature.xml
index 26e43d774e0..69bba0a0b68 100644
--- a/features/org.eclipse.osee.client.ote.feature/feature.xml
+++ b/features/org.eclipse.osee.client.ote.feature/feature.xml
@@ -29,7 +29,6 @@
<import plugin="org.eclipse.osee.framework.messaging"/>
<import plugin="org.eclipse.osee.framework.plugin.core"/>
<import plugin="org.eclipse.osgi.services"/>
- <import plugin="javax.xml"/>
<import plugin="org.eclipse.ui" version="3.5.1" match="greaterOrEqual"/>
<import plugin="org.eclipse.core.resources"/>
<import plugin="org.eclipse.core.jobs"/>
@@ -48,16 +47,34 @@
<import plugin="org.eclipse.jdt.ui"/>
<import plugin="org.eclipse.ui.workbench"/>
<import plugin="jms.libraries"/>
- <import plugin="org.eclipse.help"/>
+ <import plugin="org.apache.felix.gogo.runtime"/>
<import plugin="org.eclipse.jgit"/>
<import plugin="org.eclipse.team.svn.core"/>
- <import plugin="org.apache.felix.gogo.runtime"/>
- <import plugin="com.sun.jersey" version="1.18.0" match="greaterOrEqual"/>
- <import plugin="com.sun.jersey.client.apache" version="1.18.0" match="greaterOrEqual"/>
<import plugin="javax.servlet"/>
- <import plugin="javax.ws.rs"/>
+ <import plugin="javax.ws.rs" version="2.0.0" match="greaterOrEqual"/>
<import plugin="org.apache.commons.lang"/>
<import plugin="org.eclipse.core.net"/>
+ <import plugin="org.apache.cxf.core"/>
+ <import plugin="org.apache.cxf.jaxrs.client"/>
+ <import plugin="org.apache.cxf.jaxrs.frontend"/>
+ <import plugin="org.apache.cxf.jaxrs.model.wadl"/>
+ <import plugin="org.apache.cxf.jaxrs.provider"/>
+ <import plugin="org.apache.cxf.rs.security.oauth2"/>
+ <import plugin="org.apache.cxf.transport.http"/>
+ <import plugin="org.apache.aries.blueprint"/>
+ <import plugin="org.apache.aries.blueprint.annotation"/>
+ <import plugin="org.apache.aries.proxy"/>
+ <import plugin="org.apache.aries.quiesce"/>
+ <import plugin="org.apache.aries.util"/>
+ <import plugin="org.osgi.service.blueprint"/>
+ <import plugin="javax.wsdl"/>
+ <import plugin="javax.validation" version="1.1.0" match="greaterOrEqual"/>
+ <import plugin="javax.annotation" version="1.2.0" match="greaterOrEqual"/>
+ <import plugin="org.codehaus.jackson.core"/>
+ <import plugin="org.codehaus.jackson.jaxrs"/>
+ <import plugin="org.codehaus.jackson.mapper"/>
+ <import plugin="org.codehaus.jackson.xc"/>
+ <import plugin="com.sun.xml.fastinfoset"/>
</requires>
<plugin
diff --git a/features/org.eclipse.osee.disposition.feature/feature.xml b/features/org.eclipse.osee.disposition.feature/feature.xml
index 4a3f0688845..9f20affb914 100644
--- a/features/org.eclipse.osee.disposition.feature/feature.xml
+++ b/features/org.eclipse.osee.disposition.feature/feature.xml
@@ -18,7 +18,6 @@
</license>
<requires>
- <import plugin="com.sun.jersey"/>
<import plugin="javax.ws.rs"/>
<import plugin="org.eclipse.osee.framework.core"/>
<import plugin="org.eclipse.osee.framework.core.model"/>
diff --git a/features/org.eclipse.osee.external.feature/feature.xml b/features/org.eclipse.osee.external.feature/feature.xml
index ae50fa593b0..5a08d07da5f 100644
--- a/features/org.eclipse.osee.external.feature/feature.xml
+++ b/features/org.eclipse.osee.external.feature/feature.xml
@@ -31,12 +31,15 @@
<import feature="org.eclipse.nebula.widgets.ganttchart.feature" version="0.0.0" match="greaterOrEqual"/>
<import plugin="org.apache.commons.dbcp" version="1.4.0" match="compatible"/>
<import plugin="org.apache.commons.pool" version="1.6.0" match="compatible"/>
- <import plugin="org.slf4j.api" version="1.6.1" match="equivalent"/>
<import plugin="com.jcraft.jsch" version="0.1.44" match="greaterOrEqual"/>
<import plugin="org.apache.commons.logging" version="1.1.1" match="equivalent"/>
<import plugin="org.eclipse.jgit"/>
- <import plugin="com.sun.jersey" version="1.18.0" match="equivalent"/>
<import plugin="com.google.guava" version="11.0.0" match="greaterOrEqual"/>
+ <import plugin="org.slf4j.api" version="1.6.1" match="greaterOrEqual"/>
+ <import plugin="javax.wsdl"/>
+ <import plugin="javax.ws.rs" version="2.0.0" match="greaterOrEqual"/>
+ <import plugin="javax.validation" version="1.1.0" match="greaterOrEqual"/>
+ <import plugin="javax.annotation" version="1.2.0" match="greaterOrEqual"/>
</requires>
<plugin
@@ -66,21 +69,21 @@
install-size="0"
version="0.0.0"
unpack="false"/>
-
- <plugin
+
+ <plugin
id="org.eclipse.equinox.cm"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
- <plugin
+ <plugin
id="org.eclipse.equinox.metatype"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
-
+
<plugin
id="org.eclipse.equinox.ds"
download-size="0"
@@ -264,98 +267,203 @@
unpack="false"/>
<plugin
- id="org.jvnet.mimepull"
+ id="javax.ws.rs"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
- id="com.sun.jersey"
+ id="org.objectweb.asm"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
- id="com.sun.jersey.client.apache"
+ id="org.apache.commons.dbcp"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
- id="javax.ws.rs"
+ id="org.apache.commons.pool"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
- id="org.objectweb.asm"
+ id="com.google.guava"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
- id="org.apache.commons.dbcp"
+ id="org.hsqldb"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
- id="org.apache.commons.pool"
+ id="org.codehaus.jackson.core"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
- id="com.google.guava"
+ id="org.codehaus.jackson.jaxrs"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
- id="org.hsqldb"
+ id="org.codehaus.jackson.mapper"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
- id="com.sun.jersey.multipart"
+ id="javax.annotation"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
- id="org.codehaus.jackson.core"
+ id="org.apache.aries.blueprint"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
- id="org.codehaus.jackson.jaxrs"
+ id="org.apache.aries.blueprint.annotation"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
- id="org.codehaus.jackson.mapper"
+ id="org.apache.aries.proxy"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
- id="javax.annotation"
+ id="org.apache.aries.quiesce"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.apache.aries.util"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.osgi.service.blueprint"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.codehaus.stax2"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.apache.ws.commons.schema"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="com.ctc.wstx"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.apache.cxf.core"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.apache.cxf.jaxrs.client"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.apache.cxf.jaxrs.frontend"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.apache.cxf.jaxrs.model.wadl"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.apache.cxf.jaxrs.provider"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.apache.cxf.rs.security.oauth2"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.apache.cxf.transport.http"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="javax.validation"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.codehaus.jackson.xc"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="com.sun.xml.fastinfoset"
download-size="0"
install-size="0"
version="0.0.0"
diff --git a/features/org.eclipse.osee.x.core.external.feature/feature.xml b/features/org.eclipse.osee.x.core.external.feature/feature.xml
index 96937aaeb53..68fdeda8843 100644
--- a/features/org.eclipse.osee.x.core.external.feature/feature.xml
+++ b/features/org.eclipse.osee.x.core.external.feature/feature.xml
@@ -18,7 +18,6 @@
</license>
<requires>
- <import plugin="org.slf4j.jcl"/>
<import plugin="javax.xml" version="1.3.4" match="compatible"/>
<import plugin="org.apache.xml.resolver" version="1.2.0" match="compatible"/>
<import plugin="org.apache.xml.serializer" version="2.7.1" match="compatible"/>
@@ -26,11 +25,11 @@
<import plugin="org.eclipse.equinox.common" version="3.2.0" match="compatible"/>
<import plugin="org.eclipse.core.jobs"/>
<import plugin="org.eclipse.core.runtime"/>
- <import plugin="org.slf4j.api" version="1.6.1" match="equivalent"/>
- <import plugin="javax.servlet" version="2.5.0" match="greaterOrEqual"/>
- <import plugin="javax.servlet.jsp"/>
- <import plugin="org.apache.log4j" version="1.2.15" match="greaterOrEqual"/>
- <import plugin="com.google.guava" version="11.0.0" match="greaterOrEqual"/>
+ <import plugin="org.slf4j.api" version="1.6.1" match="greaterOrEqual"/>
+ <import plugin="javax.wsdl"/>
+ <import plugin="javax.ws.rs" version="2.0.0" match="greaterOrEqual"/>
+ <import plugin="javax.validation" version="1.1.0" match="greaterOrEqual"/>
+ <import plugin="javax.annotation" version="1.2.0" match="greaterOrEqual"/>
</requires>
<plugin
@@ -97,13 +96,6 @@
unpack="false"/>
<plugin
- id="com.sun.jersey"
- download-size="0"
- install-size="0"
- version="0.0.0"
- unpack="false"/>
-
- <plugin
id="org.eclipse.persistence.core"
download-size="0"
install-size="0"
@@ -170,13 +162,6 @@
unpack="false"/>
<plugin
- id="org.jvnet.mimepull"
- download-size="0"
- install-size="0"
- version="0.0.0"
- unpack="false"/>
-
- <plugin
id="org.objectweb.asm"
download-size="0"
install-size="0"
@@ -290,13 +275,6 @@
unpack="false"/>
<plugin
- id="com.sun.jersey.client.apache"
- download-size="0"
- install-size="0"
- version="0.0.0"
- unpack="false"/>
-
- <plugin
id="com.google.guava"
download-size="0"
install-size="0"
@@ -395,35 +373,161 @@
unpack="false"/>
<plugin
- id="com.sun.jersey.multipart"
+ id="org.json"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
- id="org.json"
+ id="javax.annotation"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
- id="javax.annotation"
+ id="org.eclipse.equinox.metatype"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
-
+
<plugin
- id="org.eclipse.equinox.metatype"
+ id="org.eclipse.equinox.cm"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
-
+
<plugin
- id="org.eclipse.equinox.cm"
+ id="org.apache.cxf.core"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.apache.cxf.jaxrs.client"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.apache.cxf.jaxrs.frontend"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.apache.cxf.jaxrs.model.wadl"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.apache.cxf.jaxrs.provider"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.apache.cxf.rs.security.oauth2"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.apache.cxf.transport.http"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="javax.validation"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="com.ctc.wstx"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.apache.ws.commons.schema"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.codehaus.stax2"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.apache.aries.blueprint"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.apache.aries.blueprint.annotation"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.apache.aries.proxy"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.apache.aries.quiesce"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.apache.aries.util"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.osgi.service.blueprint"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.codehaus.jackson.xc"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="com.sun.xml.fastinfoset"
download-size="0"
install-size="0"
version="0.0.0"
diff --git a/features/org.eclipse.osee.x.core.feature/feature.xml b/features/org.eclipse.osee.x.core.feature/feature.xml
index 1f7c092d786..041d51ed994 100644
--- a/features/org.eclipse.osee.x.core.feature/feature.xml
+++ b/features/org.eclipse.osee.x.core.feature/feature.xml
@@ -30,10 +30,9 @@
<import plugin="org.apache.xerces"/>
<import plugin="javax.mail.glassfish"/>
<import plugin="javax.servlet" version="2.5.0" match="greaterOrEqual"/>
- <import plugin="com.sun.jersey" version="1.18.0" match="greaterOrEqual"/>
- <import plugin="javax.ws.rs"/>
- <import plugin="org.junit"/>
+ <import plugin="javax.ws.rs" version="2.0.0" match="greaterOrEqual"/>
<import plugin="com.google.guava" version="11.0.0" match="greaterOrEqual"/>
+ <import plugin="org.junit"/>
</requires>
<plugin
diff --git a/plugins/org.eclipse.osee.account.rest.client/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.account.rest.client/META-INF/MANIFEST.MF
index 5cfc1053951..2292204b7e8 100644
--- a/plugins/org.eclipse.osee.account.rest.client/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.osee.account.rest.client/META-INF/MANIFEST.MF
@@ -9,19 +9,13 @@ Import-Package: com.google.inject,
com.google.inject.binder,
com.google.inject.matcher,
com.google.inject.spi,
- com.sun.jersey.api.client;version="1.18.0",
- com.sun.jersey.api.client.async;version="1.18.0",
- com.sun.jersey.api.client.config;version="1.18.0",
- com.sun.jersey.api.client.filter;version="1.18.0",
- javax.ws.rs,
- javax.ws.rs.core,
+ 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.account.rest.model,
org.eclipse.osee.framework.jdk.core.type,
- org.eclipse.osee.jaxrs.client,
- org.eclipse.osee.jaxrs
+ org.eclipse.osee.jaxrs,
+ org.eclipse.osee.jaxrs.client
Export-Package: org.eclipse.osee.account.rest.client
Bundle-Vendor: Eclipse Open System Engineering Environment
-Require-Bundle: org.codehaus.jackson.core;bundle-version="1.9.2",
- org.codehaus.jackson.jaxrs;bundle-version="1.9.2",
- org.codehaus.jackson.mapper;bundle-version="1.9.2"
Bundle-ActivationPolicy: lazy
diff --git a/plugins/org.eclipse.osee.account.rest.client/src/org/eclipse/osee/account/rest/client/AccountClientStandaloneSetup.java b/plugins/org.eclipse.osee.account.rest.client/src/org/eclipse/osee/account/rest/client/AccountClientStandaloneSetup.java
index 6f92a29d103..ac2a7f1211f 100644
--- a/plugins/org.eclipse.osee.account.rest.client/src/org/eclipse/osee/account/rest/client/AccountClientStandaloneSetup.java
+++ b/plugins/org.eclipse.osee.account.rest.client/src/org/eclipse/osee/account/rest/client/AccountClientStandaloneSetup.java
@@ -12,9 +12,6 @@ package org.eclipse.osee.account.rest.client;
import java.util.Map;
import org.eclipse.osee.account.rest.client.internal.AccountClientImpl;
-import org.eclipse.osee.account.rest.client.internal.AccountClientModule;
-import org.eclipse.osee.jaxrs.client.JaxRsClientFactory;
-import com.google.inject.Module;
/**
* Class to use when using the API in a non-OSGI environment
@@ -28,7 +25,8 @@ public final class AccountClientStandaloneSetup {
}
public static AccountClient createClient(Map<String, Object> config) {
- Module module = new AccountClientModule(config);
- return JaxRsClientFactory.createClient(AccountClientImpl.class, config, module);
+ AccountClientImpl client = new AccountClientImpl();
+ client.start(config);
+ return client;
}
}
diff --git a/plugins/org.eclipse.osee.account.rest.client/src/org/eclipse/osee/account/rest/client/internal/AccountClientImpl.java b/plugins/org.eclipse.osee.account.rest.client/src/org/eclipse/osee/account/rest/client/internal/AccountClientImpl.java
index 336cf5f6913..5d0840ad6b3 100644
--- a/plugins/org.eclipse.osee.account.rest.client/src/org/eclipse/osee/account/rest/client/internal/AccountClientImpl.java
+++ b/plugins/org.eclipse.osee.account.rest.client/src/org/eclipse/osee/account/rest/client/internal/AccountClientImpl.java
@@ -10,19 +10,30 @@
*******************************************************************************/
package org.eclipse.osee.account.rest.client.internal;
-import static org.eclipse.osee.jaxrs.client.JaxRsClientConstants.JAXRS_CLIENT_SERVER_ADDRESS;
+import static org.eclipse.osee.account.rest.model.AccountContexts.ACCOUNTS;
+import static org.eclipse.osee.account.rest.model.AccountContexts.ACCOUNT_ACTIVE;
+import static org.eclipse.osee.account.rest.model.AccountContexts.ACCOUNT_ID_PARAM;
+import static org.eclipse.osee.account.rest.model.AccountContexts.ACCOUNT_ID_TEMPLATE;
+import static org.eclipse.osee.account.rest.model.AccountContexts.ACCOUNT_LOGIN;
+import static org.eclipse.osee.account.rest.model.AccountContexts.ACCOUNT_LOGOUT;
+import static org.eclipse.osee.account.rest.model.AccountContexts.ACCOUNT_PREFERENCES;
+import static org.eclipse.osee.account.rest.model.AccountContexts.ACCOUNT_SESSSIONS;
+import static org.eclipse.osee.account.rest.model.AccountContexts.ACCOUNT_USERNAME;
+import static org.eclipse.osee.account.rest.model.AccountContexts.ACCOUNT_USERNAME_TEMPLATE;
import java.net.URI;
import java.util.ArrayList;
import java.util.Collection;
-import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import javax.ws.rs.client.Entity;
+import javax.ws.rs.client.Invocation.Builder;
+import javax.ws.rs.client.WebTarget;
import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.Status;
import javax.ws.rs.core.UriBuilder;
import org.eclipse.osee.account.rest.client.AccountClient;
import org.eclipse.osee.account.rest.model.AccountActiveData;
-import org.eclipse.osee.account.rest.model.AccountContexts;
import org.eclipse.osee.account.rest.model.AccountDetailsData;
import org.eclipse.osee.account.rest.model.AccountInfoData;
import org.eclipse.osee.account.rest.model.AccountInput;
@@ -35,11 +46,7 @@ import org.eclipse.osee.account.rest.model.SubscriptionData;
import org.eclipse.osee.framework.jdk.core.type.ResultSet;
import org.eclipse.osee.framework.jdk.core.type.ResultSets;
import org.eclipse.osee.jaxrs.client.JaxRsClient;
-import org.eclipse.osee.jaxrs.client.JaxRsClientFactory;
-import org.eclipse.osee.jaxrs.client.JaxRsClientUtils;
-import com.sun.jersey.api.client.ClientResponse;
-import com.sun.jersey.api.client.UniformInterfaceException;
-import com.sun.jersey.api.client.WebResource;
+import org.eclipse.osee.jaxrs.client.JaxRsExceptions;
/**
* @author Roberto E. Escobar
@@ -47,156 +54,127 @@ import com.sun.jersey.api.client.WebResource;
public class AccountClientImpl implements AccountClient {
private static final String OSEE_APPLICATION_SERVER = "osee.application.server";
- private JaxRsClient client;
+ private WebTarget baseTarget;
+ private WebTarget accountTarget;
public void start(Map<String, Object> properties) {
update(properties);
}
public void stop() {
- client = null;
+ baseTarget = null;
+ accountTarget = null;
}
public void update(Map<String, Object> properties) {
- Map<String, Object> propsToUse = properties;
- String newServerAddress = JaxRsClientUtils.get(propsToUse, JAXRS_CLIENT_SERVER_ADDRESS, null);
- if (newServerAddress == null) {
- propsToUse = new HashMap<String, Object>(properties);
- propsToUse.put(JAXRS_CLIENT_SERVER_ADDRESS, System.getProperty(OSEE_APPLICATION_SERVER, ""));
- }
- client = JaxRsClientFactory.createClient(propsToUse);
- }
-
- private UriBuilder newBuilder() {
- return UriBuilder.fromPath(AccountContexts.ACCOUNTS);
- }
+ JaxRsClient client = JaxRsClient.newBuilder().properties(properties).build();
- private <T> T get(URI uri, Class<T> clazz) {
- WebResource resource = client.createResource(uri);
- try {
- return resource.accept(MediaType.APPLICATION_JSON_TYPE).get(clazz);
- } catch (UniformInterfaceException ex) {
- throw client.handleException(ex);
+ String address = properties != null ? (String) properties.get(OSEE_APPLICATION_SERVER) : null;
+ if (address == null) {
+ address = System.getProperty(OSEE_APPLICATION_SERVER, "");
}
+
+ URI uri = UriBuilder.fromUri(address).build();
+ baseTarget = client.target(uri);
+ accountTarget = baseTarget.path(ACCOUNTS);
}
@Override
public AccountSessionData login(String scheme, String username, String password) {
- URI uri = newBuilder()//
- .path(AccountContexts.ACCOUNT_LOGIN)//
- .build();
-
AccountLoginData data = new AccountLoginData();
data.setUsername(username);
data.setPassword(password);
data.setScheme(scheme);
- WebResource resource = client.createResource(uri);
+ WebTarget resource = accountTarget.path(ACCOUNT_LOGIN);
try {
- return resource.post(AccountSessionData.class, data);
- } catch (UniformInterfaceException ex) {
- throw client.handleException(ex);
+ return resource.request(MediaType.APPLICATION_JSON_TYPE).post(Entity.json(data), AccountSessionData.class);
+ } catch (Exception ex) {
+ throw JaxRsExceptions.asOseeException(ex);
}
}
@Override
public boolean logout(AccountSessionData session) {
- URI uri = newBuilder()//
- .path(AccountContexts.ACCOUNT_LOGOUT)//
- .build();
-
- WebResource resource = client.createResource(uri);
- int status;
+ WebTarget resource = accountTarget.path(ACCOUNT_LOGOUT);
try {
- ClientResponse response = resource.post(ClientResponse.class, session);
- status = response.getStatus();
- } catch (UniformInterfaceException ex) {
- ClientResponse clientResponse = ex.getResponse();
- status = clientResponse.getStatus();
- if (Status.NOT_MODIFIED.getStatusCode() != status) {
- throw client.handleException(ex);
- }
+ Response response = resource.request().post(Entity.json(session));
+ return Status.OK.getStatusCode() == response.getStatus();
+ } catch (Exception ex) {
+ throw JaxRsExceptions.asOseeException(ex);
}
- return Status.OK.getStatusCode() == status;
}
@Override
public AccountInfoData createAccount(String userName, AccountInput input) {
- URI uri = newBuilder()//
- .path(AccountContexts.ACCOUNT_USERNAME_TEMPLATE)//
- .build(userName);
-
- WebResource resource = client.createResource(uri);
+ WebTarget resource = accountTarget.path(ACCOUNT_USERNAME_TEMPLATE).resolveTemplate(ACCOUNT_USERNAME, userName);
try {
- AccountInfoData data =
- resource.accept(MediaType.APPLICATION_JSON_TYPE).type(MediaType.APPLICATION_JSON_TYPE).post(
- AccountInfoData.class, input);
- return data;
- } catch (UniformInterfaceException ex) {
- throw client.handleException(ex);
+ return resource.request(MediaType.APPLICATION_JSON_TYPE).post(Entity.json(input), AccountInfoData.class);
+ } catch (Exception ex) {
+ throw JaxRsExceptions.asOseeException(ex);
}
}
@Override
public boolean deleteAccount(String accountId) {
- URI uri = newBuilder()//
- .path(AccountContexts.ACCOUNT_ID_TEMPLATE)//
- .build(accountId);
- WebResource resource = client.createResource(uri);
-
- ClientResponse response;
+ WebTarget resource = accountTarget.path(ACCOUNT_ID_TEMPLATE).resolveTemplate(ACCOUNT_ID_PARAM, accountId);
try {
- response = resource.delete(ClientResponse.class);
- } catch (UniformInterfaceException ex) {
- throw client.handleException(ex);
+ Response response = resource.request().delete();
+ return Status.OK.getStatusCode() == response.getStatus();
+ } catch (Exception ex) {
+ throw JaxRsExceptions.asOseeException(ex);
}
- int status = response.getStatus();
- return Status.OK.getStatusCode() == status;
}
@Override
public ResultSet<AccountSessionDetailsData> getAccountSessionDataByUniqueField(String accountId) {
- URI uri = newBuilder()//
- .path(AccountContexts.ACCOUNT_ID_TEMPLATE) //
- .path(AccountContexts.ACCOUNT_SESSSIONS)//
- .build(accountId);
- AccountSessionDetailsData[] data = get(uri, AccountSessionDetailsData[].class);
- return ResultSets.newResultSet(data);
+ WebTarget resource =
+ accountTarget.path(ACCOUNT_ID_TEMPLATE).path(ACCOUNT_SESSSIONS).resolveTemplate(ACCOUNT_ID_PARAM, accountId);
+ try {
+ AccountSessionDetailsData[] data =
+ resource.request(MediaType.APPLICATION_JSON_TYPE).get(AccountSessionDetailsData[].class);
+ return ResultSets.newResultSet(data);
+ } catch (Exception ex) {
+ throw JaxRsExceptions.asOseeException(ex);
+ }
}
@Override
public ResultSet<AccountInfoData> getAllAccounts() {
- URI uri = newBuilder()//
- .build();
- AccountInfoData[] accounts = get(uri, AccountInfoData[].class);
- return ResultSets.newResultSet(accounts);
+ try {
+ AccountInfoData[] accounts =
+ accountTarget.request(MediaType.APPLICATION_JSON_TYPE).get(AccountInfoData[].class);
+ return ResultSets.newResultSet(accounts);
+ } catch (Exception ex) {
+ throw JaxRsExceptions.asOseeException(ex);
+ }
}
@Override
public AccountDetailsData getAccountDetailsByUniqueField(String accountId) {
- URI uri = newBuilder()//
- .path(AccountContexts.ACCOUNT_ID_TEMPLATE)//
- .build(accountId);
- return get(uri, AccountDetailsData.class);
+ WebTarget resource = accountTarget.path(ACCOUNT_ID_TEMPLATE).resolveTemplate(ACCOUNT_ID_PARAM, accountId);
+ try {
+ return resource.request(MediaType.APPLICATION_JSON_TYPE).get(AccountDetailsData.class);
+ } catch (Exception ex) {
+ throw JaxRsExceptions.asOseeException(ex);
+ }
}
@Override
public AccountPreferencesData getAccountPreferencesByUniqueField(String accountId) {
- URI uri = newBuilder()//
- .path(AccountContexts.ACCOUNT_ID_TEMPLATE)//
- .path(AccountContexts.ACCOUNT_PREFERENCES)//
- .build(accountId);
- AccountPreferencesData data = get(uri, AccountPreferencesData.class);
- return data;
+ WebTarget resource =
+ accountTarget.path(ACCOUNT_ID_TEMPLATE).path(ACCOUNT_PREFERENCES).resolveTemplate(ACCOUNT_ID_PARAM, accountId);
+ try {
+ return resource.request(MediaType.APPLICATION_JSON_TYPE).get(AccountPreferencesData.class);
+ } catch (Exception ex) {
+ throw JaxRsExceptions.asOseeException(ex);
+ }
}
@Override
public boolean setAccountActive(String accountId, boolean active) {
- URI uri = newBuilder()//
- .path(AccountContexts.ACCOUNT_ID_TEMPLATE)//
- .path(AccountContexts.ACCOUNT_ACTIVE)//
- .build(accountId);
- WebResource resource = client.createResource(uri);
+ WebTarget resource =
+ accountTarget.path(ACCOUNT_ID_TEMPLATE).path(ACCOUNT_ACTIVE).resolveTemplate(ACCOUNT_ID_PARAM, accountId);
boolean result;
if (active) {
result = setAccountActive(resource);
@@ -208,79 +186,63 @@ public class AccountClientImpl implements AccountClient {
@Override
public boolean isAccountActive(String accountId) {
- URI uri = newBuilder()//
- .path(AccountContexts.ACCOUNT_ID_TEMPLATE)//
- .path(AccountContexts.ACCOUNT_ACTIVE)//
- .build(accountId);
- AccountActiveData data = get(uri, AccountActiveData.class);
- return data.isActive();
+ WebTarget resource =
+ accountTarget.path(ACCOUNT_ID_TEMPLATE).path(ACCOUNT_ACTIVE).resolveTemplate(ACCOUNT_ID_PARAM, accountId);
+ try {
+ AccountActiveData data = resource.request(MediaType.APPLICATION_JSON_TYPE).get(AccountActiveData.class);
+ return data.isActive();
+ } catch (Exception ex) {
+ throw JaxRsExceptions.asOseeException(ex);
+ }
}
- private boolean setAccountActive(WebResource resource) {
- int status;
+ private boolean setAccountActive(WebTarget resource) {
try {
- ClientResponse response = resource.put(ClientResponse.class);
- status = response.getStatus();
- } catch (UniformInterfaceException ex) {
- ClientResponse clientResponse = ex.getResponse();
- status = clientResponse.getStatus();
- if (Status.NOT_MODIFIED.getStatusCode() != status) {
- throw client.handleException(ex);
- }
+ Response response = resource.request().put(null);
+ return Status.OK.getStatusCode() == response.getStatus();
+ } catch (Exception ex) {
+ throw JaxRsExceptions.asOseeException(ex);
}
- return Status.OK.getStatusCode() == status;
}
- private boolean setAccountInActive(WebResource resource) {
- int status;
+ private boolean setAccountInActive(WebTarget resource) {
try {
- ClientResponse response = resource.delete(ClientResponse.class);
- status = response.getStatus();
- } catch (UniformInterfaceException ex) {
- ClientResponse clientResponse = ex.getResponse();
- status = clientResponse.getStatus();
- if (Status.NOT_MODIFIED.getStatusCode() != status) {
- throw client.handleException(ex);
- }
+ Response response = resource.request().delete();
+ return Status.OK.getStatusCode() == response.getStatus();
+ } catch (Exception ex) {
+ throw JaxRsExceptions.asOseeException(ex);
}
- return Status.OK.getStatusCode() == status;
}
@Override
public boolean setAccountPreferences(String accountId, Map<String, String> preferences) {
- URI uri = newBuilder()//
- .path(AccountContexts.ACCOUNT_ID_TEMPLATE)//
- .path(AccountContexts.ACCOUNT_PREFERENCES)//
- .build(accountId);
+ WebTarget resource =
+ accountTarget.path(ACCOUNT_ID_TEMPLATE).path(ACCOUNT_PREFERENCES).resolveTemplate(ACCOUNT_ID_PARAM, accountId);
AccountPreferencesInput input = new AccountPreferencesInput();
input.setMap(preferences);
-
- WebResource resource = client.createResource(uri);
- int status;
try {
- ClientResponse response = resource.put(ClientResponse.class, input);
- status = response.getStatus();
- } catch (UniformInterfaceException ex) {
- ClientResponse clientResponse = ex.getResponse();
- status = clientResponse.getStatus();
- if (Status.NOT_MODIFIED.getStatusCode() != status) {
- throw client.handleException(ex);
- }
+ Response response = resource.request().put(Entity.json(input));
+ return Status.OK.getStatusCode() == response.getStatus();
+ } catch (Exception ex) {
+ throw JaxRsExceptions.asOseeException(ex);
}
- return Status.OK.getStatusCode() == status;
}
private ResultSet<SubscriptionData> getSubscriptionsForAccount(String userId) {
- URI uri =
- newBuilder().path("subscriptions").path("for-account").path("{account-id}").build(
- userId);
- SubscriptionData[] data = get(uri, SubscriptionData[].class);
- return ResultSets.newResultSet(data);
+ WebTarget resource =
+ baseTarget.path("subscriptions/for-account/{account-id}").resolveTemplate(ACCOUNT_ID_PARAM, userId);
+ Builder builder = resource.request(MediaType.APPLICATION_JSON_TYPE);
+ try {
+ SubscriptionData[] data = builder.get(SubscriptionData[].class);
+ return ResultSets.newResultSet(data);
+ } catch (Exception ex) {
+ throw JaxRsExceptions.asOseeException(ex);
+ }
}
private UriBuilder newUnsubscribeBuilder() {
- return newBuilder().path("unsubscribe").path("ui").path("{subscription-uuid}");
+ return baseTarget.getUriBuilder().path("unsubscribe").path("ui").path("{subscription-uuid}");
}
@Override
@@ -289,6 +251,7 @@ public class AccountClientImpl implements AccountClient {
ResultSet<SubscriptionData> results = getSubscriptionsForAccount(userUuid);
if (!results.isEmpty()) {
List<UnsubscribeInfo> infos = new ArrayList<UnsubscribeInfo>();
+
UriBuilder builder = newUnsubscribeBuilder();
for (SubscriptionData subscription : results) {
if (subscription.isActive() && groupNames.contains(subscription.getName())) {
diff --git a/plugins/org.eclipse.osee.account.rest.client/src/org/eclipse/osee/account/rest/client/internal/AccountClientModule.java b/plugins/org.eclipse.osee.account.rest.client/src/org/eclipse/osee/account/rest/client/internal/AccountClientModule.java
deleted file mode 100644
index 195035fda66..00000000000
--- a/plugins/org.eclipse.osee.account.rest.client/src/org/eclipse/osee/account/rest/client/internal/AccountClientModule.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2013 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.account.rest.client.internal;
-
-import java.util.Map;
-import org.eclipse.osee.account.rest.client.AccountClient;
-import org.eclipse.osee.jaxrs.client.JaxRsClientUtils;
-import com.google.inject.AbstractModule;
-import com.google.inject.TypeLiteral;
-import com.google.inject.spi.InjectionListener;
-import com.google.inject.spi.TypeEncounter;
-import com.google.inject.spi.TypeListener;
-
-/**
- * @author Roberto E. Escobar
- */
-public class AccountClientModule extends AbstractModule {
-
- private final Map<String, Object> config;
-
- public AccountClientModule(Map<String, Object> config) {
- super();
- this.config = config;
- }
-
- @Override
- protected void configure() {
- bind(AccountClient.class).to(AccountClientImpl.class);
- TypeListener listener = new TypeListener() {
-
- @Override
- public <I> void hear(TypeLiteral<I> type, TypeEncounter<I> encounter) {
- encounter.register(new InjectionListener<I>() {
-
- @Override
- public void afterInjection(I injectee) {
- AccountClientImpl client = (AccountClientImpl) injectee;
- client.start(config);
- }
- });
- }
- };
- bindListener(JaxRsClientUtils.subtypeOf(AccountClient.class), listener);
- }
-
-}
diff --git a/plugins/org.eclipse.osee.account.rest.test/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.account.rest.test/META-INF/MANIFEST.MF
index 9cccd668b79..8892d63e0a4 100644
--- a/plugins/org.eclipse.osee.account.rest.test/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.osee.account.rest.test/META-INF/MANIFEST.MF
@@ -6,9 +6,9 @@ Bundle-Version: 0.18.0.qualifier
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-Vendor: Eclipse Open System Engineering Environment
Fragment-Host: org.eclipse.osee.account.rest;bundle-version="0.17.0"
-Import-Package: com.sun.ws.rs.ext,
- org.apache.commons.codec.binary,
+Import-Package: org.apache.aries.blueprint;version="1.3.0",
org.apache.commons.lang.math,
+ org.apache.cxf.jaxrs.impl;version="3.0.0",
org.hamcrest.core,
org.junit,
org.junit.rules,
diff --git a/plugins/org.eclipse.osee.account.rest.test/pom.xml b/plugins/org.eclipse.osee.account.rest.test/pom.xml
index e5216d146e4..de56bf6810e 100644
--- a/plugins/org.eclipse.osee.account.rest.test/pom.xml
+++ b/plugins/org.eclipse.osee.account.rest.test/pom.xml
@@ -23,10 +23,13 @@
<configuration>
<testSuite>org.eclipse.osee.account.rest.test</testSuite>
<testClass>org.eclipse.osee.account.rest.AccountRestTestSuite</testClass>
+ <systemProperties combine.children="append">
+ <javax.ws.rs.ext.RuntimeDelegate>org.apache.cxf.jaxrs.impl.RuntimeDelegateImpl</javax.ws.rs.ext.RuntimeDelegate>
+ </systemProperties>
</configuration>
</plugin>
</plugins>
</build>
-
+
</project>
diff --git a/plugins/org.eclipse.osee.account.rest.test/src/org/eclipse/osee/account/rest/internal/AccountResourceTest.java b/plugins/org.eclipse.osee.account.rest.test/src/org/eclipse/osee/account/rest/internal/AccountResourceTest.java
index e1dcaea7de2..42c13d59afb 100644
--- a/plugins/org.eclipse.osee.account.rest.test/src/org/eclipse/osee/account/rest/internal/AccountResourceTest.java
+++ b/plugins/org.eclipse.osee.account.rest.test/src/org/eclipse/osee/account/rest/internal/AccountResourceTest.java
@@ -138,8 +138,8 @@ public class AccountResourceTest {
URI location = (URI) response.getMetadata().getFirst(HttpHeaders.LOCATION);
URI expectedLocation =
- UriBuilder.fromUri(uri).path("..").path("..").path("subscriptions").path("for-account").path("{account-id}").build(
- ACCOUNT_ID);
+ UriBuilder.fromUri(uri).path("..").path("..").path("..").path("subscriptions").path("for-account").path(
+ "{account-id}").build(ACCOUNT_ID);
assertEquals(expectedLocation, location);
}
diff --git a/plugins/org.eclipse.osee.account.rest/src/org/eclipse/osee/account/rest/internal/AccountApplication.java b/plugins/org.eclipse.osee.account.rest/src/org/eclipse/osee/account/rest/internal/AccountApplication.java
index fb85ddf6df6..a03d23bec93 100644
--- a/plugins/org.eclipse.osee.account.rest/src/org/eclipse/osee/account/rest/internal/AccountApplication.java
+++ b/plugins/org.eclipse.osee.account.rest/src/org/eclipse/osee/account/rest/internal/AccountApplication.java
@@ -16,12 +16,11 @@ import javax.ws.rs.ApplicationPath;
import javax.ws.rs.core.Application;
import org.eclipse.osee.account.admin.AccountAdmin;
import org.eclipse.osee.account.admin.SubscriptionAdmin;
-import org.eclipse.osee.account.rest.model.AccountContexts;
/**
* @author Roberto E. Escobar
*/
-@ApplicationPath(AccountContexts.ACCOUNTS)
+@ApplicationPath("/")
public class AccountApplication extends Application {
private final Set<Object> singletons = new HashSet<Object>();
diff --git a/plugins/org.eclipse.osee.account.rest/src/org/eclipse/osee/account/rest/internal/AccountResource.java b/plugins/org.eclipse.osee.account.rest/src/org/eclipse/osee/account/rest/internal/AccountResource.java
index 9a031447943..201c2c6e3b7 100644
--- a/plugins/org.eclipse.osee.account.rest/src/org/eclipse/osee/account/rest/internal/AccountResource.java
+++ b/plugins/org.eclipse.osee.account.rest/src/org/eclipse/osee/account/rest/internal/AccountResource.java
@@ -101,8 +101,8 @@ public class AccountResource {
public Response getSubscriptions(@Context UriInfo uriInfo) {
URI requestUri = uriInfo.getRequestUri();
URI uri =
- UriBuilder.fromUri(requestUri).path("..").path("..").path("subscriptions").path("for-account").path(
- "{account-id}").build(accountId);
+ UriBuilder.fromUri(requestUri).path("../../../").path("subscriptions").path("for-account").path("{account-id}").build(
+ accountId);
return Response.seeOther(uri).build();
}
diff --git a/plugins/org.eclipse.osee.account.rest/src/org/eclipse/osee/account/rest/internal/AccountsResource.java b/plugins/org.eclipse.osee.account.rest/src/org/eclipse/osee/account/rest/internal/AccountsResource.java
index e73b54c4d3f..9b2c5ae8c36 100644
--- a/plugins/org.eclipse.osee.account.rest/src/org/eclipse/osee/account/rest/internal/AccountsResource.java
+++ b/plugins/org.eclipse.osee.account.rest/src/org/eclipse/osee/account/rest/internal/AccountsResource.java
@@ -23,7 +23,7 @@ import org.eclipse.osee.account.rest.model.AccountInfoData;
/**
* @author Roberto E. Escobar
*/
-@Path("/")
+@Path(AccountContexts.ACCOUNTS)
public class AccountsResource {
private final AccountOps accountOps;
diff --git a/plugins/org.eclipse.osee.ats/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.ats/META-INF/MANIFEST.MF
index b27dbb0af2a..7c1ff220b76 100644
--- a/plugins/org.eclipse.osee.ats/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.osee.ats/META-INF/MANIFEST.MF
@@ -72,6 +72,7 @@ Import-Package: com.google.common.reflect,
com.sun.jersey.api.client,
javax.mail,
javax.mail.internet,
+ javax.ws.rs.client;version="2.0.0",
javax.ws.rs.core,
org.eclipse.osee.ats.api,
org.eclipse.osee.ats.api.ai,
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/config/AtsConfigurationUtil.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/config/AtsConfigurationUtil.java
index 61500b2a02a..9253dad868b 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/config/AtsConfigurationUtil.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/config/AtsConfigurationUtil.java
@@ -11,16 +11,13 @@
package org.eclipse.osee.ats.config;
import java.net.URI;
-import java.util.HashMap;
-import java.util.Map;
+import javax.ws.rs.client.WebTarget;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriBuilder;
import org.eclipse.osee.ats.api.config.AtsConfigurations;
import org.eclipse.osee.framework.core.client.OseeClientProperties;
import org.eclipse.osee.jaxrs.client.JaxRsClient;
-import org.eclipse.osee.jaxrs.client.JaxRsClientConstants;
-import org.eclipse.osee.jaxrs.client.JaxRsClientFactory;
-import com.sun.jersey.api.client.WebResource;
+import org.eclipse.osee.jaxrs.client.JaxRsExceptions;
/**
* @author Donald G. Dunne
@@ -29,11 +26,12 @@ public class AtsConfigurationUtil {
public static AtsConfigurations getConfigurations() {
String appServer = OseeClientProperties.getOseeApplicationServer();
- URI uri = UriBuilder.fromPath("ats").path("config").build();
- Map<String, Object> config = new HashMap<String, Object>();
- config.put(JaxRsClientConstants.JAXRS_CLIENT_SERVER_ADDRESS, appServer);
- JaxRsClient client = JaxRsClientFactory.createClient(config);
- WebResource resource = client.createResource(uri);
- return resource.accept(MediaType.APPLICATION_JSON).get(AtsConfigurations.class);
+ URI uri = UriBuilder.fromUri(appServer).path("ats").path("config").build();
+ WebTarget resource = JaxRsClient.newClient().target(uri);
+ try {
+ return resource.request(MediaType.APPLICATION_JSON).get(AtsConfigurations.class);
+ } catch (Exception ex) {
+ throw JaxRsExceptions.asOseeException(ex);
+ }
}
}
diff --git a/plugins/org.eclipse.osee.disposition.rest.test/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.disposition.rest.test/META-INF/MANIFEST.MF
index 318197569ab..96f32494003 100644
--- a/plugins/org.eclipse.osee.disposition.rest.test/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.osee.disposition.rest.test/META-INF/MANIFEST.MF
@@ -6,7 +6,9 @@ Bundle-Version: 0.18.0.qualifier
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-Vendor: Eclipse Open System Engineering Environment
Fragment-Host: org.eclipse.osee.disposition.rest
-Import-Package: org.eclipse.osee.event,
+Import-Package: org.apache.aries.blueprint;version="1.3.0",
+ org.apache.cxf.jaxrs.impl;version="3.0.0",
+ org.eclipse.osee.event,
org.eclipse.osee.executor.admin,
org.eclipse.osee.framework.core.services,
org.eclipse.osee.framework.database,
diff --git a/plugins/org.eclipse.osee.disposition.rest.test/pom.xml b/plugins/org.eclipse.osee.disposition.rest.test/pom.xml
index c386e6ce470..deb2bc03e27 100644
--- a/plugins/org.eclipse.osee.disposition.rest.test/pom.xml
+++ b/plugins/org.eclipse.osee.disposition.rest.test/pom.xml
@@ -23,6 +23,9 @@
<configuration>
<testSuite>org.eclipse.osee.disposition.rest.test</testSuite>
<testClass>org.eclipse.osee.disposition.rest.DispositionTestSuite</testClass>
+ <systemProperties combine.children="append">
+ <javax.ws.rs.ext.RuntimeDelegate>org.apache.cxf.jaxrs.impl.RuntimeDelegateImpl</javax.ws.rs.ext.RuntimeDelegate>
+ </systemProperties>
<dependencies>
<dependency>
<type>eclipse-feature</type>
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/ArtifactQuery.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/ArtifactQuery.java
index aa29c431582..defa195c2ca 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/ArtifactQuery.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/ArtifactQuery.java
@@ -15,6 +15,7 @@ import static org.eclipse.osee.framework.core.enums.DeletionFlag.INCLUDE_DELETED
import static org.eclipse.osee.framework.core.enums.LoadLevel.ALL;
import static org.eclipse.osee.framework.skynet.core.artifact.LoadType.INCLUDE_CACHE;
import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
import java.util.ArrayList;
@@ -630,10 +631,14 @@ public class ArtifactQuery {
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
Object toReturn = null;
Method localMethod = getMethodFor(this.getClass(), method);
- if (localMethod != null) {
- toReturn = localMethod.invoke(this, args);
- } else {
- toReturn = invokeOnDelegate(proxied, method, args);
+ try {
+ if (localMethod != null) {
+ toReturn = localMethod.invoke(this, args);
+ } else {
+ toReturn = invokeOnDelegate(proxied, method, args);
+ }
+ } catch (InvocationTargetException e) {
+ throw e.getCause();
}
return toReturn;
}
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/ArtifactQueryBuilder.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/ArtifactQueryBuilder.java
index bff201b195d..02fcb85cdb2 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/ArtifactQueryBuilder.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/ArtifactQueryBuilder.java
@@ -15,6 +15,7 @@ import static org.eclipse.osee.framework.core.enums.DeletionFlag.INCLUDE_DELETED
import static org.eclipse.osee.framework.skynet.core.artifact.LoadType.INCLUDE_CACHE;
import static org.eclipse.osee.framework.skynet.core.artifact.LoadType.RELOAD_CACHE;
import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
import java.util.ArrayList;
@@ -371,7 +372,11 @@ public class ArtifactQueryBuilder {
Method localMethod = getMethodFor(getClass(), method);
if (localMethod != null) {
- toReturn = localMethod.invoke(this, args);
+ try {
+ toReturn = localMethod.invoke(this, args);
+ } catch (InvocationTargetException e) {
+ throw e.getCause();
+ }
if (toReturn == null) {
toReturn = proxy;
}
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/QueryBuilderArtifact.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/QueryBuilderArtifact.java
index 21fceacd55c..3fe5523be4d 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/QueryBuilderArtifact.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/QueryBuilderArtifact.java
@@ -22,6 +22,6 @@ public interface QueryBuilderArtifact extends QueryBuilder {
ResultSet<Artifact> getResults() throws OseeCoreException;
- ResultSet<ArtifactMatch> getMatches();
+ ResultSet<ArtifactMatch> getMatches() throws OseeCoreException;
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.jaxrs.client.test/.classpath b/plugins/org.eclipse.osee.jaxrs.client.test/.classpath
new file mode 100644
index 00000000000..ad32c83a788
--- /dev/null
+++ b/plugins/org.eclipse.osee.jaxrs.client.test/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/plugins/org.eclipse.osee.jaxrs.client.test/.project b/plugins/org.eclipse.osee.jaxrs.client.test/.project
new file mode 100644
index 00000000000..cbe73a9b584
--- /dev/null
+++ b/plugins/org.eclipse.osee.jaxrs.client.test/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.osee.jaxrs.client.test</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/plugins/org.eclipse.osee.jaxrs.client.test/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.jaxrs.client.test/META-INF/MANIFEST.MF
new file mode 100644
index 00000000000..05ae8553aad
--- /dev/null
+++ b/plugins/org.eclipse.osee.jaxrs.client.test/META-INF/MANIFEST.MF
@@ -0,0 +1,16 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: OSEE JAX-RS ClientTest (Incubation)
+Bundle-SymbolicName: org.eclipse.osee.jaxrs.client.test
+Bundle-Version: 0.18.0.qualifier
+Fragment-Host: org.eclipse.osee.jaxrs.client
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Bundle-Vendor: Eclipse Open System Engineering Environment
+Import-Package: org.hamcrest.core,
+ org.junit,
+ org.junit.rules,
+ org.junit.runner,
+ org.junit.runners,
+ org.mockito;bundle-version="1.9.0",
+ org.mockito.invocation,
+ org.mockito.stubbing
diff --git a/plugins/org.eclipse.osee.jaxrs.client.test/build.properties b/plugins/org.eclipse.osee.jaxrs.client.test/build.properties
new file mode 100644
index 00000000000..34d2e4d2dad
--- /dev/null
+++ b/plugins/org.eclipse.osee.jaxrs.client.test/build.properties
@@ -0,0 +1,4 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .
diff --git a/plugins/org.eclipse.osee.jaxrs.client.test/pom.xml b/plugins/org.eclipse.osee.jaxrs.client.test/pom.xml
new file mode 100644
index 00000000000..efdb530006e
--- /dev/null
+++ b/plugins/org.eclipse.osee.jaxrs.client.test/pom.xml
@@ -0,0 +1,30 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.eclipse.osee</groupId>
+ <artifactId>org.eclipse.osee.x.core.parent</artifactId>
+ <version>0.18.0-SNAPSHOT</version>
+ <relativePath>../../plugins/org.eclipse.osee.x.core.parent</relativePath>
+ </parent>
+
+ <artifactId>org.eclipse.osee.jaxrs.client.test</artifactId>
+ <packaging>eclipse-test-plugin</packaging>
+ <name>OSEE JAX-RS Client Test - (Incubation)</name>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.eclipse.tycho</groupId>
+ <artifactId>tycho-surefire-plugin</artifactId>
+ <version>${tycho-version}</version>
+ <configuration>
+ <testSuite>org.eclipse.osee.jaxrs.client.test</testSuite>
+ <testClass>org.eclipse.osee.jaxrs.client.JaxRsClientTestSuite</testClass>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/plugins/org.eclipse.osee.jaxrs.client.test/src/org/eclipse/osee/jaxrs/client/JaxRsClientBuilderTest.java b/plugins/org.eclipse.osee.jaxrs.client.test/src/org/eclipse/osee/jaxrs/client/JaxRsClientBuilderTest.java
new file mode 100644
index 00000000000..e47abd2d7f2
--- /dev/null
+++ b/plugins/org.eclipse.osee.jaxrs.client.test/src/org/eclipse/osee/jaxrs/client/JaxRsClientBuilderTest.java
@@ -0,0 +1,551 @@
+/*******************************************************************************
+ * Copyright (c) 2014 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.jaxrs.client;
+
+import static org.eclipse.osee.jaxrs.client.JaxRsClientConstants.CHUNK_LENGTH_MIN_LIMIT;
+import static org.eclipse.osee.jaxrs.client.JaxRsClientConstants.CHUNK_THRESHOLD_MIN_LIMIT;
+import static org.eclipse.osee.jaxrs.client.JaxRsClientConstants.DEFAULT_JAXRS_CLIENT_ASYNC_EXECUTE_TIMEOUT;
+import static org.eclipse.osee.jaxrs.client.JaxRsClientConstants.DEFAULT_JAXRS_CLIENT_ASYNC_EXECUTE_TIMEOUT_REJECTION;
+import static org.eclipse.osee.jaxrs.client.JaxRsClientConstants.DEFAULT_JAXRS_CLIENT_CHUNKING_ALLOWED;
+import static org.eclipse.osee.jaxrs.client.JaxRsClientConstants.DEFAULT_JAXRS_CLIENT_CHUNKING_THRESHOLD;
+import static org.eclipse.osee.jaxrs.client.JaxRsClientConstants.DEFAULT_JAXRS_CLIENT_CHUNK_SIZE;
+import static org.eclipse.osee.jaxrs.client.JaxRsClientConstants.DEFAULT_JAXRS_CLIENT_CONNECTION_TIMEOUT;
+import static org.eclipse.osee.jaxrs.client.JaxRsClientConstants.DEFAULT_JAXRS_CLIENT_CONNECTION_TYPE;
+import static org.eclipse.osee.jaxrs.client.JaxRsClientConstants.DEFAULT_JAXRS_CLIENT_CREATE_THREADSAFE_PROXY_CLIENTS;
+import static org.eclipse.osee.jaxrs.client.JaxRsClientConstants.DEFAULT_JAXRS_CLIENT_FOLLOW_REDIRECTS;
+import static org.eclipse.osee.jaxrs.client.JaxRsClientConstants.DEFAULT_JAXRS_CLIENT_MAX_RETRANSMITS;
+import static org.eclipse.osee.jaxrs.client.JaxRsClientConstants.DEFAULT_JAXRS_CLIENT_NON_PROXY_HOSTS;
+import static org.eclipse.osee.jaxrs.client.JaxRsClientConstants.DEFAULT_JAXRS_CLIENT_PROXY_ADDRESS;
+import static org.eclipse.osee.jaxrs.client.JaxRsClientConstants.DEFAULT_JAXRS_CLIENT_PROXY_AUTHORIZATION_TYPE;
+import static org.eclipse.osee.jaxrs.client.JaxRsClientConstants.DEFAULT_JAXRS_CLIENT_PROXY_CLIENT_SUB_RESOURCES_INHERIT_HEADERS;
+import static org.eclipse.osee.jaxrs.client.JaxRsClientConstants.DEFAULT_JAXRS_CLIENT_PROXY_PASSWORD;
+import static org.eclipse.osee.jaxrs.client.JaxRsClientConstants.DEFAULT_JAXRS_CLIENT_PROXY_PORT;
+import static org.eclipse.osee.jaxrs.client.JaxRsClientConstants.DEFAULT_JAXRS_CLIENT_PROXY_TYPE;
+import static org.eclipse.osee.jaxrs.client.JaxRsClientConstants.DEFAULT_JAXRS_CLIENT_PROXY_USERNAME;
+import static org.eclipse.osee.jaxrs.client.JaxRsClientConstants.DEFAULT_JAXRS_CLIENT_RECEIVE_TIMEOUT;
+import static org.eclipse.osee.jaxrs.client.JaxRsClientConstants.DEFAULT_JAXRS_CLIENT_SERVER_AUTHORIZATION_TYPE;
+import static org.eclipse.osee.jaxrs.client.JaxRsClientConstants.DEFAULT_JAXRS_CLIENT_SERVER_PASSWORD;
+import static org.eclipse.osee.jaxrs.client.JaxRsClientConstants.DEFAULT_JAXRS_CLIENT_SERVER_USERNAME;
+import static org.eclipse.osee.jaxrs.client.JaxRsClientConstants.JAXRS_CLIENT_ASYNC_EXECUTE_TIMEOUT;
+import static org.eclipse.osee.jaxrs.client.JaxRsClientConstants.JAXRS_CLIENT_ASYNC_EXECUTE_TIMEOUT_REJECTION;
+import static org.eclipse.osee.jaxrs.client.JaxRsClientConstants.JAXRS_CLIENT_CHUNKING_ALLOWED;
+import static org.eclipse.osee.jaxrs.client.JaxRsClientConstants.JAXRS_CLIENT_CHUNKING_THRESHOLD;
+import static org.eclipse.osee.jaxrs.client.JaxRsClientConstants.JAXRS_CLIENT_CHUNK_SIZE;
+import static org.eclipse.osee.jaxrs.client.JaxRsClientConstants.JAXRS_CLIENT_CONNECTION_TIMEOUT;
+import static org.eclipse.osee.jaxrs.client.JaxRsClientConstants.JAXRS_CLIENT_CONNECTION_TYPE;
+import static org.eclipse.osee.jaxrs.client.JaxRsClientConstants.JAXRS_CLIENT_CREATE_THREADSAFE_PROXY_CLIENTS;
+import static org.eclipse.osee.jaxrs.client.JaxRsClientConstants.JAXRS_CLIENT_FOLLOW_REDIRECTS;
+import static org.eclipse.osee.jaxrs.client.JaxRsClientConstants.JAXRS_CLIENT_MAX_RETRANSMITS;
+import static org.eclipse.osee.jaxrs.client.JaxRsClientConstants.JAXRS_CLIENT_NON_PROXY_HOSTS;
+import static org.eclipse.osee.jaxrs.client.JaxRsClientConstants.JAXRS_CLIENT_PROXY_ADDRESS;
+import static org.eclipse.osee.jaxrs.client.JaxRsClientConstants.JAXRS_CLIENT_PROXY_AUTHORIZATION_TYPE;
+import static org.eclipse.osee.jaxrs.client.JaxRsClientConstants.JAXRS_CLIENT_PROXY_CLIENT_SUB_RESOURCES_INHERIT_HEADERS;
+import static org.eclipse.osee.jaxrs.client.JaxRsClientConstants.JAXRS_CLIENT_PROXY_PASSWORD;
+import static org.eclipse.osee.jaxrs.client.JaxRsClientConstants.JAXRS_CLIENT_PROXY_TYPE;
+import static org.eclipse.osee.jaxrs.client.JaxRsClientConstants.JAXRS_CLIENT_PROXY_USERNAME;
+import static org.eclipse.osee.jaxrs.client.JaxRsClientConstants.JAXRS_CLIENT_RECEIVE_TIMEOUT;
+import static org.eclipse.osee.jaxrs.client.JaxRsClientConstants.JAXRS_CLIENT_SERVER_AUTHORIZATION_TYPE;
+import static org.eclipse.osee.jaxrs.client.JaxRsClientConstants.JAXRS_CLIENT_SERVER_PASSWORD;
+import static org.eclipse.osee.jaxrs.client.JaxRsClientConstants.JAXRS_CLIENT_SERVER_USERNAME;
+import static org.eclipse.osee.jaxrs.client.JaxRsClientConstants.RETRANSMIT_MIN_LIMIT;
+import static org.eclipse.osee.jaxrs.client.JaxRsClientConstants.TIMEOUT_MIN_LIMIT;
+import static org.junit.Assert.assertEquals;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+import javax.ws.rs.client.WebTarget;
+import org.eclipse.osee.jaxrs.client.JaxRsClient.JaxRsClientBuilder;
+import org.eclipse.osee.jaxrs.client.JaxRsClient.JaxRsClientFactory;
+import org.eclipse.osee.jaxrs.client.JaxRsClientConstants.ConnectionType;
+import org.eclipse.osee.jaxrs.client.JaxRsClientConstants.ProxyType;
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.ArgumentCaptor;
+import org.mockito.Captor;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+
+/**
+ * Test Case for {@link JaxRsClientBuilder}
+ *
+ * @author Roberto E. Escobar
+ */
+public class JaxRsClientBuilderTest {
+
+ private static final long POSITIVE_TIMEOUT = Long.MAX_VALUE;
+ private static final long NEGATIVE_TIMEOUT = Long.MIN_VALUE;
+ private static final int POSITIVE_INT = Integer.MAX_VALUE;
+ private static final int NEGATIVE_INT = Integer.MIN_VALUE;
+
+ private static final String PROXY_ADDRESS = "proxy-address.com";
+ private static final int PROXY_PORT = 78612;
+
+ private static final long ASYNC_EXECUTE_TIMEOUT = 32423L;
+ private static final boolean ASYNC_EXECUTE_TIMEOUT_REJECTION = true;
+ private static final int CHUNK_SIZE = 864;
+ private static final boolean CHUNKING_ALLOWED = true;
+ private static final int CHUNKING_THRESHOLD = 9872394;
+ private static final long CONNECTION_TIMEOUT = 2327L;
+ private static final ConnectionType CONNECTION_TYPE = ConnectionType.CLOSE;
+ private static final boolean CREATE_THREADSAFE_PROXY_CLIENTS = true;
+ private static final boolean FOLLOW_REDIRECTS = false;
+ private static final int MAX_RETRANSMITS = 452;
+ private static final String NON_PROXY_HOSTS = "non-proxy-hosts";
+ private static final String FULL_PROXY_ADDRESS = "http://" + PROXY_ADDRESS + ":" + PROXY_PORT;
+ private static final String PROXY_AUTHORIZATION_TYPE = "proxy-authentication-type";
+ private static final boolean PROXY_CLIENT_SUB_RESOURCES_INHERIT_HEADERS = true;
+ private static final String PROXY_PASSWORD = "proxy-password";
+ private static final ProxyType PROXY_TYPE = ProxyType.SOCKS;
+ private static final String PROXY_USERNAME = "proxy-username";
+ private static final long RECEIVE_TIMEOUT = 87532L;
+ private static final String SERVER_AUTHORIZATION_TYPE = "server-authentication-type";
+ private static final String SERVER_PASSWORD = "server-password";
+ private static final String SERVER_USERNAME = "server-username";
+
+ //@formatter:off
+ @Mock private JaxRsClientFactory factory;
+ @Mock private Map<String, Object> properties;
+ @Mock private WebTarget target;
+ @Captor private ArgumentCaptor<Map<String, Object>> propCaptor;
+ //@formatter:on
+
+ private JaxRsClientBuilder builder;
+
+ @Before
+ public void setup() {
+ MockitoAnnotations.initMocks(this);
+
+ builder = new JaxRsClientBuilder(factory);
+ }
+
+ @Test
+ public void testAllowChunking() {
+ builder.allowChunking(true);
+ assertEquals(true, builder.isChunkingAllowed());
+
+ builder.allowChunking(false);
+ assertEquals(false, builder.isChunkingAllowed());
+ }
+
+ @Test
+ public void testAsyncExecTimeout() {
+ builder.asyncExecTimeout(POSITIVE_TIMEOUT);
+ assertEquals(POSITIVE_TIMEOUT, builder.getAsyncExecuteTimeout());
+
+ builder.asyncExecTimeout(NEGATIVE_TIMEOUT);
+ assertEquals(TIMEOUT_MIN_LIMIT, builder.getAsyncExecuteTimeout());
+ }
+
+ @Test
+ public void testAsyncTimeoutRejection() {
+ builder.asyncExecTimeoutRejection(true);
+ assertEquals(true, builder.isAsyncExecuteTimeoutRejection());
+
+ builder.asyncExecTimeoutRejection(false);
+ assertEquals(false, builder.isAsyncExecuteTimeoutRejection());
+ }
+
+ @Test
+ public void testConnectionTimeout() {
+ builder.connectionTimeout(POSITIVE_TIMEOUT);
+ assertEquals(POSITIVE_TIMEOUT, builder.getConnectionTimeout());
+
+ builder.connectionTimeout(NEGATIVE_TIMEOUT);
+ assertEquals(TIMEOUT_MIN_LIMIT, builder.getConnectionTimeout());
+ }
+
+ @Test
+ public void testReceiveTimeout() {
+ builder.receiveTimeout(POSITIVE_TIMEOUT);
+ assertEquals(POSITIVE_TIMEOUT, builder.getReceiveTimeout());
+
+ builder.receiveTimeout(NEGATIVE_TIMEOUT);
+ assertEquals(TIMEOUT_MIN_LIMIT, builder.getReceiveTimeout());
+ }
+
+ @Test
+ public void testConnectionType() {
+ builder.connectionType(ConnectionType.CLOSE);
+ assertEquals(ConnectionType.CLOSE, builder.getConnectionType());
+
+ builder.connectionType(null);
+ assertEquals(ConnectionType.KEEP_ALIVE, builder.getConnectionType());
+ }
+
+ @Test
+ public void testProxyType() {
+ builder.proxyType(ProxyType.SOCKS);
+
+ builder.proxyType(ProxyType.SOCKS);
+ assertEquals(ProxyType.SOCKS, builder.getProxyType());
+
+ builder.proxyType(null);
+ assertEquals(ProxyType.HTTP, builder.getProxyType());
+ }
+
+ @Test
+ public void testFollowRedirects() {
+ builder.followRedirects(true);
+ assertEquals(true, builder.isFollowRedirectsAllowed());
+
+ builder.followRedirects(false);
+ assertEquals(false, builder.isFollowRedirectsAllowed());
+ }
+
+ @Test
+ public void testChunkingSize() {
+ builder.chunkLength(POSITIVE_INT);
+ assertEquals(POSITIVE_INT, builder.getChunkLength());
+
+ builder.chunkLength(NEGATIVE_INT);
+ assertEquals(CHUNK_LENGTH_MIN_LIMIT, builder.getChunkLength());
+ }
+
+ @Test
+ public void testChunkingThreshold() {
+ builder.chunkingThreshold(POSITIVE_INT);
+ assertEquals(POSITIVE_INT, builder.getChunkingThreshold());
+
+ builder.chunkingThreshold(NEGATIVE_INT);
+ assertEquals(CHUNK_THRESHOLD_MIN_LIMIT, builder.getChunkingThreshold());
+ }
+
+ @Test
+ public void testMaxRetransmit() {
+ builder.maxRetransmits(POSITIVE_INT);
+ assertEquals(POSITIVE_INT, builder.getMaxRetransmits());
+
+ builder.maxRetransmits(NEGATIVE_INT);
+ assertEquals(RETRANSMIT_MIN_LIMIT, builder.getMaxRetransmits());
+ }
+
+ @Test
+ public void testCreateThreadSafeProxyClients() {
+ builder.createThreadSafeProxyClients(true);
+ assertEquals(true, builder.isCreateThreadSafeProxyClients());
+
+ builder.createThreadSafeProxyClients(false);
+ assertEquals(false, builder.isCreateThreadSafeProxyClients());
+ }
+
+ @Test
+ public void testProxyClientSubResourcesInheritHeaders() {
+ builder.proxyClientSubResourcesInheritHeaders(true);
+ assertEquals(true, builder.isProxyClientSubResourcesInheritHeaders());
+
+ builder.proxyClientSubResourcesInheritHeaders(false);
+ assertEquals(false, builder.isProxyClientSubResourcesInheritHeaders());
+ }
+
+ @Test
+ public void testNonProxyHosts() {
+ builder.nonProxyHosts(NON_PROXY_HOSTS);
+ assertEquals(NON_PROXY_HOSTS, builder.getNonProxyHosts());
+ }
+
+ @Test
+ public void testProxyAddress() {
+ builder.proxyAddress(FULL_PROXY_ADDRESS);
+
+ assertEquals(FULL_PROXY_ADDRESS, builder.getFullProxyAddress());
+ assertEquals(PROXY_ADDRESS, builder.getProxyAddress());
+ assertEquals(PROXY_PORT, builder.getProxyPort());
+ }
+
+ @Test
+ public void testProxyAuthorizationType() {
+ builder.proxyAuthorizationType(PROXY_AUTHORIZATION_TYPE);
+ assertEquals(PROXY_AUTHORIZATION_TYPE, builder.getProxyAuthorizationType());
+ }
+
+ @Test
+ public void testProxyPassword() {
+ builder.proxyPassword(PROXY_PASSWORD);
+ assertEquals(PROXY_PASSWORD, builder.getProxyPassword());
+ }
+
+ @Test
+ public void testProxyUsername() {
+ builder.proxyUsername(PROXY_USERNAME);
+ assertEquals(PROXY_USERNAME, builder.getProxyUsername());
+ }
+
+ @Test
+ public void testServerAuthorizationType() {
+ builder.authorizationType(SERVER_AUTHORIZATION_TYPE);
+ assertEquals(SERVER_AUTHORIZATION_TYPE, builder.getServerAuthorizationType());
+ }
+
+ @Test
+ public void testServerPassword() {
+ builder.password(SERVER_PASSWORD);
+ assertEquals(SERVER_PASSWORD, builder.getServerPassword());
+ }
+
+ @Test
+ public void testServerUsername() {
+ builder.username(SERVER_USERNAME);
+ assertEquals(SERVER_USERNAME, builder.getServerUsername());
+ }
+
+ @Test
+ public void testDefaultProperties() {
+ Map<String, Object> properties = new HashMap<String, Object>();
+ builder.properties(properties);
+
+ JaxRsClient actual = builder.build();
+ JaxRsClientConfig config = actual.getConfig();
+
+ //@formatter:off
+ assertEquals(DEFAULT_JAXRS_CLIENT_ASYNC_EXECUTE_TIMEOUT, config.getAsyncExecuteTimeout());
+ assertEquals(DEFAULT_JAXRS_CLIENT_CHUNKING_THRESHOLD, config.getChunkingThreshold());
+ assertEquals(DEFAULT_JAXRS_CLIENT_CHUNK_SIZE, config.getChunkLength());
+ assertEquals(DEFAULT_JAXRS_CLIENT_CONNECTION_TIMEOUT, config.getConnectionTimeout());
+ assertEquals(DEFAULT_JAXRS_CLIENT_CONNECTION_TYPE, config.getConnectionType());
+ assertEquals(DEFAULT_JAXRS_CLIENT_PROXY_ADDRESS, config.getFullProxyAddress());
+ assertEquals(DEFAULT_JAXRS_CLIENT_MAX_RETRANSMITS, config.getMaxRetransmits());
+ assertEquals(DEFAULT_JAXRS_CLIENT_NON_PROXY_HOSTS, config.getNonProxyHosts());
+ assertEquals(DEFAULT_JAXRS_CLIENT_PROXY_AUTHORIZATION_TYPE, config.getProxyAuthorizationType());
+ assertEquals(DEFAULT_JAXRS_CLIENT_PROXY_ADDRESS, config.getProxyAddress());
+ assertEquals(DEFAULT_JAXRS_CLIENT_PROXY_PASSWORD, config.getProxyPassword());
+ assertEquals(DEFAULT_JAXRS_CLIENT_PROXY_PORT, config.getProxyPort());
+ assertEquals(DEFAULT_JAXRS_CLIENT_PROXY_TYPE, config.getProxyType());
+ assertEquals(DEFAULT_JAXRS_CLIENT_PROXY_USERNAME, config.getProxyUsername());
+ assertEquals(DEFAULT_JAXRS_CLIENT_RECEIVE_TIMEOUT, config.getReceiveTimeout());
+ assertEquals(DEFAULT_JAXRS_CLIENT_SERVER_AUTHORIZATION_TYPE, config.getServerAuthorizationType());
+ assertEquals(DEFAULT_JAXRS_CLIENT_SERVER_PASSWORD, config.getServerPassword());
+ assertEquals(DEFAULT_JAXRS_CLIENT_SERVER_USERNAME, config.getServerUsername());
+ assertEquals(DEFAULT_JAXRS_CLIENT_ASYNC_EXECUTE_TIMEOUT_REJECTION, config.isAsyncExecuteTimeoutRejection());
+ assertEquals(DEFAULT_JAXRS_CLIENT_CHUNKING_ALLOWED, config.isChunkingAllowed());
+ assertEquals(DEFAULT_JAXRS_CLIENT_CREATE_THREADSAFE_PROXY_CLIENTS, config.isCreateThreadSafeProxyClients());
+ assertEquals(DEFAULT_JAXRS_CLIENT_FOLLOW_REDIRECTS, config.isFollowRedirectsAllowed());
+ assertEquals(DEFAULT_JAXRS_CLIENT_PROXY_CLIENT_SUB_RESOURCES_INHERIT_HEADERS, config.isProxyClientSubResourcesInheritHeaders());
+ assertEquals(false, config.isProxyAuthorizationRequired());
+ assertEquals(false, config.isProxyRequired());
+ assertEquals(false, config.isServerAuthorizationRequired());
+ //@formatter:on
+ }
+
+ @Test
+ public void testPropertiesDefaultsWithNegatives() {
+ Map<String, Object> props = new HashMap<String, Object>();
+ props.put(JAXRS_CLIENT_CONNECTION_TIMEOUT, NEGATIVE_TIMEOUT);
+ props.put(JAXRS_CLIENT_RECEIVE_TIMEOUT, NEGATIVE_TIMEOUT);
+ props.put(JAXRS_CLIENT_MAX_RETRANSMITS, NEGATIVE_INT);
+ props.put(JAXRS_CLIENT_CHUNKING_THRESHOLD, NEGATIVE_INT);
+ props.put(JAXRS_CLIENT_CHUNK_SIZE, NEGATIVE_INT);
+ props.put(JAXRS_CLIENT_ASYNC_EXECUTE_TIMEOUT, NEGATIVE_TIMEOUT);
+ builder.properties(props);
+
+ JaxRsClient actual = builder.build();
+ JaxRsClientConfig config = actual.getConfig();
+
+ //@formatter:off
+ assertEquals(TIMEOUT_MIN_LIMIT, config.getAsyncExecuteTimeout());
+ assertEquals(CHUNK_THRESHOLD_MIN_LIMIT, config.getChunkingThreshold());
+ assertEquals(CHUNK_LENGTH_MIN_LIMIT, config.getChunkLength());
+ assertEquals(TIMEOUT_MIN_LIMIT, config.getConnectionTimeout());
+ assertEquals(DEFAULT_JAXRS_CLIENT_CONNECTION_TYPE, config.getConnectionType());
+ assertEquals(DEFAULT_JAXRS_CLIENT_PROXY_ADDRESS, config.getFullProxyAddress());
+ assertEquals(RETRANSMIT_MIN_LIMIT, config.getMaxRetransmits());
+ assertEquals(DEFAULT_JAXRS_CLIENT_NON_PROXY_HOSTS, config.getNonProxyHosts());
+ assertEquals(DEFAULT_JAXRS_CLIENT_PROXY_AUTHORIZATION_TYPE, config.getProxyAuthorizationType());
+ assertEquals(DEFAULT_JAXRS_CLIENT_PROXY_ADDRESS, config.getProxyAddress());
+ assertEquals(DEFAULT_JAXRS_CLIENT_PROXY_PASSWORD, config.getProxyPassword());
+ assertEquals(DEFAULT_JAXRS_CLIENT_PROXY_PORT, config.getProxyPort());
+ assertEquals(DEFAULT_JAXRS_CLIENT_PROXY_TYPE, config.getProxyType());
+ assertEquals(DEFAULT_JAXRS_CLIENT_PROXY_USERNAME, config.getProxyUsername());
+ assertEquals(TIMEOUT_MIN_LIMIT, config.getReceiveTimeout());
+ assertEquals(DEFAULT_JAXRS_CLIENT_SERVER_AUTHORIZATION_TYPE, config.getServerAuthorizationType());
+ assertEquals(DEFAULT_JAXRS_CLIENT_SERVER_PASSWORD, config.getServerPassword());
+ assertEquals(DEFAULT_JAXRS_CLIENT_SERVER_USERNAME, config.getServerUsername());
+ assertEquals(DEFAULT_JAXRS_CLIENT_ASYNC_EXECUTE_TIMEOUT_REJECTION, config.isAsyncExecuteTimeoutRejection());
+ assertEquals(DEFAULT_JAXRS_CLIENT_CHUNKING_ALLOWED, config.isChunkingAllowed());
+ assertEquals(DEFAULT_JAXRS_CLIENT_CREATE_THREADSAFE_PROXY_CLIENTS, config.isCreateThreadSafeProxyClients());
+ assertEquals(DEFAULT_JAXRS_CLIENT_FOLLOW_REDIRECTS, config.isFollowRedirectsAllowed());
+ assertEquals(DEFAULT_JAXRS_CLIENT_PROXY_CLIENT_SUB_RESOURCES_INHERIT_HEADERS, config.isProxyClientSubResourcesInheritHeaders());
+ assertEquals(false, config.isProxyAuthorizationRequired());
+ assertEquals(false, config.isProxyRequired());
+ assertEquals(false, config.isServerAuthorizationRequired());
+ //@formatter:on
+ }
+
+ @Test
+ public void testProperties() {
+ Map<String, Object> props = new HashMap<String, Object>();
+ props.put(JAXRS_CLIENT_ASYNC_EXECUTE_TIMEOUT, ASYNC_EXECUTE_TIMEOUT);
+ props.put(JAXRS_CLIENT_ASYNC_EXECUTE_TIMEOUT_REJECTION, ASYNC_EXECUTE_TIMEOUT_REJECTION);
+ props.put(JAXRS_CLIENT_CHUNK_SIZE, CHUNK_SIZE);
+ props.put(JAXRS_CLIENT_CHUNKING_ALLOWED, CHUNKING_ALLOWED);
+ props.put(JAXRS_CLIENT_CHUNKING_THRESHOLD, CHUNKING_THRESHOLD);
+ props.put(JAXRS_CLIENT_CONNECTION_TIMEOUT, CONNECTION_TIMEOUT);
+ props.put(JAXRS_CLIENT_CONNECTION_TYPE, CONNECTION_TYPE);
+ props.put(JAXRS_CLIENT_CREATE_THREADSAFE_PROXY_CLIENTS, CREATE_THREADSAFE_PROXY_CLIENTS);
+ props.put(JAXRS_CLIENT_FOLLOW_REDIRECTS, FOLLOW_REDIRECTS);
+ props.put(JAXRS_CLIENT_MAX_RETRANSMITS, MAX_RETRANSMITS);
+ props.put(JAXRS_CLIENT_NON_PROXY_HOSTS, NON_PROXY_HOSTS);
+ props.put(JAXRS_CLIENT_PROXY_ADDRESS, FULL_PROXY_ADDRESS);
+ props.put(JAXRS_CLIENT_PROXY_AUTHORIZATION_TYPE, PROXY_AUTHORIZATION_TYPE);
+ props.put(JAXRS_CLIENT_PROXY_CLIENT_SUB_RESOURCES_INHERIT_HEADERS, PROXY_CLIENT_SUB_RESOURCES_INHERIT_HEADERS);
+ props.put(JAXRS_CLIENT_PROXY_PASSWORD, PROXY_PASSWORD);
+ props.put(JAXRS_CLIENT_PROXY_TYPE, PROXY_TYPE);
+ props.put(JAXRS_CLIENT_PROXY_USERNAME, PROXY_USERNAME);
+ props.put(JAXRS_CLIENT_RECEIVE_TIMEOUT, RECEIVE_TIMEOUT);
+ props.put(JAXRS_CLIENT_SERVER_AUTHORIZATION_TYPE, SERVER_AUTHORIZATION_TYPE);
+ props.put(JAXRS_CLIENT_SERVER_PASSWORD, SERVER_PASSWORD);
+ props.put(JAXRS_CLIENT_SERVER_USERNAME, SERVER_USERNAME);
+
+ builder.properties(props);
+
+ JaxRsClient actual = builder.build();
+ JaxRsClientConfig config = actual.getConfig();
+
+ assertEquals(ASYNC_EXECUTE_TIMEOUT, config.getAsyncExecuteTimeout());
+ assertEquals(ASYNC_EXECUTE_TIMEOUT_REJECTION, config.isAsyncExecuteTimeoutRejection());
+ assertEquals(CHUNK_SIZE, config.getChunkLength());
+ assertEquals(CHUNKING_ALLOWED, config.isChunkingAllowed());
+ assertEquals(CHUNKING_THRESHOLD, config.getChunkingThreshold());
+ assertEquals(CONNECTION_TIMEOUT, config.getConnectionTimeout());
+ assertEquals(CONNECTION_TYPE, config.getConnectionType());
+ assertEquals(CREATE_THREADSAFE_PROXY_CLIENTS, config.isCreateThreadSafeProxyClients());
+ assertEquals(FOLLOW_REDIRECTS, config.isFollowRedirectsAllowed());
+ assertEquals(MAX_RETRANSMITS, config.getMaxRetransmits());
+ assertEquals(NON_PROXY_HOSTS, config.getNonProxyHosts());
+ assertEquals(PROXY_ADDRESS, config.getProxyAddress());
+ assertEquals(PROXY_AUTHORIZATION_TYPE, config.getProxyAuthorizationType());
+ assertEquals(PROXY_CLIENT_SUB_RESOURCES_INHERIT_HEADERS, config.isProxyClientSubResourcesInheritHeaders());
+ assertEquals(PROXY_PASSWORD, config.getProxyPassword());
+ assertEquals(PROXY_TYPE, config.getProxyType());
+ assertEquals(PROXY_USERNAME, config.getProxyUsername());
+ assertEquals(RECEIVE_TIMEOUT, config.getReceiveTimeout());
+ assertEquals(SERVER_AUTHORIZATION_TYPE, config.getServerAuthorizationType());
+ assertEquals(SERVER_PASSWORD, config.getServerPassword());
+ assertEquals(SERVER_USERNAME, config.getServerUsername());
+ assertEquals(FULL_PROXY_ADDRESS, config.getFullProxyAddress());
+ assertEquals(true, config.isProxyAuthorizationRequired());
+ assertEquals(true, config.isProxyRequired());
+ assertEquals(true, config.isServerAuthorizationRequired());
+ }
+
+ @Test
+ public void testNoChangeAfterBuild() {
+ builder.allowChunking(CHUNKING_ALLOWED);
+ builder.asyncExecTimeout(ASYNC_EXECUTE_TIMEOUT);
+ builder.asyncExecTimeoutRejection(ASYNC_EXECUTE_TIMEOUT_REJECTION);
+ builder.chunkingThreshold(CHUNKING_THRESHOLD);
+ builder.chunkLength(CHUNK_SIZE);
+ builder.connectionTimeout(CONNECTION_TIMEOUT);
+ builder.connectionType(CONNECTION_TYPE);
+ builder.createThreadSafeProxyClients(CREATE_THREADSAFE_PROXY_CLIENTS);
+ builder.followRedirects(FOLLOW_REDIRECTS);
+ builder.maxRetransmits(MAX_RETRANSMITS);
+ builder.nonProxyHosts(NON_PROXY_HOSTS);
+ builder.proxyAddress(FULL_PROXY_ADDRESS);
+ builder.proxyAuthorizationType(PROXY_AUTHORIZATION_TYPE);
+ builder.proxyClientSubResourcesInheritHeaders(PROXY_CLIENT_SUB_RESOURCES_INHERIT_HEADERS);
+ builder.proxyPassword(PROXY_PASSWORD);
+ builder.proxyType(PROXY_TYPE);
+ builder.proxyUsername(PROXY_USERNAME);
+ builder.receiveTimeout(RECEIVE_TIMEOUT);
+ builder.authorizationType(SERVER_AUTHORIZATION_TYPE);
+ builder.password(SERVER_PASSWORD);
+ builder.username(SERVER_USERNAME);
+
+ JaxRsClient actual = builder.build();
+ JaxRsClientConfig config = actual.getConfig();
+
+ assertEquals(ASYNC_EXECUTE_TIMEOUT, config.getAsyncExecuteTimeout());
+ assertEquals(ASYNC_EXECUTE_TIMEOUT_REJECTION, config.isAsyncExecuteTimeoutRejection());
+ assertEquals(CHUNK_SIZE, config.getChunkLength());
+ assertEquals(CHUNKING_ALLOWED, config.isChunkingAllowed());
+ assertEquals(CHUNKING_THRESHOLD, config.getChunkingThreshold());
+ assertEquals(CONNECTION_TIMEOUT, config.getConnectionTimeout());
+ assertEquals(CONNECTION_TYPE, config.getConnectionType());
+ assertEquals(CREATE_THREADSAFE_PROXY_CLIENTS, config.isCreateThreadSafeProxyClients());
+ assertEquals(FOLLOW_REDIRECTS, config.isFollowRedirectsAllowed());
+ assertEquals(MAX_RETRANSMITS, config.getMaxRetransmits());
+ assertEquals(NON_PROXY_HOSTS, config.getNonProxyHosts());
+ assertEquals(PROXY_ADDRESS, config.getProxyAddress());
+ assertEquals(PROXY_AUTHORIZATION_TYPE, config.getProxyAuthorizationType());
+ assertEquals(PROXY_CLIENT_SUB_RESOURCES_INHERIT_HEADERS, config.isProxyClientSubResourcesInheritHeaders());
+ assertEquals(PROXY_PASSWORD, config.getProxyPassword());
+ assertEquals(PROXY_TYPE, config.getProxyType());
+ assertEquals(PROXY_USERNAME, config.getProxyUsername());
+ assertEquals(RECEIVE_TIMEOUT, config.getReceiveTimeout());
+ assertEquals(SERVER_AUTHORIZATION_TYPE, config.getServerAuthorizationType());
+ assertEquals(SERVER_PASSWORD, config.getServerPassword());
+ assertEquals(SERVER_USERNAME, config.getServerUsername());
+ assertEquals(FULL_PROXY_ADDRESS, config.getFullProxyAddress());
+ assertEquals(true, config.isProxyAuthorizationRequired());
+ assertEquals(true, config.isProxyRequired());
+ assertEquals(true, config.isServerAuthorizationRequired());
+
+ builder.properties(Collections.<String, Object> emptyMap());
+
+ actual = builder.build();
+ JaxRsClientConfig config2 = actual.getConfig();
+
+ assertEquals(ASYNC_EXECUTE_TIMEOUT, config.getAsyncExecuteTimeout());
+ assertEquals(ASYNC_EXECUTE_TIMEOUT_REJECTION, config.isAsyncExecuteTimeoutRejection());
+ assertEquals(CHUNK_SIZE, config.getChunkLength());
+ assertEquals(CHUNKING_ALLOWED, config.isChunkingAllowed());
+ assertEquals(CHUNKING_THRESHOLD, config.getChunkingThreshold());
+ assertEquals(CONNECTION_TIMEOUT, config.getConnectionTimeout());
+ assertEquals(CONNECTION_TYPE, config.getConnectionType());
+ assertEquals(CREATE_THREADSAFE_PROXY_CLIENTS, config.isCreateThreadSafeProxyClients());
+ assertEquals(FOLLOW_REDIRECTS, config.isFollowRedirectsAllowed());
+ assertEquals(MAX_RETRANSMITS, config.getMaxRetransmits());
+ assertEquals(NON_PROXY_HOSTS, config.getNonProxyHosts());
+ assertEquals(PROXY_ADDRESS, config.getProxyAddress());
+ assertEquals(PROXY_AUTHORIZATION_TYPE, config.getProxyAuthorizationType());
+ assertEquals(PROXY_CLIENT_SUB_RESOURCES_INHERIT_HEADERS, config.isProxyClientSubResourcesInheritHeaders());
+ assertEquals(PROXY_PASSWORD, config.getProxyPassword());
+ assertEquals(PROXY_TYPE, config.getProxyType());
+ assertEquals(PROXY_USERNAME, config.getProxyUsername());
+ assertEquals(RECEIVE_TIMEOUT, config.getReceiveTimeout());
+ assertEquals(SERVER_AUTHORIZATION_TYPE, config.getServerAuthorizationType());
+ assertEquals(SERVER_PASSWORD, config.getServerPassword());
+ assertEquals(SERVER_USERNAME, config.getServerUsername());
+ assertEquals(FULL_PROXY_ADDRESS, config.getFullProxyAddress());
+ assertEquals(true, config.isProxyAuthorizationRequired());
+ assertEquals(true, config.isProxyRequired());
+ assertEquals(true, config.isServerAuthorizationRequired());
+
+ //@formatter:off
+ assertEquals(DEFAULT_JAXRS_CLIENT_ASYNC_EXECUTE_TIMEOUT, config2.getAsyncExecuteTimeout());
+ assertEquals(DEFAULT_JAXRS_CLIENT_CHUNKING_THRESHOLD, config2.getChunkingThreshold());
+ assertEquals(DEFAULT_JAXRS_CLIENT_CHUNK_SIZE, config2.getChunkLength());
+ assertEquals(DEFAULT_JAXRS_CLIENT_CONNECTION_TIMEOUT, config2.getConnectionTimeout());
+ assertEquals(DEFAULT_JAXRS_CLIENT_CONNECTION_TYPE, config2.getConnectionType());
+ assertEquals(DEFAULT_JAXRS_CLIENT_PROXY_ADDRESS, config2.getFullProxyAddress());
+ assertEquals(DEFAULT_JAXRS_CLIENT_MAX_RETRANSMITS, config2.getMaxRetransmits());
+ assertEquals(DEFAULT_JAXRS_CLIENT_NON_PROXY_HOSTS, config2.getNonProxyHosts());
+ assertEquals(DEFAULT_JAXRS_CLIENT_PROXY_AUTHORIZATION_TYPE, config2.getProxyAuthorizationType());
+ assertEquals(DEFAULT_JAXRS_CLIENT_PROXY_ADDRESS, config2.getProxyAddress());
+ assertEquals(DEFAULT_JAXRS_CLIENT_PROXY_PASSWORD, config2.getProxyPassword());
+ assertEquals(DEFAULT_JAXRS_CLIENT_PROXY_PORT, config2.getProxyPort());
+ assertEquals(DEFAULT_JAXRS_CLIENT_PROXY_TYPE, config2.getProxyType());
+ assertEquals(DEFAULT_JAXRS_CLIENT_PROXY_USERNAME, config2.getProxyUsername());
+ assertEquals(DEFAULT_JAXRS_CLIENT_RECEIVE_TIMEOUT, config2.getReceiveTimeout());
+ assertEquals(DEFAULT_JAXRS_CLIENT_SERVER_AUTHORIZATION_TYPE, config2.getServerAuthorizationType());
+ assertEquals(DEFAULT_JAXRS_CLIENT_SERVER_PASSWORD, config2.getServerPassword());
+ assertEquals(DEFAULT_JAXRS_CLIENT_SERVER_USERNAME, config2.getServerUsername());
+ assertEquals(DEFAULT_JAXRS_CLIENT_ASYNC_EXECUTE_TIMEOUT_REJECTION, config2.isAsyncExecuteTimeoutRejection());
+ assertEquals(DEFAULT_JAXRS_CLIENT_CHUNKING_ALLOWED, config2.isChunkingAllowed());
+ assertEquals(DEFAULT_JAXRS_CLIENT_CREATE_THREADSAFE_PROXY_CLIENTS, config2.isCreateThreadSafeProxyClients());
+ assertEquals(DEFAULT_JAXRS_CLIENT_FOLLOW_REDIRECTS, config2.isFollowRedirectsAllowed());
+ assertEquals(DEFAULT_JAXRS_CLIENT_PROXY_CLIENT_SUB_RESOURCES_INHERIT_HEADERS, config2.isProxyClientSubResourcesInheritHeaders());
+ assertEquals(false, config2.isProxyAuthorizationRequired());
+ assertEquals(false, config2.isProxyRequired());
+ assertEquals(false, config2.isServerAuthorizationRequired());
+ //@formatter:on
+ }
+}
diff --git a/plugins/org.eclipse.osee.jaxrs.client.test/src/org/eclipse/osee/jaxrs/client/JaxRsClientTest.java b/plugins/org.eclipse.osee.jaxrs.client.test/src/org/eclipse/osee/jaxrs/client/JaxRsClientTest.java
new file mode 100644
index 00000000000..f726dc577f9
--- /dev/null
+++ b/plugins/org.eclipse.osee.jaxrs.client.test/src/org/eclipse/osee/jaxrs/client/JaxRsClientTest.java
@@ -0,0 +1,115 @@
+/*******************************************************************************
+ * Copyright (c) 2014 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.jaxrs.client;
+
+import static org.junit.Assert.assertEquals;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+import java.net.URI;
+import java.net.URISyntaxException;
+import javax.ws.rs.client.WebTarget;
+import org.eclipse.osee.jaxrs.client.JaxRsClient.JaxRsClientFactory;
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.mockito.invocation.InvocationOnMock;
+import org.mockito.stubbing.Answer;
+
+/**
+ * Test Case for {@link JaxRsClient}
+ *
+ * @author Roberto E. Escobar
+ */
+public class JaxRsClientTest {
+
+ private static final String URI_STRING = "hello";
+ private static final String URI = "http://hello.com";
+
+ //@formatter:off
+ @Mock private JaxRsClientFactory factory;
+ @Mock private JaxRsClientConfig config;
+ @Mock private WebTarget target;
+ //@formatter:on
+
+ private JaxRsClient client;
+
+ @Before
+ public void setup() {
+ MockitoAnnotations.initMocks(this);
+
+ client = new JaxRsClient(factory, config);
+ }
+
+ @Test
+ public void testTargetEmpty() {
+ when(factory.newTarget(config, null)).thenReturn(target);
+
+ WebTarget actual = client.target();
+ assertEquals(target, actual);
+ verify(factory).newTarget(config, null);
+ }
+
+ @Test
+ public void testTargetString() {
+ when(factory.newTarget(config, URI_STRING)).thenReturn(target);
+
+ WebTarget actual = client.target(URI_STRING);
+ assertEquals(target, actual);
+ verify(factory).newTarget(config, URI_STRING);
+ }
+
+ @Test
+ public void testTargetURI() throws URISyntaxException {
+ URI expectedUri = new URI(URI);
+
+ when(factory.newTarget(config, URI)).thenReturn(target);
+
+ WebTarget actual = client.target(expectedUri);
+ assertEquals(target, actual);
+ verify(factory).newTarget(config, URI);
+ }
+
+ @Test
+ public void testTargetProxyString() {
+ String instance = URI_STRING;
+ Class<?> clazz = String.class;
+
+ when(factory.newClient(config, URI_STRING, clazz)).thenAnswer(answer(instance));
+
+ Object actual = client.targetProxy(URI_STRING, clazz);
+ assertEquals(instance, actual);
+ verify(factory).newClient(config, URI_STRING, clazz);
+ }
+
+ @Test
+ public void testTargetProxyURI() throws URISyntaxException {
+ URI expectedUri = new URI(URI);
+ String instance = URI_STRING;
+ Class<?> clazz = String.class;
+
+ when(factory.newClient(config, URI, clazz)).thenAnswer(answer(instance));
+
+ Object actual = client.targetProxy(expectedUri, clazz);
+ assertEquals(instance, actual);
+ verify(factory).newClient(config, URI, clazz);
+ }
+
+ private static <T> Answer<T> answer(final T object) {
+ return new Answer<T>() {
+
+ @Override
+ public T answer(InvocationOnMock invocation) throws Throwable {
+ return object;
+ }
+ };
+ }
+}
diff --git a/plugins/org.eclipse.osee.jaxrs.client.test/src/org/eclipse/osee/jaxrs/client/JaxRsClientTestSuite.java b/plugins/org.eclipse.osee.jaxrs.client.test/src/org/eclipse/osee/jaxrs/client/JaxRsClientTestSuite.java
new file mode 100644
index 00000000000..e193491af8e
--- /dev/null
+++ b/plugins/org.eclipse.osee.jaxrs.client.test/src/org/eclipse/osee/jaxrs/client/JaxRsClientTestSuite.java
@@ -0,0 +1,24 @@
+/*******************************************************************************
+ * Copyright (c) 2014 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.jaxrs.client;
+
+import org.eclipse.osee.jaxrs.client.internal.JaxRsClientInternalTestSuite;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+/**
+ * @author Roberto E. Escobar
+ */
+@RunWith(Suite.class)
+@Suite.SuiteClasses({JaxRsClientInternalTestSuite.class, JaxRsClientBuilderTest.class, JaxRsClientTest.class})
+public class JaxRsClientTestSuite {
+ // Test Suite
+}
diff --git a/plugins/org.eclipse.osee.jaxrs.client.test/src/org/eclipse/osee/jaxrs/client/internal/JaxRsClientInternalTestSuite.java b/plugins/org.eclipse.osee.jaxrs.client.test/src/org/eclipse/osee/jaxrs/client/internal/JaxRsClientInternalTestSuite.java
new file mode 100644
index 00000000000..5a2b2640639
--- /dev/null
+++ b/plugins/org.eclipse.osee.jaxrs.client.test/src/org/eclipse/osee/jaxrs/client/internal/JaxRsClientInternalTestSuite.java
@@ -0,0 +1,24 @@
+/*******************************************************************************
+ * Copyright (c) 2014 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.jaxrs.client.internal;
+
+import org.eclipse.osee.jaxrs.client.internal.ext.JaxRsClientExtTestSuite;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+/**
+ * @author Roberto E. Escobar
+ */
+@RunWith(Suite.class)
+@Suite.SuiteClasses({JaxRsClientExtTestSuite.class})
+public class JaxRsClientInternalTestSuite {
+ // Test Suite
+}
diff --git a/plugins/org.eclipse.osee.jaxrs.client.test/src/org/eclipse/osee/jaxrs/client/internal/ext/CxfJaxRsClientConfiguratorTest.java b/plugins/org.eclipse.osee.jaxrs.client.test/src/org/eclipse/osee/jaxrs/client/internal/ext/CxfJaxRsClientConfiguratorTest.java
new file mode 100644
index 00000000000..83efe424752
--- /dev/null
+++ b/plugins/org.eclipse.osee.jaxrs.client.test/src/org/eclipse/osee/jaxrs/client/internal/ext/CxfJaxRsClientConfiguratorTest.java
@@ -0,0 +1,409 @@
+/*******************************************************************************
+ * Copyright (c) 2014 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.jaxrs.client.internal.ext;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.mockito.Matchers.anyInt;
+import static org.mockito.Matchers.anyString;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import javax.ws.rs.client.ClientBuilder;
+import javax.ws.rs.ext.RuntimeDelegate;
+import org.apache.cxf.configuration.security.AuthorizationPolicy;
+import org.apache.cxf.configuration.security.ProxyAuthorizationPolicy;
+import org.apache.cxf.feature.LoggingFeature;
+import org.apache.cxf.jaxrs.client.JAXRSClientFactoryBean;
+import org.apache.cxf.jaxrs.client.ThreadLocalClientState;
+import org.apache.cxf.transport.common.gzip.GZIPFeature;
+import org.apache.cxf.transport.http.HTTPConduit;
+import org.apache.cxf.transports.http.configuration.HTTPClientPolicy;
+import org.apache.cxf.transports.http.configuration.ProxyServerType;
+import org.codehaus.jackson.jaxrs.JacksonJaxbJsonProvider;
+import org.codehaus.jackson.jaxrs.JsonMappingExceptionMapper;
+import org.codehaus.jackson.jaxrs.JsonParseExceptionMapper;
+import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
+import org.eclipse.osee.jaxrs.client.JaxRsClientConfig;
+import org.eclipse.osee.jaxrs.client.JaxRsClientConstants.ConnectionType;
+import org.eclipse.osee.jaxrs.client.JaxRsClientConstants.ProxyType;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.mockito.ArgumentCaptor;
+import org.mockito.Captor;
+import org.mockito.Matchers;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+
+/**
+ * Test Case for {@link CxfJaxRsClientConfigurator}
+ *
+ * @author Roberto E. Escobar
+ */
+public class CxfJaxRsClientConfiguratorTest {
+
+ private static final String SERVER_ADDRESS = "http://hello.com";
+
+ private static final long ASYNC_EXECUTE_TIMEOUT = 32423L;
+ private static final boolean ASYNC_EXECUTE_TIMEOUT_REJECTION = true;
+ private static final int CHUNK_SIZE = 864;
+ private static final boolean CHUNKING_ALLOWED = true;
+ private static final int CHUNKING_THRESHOLD = 9872394;
+ private static final long CONNECTION_TIMEOUT = 2327L;
+ private static final ConnectionType CONNECTION_TYPE = ConnectionType.CLOSE;
+ private static final boolean FOLLOW_REDIRECTS = false;
+ private static final int MAX_RETRANSMITS = 452;
+ private static final String NON_PROXY_HOSTS = "non-proxy-hosts";
+ private static final String PROXY_ADDRESS = "proxy-address.com";
+ private static final int PROXY_PORT = 78612;
+ private static final String PROXY_AUTHORIZATION_TYPE = "proxy-authentication-type";
+ private static final String PROXY_PASSWORD = "proxy-password";
+ private static final ProxyType PROXY_TYPE = ProxyType.SOCKS;
+ private static final String PROXY_USERNAME = "proxy-username";
+ private static final long RECEIVE_TIMEOUT = 87532L;
+ private static final String SERVER_AUTHORIZATION_TYPE = "server-authentication-type";
+ private static final String SERVER_PASSWORD = "server-password";
+ private static final String SERVER_USERNAME = "server-username";
+
+ private static final ProxyServerType CXF_PROXY_SERVER_TYPE = ProxyServerType.SOCKS;
+ private static final org.apache.cxf.transports.http.configuration.ConnectionType CXF_CONNECTION_TYPE =
+ org.apache.cxf.transports.http.configuration.ConnectionType.CLOSE;
+
+ @Rule
+ public ExpectedException thrown = ExpectedException.none();
+
+ //@formatter:off
+ @Mock private JaxRsClientConfig config;
+ @Mock private HTTPConduit conduit;
+ @Mock private ClientBuilder builder;
+ @Mock private JAXRSClientFactoryBean bean;
+
+ @Mock private HTTPClientPolicy policy1;
+ @Mock private AuthorizationPolicy policy2;
+ @Mock private ProxyAuthorizationPolicy policy3;
+
+ @Captor private ArgumentCaptor<Object> captor;
+ @Captor private ArgumentCaptor<HTTPClientPolicy> captor1;
+ @Captor private ArgumentCaptor<AuthorizationPolicy> captor2;
+ @Captor private ArgumentCaptor<ProxyAuthorizationPolicy> captor3;
+ //@formatter:on
+
+ private Map<String, Object> props;
+ private CxfJaxRsClientConfigurator configurator;
+ private String mapAsString;
+
+ @Before
+ public void setup() {
+ MockitoAnnotations.initMocks(this);
+
+ configurator = new CxfJaxRsClientConfigurator();
+
+ props = new LinkedHashMap<String, Object>();
+ props.put("a", "1");
+ props.put("b", "2");
+ props.put("c", "3");
+ mapAsString = props.toString();
+ }
+
+ @Test
+ public void testConfigureJaxRsRuntime() {
+ configurator.configureJaxRsRuntime();
+
+ assertEquals(org.apache.cxf.jaxrs.impl.RuntimeDelegateImpl.class, RuntimeDelegate.getInstance().getClass());
+ assertEquals("org.apache.cxf.jaxrs.client.spec.ClientBuilderImpl",
+ System.getProperty("javax.ws.rs.client.ClientBuilder"));
+ }
+
+ @Test
+ public void testConfigureDefaults() {
+ configurator.configureDefaults(props);
+
+ Iterator<? extends Object> iterator = configurator.getFeatures().iterator();
+ assertEquals(LoggingFeature.class, iterator.next().getClass());
+ assertEquals(GZIPFeature.class, iterator.next().getClass());
+
+ iterator = configurator.getProviders().iterator();
+ assertEquals(GenericResponseExceptionMapper.class, iterator.next().getClass());
+ assertEquals(JacksonJaxbJsonProvider.class, iterator.next().getClass());
+ assertEquals(JsonParseExceptionMapper.class, iterator.next());
+ assertEquals(JsonMappingExceptionMapper.class, iterator.next());
+
+ assertEquals(mapAsString, configurator.getProperties().toString());
+ }
+
+ @Test
+ public void testConfigureBean() {
+ when(config.isCreateThreadSafeProxyClients()).thenReturn(true);
+ when(config.isProxyClientSubResourcesInheritHeaders()).thenReturn(true);
+
+ configurator.configureBean(config, SERVER_ADDRESS, bean);
+
+ verify(bean).setProviders(configurator.getProviders());
+ verify(bean).setFeatures(configurator.getFeatures());
+ verify(bean).setProperties(configurator.getProperties());
+ verify(bean).setInheritHeaders(true);
+ verify(bean).setInitialState(Matchers.<ThreadLocalClientState> any());
+
+ verify(config).isCreateThreadSafeProxyClients();
+ verify(config).isProxyClientSubResourcesInheritHeaders();
+ }
+
+ @Test
+ public void testConfigureBeanOptionsFalse() {
+ when(config.isCreateThreadSafeProxyClients()).thenReturn(false);
+ when(config.isProxyClientSubResourcesInheritHeaders()).thenReturn(false);
+
+ configurator.configureBean(config, SERVER_ADDRESS, bean);
+
+ verify(bean).setProviders(configurator.getProviders());
+ verify(bean).setFeatures(configurator.getFeatures());
+ verify(bean).setProperties(configurator.getProperties());
+ verify(bean).setInheritHeaders(false);
+ verify(bean, times(0)).setInitialState(Matchers.<ThreadLocalClientState> any());
+
+ verify(config).isCreateThreadSafeProxyClients();
+ verify(config).isProxyClientSubResourcesInheritHeaders();
+ }
+
+ @Test
+ public void testConfigureBeanServerAddressNull() {
+ thrown.expect(OseeCoreException.class);
+ thrown.expectMessage("server address cannot be null");
+ configurator.configureBean(config, null, bean);
+ }
+
+ @Test
+ public void testConfigureBeanServerAddressEmpty() {
+ thrown.expect(OseeCoreException.class);
+ thrown.expectMessage("server address cannot be empty");
+ configurator.configureBean(config, "", bean);
+ }
+
+ @Test
+ public void testConfigureClientBuilder() {
+ configurator.configureDefaults(props);
+ configurator.configureClientBuilder(config, builder);
+
+ verify(builder, times(6)).register(captor.capture());
+
+ List<Object> actual = captor.getAllValues();
+ assertEquals(6, actual.size());
+
+ Iterator<Object> iterator = actual.iterator();
+ assertEquals(GenericResponseExceptionMapper.class, iterator.next().getClass());
+ assertEquals(JacksonJaxbJsonProvider.class, iterator.next().getClass());
+ assertEquals(JsonParseExceptionMapper.class, iterator.next());
+ assertEquals(JsonMappingExceptionMapper.class, iterator.next());
+ assertEquals(LoggingFeature.class, iterator.next().getClass());
+ assertEquals(GZIPFeature.class, iterator.next().getClass());
+
+ verify(builder).property("a", "1");
+ verify(builder).property("b", "2");
+ verify(builder).property("c", "3");
+ }
+
+ @Test
+ public void testConfigureConduitWithAuthorization() {
+ when(conduit.getClient()).thenReturn(policy1);
+ when(conduit.getAuthorization()).thenReturn(policy2);
+
+ when(config.isChunkingAllowed()).thenReturn(CHUNKING_ALLOWED);
+ when(config.getAsyncExecuteTimeout()).thenReturn(ASYNC_EXECUTE_TIMEOUT);
+ when(config.isAsyncExecuteTimeoutRejection()).thenReturn(ASYNC_EXECUTE_TIMEOUT_REJECTION);
+ when(config.isFollowRedirectsAllowed()).thenReturn(FOLLOW_REDIRECTS);
+ when(config.getChunkingThreshold()).thenReturn(CHUNKING_THRESHOLD);
+ when(config.getChunkLength()).thenReturn(CHUNK_SIZE);
+ when(config.getConnectionType()).thenReturn(CONNECTION_TYPE);
+ when(config.getConnectionTimeout()).thenReturn(CONNECTION_TIMEOUT);
+ when(config.getMaxRetransmits()).thenReturn(MAX_RETRANSMITS);
+ when(config.getReceiveTimeout()).thenReturn(RECEIVE_TIMEOUT);
+
+ when(config.isServerAuthorizationRequired()).thenReturn(true);
+ when(config.getServerUsername()).thenReturn(SERVER_USERNAME);
+ when(config.getServerPassword()).thenReturn(SERVER_PASSWORD);
+ when(config.getServerAuthorizationType()).thenReturn(SERVER_AUTHORIZATION_TYPE);
+
+ configurator.configureConnection(config, conduit);
+
+ verify(conduit).getClient();
+ verify(policy1).setAllowChunking(CHUNKING_ALLOWED);
+ verify(policy1).setAsyncExecuteTimeout(ASYNC_EXECUTE_TIMEOUT);
+ verify(policy1).setAsyncExecuteTimeoutRejection(ASYNC_EXECUTE_TIMEOUT_REJECTION);
+ verify(policy1).setAutoRedirect(FOLLOW_REDIRECTS);
+ verify(policy1).setChunkingThreshold(CHUNKING_THRESHOLD);
+ verify(policy1).setChunkLength(CHUNK_SIZE);
+ verify(policy1).setConnection(CXF_CONNECTION_TYPE);
+ verify(policy1).setConnectionTimeout(CONNECTION_TIMEOUT);
+ verify(policy1).setMaxRetransmits(MAX_RETRANSMITS);
+ verify(policy1).setReceiveTimeout(RECEIVE_TIMEOUT);
+
+ verify(conduit).getAuthorization();
+ verify(policy2).setUserName(SERVER_USERNAME);
+ verify(policy2).setPassword(SERVER_PASSWORD);
+ verify(policy2).setAuthorizationType(SERVER_AUTHORIZATION_TYPE);
+
+ verify(conduit, times(0)).getProxyAuthorization();
+ verify(conduit, times(0)).setClient(Matchers.<HTTPClientPolicy> any());
+ verify(conduit, times(0)).setAuthorization(Matchers.<AuthorizationPolicy> any());
+ verify(conduit, times(0)).setProxyAuthorization(Matchers.<ProxyAuthorizationPolicy> any());
+ }
+
+ @Test
+ public void testConfigureConduitNoAuthorization() {
+ when(conduit.getClient()).thenReturn(policy1);
+ when(conduit.getAuthorization()).thenReturn(policy2);
+
+ when(config.isChunkingAllowed()).thenReturn(CHUNKING_ALLOWED);
+ when(config.getAsyncExecuteTimeout()).thenReturn(ASYNC_EXECUTE_TIMEOUT);
+ when(config.isAsyncExecuteTimeoutRejection()).thenReturn(ASYNC_EXECUTE_TIMEOUT_REJECTION);
+ when(config.isFollowRedirectsAllowed()).thenReturn(FOLLOW_REDIRECTS);
+ when(config.getChunkingThreshold()).thenReturn(CHUNKING_THRESHOLD);
+ when(config.getChunkLength()).thenReturn(CHUNK_SIZE);
+ when(config.getConnectionType()).thenReturn(CONNECTION_TYPE);
+ when(config.getConnectionTimeout()).thenReturn(CONNECTION_TIMEOUT);
+ when(config.getMaxRetransmits()).thenReturn(MAX_RETRANSMITS);
+ when(config.getReceiveTimeout()).thenReturn(RECEIVE_TIMEOUT);
+
+ when(config.isServerAuthorizationRequired()).thenReturn(false);
+ when(config.getServerUsername()).thenReturn(SERVER_USERNAME);
+ when(config.getServerPassword()).thenReturn(SERVER_PASSWORD);
+ when(config.getServerAuthorizationType()).thenReturn(SERVER_AUTHORIZATION_TYPE);
+
+ configurator.configureConnection(config, conduit);
+
+ verify(conduit).getClient();
+ verify(policy1).setAllowChunking(CHUNKING_ALLOWED);
+ verify(policy1).setAsyncExecuteTimeout(ASYNC_EXECUTE_TIMEOUT);
+ verify(policy1).setAsyncExecuteTimeoutRejection(ASYNC_EXECUTE_TIMEOUT_REJECTION);
+ verify(policy1).setAutoRedirect(FOLLOW_REDIRECTS);
+ verify(policy1).setChunkingThreshold(CHUNKING_THRESHOLD);
+ verify(policy1).setChunkLength(CHUNK_SIZE);
+ verify(policy1).setConnection(CXF_CONNECTION_TYPE);
+ verify(policy1).setConnectionTimeout(CONNECTION_TIMEOUT);
+ verify(policy1).setMaxRetransmits(MAX_RETRANSMITS);
+ verify(policy1).setReceiveTimeout(RECEIVE_TIMEOUT);
+
+ verify(conduit, times(0)).getAuthorization();
+ verify(policy2, times(0)).setUserName(anyString());
+ verify(policy2, times(0)).setPassword(anyString());
+ verify(policy2, times(0)).setAuthorizationType(anyString());
+
+ verify(conduit, times(0)).getProxyAuthorization();
+ }
+
+ @Test
+ public void testConfigureProxyNotRequired() {
+ when(config.isProxyRequired()).thenReturn(false);
+
+ configurator.configureProxy(config, conduit);
+
+ verify(conduit, times(0)).getClient();
+ verify(policy1, times(0)).setProxyServer(anyString());
+ verify(policy1, times(0)).setProxyServerPort(anyInt());
+ verify(policy1, times(0)).setNonProxyHosts(anyString());
+ verify(policy1, times(0)).setProxyServerType(Matchers.<ProxyServerType> any());
+
+ verify(conduit, times(0)).getProxyAuthorization();
+ verify(policy3, times(0)).setUserName(anyString());
+ verify(policy3, times(0)).setPassword(anyString());
+ verify(policy3, times(0)).setAuthorizationType(anyString());
+ }
+
+ @Test
+ public void testConfigureProxyWithAuthorization() {
+ when(conduit.getClient()).thenReturn(policy1);
+ when(conduit.getProxyAuthorization()).thenReturn(policy3);
+
+ when(config.isProxyRequired()).thenReturn(true);
+ when(config.getNonProxyHosts()).thenReturn(NON_PROXY_HOSTS);
+ when(config.getProxyType()).thenReturn(PROXY_TYPE);
+
+ when(config.isProxyAuthorizationRequired()).thenReturn(true);
+ when(config.getProxyAddress()).thenReturn(PROXY_ADDRESS);
+ when(config.getProxyPort()).thenReturn(PROXY_PORT);
+ when(config.getProxyUsername()).thenReturn(PROXY_USERNAME);
+ when(config.getProxyPassword()).thenReturn(PROXY_PASSWORD);
+ when(config.getProxyAuthorizationType()).thenReturn(PROXY_AUTHORIZATION_TYPE);
+
+ configurator.configureProxy(config, conduit);
+
+ verify(conduit).getClient();
+ verify(policy1).setProxyServer(PROXY_ADDRESS);
+ verify(policy1).setProxyServerPort(PROXY_PORT);
+ verify(policy1).setNonProxyHosts(NON_PROXY_HOSTS);
+ verify(policy1).setProxyServerType(CXF_PROXY_SERVER_TYPE);
+
+ verify(conduit).getProxyAuthorization();
+ verify(policy3).setUserName(PROXY_USERNAME);
+ verify(policy3).setPassword(PROXY_PASSWORD);
+ verify(policy3).setAuthorizationType(PROXY_AUTHORIZATION_TYPE);
+
+ verify(conduit, times(0)).getAuthorization();
+ verify(conduit, times(0)).setClient(Matchers.<HTTPClientPolicy> any());
+ verify(conduit, times(0)).setAuthorization(Matchers.<AuthorizationPolicy> any());
+ verify(conduit, times(0)).setProxyAuthorization(Matchers.<ProxyAuthorizationPolicy> any());
+ }
+
+ @Test
+ public void testConfigureProxyNoPortAndNoAuthorization() {
+ when(conduit.getClient()).thenReturn(policy1);
+
+ when(config.isProxyRequired()).thenReturn(true);
+ when(config.getNonProxyHosts()).thenReturn(NON_PROXY_HOSTS);
+ when(config.getProxyType()).thenReturn(PROXY_TYPE);
+
+ when(config.isProxyAuthorizationRequired()).thenReturn(false);
+ when(config.getProxyAddress()).thenReturn(PROXY_ADDRESS);
+ when(config.getProxyPort()).thenReturn(-1);
+
+ configurator.configureProxy(config, conduit);
+
+ verify(conduit).getClient();
+ verify(policy1).setProxyServer(PROXY_ADDRESS);
+ verify(policy1, times(0)).setProxyServerPort(anyInt());
+ verify(policy1).setNonProxyHosts(NON_PROXY_HOSTS);
+ verify(policy1).setProxyServerType(CXF_PROXY_SERVER_TYPE);
+
+ verify(conduit, times(0)).getProxyAuthorization();
+ verify(policy3, times(0)).setUserName(anyString());
+ verify(policy3, times(0)).setPassword(anyString());
+ verify(policy3, times(0)).setAuthorizationType(anyString());
+ }
+
+ @Test
+ public void testConduitPolicyNull() {
+ when(conduit.getClient()).thenReturn(null);
+ when(conduit.getAuthorization()).thenReturn(null);
+ when(conduit.getProxyAuthorization()).thenReturn(null);
+
+ when(config.isProxyRequired()).thenReturn(true);
+ when(config.isProxyAuthorizationRequired()).thenReturn(true);
+ when(config.isServerAuthorizationRequired()).thenReturn(true);
+
+ configurator.configureConnection(config, conduit);
+ configurator.configureProxy(config, conduit);
+
+ verify(conduit, times(2)).setClient(captor1.capture());
+ verify(conduit).setAuthorization(captor2.capture());
+ verify(conduit).setProxyAuthorization(captor3.capture());
+
+ assertNotNull(captor1.getValue());
+ assertNotNull(captor2.getValue());
+ assertNotNull(captor3.getValue());
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.jaxrs.client.test/src/org/eclipse/osee/jaxrs/client/internal/ext/JaxRsClientExtTestSuite.java b/plugins/org.eclipse.osee.jaxrs.client.test/src/org/eclipse/osee/jaxrs/client/internal/ext/JaxRsClientExtTestSuite.java
new file mode 100644
index 00000000000..2b270c63476
--- /dev/null
+++ b/plugins/org.eclipse.osee.jaxrs.client.test/src/org/eclipse/osee/jaxrs/client/internal/ext/JaxRsClientExtTestSuite.java
@@ -0,0 +1,24 @@
+/*******************************************************************************
+ * Copyright (c) 2014 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.jaxrs.client.internal.ext;
+
+import org.eclipse.osee.jaxrs.client.internal.ext.CxfJaxRsClientConfiguratorTest;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+/**
+ * @author Roberto E. Escobar
+ */
+@RunWith(Suite.class)
+@Suite.SuiteClasses({CxfJaxRsClientConfiguratorTest.class})
+public class JaxRsClientExtTestSuite {
+ // Test Suite
+}
diff --git a/plugins/org.eclipse.osee.jaxrs.client/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.jaxrs.client/META-INF/MANIFEST.MF
index d101cf05a5c..0a17714d048 100644
--- a/plugins/org.eclipse.osee.jaxrs.client/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.osee.jaxrs.client/META-INF/MANIFEST.MF
@@ -6,28 +6,27 @@ Bundle-Version: 0.18.0.qualifier
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-Vendor: Eclipse Open System Engineering Environment
Bundle-ActivationPolicy: lazy
-Import-Package: com.google.inject,
- com.google.inject.binder,
- com.google.inject.matcher,
- com.google.inject.name,
- com.google.inject.spi,
- com.google.inject.util,
- javax.inject,
- javax.ws.rs,
- javax.ws.rs.core,
+Import-Package: javax.servlet;version="2.6.0",
+ javax.servlet.http;version="2.6.0",
+ javax.ws.rs;version="2.0.0",
+ javax.ws.rs.client;version="2.0.0",
+ javax.ws.rs.core;version="2.0.0",
+ javax.ws.rs.ext;version="2.0.0",
+ org.apache.aries.blueprint;version="1.3.0",
+ org.apache.cxf.configuration.security;version="3.0.0",
+ org.apache.cxf.endpoint;version="3.0.0",
+ org.apache.cxf.feature;version="3.0.0",
+ org.apache.cxf.jaxrs;version="3.0.0",
+ org.apache.cxf.jaxrs.client;version="3.0.0",
+ org.apache.cxf.jaxrs.client.spec;version="3.0.0",
+ org.apache.cxf.jaxrs.impl;version="3.0.0",
+ org.apache.cxf.transport.common.gzip;version="3.0.0",
+ org.apache.cxf.transport.http;version="3.0.0",
+ org.apache.cxf.transports.http.configuration;version="3.0.0",
+ org.codehaus.jackson.jaxrs;version="1.9.13",
org.eclipse.osee.framework.jdk.core.type,
org.eclipse.osee.framework.jdk.core.util,
org.eclipse.osee.jaxrs
Export-Package: org.eclipse.osee.jaxrs.client
-Require-Bundle: org.eclipse.core.runtime;visibility:=reexport,
- javax.servlet;visibility:=reexport,
- com.google.inject,
- org.apache.commons.httpclient;visibility:=reexport,
- org.apache.commons.logging;visibility:=reexport,
- org.apache.log4j;visibility:=reexport,
- org.slf4j.api;visibility:=reexport,
- org.codehaus.jackson.core;visibility:=reexport,
- org.codehaus.jackson.jaxrs;visibility:=reexport,
- org.codehaus.jackson.mapper;visibility:=reexport,
- com.sun.jersey;bundle-version="1.18.0",
- com.sun.jersey.client.apache;bundle-version="1.18.0"
+Require-Bundle: org.codehaus.stax2;bundle-version="3.1.4",
+ com.ctc.wstx;bundle-version="4.3.0"
diff --git a/plugins/org.eclipse.osee.jaxrs.client/src/org/eclipse/osee/jaxrs/client/JaxRsClient.java b/plugins/org.eclipse.osee.jaxrs.client/src/org/eclipse/osee/jaxrs/client/JaxRsClient.java
index d844de6be05..387512cdb57 100644
--- a/plugins/org.eclipse.osee.jaxrs.client/src/org/eclipse/osee/jaxrs/client/JaxRsClient.java
+++ b/plugins/org.eclipse.osee.jaxrs.client/src/org/eclipse/osee/jaxrs/client/JaxRsClient.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2012 Boeing.
+ * Copyright (c) 2014 Boeing.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -11,18 +11,246 @@
package org.eclipse.osee.jaxrs.client;
import java.net.URI;
-import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
-import com.sun.jersey.api.client.UniformInterfaceException;
-import com.sun.jersey.api.client.WebResource;
+import java.util.Map;
+import javax.ws.rs.client.WebTarget;
+import org.eclipse.osee.jaxrs.client.JaxRsClientConstants.ConnectionType;
+import org.eclipse.osee.jaxrs.client.JaxRsClientConstants.ProxyType;
+import org.eclipse.osee.jaxrs.client.internal.JaxRsClientRuntime;
/**
- * @author John Misinco
* @author Roberto E. Escobar
*/
-public interface JaxRsClient {
+public final class JaxRsClient {
- WebResource createResource(URI uri) throws OseeCoreException;
+ public interface JaxRsClientFactory {
- RuntimeException handleException(UniformInterfaceException ex);
+ <T> T newClient(JaxRsClientConfig config, String serverAddress, Class<T> clazz);
+
+ WebTarget newTarget(JaxRsClientConfig config, String serverAddress);
+ }
+
+ public static JaxRsClientBuilder newBuilder() {
+ JaxRsClientFactory factory = JaxRsClientRuntime.getClientFactoryInstance();
+ return new JaxRsClientBuilder(factory);
+ }
+
+ public static JaxRsClientBuilder newBuilder(JaxRsClientConfig config) {
+ return newBuilder().withConfig(config);
+ }
+
+ public static JaxRsClientBuilder newBuilder(Map<String, Object> properties) {
+ return newBuilder().properties(properties);
+ }
+
+ public static JaxRsClient newClient() {
+ return newBuilder().build();
+ }
+
+ public static JaxRsClient fromConfig(JaxRsClientConfig config) {
+ return newBuilder(config).build();
+ }
+
+ public static JaxRsClient fromProperties(Map<String, Object> properties) {
+ return newBuilder(properties).build();
+ }
+
+ private final JaxRsClientConfig config;
+ private final JaxRsClientFactory factory;
+
+ protected JaxRsClient(JaxRsClientFactory factory, JaxRsClientConfig config) {
+ super();
+ this.config = config;
+ this.factory = factory;
+ }
+
+ /**
+ * Creates a JAX-RS WebTarget
+ *
+ * @return target
+ */
+ public WebTarget target() {
+ return target((String) null);
+ }
+
+ /**
+ * Creates a JAX-RS WebTarget
+ *
+ * @param baseAddress
+ * @return target
+ */
+ public WebTarget target(URI address) {
+ return target(address != null ? address.toString() : null);
+ }
+
+ /**
+ * Creates a JAX-RS WebTarget
+ *
+ * @param baseAddress
+ * @return target
+ */
+ public WebTarget target(String address) {
+ return factory.newTarget(config, address);
+ }
+
+ /**
+ * Proxy sub-resource methods returning Objects can not be invoked. Prefer to have sub-resource methods returning
+ * typed classes: interfaces, abstract classes or concrete implementations.
+ *
+ * @param endpointAddress - address to the endpoint represented by clazz
+ * @param clazz - JAX-RS annotated class used to create a proxy client
+ * @return targetProxy
+ */
+ public <T> T targetProxy(URI address, Class<T> clazz) {
+ return targetProxy(address != null ? address.toString() : null, clazz);
+ }
+
+ /**
+ * Proxy sub-resource methods returning Objects can not be invoked. Prefer to have sub-resource methods returning
+ * typed classes: interfaces, abstract classes or concrete implementations.
+ *
+ * @param endpointAddress - address to the endpoint represented by clazz
+ * @param clazz - JAX-RS annotated class used to create a proxy client
+ * @return targetProxy
+ */
+ public <T> T targetProxy(String address, Class<T> clazz) {
+ return factory.newClient(config, address, clazz);
+ }
+
+ /**
+ * JAX-RS Client configuration
+ *
+ * @return config
+ */
+ public JaxRsClientConfig getConfig() {
+ return config;
+ }
+
+ public static final class JaxRsClientBuilder extends JaxRsClientConfig {
+
+ private final JaxRsClientFactory factory;
+
+ protected JaxRsClientBuilder(JaxRsClientFactory factory) {
+ super();
+ this.factory = factory;
+ }
+
+ private JaxRsClientBuilder withConfig(JaxRsClientConfig config) {
+ return this;
+ }
+
+ public JaxRsClientBuilder properties(Map<String, Object> src) {
+ readProperties(src);
+ return this;
+ }
+
+ public JaxRsClientBuilder asyncExecTimeout(long asyncExecuteTimeout) {
+ setAsyncExecuteTimeout(asyncExecuteTimeout);
+ return this;
+ }
+
+ public JaxRsClientBuilder asyncExecTimeoutRejection(boolean asyncExecuteTimeoutRejection) {
+ setAsyncExecuteTimeoutRejection(asyncExecuteTimeoutRejection);
+ return this;
+ }
+
+ public JaxRsClientBuilder followRedirects(boolean followRedirectsAutomatically) {
+ setFollowRedirects(followRedirectsAutomatically);
+ return this;
+ }
+
+ public JaxRsClientBuilder allowChunking(boolean chunkingAllowed) {
+ setChunkingAllowed(chunkingAllowed);
+ return this;
+ }
+
+ public JaxRsClientBuilder chunkingThreshold(int chunkingThreshold) {
+ setChunkingThreshold(chunkingThreshold);
+ return this;
+ }
+
+ public JaxRsClientBuilder chunkLength(int chunkLength) {
+ setChunkLength(chunkLength);
+ return this;
+ }
+
+ public JaxRsClientBuilder connectionTimeout(long connectionTimeoutInMillis) {
+ setConnectionTimeout(connectionTimeoutInMillis);
+ return this;
+ }
+
+ public JaxRsClientBuilder connectionType(ConnectionType connectionType) {
+ setConnectionType(connectionType);
+ return this;
+ }
+
+ public JaxRsClientBuilder maxRetransmits(int maxRetransmits) {
+ setMaxRetransmits(maxRetransmits);
+ return this;
+ }
+
+ public JaxRsClientBuilder nonProxyHosts(String nonProxyHosts) {
+ setNonProxyHosts(nonProxyHosts);
+ return this;
+ }
+
+ public JaxRsClientBuilder proxyAddress(String proxyAddress) {
+ setProxyAddress(proxyAddress);
+ return this;
+ }
+
+ public JaxRsClientBuilder proxyAuthorizationType(String proxyAuthorizationType) {
+ setProxyAuthorizationType(proxyAuthorizationType);
+ return this;
+ }
+
+ public JaxRsClientBuilder proxyPassword(String proxyPassword) {
+ setProxyPassword(proxyPassword);
+ return this;
+ }
+
+ public JaxRsClientBuilder proxyType(ProxyType proxyType) {
+ setProxyType(proxyType);
+ return this;
+ }
+
+ public JaxRsClientBuilder proxyUsername(String proxyUsername) {
+ setProxyUsername(proxyUsername);
+ return this;
+ }
+
+ public JaxRsClientBuilder receiveTimeout(long receiveTimeoutInMillis) {
+ setReceiveTimeout(receiveTimeoutInMillis);
+ return this;
+ }
+
+ public JaxRsClientBuilder authorizationType(String serverAuthorizationType) {
+ setServerAuthorizationType(serverAuthorizationType);
+ return this;
+ }
+
+ public JaxRsClientBuilder password(String serverPassword) {
+ setServerPassword(serverPassword);
+ return this;
+ }
+
+ public JaxRsClientBuilder username(String serverUsername) {
+ setServerUsername(serverUsername);
+ return this;
+ }
+
+ public JaxRsClientBuilder createThreadSafeProxyClients(boolean createThreadSafeClients) {
+ setCreateThreadSafeProxyClients(createThreadSafeClients);
+ return this;
+ }
+
+ public JaxRsClientBuilder proxyClientSubResourcesInheritHeaders(boolean inheritHeaders) {
+ setProxyClientSubResourcesInheritHeaders(inheritHeaders);
+ return this;
+ }
+
+ public JaxRsClient build() {
+ return new JaxRsClient(factory, copy());
+ }
+ }
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.jaxrs.client/src/org/eclipse/osee/jaxrs/client/JaxRsClientConfig.java b/plugins/org.eclipse.osee.jaxrs.client/src/org/eclipse/osee/jaxrs/client/JaxRsClientConfig.java
new file mode 100644
index 00000000000..957a2bf8b22
--- /dev/null
+++ b/plugins/org.eclipse.osee.jaxrs.client/src/org/eclipse/osee/jaxrs/client/JaxRsClientConfig.java
@@ -0,0 +1,437 @@
+/*******************************************************************************
+ * Copyright (c) 2014 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.jaxrs.client;
+
+import static org.eclipse.osee.jaxrs.client.JaxRsClientConstants.CHUNK_LENGTH_MIN_LIMIT;
+import static org.eclipse.osee.jaxrs.client.JaxRsClientConstants.CHUNK_THRESHOLD_MIN_LIMIT;
+import static org.eclipse.osee.jaxrs.client.JaxRsClientConstants.DEFAULT_JAXRS_CLIENT_ASYNC_EXECUTE_TIMEOUT;
+import static org.eclipse.osee.jaxrs.client.JaxRsClientConstants.DEFAULT_JAXRS_CLIENT_ASYNC_EXECUTE_TIMEOUT_REJECTION;
+import static org.eclipse.osee.jaxrs.client.JaxRsClientConstants.DEFAULT_JAXRS_CLIENT_CHUNKING_ALLOWED;
+import static org.eclipse.osee.jaxrs.client.JaxRsClientConstants.DEFAULT_JAXRS_CLIENT_CHUNKING_THRESHOLD;
+import static org.eclipse.osee.jaxrs.client.JaxRsClientConstants.DEFAULT_JAXRS_CLIENT_CHUNK_SIZE;
+import static org.eclipse.osee.jaxrs.client.JaxRsClientConstants.DEFAULT_JAXRS_CLIENT_CONNECTION_TIMEOUT;
+import static org.eclipse.osee.jaxrs.client.JaxRsClientConstants.DEFAULT_JAXRS_CLIENT_CONNECTION_TYPE;
+import static org.eclipse.osee.jaxrs.client.JaxRsClientConstants.DEFAULT_JAXRS_CLIENT_CREATE_THREADSAFE_PROXY_CLIENTS;
+import static org.eclipse.osee.jaxrs.client.JaxRsClientConstants.DEFAULT_JAXRS_CLIENT_FOLLOW_REDIRECTS;
+import static org.eclipse.osee.jaxrs.client.JaxRsClientConstants.DEFAULT_JAXRS_CLIENT_MAX_RETRANSMITS;
+import static org.eclipse.osee.jaxrs.client.JaxRsClientConstants.DEFAULT_JAXRS_CLIENT_NON_PROXY_HOSTS;
+import static org.eclipse.osee.jaxrs.client.JaxRsClientConstants.DEFAULT_JAXRS_CLIENT_PROXY_ADDRESS;
+import static org.eclipse.osee.jaxrs.client.JaxRsClientConstants.DEFAULT_JAXRS_CLIENT_PROXY_AUTHORIZATION_TYPE;
+import static org.eclipse.osee.jaxrs.client.JaxRsClientConstants.DEFAULT_JAXRS_CLIENT_PROXY_CLIENT_SUB_RESOURCES_INHERIT_HEADERS;
+import static org.eclipse.osee.jaxrs.client.JaxRsClientConstants.DEFAULT_JAXRS_CLIENT_PROXY_PASSWORD;
+import static org.eclipse.osee.jaxrs.client.JaxRsClientConstants.DEFAULT_JAXRS_CLIENT_PROXY_TYPE;
+import static org.eclipse.osee.jaxrs.client.JaxRsClientConstants.DEFAULT_JAXRS_CLIENT_PROXY_USERNAME;
+import static org.eclipse.osee.jaxrs.client.JaxRsClientConstants.DEFAULT_JAXRS_CLIENT_RECEIVE_TIMEOUT;
+import static org.eclipse.osee.jaxrs.client.JaxRsClientConstants.DEFAULT_JAXRS_CLIENT_SERVER_AUTHORIZATION_TYPE;
+import static org.eclipse.osee.jaxrs.client.JaxRsClientConstants.DEFAULT_JAXRS_CLIENT_SERVER_PASSWORD;
+import static org.eclipse.osee.jaxrs.client.JaxRsClientConstants.DEFAULT_JAXRS_CLIENT_SERVER_USERNAME;
+import static org.eclipse.osee.jaxrs.client.JaxRsClientConstants.JAXRS_CLIENT_ASYNC_EXECUTE_TIMEOUT;
+import static org.eclipse.osee.jaxrs.client.JaxRsClientConstants.JAXRS_CLIENT_ASYNC_EXECUTE_TIMEOUT_REJECTION;
+import static org.eclipse.osee.jaxrs.client.JaxRsClientConstants.JAXRS_CLIENT_CHUNKING_ALLOWED;
+import static org.eclipse.osee.jaxrs.client.JaxRsClientConstants.JAXRS_CLIENT_CHUNKING_THRESHOLD;
+import static org.eclipse.osee.jaxrs.client.JaxRsClientConstants.JAXRS_CLIENT_CHUNK_SIZE;
+import static org.eclipse.osee.jaxrs.client.JaxRsClientConstants.JAXRS_CLIENT_CONNECTION_TIMEOUT;
+import static org.eclipse.osee.jaxrs.client.JaxRsClientConstants.JAXRS_CLIENT_CONNECTION_TYPE;
+import static org.eclipse.osee.jaxrs.client.JaxRsClientConstants.JAXRS_CLIENT_CREATE_THREADSAFE_PROXY_CLIENTS;
+import static org.eclipse.osee.jaxrs.client.JaxRsClientConstants.JAXRS_CLIENT_FOLLOW_REDIRECTS;
+import static org.eclipse.osee.jaxrs.client.JaxRsClientConstants.JAXRS_CLIENT_MAX_RETRANSMITS;
+import static org.eclipse.osee.jaxrs.client.JaxRsClientConstants.JAXRS_CLIENT_NON_PROXY_HOSTS;
+import static org.eclipse.osee.jaxrs.client.JaxRsClientConstants.JAXRS_CLIENT_PROXY_ADDRESS;
+import static org.eclipse.osee.jaxrs.client.JaxRsClientConstants.JAXRS_CLIENT_PROXY_AUTHORIZATION_TYPE;
+import static org.eclipse.osee.jaxrs.client.JaxRsClientConstants.JAXRS_CLIENT_PROXY_CLIENT_SUB_RESOURCES_INHERIT_HEADERS;
+import static org.eclipse.osee.jaxrs.client.JaxRsClientConstants.JAXRS_CLIENT_PROXY_PASSWORD;
+import static org.eclipse.osee.jaxrs.client.JaxRsClientConstants.JAXRS_CLIENT_PROXY_TYPE;
+import static org.eclipse.osee.jaxrs.client.JaxRsClientConstants.JAXRS_CLIENT_PROXY_USERNAME;
+import static org.eclipse.osee.jaxrs.client.JaxRsClientConstants.JAXRS_CLIENT_RECEIVE_TIMEOUT;
+import static org.eclipse.osee.jaxrs.client.JaxRsClientConstants.JAXRS_CLIENT_SERVER_AUTHORIZATION_TYPE;
+import static org.eclipse.osee.jaxrs.client.JaxRsClientConstants.JAXRS_CLIENT_SERVER_PASSWORD;
+import static org.eclipse.osee.jaxrs.client.JaxRsClientConstants.JAXRS_CLIENT_SERVER_USERNAME;
+import static org.eclipse.osee.jaxrs.client.JaxRsClientConstants.PORT_MIN_LIMIT;
+import static org.eclipse.osee.jaxrs.client.JaxRsClientConstants.RETRANSMIT_MIN_LIMIT;
+import static org.eclipse.osee.jaxrs.client.JaxRsClientConstants.TIMEOUT_MIN_LIMIT;
+import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import org.eclipse.osee.framework.jdk.core.util.Strings;
+import org.eclipse.osee.jaxrs.client.JaxRsClientConstants.ConnectionType;
+import org.eclipse.osee.jaxrs.client.JaxRsClientConstants.ProxyType;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class JaxRsClientConfig {
+
+ private static final Pattern PORT_ADDRESS_PATTERN = Pattern.compile(":(\\d+)");
+
+ private long asyncExecuteTimeout;
+ private boolean asyncExecuteTimeoutRejection;
+ private long connectionTimeout;
+ private long receiveTimeout;
+ private ConnectionType connectionType;
+ private int maxRetransmits;
+ private String nonProxyHosts;
+ private String fullProxyAddress;
+ private String proxyAuthorizationType;
+ private String proxyPassword;
+ private ProxyType proxyType;
+ private String proxyUsername;
+ private String serverAuthorizationType;
+ private String serverPassword;
+ private String serverUsername;
+ private boolean followRedirects;
+ private boolean chunkingAllowed;
+ private int chunkingThreshold;
+ private int chunkLength;
+ private boolean proxyClientSubResourcesInheritHeaders;
+ private boolean proxyClientThreadSafe;
+
+ JaxRsClientConfig() {
+ super();
+ reset();
+ }
+
+ private void reset() {
+ setAsyncExecuteTimeout(DEFAULT_JAXRS_CLIENT_ASYNC_EXECUTE_TIMEOUT);
+ setAsyncExecuteTimeoutRejection(DEFAULT_JAXRS_CLIENT_ASYNC_EXECUTE_TIMEOUT_REJECTION);
+ setConnectionTimeout(DEFAULT_JAXRS_CLIENT_CONNECTION_TIMEOUT);
+ setReceiveTimeout(DEFAULT_JAXRS_CLIENT_RECEIVE_TIMEOUT);
+ setConnectionType(DEFAULT_JAXRS_CLIENT_CONNECTION_TYPE);
+ setMaxRetransmits(DEFAULT_JAXRS_CLIENT_MAX_RETRANSMITS);
+ setNonProxyHosts(DEFAULT_JAXRS_CLIENT_NON_PROXY_HOSTS);
+ setProxyAddress(DEFAULT_JAXRS_CLIENT_PROXY_ADDRESS);
+ setProxyAuthorizationType(DEFAULT_JAXRS_CLIENT_PROXY_AUTHORIZATION_TYPE);
+ setProxyPassword(DEFAULT_JAXRS_CLIENT_PROXY_PASSWORD);
+ setProxyType(DEFAULT_JAXRS_CLIENT_PROXY_TYPE);
+ setProxyUsername(DEFAULT_JAXRS_CLIENT_PROXY_USERNAME);
+ setServerAuthorizationType(DEFAULT_JAXRS_CLIENT_SERVER_AUTHORIZATION_TYPE);
+ setServerPassword(DEFAULT_JAXRS_CLIENT_SERVER_PASSWORD);
+ setServerUsername(DEFAULT_JAXRS_CLIENT_SERVER_USERNAME);
+ setFollowRedirects(DEFAULT_JAXRS_CLIENT_FOLLOW_REDIRECTS);
+ setChunkingAllowed(DEFAULT_JAXRS_CLIENT_CHUNKING_ALLOWED);
+ setChunkingThreshold(DEFAULT_JAXRS_CLIENT_CHUNKING_THRESHOLD);
+ setChunkLength(DEFAULT_JAXRS_CLIENT_CHUNK_SIZE);
+ setCreateThreadSafeProxyClients(DEFAULT_JAXRS_CLIENT_CREATE_THREADSAFE_PROXY_CLIENTS);
+ setProxyClientSubResourcesInheritHeaders(DEFAULT_JAXRS_CLIENT_PROXY_CLIENT_SUB_RESOURCES_INHERIT_HEADERS);
+ }
+
+ public boolean isChunkingAllowed() {
+ return chunkingAllowed;
+ }
+
+ public long getAsyncExecuteTimeout() {
+ return limit(TIMEOUT_MIN_LIMIT, asyncExecuteTimeout);
+ }
+
+ public boolean isAsyncExecuteTimeoutRejection() {
+ return asyncExecuteTimeoutRejection;
+ }
+
+ public long getConnectionTimeout() {
+ return limit(TIMEOUT_MIN_LIMIT, connectionTimeout);
+ }
+
+ public long getReceiveTimeout() {
+ return limit(TIMEOUT_MIN_LIMIT, receiveTimeout);
+ }
+
+ public ConnectionType getConnectionType() {
+ return connectionType != null ? connectionType : DEFAULT_JAXRS_CLIENT_CONNECTION_TYPE;
+ }
+
+ public int getMaxRetransmits() {
+ return limit(RETRANSMIT_MIN_LIMIT, maxRetransmits);
+ }
+
+ public String getNonProxyHosts() {
+ return nonProxyHosts;
+ }
+
+ public String getProxyAuthorizationType() {
+ return proxyAuthorizationType;
+ }
+
+ public String getProxyPassword() {
+ return proxyPassword;
+ }
+
+ public ProxyType getProxyType() {
+ return proxyType != null ? proxyType : DEFAULT_JAXRS_CLIENT_PROXY_TYPE;
+ }
+
+ public String getProxyUsername() {
+ return proxyUsername;
+ }
+
+ public String getServerAuthorizationType() {
+ return serverAuthorizationType;
+ }
+
+ public String getServerPassword() {
+ return serverPassword;
+ }
+
+ public String getServerUsername() {
+ return serverUsername;
+ }
+
+ public boolean isFollowRedirectsAllowed() {
+ return followRedirects;
+ }
+
+ public int getChunkingThreshold() {
+ return limit(CHUNK_THRESHOLD_MIN_LIMIT, chunkingThreshold);
+ }
+
+ public int getChunkLength() {
+ return limit(CHUNK_LENGTH_MIN_LIMIT, chunkLength);
+ }
+
+ public String getProxyAddress() {
+ return getHost(getFullProxyAddress());
+ }
+
+ public int getProxyPort() {
+ return getPort(getFullProxyAddress());
+ }
+
+ public String getFullProxyAddress() {
+ return fullProxyAddress;
+ }
+
+ public boolean isServerAuthorizationRequired() {
+ return Strings.isValid(getServerUsername()) && Strings.isValid(getServerPassword());
+ }
+
+ public boolean isProxyAuthorizationRequired() {
+ return Strings.isValid(getProxyUsername()) && Strings.isValid(getProxyPassword());
+ }
+
+ public boolean isProxyRequired() {
+ return Strings.isValid(getProxyAddress());
+ }
+
+ public boolean isProxyClientSubResourcesInheritHeaders() {
+ return proxyClientSubResourcesInheritHeaders;
+ }
+
+ public boolean isCreateThreadSafeProxyClients() {
+ return proxyClientThreadSafe;
+ }
+
+ void setAsyncExecuteTimeout(long asyncExecuteTimeout) {
+ this.asyncExecuteTimeout = asyncExecuteTimeout;
+ }
+
+ void setAsyncExecuteTimeoutRejection(boolean asyncExecuteTimeoutRejection) {
+ this.asyncExecuteTimeoutRejection = asyncExecuteTimeoutRejection;
+ }
+
+ void setConnectionTimeout(long connectionTimeout) {
+ this.connectionTimeout = connectionTimeout;
+ }
+
+ void setReceiveTimeout(long receiveTimeout) {
+ this.receiveTimeout = receiveTimeout;
+ }
+
+ void setConnectionType(ConnectionType connectionType) {
+ this.connectionType = connectionType;
+ }
+
+ void setMaxRetransmits(int maxRetransmits) {
+ this.maxRetransmits = maxRetransmits;
+ }
+
+ void setNonProxyHosts(String nonProxyHosts) {
+ this.nonProxyHosts = nonProxyHosts;
+ }
+
+ void setProxyAddress(String fullProxyAddress) {
+ this.fullProxyAddress = fullProxyAddress;
+ }
+
+ void setProxyAuthorizationType(String proxyAuthorizationType) {
+ this.proxyAuthorizationType = proxyAuthorizationType;
+ }
+
+ void setProxyPassword(String proxyPassword) {
+ this.proxyPassword = proxyPassword;
+ }
+
+ void setProxyType(ProxyType proxyType) {
+ this.proxyType = proxyType;
+ }
+
+ void setProxyUsername(String proxyUsername) {
+ this.proxyUsername = proxyUsername;
+ }
+
+ void setServerAuthorizationType(String serverAuthorizationType) {
+ this.serverAuthorizationType = serverAuthorizationType;
+ }
+
+ void setServerPassword(String serverPassword) {
+ this.serverPassword = serverPassword;
+ }
+
+ void setServerUsername(String serverUsername) {
+ this.serverUsername = serverUsername;
+ }
+
+ void setFollowRedirects(boolean autoRedirectsAllowed) {
+ this.followRedirects = autoRedirectsAllowed;
+ }
+
+ void setChunkingAllowed(boolean chunkingAllowed) {
+ this.chunkingAllowed = chunkingAllowed;
+ }
+
+ void setChunkingThreshold(int chunkingThreshold) {
+ this.chunkingThreshold = chunkingThreshold;
+ }
+
+ void setChunkLength(int chunkLength) {
+ this.chunkLength = chunkLength;
+ }
+
+ void setProxyClientSubResourcesInheritHeaders(boolean proxyClientSubResourcesInheritHeaders) {
+ this.proxyClientSubResourcesInheritHeaders = proxyClientSubResourcesInheritHeaders;
+ }
+
+ void setCreateThreadSafeProxyClients(boolean proxyClientThreadSafe) {
+ this.proxyClientThreadSafe = proxyClientThreadSafe;
+ }
+
+ void readProperties(Map<String, Object> src) {
+ //@formatter:off
+ setAsyncExecuteTimeout(getLong(src, JAXRS_CLIENT_ASYNC_EXECUTE_TIMEOUT, DEFAULT_JAXRS_CLIENT_ASYNC_EXECUTE_TIMEOUT));
+ setAsyncExecuteTimeoutRejection(getBoolean(src, JAXRS_CLIENT_ASYNC_EXECUTE_TIMEOUT_REJECTION, DEFAULT_JAXRS_CLIENT_ASYNC_EXECUTE_TIMEOUT_REJECTION));
+ setFollowRedirects(getBoolean(src, JAXRS_CLIENT_FOLLOW_REDIRECTS, DEFAULT_JAXRS_CLIENT_FOLLOW_REDIRECTS));
+ setChunkingAllowed(getBoolean(src, JAXRS_CLIENT_CHUNKING_ALLOWED, DEFAULT_JAXRS_CLIENT_CHUNKING_ALLOWED));
+ setChunkingThreshold(getInt(src, JAXRS_CLIENT_CHUNKING_THRESHOLD, DEFAULT_JAXRS_CLIENT_CHUNKING_THRESHOLD));
+ setChunkLength(getInt(src, JAXRS_CLIENT_CHUNK_SIZE, DEFAULT_JAXRS_CLIENT_CHUNK_SIZE));
+ setConnectionTimeout(getLong(src, JAXRS_CLIENT_CONNECTION_TIMEOUT, DEFAULT_JAXRS_CLIENT_CONNECTION_TIMEOUT));
+ setConnectionType(getConnectionType(src, JAXRS_CLIENT_CONNECTION_TYPE, DEFAULT_JAXRS_CLIENT_CONNECTION_TYPE));
+ setMaxRetransmits(getInt(src, JAXRS_CLIENT_MAX_RETRANSMITS, DEFAULT_JAXRS_CLIENT_MAX_RETRANSMITS));
+ setNonProxyHosts(get(src, JAXRS_CLIENT_NON_PROXY_HOSTS, DEFAULT_JAXRS_CLIENT_NON_PROXY_HOSTS));
+ setProxyAddress(get(src, JAXRS_CLIENT_PROXY_ADDRESS, DEFAULT_JAXRS_CLIENT_PROXY_ADDRESS));
+ setProxyAuthorizationType(get(src, JAXRS_CLIENT_PROXY_AUTHORIZATION_TYPE, DEFAULT_JAXRS_CLIENT_PROXY_AUTHORIZATION_TYPE));
+ setProxyPassword(get(src, JAXRS_CLIENT_PROXY_PASSWORD, DEFAULT_JAXRS_CLIENT_PROXY_PASSWORD));
+ setProxyType(getProxyType(src, JAXRS_CLIENT_PROXY_TYPE, DEFAULT_JAXRS_CLIENT_PROXY_TYPE));
+ setProxyUsername(get(src, JAXRS_CLIENT_PROXY_USERNAME, DEFAULT_JAXRS_CLIENT_PROXY_USERNAME));
+ setReceiveTimeout(getLong(src, JAXRS_CLIENT_RECEIVE_TIMEOUT, DEFAULT_JAXRS_CLIENT_RECEIVE_TIMEOUT));
+ setServerAuthorizationType(get(src, JAXRS_CLIENT_SERVER_AUTHORIZATION_TYPE, DEFAULT_JAXRS_CLIENT_SERVER_AUTHORIZATION_TYPE));
+ setServerPassword(get(src, JAXRS_CLIENT_SERVER_PASSWORD, DEFAULT_JAXRS_CLIENT_SERVER_PASSWORD));
+ setServerUsername(get(src, JAXRS_CLIENT_SERVER_USERNAME, DEFAULT_JAXRS_CLIENT_SERVER_USERNAME));
+ setCreateThreadSafeProxyClients(getBoolean(src, JAXRS_CLIENT_CREATE_THREADSAFE_PROXY_CLIENTS, DEFAULT_JAXRS_CLIENT_CREATE_THREADSAFE_PROXY_CLIENTS));;
+ setProxyClientSubResourcesInheritHeaders(getBoolean(src, JAXRS_CLIENT_PROXY_CLIENT_SUB_RESOURCES_INHERIT_HEADERS, DEFAULT_JAXRS_CLIENT_PROXY_CLIENT_SUB_RESOURCES_INHERIT_HEADERS));
+ //@formatter:on
+ }
+
+ protected JaxRsClientConfig copy() {
+ JaxRsClientConfig data = new JaxRsClientConfig();
+ data.asyncExecuteTimeout = this.asyncExecuteTimeout;
+ data.asyncExecuteTimeoutRejection = this.asyncExecuteTimeoutRejection;
+ data.connectionTimeout = this.connectionTimeout;
+ data.receiveTimeout = this.receiveTimeout;
+ data.connectionType = this.connectionType;
+ data.maxRetransmits = this.maxRetransmits;
+ data.nonProxyHosts = this.nonProxyHosts;
+ data.fullProxyAddress = this.fullProxyAddress;
+ data.proxyAuthorizationType = this.proxyAuthorizationType;
+ data.proxyPassword = this.proxyPassword;
+ data.proxyType = this.proxyType;
+ data.proxyUsername = this.proxyUsername;
+ data.serverAuthorizationType = this.serverAuthorizationType;
+ data.serverPassword = this.serverPassword;
+ data.serverUsername = this.serverUsername;
+ data.followRedirects = this.followRedirects;
+ data.chunkingAllowed = this.chunkingAllowed;
+ data.chunkingThreshold = this.chunkingThreshold;
+ data.chunkLength = this.chunkLength;
+ data.proxyClientSubResourcesInheritHeaders = this.proxyClientSubResourcesInheritHeaders;
+ data.proxyClientThreadSafe = this.proxyClientThreadSafe;
+ return data;
+ }
+
+ @Override
+ public String toString() {
+ return "JaxRsClientConfig [asyncExecuteTimeout=" + asyncExecuteTimeout + ", asyncExecuteTimeoutRejection=" + asyncExecuteTimeoutRejection + ", connectionTimeout=" + connectionTimeout + ", receiveTimeout=" + receiveTimeout + ", connectionType=" + connectionType + ", maxRetransmits=" + maxRetransmits + ", nonProxyHosts=" + nonProxyHosts + ", fullProxyAddress=" + fullProxyAddress + ", proxyAuthorizationType=" + proxyAuthorizationType + ", proxyPassword=" + proxyPassword + ", proxyType=" + proxyType + ", proxyUsername=" + proxyUsername + ", serverAuthorizationType=" + serverAuthorizationType + ", serverPassword=" + serverPassword + ", serverUsername=" + serverUsername + ", followRedirects=" + followRedirects + ", chunkingAllowed=" + chunkingAllowed + ", chunkingThreshold=" + chunkingThreshold + ", chunkLength=" + chunkLength + ", proxyClientSubResourcesInheritHeaders=" + proxyClientSubResourcesInheritHeaders + ", proxyClientThreadSafe=" + proxyClientThreadSafe + "]";
+ }
+
+ private static int limit(int minLimit, int value) {
+ return value < minLimit ? minLimit : value;
+ }
+
+ private static long limit(long minLimit, long value) {
+ return value < minLimit ? minLimit : value;
+ }
+
+ private static ProxyType getProxyType(Map<String, Object> props, String key, ProxyType defaultValue) {
+ String toReturn = get(props, key, String.valueOf(defaultValue));
+ return ProxyType.parse(toReturn);
+ }
+
+ private static ConnectionType getConnectionType(Map<String, Object> props, String key, ConnectionType defaultValue) {
+ String toReturn = get(props, key, String.valueOf(defaultValue));
+ return ConnectionType.parse(toReturn);
+ }
+
+ private static long getLong(Map<String, Object> props, String key, long defaultValue) {
+ String toReturn = get(props, key, String.valueOf(defaultValue));
+ return Strings.isNumeric(toReturn) ? Long.parseLong(toReturn) : -1L;
+ }
+
+ private static int getInt(Map<String, Object> props, String key, int defaultValue) {
+ String toReturn = get(props, key, String.valueOf(defaultValue));
+ return Strings.isNumeric(toReturn) ? Integer.parseInt(toReturn) : -1;
+ }
+
+ private static boolean getBoolean(Map<String, Object> props, String key, boolean defaultValue) {
+ String toReturn = get(props, key, String.valueOf(defaultValue));
+ return Boolean.parseBoolean(toReturn);
+ }
+
+ private static String get(Map<String, Object> props, String key, String defaultValue) {
+ String toReturn = defaultValue;
+ Object object = props != null ? props.get(key) : null;
+ if (object != null) {
+ toReturn = String.valueOf(object);
+ }
+ return toReturn;
+ }
+
+ private static int getPort(String address) {
+ int toReturn = PORT_MIN_LIMIT;
+ if (Strings.isValid(address)) {
+ Matcher matcher = PORT_ADDRESS_PATTERN.matcher(address);
+ if (matcher.find()) {
+ String port = matcher.group(1);
+ toReturn = limit(PORT_MIN_LIMIT, Integer.parseInt(port));
+ }
+ }
+ return toReturn;
+ }
+
+ private static String getHost(String address) {
+ String toReturn = address;
+ if (Strings.isValid(toReturn)) {
+ toReturn = toReturn.replaceAll(".*?//", "");
+ Matcher matcher = PORT_ADDRESS_PATTERN.matcher(toReturn);
+ if (matcher.find()) {
+ int index = matcher.start(1);
+ toReturn = toReturn.substring(0, index - 1);
+ }
+ }
+ return toReturn;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.jaxrs.client/src/org/eclipse/osee/jaxrs/client/JaxRsClientConstants.java b/plugins/org.eclipse.osee.jaxrs.client/src/org/eclipse/osee/jaxrs/client/JaxRsClientConstants.java
index d6a5bf519fc..08c3eee45cd 100644
--- a/plugins/org.eclipse.osee.jaxrs.client/src/org/eclipse/osee/jaxrs/client/JaxRsClientConstants.java
+++ b/plugins/org.eclipse.osee.jaxrs.client/src/org/eclipse/osee/jaxrs/client/JaxRsClientConstants.java
@@ -10,31 +10,113 @@
*******************************************************************************/
package org.eclipse.osee.jaxrs.client;
+import org.eclipse.osee.framework.jdk.core.util.Strings;
+
/**
* @author Roberto E. Escobar
*/
public final class JaxRsClientConstants {
private JaxRsClientConstants() {
- // Utility class
+ // Constants
}
- public static final String NAMESPACE = "jaxrs.client";
+ private static final String NAMESPACE = "jaxrs.client";
- private static String qualify(String value) {
+ static String qualify(String value) {
return String.format("%s.%s", NAMESPACE, value);
}
- public static final boolean DEFAULT_JAXRS_CLIENT_FOLLOW_REDIRECTS = true;
- public static final int DEFAULT_JAXRS_CLIENT_THREADPOOL_SIZE = -1; // cached thread pool - no limit
- public static final int DEFAULT_JAXRS_CLIENT_CONNECT_TIMEOUT = 30 * 1000; // 30 seconds
- public static final int DEFAULT_JAXRS_CLIENT_READ_TIMEOUT = -1; // infinity
+ public static enum ProxyType {
+ HTTP,
+ SOCKS;
+
+ public static ProxyType parse(String value) {
+ ProxyType toReturn = ProxyType.HTTP;
+ if (Strings.isValid(value)) {
+ String toFind = value.toUpperCase().trim();
+ for (ProxyType type : ProxyType.values()) {
+ if (type.name().equals(toFind)) {
+ toReturn = type;
+ break;
+ }
+ }
+ }
+ return toReturn;
+ }
+ }
+
+ public static enum ConnectionType {
+ CLOSE,
+ KEEP_ALIVE;
- public static final String JAXRS_CLIENT_SERVER_ADDRESS = qualify("server.address");
- public static final String JAXRS_CLIENT_PROXY_SERVER_ADDRESS = qualify("proxy.server.address");
+ public static ConnectionType parse(String value) {
+ ConnectionType toReturn = ConnectionType.KEEP_ALIVE;
+ if (Strings.isValid(value)) {
+ String toFind = value.toUpperCase().trim();
+ for (ConnectionType type : ConnectionType.values()) {
+ if (type.name().equals(toFind)) {
+ toReturn = type;
+ break;
+ }
+ }
+ }
+ return toReturn;
+ }
+ }
+
+ public static final String BASIC_AUTHENTICATION = "Basic";
+
+ public static final String JAXRS_CLIENT_SERVER_USERNAME = qualify("server.username");
+ public static final String JAXRS_CLIENT_SERVER_PASSWORD = qualify("server.password");
+ public static final String JAXRS_CLIENT_SERVER_AUTHORIZATION_TYPE = qualify("server.authorization.type");
public static final String JAXRS_CLIENT_FOLLOW_REDIRECTS = qualify("follow.redirects");
- public static final String JAXRS_CLIENT_CONNECT_TIMEOUT = qualify("connect.timeout");
- public static final String JAXRS_CLIENT_READ_TIMEOUT = qualify("read.timeout");
- public static final String JAXRS_CLIENT_THREADPOOL_SIZE = qualify("threadpool.size");
+ public static final String JAXRS_CLIENT_CONNECTION_TIMEOUT = qualify("connection.timeout");
+ public static final String JAXRS_CLIENT_RECEIVE_TIMEOUT = qualify("receive.timeout");
+ public static final String JAXRS_CLIENT_ASYNC_EXECUTE_TIMEOUT = qualify("async.exec.timeout");
+ public static final String JAXRS_CLIENT_ASYNC_EXECUTE_TIMEOUT_REJECTION = qualify("async.exec.timeout.rejection");
+ public static final String JAXRS_CLIENT_MAX_RETRANSMITS = qualify("max.retransmits");
+ public static final String JAXRS_CLIENT_CHUNKING_ALLOWED = qualify("is.chunking.allowed");
+ public static final String JAXRS_CLIENT_CHUNKING_THRESHOLD = qualify("chunking.threshold");
+ public static final String JAXRS_CLIENT_CHUNK_SIZE = qualify("chunk.size");
+ public static final String JAXRS_CLIENT_CONNECTION_TYPE = qualify("connection.type");
+ public static final String JAXRS_CLIENT_PROXY_ADDRESS = qualify("proxy.server.address");
+ public static final String JAXRS_CLIENT_PROXY_TYPE = qualify("proxy.server.type");
+ public static final String JAXRS_CLIENT_NON_PROXY_HOSTS = qualify("non.proxy.hosts");
+ public static final String JAXRS_CLIENT_PROXY_USERNAME = qualify("proxy.username");
+ public static final String JAXRS_CLIENT_PROXY_PASSWORD = qualify("proxy.password");
+ public static final String JAXRS_CLIENT_PROXY_AUTHORIZATION_TYPE = qualify("proxy.authorization.type");
+ public static final String JAXRS_CLIENT_CREATE_THREADSAFE_PROXY_CLIENTS = qualify("create.threadsafe.proxy.clients");
+ public static final String JAXRS_CLIENT_PROXY_CLIENT_SUB_RESOURCES_INHERIT_HEADERS =
+ qualify("proxy.client.subresources.inherit.headers");
+
+ public static final String DEFAULT_JAXRS_CLIENT_SERVER_USERNAME = null;
+ public static final String DEFAULT_JAXRS_CLIENT_SERVER_PASSWORD = null;
+ public static final String DEFAULT_JAXRS_CLIENT_SERVER_AUTHORIZATION_TYPE = BASIC_AUTHENTICATION;
+ public static final boolean DEFAULT_JAXRS_CLIENT_FOLLOW_REDIRECTS = true;
+ public static final long DEFAULT_JAXRS_CLIENT_CONNECTION_TIMEOUT = 30000L; // Long - 0 infinite default 30000L millis
+ public static final long DEFAULT_JAXRS_CLIENT_RECEIVE_TIMEOUT = 0L; // Long - 0 infinite default 30000L millis
+ public static final long DEFAULT_JAXRS_CLIENT_ASYNC_EXECUTE_TIMEOUT = 5000L;
+ public static final boolean DEFAULT_JAXRS_CLIENT_ASYNC_EXECUTE_TIMEOUT_REJECTION = true;
+ public static final int DEFAULT_JAXRS_CLIENT_MAX_RETRANSMITS = -1; // any negative number equals unlimited
+ public static final boolean DEFAULT_JAXRS_CLIENT_CHUNKING_ALLOWED = true;
+ public static final int DEFAULT_JAXRS_CLIENT_CHUNKING_THRESHOLD = 4096;
+ public static final int DEFAULT_JAXRS_CLIENT_CHUNK_SIZE = 0; //If chunk length is less than or equal to zero, a default value will be used.
+ public static final ConnectionType DEFAULT_JAXRS_CLIENT_CONNECTION_TYPE = ConnectionType.KEEP_ALIVE;
+ public static final ProxyType DEFAULT_JAXRS_CLIENT_PROXY_TYPE = ProxyType.HTTP;
+ public static final String DEFAULT_JAXRS_CLIENT_PROXY_ADDRESS = null;
+ public static final int DEFAULT_JAXRS_CLIENT_PROXY_PORT = -1;
+ public static final String DEFAULT_JAXRS_CLIENT_NON_PROXY_HOSTS = null;
+ public static final String DEFAULT_JAXRS_CLIENT_PROXY_USERNAME = null;
+ public static final String DEFAULT_JAXRS_CLIENT_PROXY_PASSWORD = null;
+ public static final String DEFAULT_JAXRS_CLIENT_PROXY_AUTHORIZATION_TYPE = BASIC_AUTHENTICATION;
+ public static final boolean DEFAULT_JAXRS_CLIENT_CREATE_THREADSAFE_PROXY_CLIENTS = false;
+ public static final boolean DEFAULT_JAXRS_CLIENT_PROXY_CLIENT_SUB_RESOURCES_INHERIT_HEADERS = false;
+
+ public static int RETRANSMIT_MIN_LIMIT = -1;
+ public static int PORT_MIN_LIMIT = -1;
+ public static long TIMEOUT_MIN_LIMIT = 0L;
+ public static int CHUNK_LENGTH_MIN_LIMIT = 0;
+ public static int CHUNK_THRESHOLD_MIN_LIMIT = DEFAULT_JAXRS_CLIENT_CHUNKING_THRESHOLD;
}
diff --git a/plugins/org.eclipse.osee.jaxrs.client/src/org/eclipse/osee/jaxrs/client/JaxRsClientFactory.java b/plugins/org.eclipse.osee.jaxrs.client/src/org/eclipse/osee/jaxrs/client/JaxRsClientFactory.java
deleted file mode 100644
index 181b223b9dd..00000000000
--- a/plugins/org.eclipse.osee.jaxrs.client/src/org/eclipse/osee/jaxrs/client/JaxRsClientFactory.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2014 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.jaxrs.client;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import org.eclipse.osee.jaxrs.client.internal.StandaloneModule;
-import com.google.inject.Guice;
-import com.google.inject.Injector;
-import com.google.inject.Module;
-
-/**
- * @author Roberto E. Escobar
- */
-public final class JaxRsClientFactory {
-
- private JaxRsClientFactory() {
- // Utility class
- }
-
- public static JaxRsClient createClient(Map<String, Object> props) {
- return createClient(JaxRsClient.class, props);
- }
-
- public static <T> T createClient(Class<T> api, Map<String, Object> props, Module... modules) {
- Injector injector = createInjector(props, modules);
- return injector.getInstance(api);
- }
-
- private static Injector createInjector(Map<String, Object> props, Module... modules) {
- List<Module> moduleList = new ArrayList<Module>();
- moduleList.add(new StandaloneModule(props));
- for (Module module : modules) {
- moduleList.add(module);
- }
- return Guice.createInjector(moduleList);
- }
-}
diff --git a/plugins/org.eclipse.osee.jaxrs.client/src/org/eclipse/osee/jaxrs/client/JaxRsClientUtils.java b/plugins/org.eclipse.osee.jaxrs.client/src/org/eclipse/osee/jaxrs/client/JaxRsClientUtils.java
deleted file mode 100644
index 063464cb248..00000000000
--- a/plugins/org.eclipse.osee.jaxrs.client/src/org/eclipse/osee/jaxrs/client/JaxRsClientUtils.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2014 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.jaxrs.client;
-
-import java.util.Map;
-import org.eclipse.osee.framework.jdk.core.util.Strings;
-import com.google.inject.TypeLiteral;
-import com.google.inject.matcher.AbstractMatcher;
-import com.google.inject.matcher.Matcher;
-
-/**
- * @author Roberto E. Escobar
- */
-public final class JaxRsClientUtils {
-
- private JaxRsClientUtils() {
- // Utility class
- }
-
- public static Integer getInt(Map<String, Object> props, String key, int defaultValue) {
- String toReturn = get(props, key, String.valueOf(defaultValue));
- return Strings.isNumeric(toReturn) ? Integer.parseInt(toReturn) : -1;
- }
-
- public static boolean getBoolean(Map<String, Object> props, String key, boolean defaultValue) {
- String toReturn = get(props, key, String.valueOf(defaultValue));
- return Boolean.parseBoolean(toReturn);
- }
-
- public static String get(Map<String, Object> props, String key, String defaultValue) {
- String toReturn = defaultValue;
- Object object = props != null ? props.get(key) : null;
- if (object != null) {
- toReturn = String.valueOf(object);
- }
- return toReturn;
- }
-
- public static Matcher<? super TypeLiteral<?>> subtypeOf(Class<?> superclass) {
- return new SubTypeOfMatcher(TypeLiteral.get(superclass));
- }
-
- private static final class SubTypeOfMatcher extends AbstractMatcher<TypeLiteral<?>> {
- private final TypeLiteral<?> superType;
-
- public SubTypeOfMatcher(TypeLiteral<?> superType) {
- super();
- this.superType = superType;
- }
-
- @Override
- public boolean matches(TypeLiteral<?> subType) {
- return subType.equals(superType) || superType.getRawType().isAssignableFrom(subType.getRawType());
- }
- }
-
-}
diff --git a/plugins/org.eclipse.osee.jaxrs.client/src/org/eclipse/osee/jaxrs/client/JaxRsExceptions.java b/plugins/org.eclipse.osee.jaxrs.client/src/org/eclipse/osee/jaxrs/client/JaxRsExceptions.java
new file mode 100644
index 00000000000..aebbd4ba604
--- /dev/null
+++ b/plugins/org.eclipse.osee.jaxrs.client/src/org/eclipse/osee/jaxrs/client/JaxRsExceptions.java
@@ -0,0 +1,145 @@
+/*******************************************************************************
+ * Copyright (c) 2014 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.jaxrs.client;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.client.ResponseProcessingException;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.Response.Status;
+import org.apache.cxf.jaxrs.impl.ResponseImpl;
+import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
+import org.eclipse.osee.framework.jdk.core.util.Lib;
+import org.eclipse.osee.jaxrs.ErrorResponse;
+import org.eclipse.osee.jaxrs.JaxRsConstants;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public final class JaxRsExceptions {
+
+ private JaxRsExceptions() {
+ // Utility class
+ }
+
+ public static boolean isErrorResponse(Response response) {
+ String header = response.getHeaderString(JaxRsConstants.OSEE_ERROR_REPONSE_HEADER);
+ return Boolean.valueOf(header);
+ }
+
+ public static OseeCoreException asOseeException(Throwable th) {
+ OseeCoreException toReturn;
+ if (th instanceof ResponseProcessingException) {
+ toReturn = asOseeException((ResponseProcessingException) th);
+ } else if (th instanceof WebApplicationException) {
+ toReturn = asOseeException((WebApplicationException) th);
+ } else if (th instanceof OseeCoreException) {
+ toReturn = (OseeCoreException) th;
+ } else {
+ toReturn = new OseeCoreException(th.getCause(), th.getLocalizedMessage());
+ }
+ return toReturn;
+ }
+
+ private static OseeCoreException asOseeException(ResponseProcessingException ex) {
+ Response response = ex.getResponse();
+ OseeCoreException toReturn;
+ if (response.hasEntity()) {
+ toReturn = asOseeException(response);
+ } else {
+ Throwable cause = ex.getCause();
+ String message = buildExceptionMessage(response.getStatus(), cause, ex.getMessage());
+ toReturn = new OseeCoreException(cause, message);
+ }
+ return toReturn;
+ }
+
+ private static OseeCoreException asOseeException(WebApplicationException ex) {
+ Response response = ex.getResponse();
+ OseeCoreException toReturn;
+ if (response.hasEntity()) {
+ toReturn = asOseeException(response);
+ } else {
+ Throwable cause = ex.getCause();
+ String message = buildExceptionMessage(response.getStatus(), cause, ex.getMessage());
+ toReturn = new OseeCoreException(cause, message);
+ }
+ return toReturn;
+ }
+
+ private static String buildExceptionMessage(int statusCode, Throwable cause, String exMessage) {
+ StringBuilder sb = new StringBuilder();
+ sb.append("JAX-RS Client Exception caught - ").append(statusCode);
+ String message = cause == null ? exMessage : cause.getMessage();
+ if (message == null && cause != null) {
+ message = "exception cause class: " + cause.getClass().getName();
+ }
+ if (message != null) {
+ sb.append(", message: ").append(message);
+ }
+ return sb.toString();
+ }
+
+ public static OseeCoreException asOseeException(Response response) {
+ String message = "";
+ if (response == null) {
+ message = "Error mapping response exception - response was null";
+ } else if (response.hasEntity()) {
+ Object entity = response.getEntity();
+ try {
+ if (isErrorResponse(response)) {
+ message = readEntity(response, ErrorResponse.class).toString();
+ } else if (entity instanceof InputStream) {
+ MediaType mediaType = response.getMediaType();
+ message = readStream((InputStream) entity, mediaType);
+ } else {
+ message = String.format("%s [%s]", getResponseString(response), entity);
+ }
+ } catch (Throwable th) {
+ message =
+ String.format("Error processing reponse error - %s [%s]", getResponseString(response),
+ th.getLocalizedMessage());
+ }
+ } else {
+ message = getResponseString(response);
+ }
+ return new OseeCoreException(message);
+ }
+
+ private static String getResponseString(Response response) {
+ StringBuilder builder = new StringBuilder();
+ builder.append("status[");
+ int statusCode = response.getStatus();
+ builder.append(statusCode);
+ builder.append("]");
+
+ Status status = Status.fromStatusCode(statusCode);
+ if (status != null) {
+ builder.append(" reason[");
+ builder.append(status.getReasonPhrase());
+ builder.append("]");
+ }
+ return builder.toString();
+ }
+
+ private static <T> T readEntity(Response response, Class<T> clazz) {
+ return ((ResponseImpl) response).doReadEntity(clazz, clazz, clazz.getAnnotations());
+ }
+
+ private static String readStream(InputStream inputStream, MediaType mediaType) throws IOException {
+ ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
+ Lib.inputStreamToOutputStream(inputStream, outputStream);
+ return outputStream.toString("UTF-8");
+ }
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.jaxrs.client/src/org/eclipse/osee/jaxrs/client/internal/JaxRsClientConfigurator.java b/plugins/org.eclipse.osee.jaxrs.client/src/org/eclipse/osee/jaxrs/client/internal/JaxRsClientConfigurator.java
new file mode 100644
index 00000000000..f74969beac1
--- /dev/null
+++ b/plugins/org.eclipse.osee.jaxrs.client/src/org/eclipse/osee/jaxrs/client/internal/JaxRsClientConfigurator.java
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * Copyright (c) 2014 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.jaxrs.client.internal;
+
+import java.util.Map;
+import javax.ws.rs.client.ClientBuilder;
+import org.apache.cxf.jaxrs.client.JAXRSClientFactoryBean;
+import org.apache.cxf.transport.http.HTTPConduit;
+import org.eclipse.osee.jaxrs.client.JaxRsClientConfig;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public interface JaxRsClientConfigurator {
+
+ void configureDefaults(Map<String, Object> properties);
+
+ void configureBean(JaxRsClientConfig config, String serverAddress, JAXRSClientFactoryBean bean);
+
+ void configureClientBuilder(JaxRsClientConfig config, ClientBuilder builder);
+
+ void configureConnection(JaxRsClientConfig config, HTTPConduit conduit);
+
+ void configureProxy(JaxRsClientConfig config, HTTPConduit conduit);
+
+ void configureJaxRsRuntime();
+
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.jaxrs.client/src/org/eclipse/osee/jaxrs/client/internal/JaxRsClientImpl.java b/plugins/org.eclipse.osee.jaxrs.client/src/org/eclipse/osee/jaxrs/client/internal/JaxRsClientImpl.java
deleted file mode 100644
index 843b80a89e4..00000000000
--- a/plugins/org.eclipse.osee.jaxrs.client/src/org/eclipse/osee/jaxrs/client/internal/JaxRsClientImpl.java
+++ /dev/null
@@ -1,134 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2014 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.jaxrs.client.internal;
-
-import static org.eclipse.osee.jaxrs.client.JaxRsClientConstants.DEFAULT_JAXRS_CLIENT_CONNECT_TIMEOUT;
-import static org.eclipse.osee.jaxrs.client.JaxRsClientConstants.DEFAULT_JAXRS_CLIENT_FOLLOW_REDIRECTS;
-import static org.eclipse.osee.jaxrs.client.JaxRsClientConstants.DEFAULT_JAXRS_CLIENT_READ_TIMEOUT;
-import static org.eclipse.osee.jaxrs.client.JaxRsClientConstants.DEFAULT_JAXRS_CLIENT_THREADPOOL_SIZE;
-import static org.eclipse.osee.jaxrs.client.JaxRsClientConstants.JAXRS_CLIENT_CONNECT_TIMEOUT;
-import static org.eclipse.osee.jaxrs.client.JaxRsClientConstants.JAXRS_CLIENT_FOLLOW_REDIRECTS;
-import static org.eclipse.osee.jaxrs.client.JaxRsClientConstants.JAXRS_CLIENT_PROXY_SERVER_ADDRESS;
-import static org.eclipse.osee.jaxrs.client.JaxRsClientConstants.JAXRS_CLIENT_READ_TIMEOUT;
-import static org.eclipse.osee.jaxrs.client.JaxRsClientConstants.JAXRS_CLIENT_SERVER_ADDRESS;
-import static org.eclipse.osee.jaxrs.client.JaxRsClientConstants.JAXRS_CLIENT_THREADPOOL_SIZE;
-import static org.eclipse.osee.jaxrs.client.JaxRsClientUtils.get;
-import static org.eclipse.osee.jaxrs.client.JaxRsClientUtils.getBoolean;
-import static org.eclipse.osee.jaxrs.client.JaxRsClientUtils.getInt;
-import java.net.URI;
-import java.util.Map;
-import javax.ws.rs.core.UriBuilder;
-import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
-import org.eclipse.osee.framework.jdk.core.util.Strings;
-import org.eclipse.osee.jaxrs.ErrorResponse;
-import org.eclipse.osee.jaxrs.client.JaxRsClient;
-import org.eclipse.osee.jaxrs.client.JaxRsClientUtils;
-import com.sun.jersey.api.client.Client;
-import com.sun.jersey.api.client.ClientResponse;
-import com.sun.jersey.api.client.UniformInterfaceException;
-import com.sun.jersey.api.client.WebResource;
-import com.sun.jersey.api.client.config.ClientConfig;
-import com.sun.jersey.client.apache.ApacheHttpClient;
-import com.sun.jersey.client.apache.config.ApacheHttpClientConfig;
-import com.sun.jersey.client.apache.config.DefaultApacheHttpClientConfig;
-
-/**
- * @author Roberto E. Escobar
- */
-public class JaxRsClientImpl implements JaxRsClient {
-
- public interface JaxRsClientHolder {
- WebResource target(URI uri);
- }
-
- private volatile JaxRsClientHolder client;
-
- @Override
- public WebResource createResource(URI uri) {
- return client.target(uri);
- }
-
- public void configure(Map<String, Object> properties) {
- client = newJaxRsClient(properties);
- }
-
- @Override
- public RuntimeException handleException(UniformInterfaceException ex) {
- String message = null;
- try {
- ClientResponse response = ex.getResponse();
- ErrorResponse error = response.getEntity(ErrorResponse.class);
- message = error != null ? error.toString() : "Error message not available.";
- } catch (Throwable th) {
- message = String.format("Error Response object not available - [%s]", th.getLocalizedMessage());
- }
- return new OseeCoreException(ex, message);
- }
-
- private JaxRsClientHolder newJaxRsClient(Map<String, Object> props) {
- DefaultApacheHttpClientConfig clientConfig = new DefaultApacheHttpClientConfig();
- Map<String, Object> properties = clientConfig.getProperties();
-
- String proxyAddress = get(props, JAXRS_CLIENT_PROXY_SERVER_ADDRESS, "");
- if (Strings.isValid(proxyAddress)) {
- properties.put(ApacheHttpClientConfig.PROPERTY_PROXY_URI, proxyAddress);
- }
-
- //@formatter:off
- properties.put(ClientConfig.PROPERTY_FOLLOW_REDIRECTS, getBoolean(props, JAXRS_CLIENT_FOLLOW_REDIRECTS, DEFAULT_JAXRS_CLIENT_FOLLOW_REDIRECTS));
- properties.put(ClientConfig.PROPERTY_THREADPOOL_SIZE, getInt(props, JAXRS_CLIENT_THREADPOOL_SIZE, DEFAULT_JAXRS_CLIENT_THREADPOOL_SIZE));
- properties.put(ClientConfig.PROPERTY_CONNECT_TIMEOUT, minZero(getInt(props, JAXRS_CLIENT_CONNECT_TIMEOUT, DEFAULT_JAXRS_CLIENT_CONNECT_TIMEOUT)));
- properties.put(ClientConfig.PROPERTY_READ_TIMEOUT, minZero(getInt(props, JAXRS_CLIENT_READ_TIMEOUT, DEFAULT_JAXRS_CLIENT_READ_TIMEOUT)));
- //@formatter:on
-
- Client delegate = ApacheHttpClient.create(clientConfig);
- JaxRsClientHolder toReturn;
- String serverAddress = JaxRsClientUtils.get(props, JAXRS_CLIENT_SERVER_ADDRESS, "");
- if (Strings.isValid(serverAddress)) {
- toReturn = newClient(delegate, serverAddress);
- } else {
- toReturn = newClient(delegate);
- }
- return toReturn;
- }
-
- private static int minZero(int value) {
- return value < 0 ? 0 : value;
- }
-
- private JaxRsClientHolder newClient(final Client delegate) {
- return new JaxRsClientHolder() {
-
- @Override
- public WebResource target(URI uri) {
- return delegate.resource(uri);
- }
- };
- }
-
- private JaxRsClientHolder newClient(final Client delegate, final String serverAddress) {
- return new JaxRsClientHolder() {
-
- private boolean isPartialAddress(URI uri) {
- return uri != null && !uri.isAbsolute();
- }
-
- @Override
- public WebResource target(URI uri) {
- URI uriToContact = uri;
- if (isPartialAddress(uriToContact)) {
- uriToContact = UriBuilder.fromUri(serverAddress).path(uri.toASCIIString()).build();
- }
- return delegate.resource(uriToContact);
- }
- };
- }
-}
diff --git a/plugins/org.eclipse.osee.jaxrs.client/src/org/eclipse/osee/jaxrs/client/internal/JaxRsClientRuntime.java b/plugins/org.eclipse.osee.jaxrs.client/src/org/eclipse/osee/jaxrs/client/internal/JaxRsClientRuntime.java
new file mode 100644
index 00000000000..d72255444e9
--- /dev/null
+++ b/plugins/org.eclipse.osee.jaxrs.client/src/org/eclipse/osee/jaxrs/client/internal/JaxRsClientRuntime.java
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * Copyright (c) 2014 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.jaxrs.client.internal;
+
+import java.util.Collections;
+import org.eclipse.osee.jaxrs.client.JaxRsClient.JaxRsClientFactory;
+import org.eclipse.osee.jaxrs.client.internal.ext.CxfJaxRsClientConfigurator;
+import org.eclipse.osee.jaxrs.client.internal.ext.CxfJaxRsClientFactory;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public final class JaxRsClientRuntime {
+
+ private JaxRsClientRuntime() {
+ //
+ }
+
+ private static volatile JaxRsClientFactory instance;
+
+ public static JaxRsClientFactory getClientFactoryInstance() {
+ if (instance == null) {
+ instance = newClientFactory();
+ }
+ return instance;
+ }
+
+ private static JaxRsClientFactory newClientFactory() {
+ CxfJaxRsClientConfigurator configurator = new CxfJaxRsClientConfigurator();
+ configurator.configureJaxRsRuntime();
+ configurator.configureDefaults(Collections.<String, Object> emptyMap());
+ return new CxfJaxRsClientFactory(configurator);
+ }
+
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.jaxrs.client/src/org/eclipse/osee/jaxrs/client/internal/StandaloneModule.java b/plugins/org.eclipse.osee.jaxrs.client/src/org/eclipse/osee/jaxrs/client/internal/StandaloneModule.java
deleted file mode 100644
index 3a62d6247ed..00000000000
--- a/plugins/org.eclipse.osee.jaxrs.client/src/org/eclipse/osee/jaxrs/client/internal/StandaloneModule.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2013 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.jaxrs.client.internal;
-
-import static org.eclipse.osee.jaxrs.client.JaxRsClientUtils.subtypeOf;
-import java.util.Map;
-import org.eclipse.osee.jaxrs.client.JaxRsClient;
-import com.google.inject.AbstractModule;
-import com.google.inject.TypeLiteral;
-import com.google.inject.spi.InjectionListener;
-import com.google.inject.spi.TypeEncounter;
-import com.google.inject.spi.TypeListener;
-
-/**
- * @author Roberto E. Escobar
- */
-public class StandaloneModule extends AbstractModule {
-
- private final Map<String, Object> props;
-
- public StandaloneModule(Map<String, Object> props) {
- this.props = props;
- }
-
- @Override
- protected void configure() {
- bind(JaxRsClient.class).to(JaxRsClientImpl.class);
-
- TypeListener listener = new TypeListener() {
-
- @Override
- public <I> void hear(TypeLiteral<I> type, TypeEncounter<I> encounter) {
- encounter.register(new InjectionListener<I>() {
-
- @Override
- public void afterInjection(I injectee) {
- JaxRsClientImpl client = (JaxRsClientImpl) injectee;
- client.configure(props);
- }
- });
- }
- };
- bindListener(subtypeOf(JaxRsClient.class), listener);
- }
-
-}
diff --git a/plugins/org.eclipse.osee.jaxrs.client/src/org/eclipse/osee/jaxrs/client/internal/ext/CxfJaxRsClientConfigurator.java b/plugins/org.eclipse.osee.jaxrs.client/src/org/eclipse/osee/jaxrs/client/internal/ext/CxfJaxRsClientConfigurator.java
new file mode 100644
index 00000000000..6123b51ca8e
--- /dev/null
+++ b/plugins/org.eclipse.osee.jaxrs.client/src/org/eclipse/osee/jaxrs/client/internal/ext/CxfJaxRsClientConfigurator.java
@@ -0,0 +1,237 @@
+/*******************************************************************************
+ * Copyright (c) 2014 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.jaxrs.client.internal.ext;
+
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import javax.ws.rs.client.ClientBuilder;
+import javax.ws.rs.ext.RuntimeDelegate;
+import org.apache.cxf.configuration.security.AuthorizationPolicy;
+import org.apache.cxf.configuration.security.ProxyAuthorizationPolicy;
+import org.apache.cxf.feature.Feature;
+import org.apache.cxf.feature.LoggingFeature;
+import org.apache.cxf.jaxrs.client.JAXRSClientFactoryBean;
+import org.apache.cxf.jaxrs.client.ThreadLocalClientState;
+import org.apache.cxf.transport.common.gzip.GZIPFeature;
+import org.apache.cxf.transport.http.HTTPConduit;
+import org.apache.cxf.transports.http.configuration.HTTPClientPolicy;
+import org.apache.cxf.transports.http.configuration.ProxyServerType;
+import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
+import org.eclipse.osee.framework.jdk.core.util.Conditions;
+import org.eclipse.osee.jaxrs.JacksonFeature;
+import org.eclipse.osee.jaxrs.client.JaxRsClientConfig;
+import org.eclipse.osee.jaxrs.client.JaxRsClientConstants.ConnectionType;
+import org.eclipse.osee.jaxrs.client.JaxRsClientConstants.ProxyType;
+import org.eclipse.osee.jaxrs.client.internal.JaxRsClientConfigurator;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public final class CxfJaxRsClientConfigurator implements JaxRsClientConfigurator {
+
+ private static final String APACHE_CXF_LOGGER = "org.apache.cxf.Logger";
+ private static final String JAVAX_WS_RS_CLIENT_BUILDER_PROPERTY = "javax.ws.rs.client.ClientBuilder";
+
+ private static final String DEFAULT_JAXRS_CLIENT_BUILDER_IMPL = "org.apache.cxf.jaxrs.client.spec.ClientBuilderImpl";
+ private static final String DEFAULT_CXF_LOGGING_IMPL = "org.apache.cxf.common.logging.Slf4jLogger";
+
+ private List<? extends Object> providers;
+ private List<Feature> features;
+ private Map<String, Object> properties;
+
+ public List<? extends Object> getProviders() {
+ return providers;
+ }
+
+ public List<Feature> getFeatures() {
+ return features;
+ }
+
+ public Map<String, Object> getProperties() {
+ return properties;
+ }
+
+ @Override
+ public void configureJaxRsRuntime() {
+ System.setProperty(APACHE_CXF_LOGGER, DEFAULT_CXF_LOGGING_IMPL);
+
+ // Ensure CXF JAX-RS implementation is loaded
+ RuntimeDelegate runtimeDelegate = new org.apache.cxf.jaxrs.impl.RuntimeDelegateImpl();
+ RuntimeDelegate.setInstance(runtimeDelegate);
+
+ try {
+ ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
+ if (classLoader == null) {
+ classLoader = getClass().getClassLoader();
+ }
+ classLoader.loadClass(DEFAULT_JAXRS_CLIENT_BUILDER_IMPL);
+ } catch (ClassNotFoundException ex) {
+ throw new OseeCoreException(ex, "Unable to find JAX-RS Client Builder implementation - [%s]",
+ DEFAULT_JAXRS_CLIENT_BUILDER_IMPL);
+ }
+ System.setProperty(JAVAX_WS_RS_CLIENT_BUILDER_PROPERTY, DEFAULT_JAXRS_CLIENT_BUILDER_IMPL);
+ }
+
+ @Override
+ public void configureDefaults(Map<String, Object> properties) {
+ List<Object> providers = new ArrayList<Object>();
+ providers.add(new GenericResponseExceptionMapper());
+ providers.addAll(JacksonFeature.getProviders());
+ this.providers = providers;
+
+ List<Feature> features = new ArrayList<Feature>(2);
+ LoggingFeature loggingFeature = new LoggingFeature();
+ loggingFeature.setPrettyLogging(true);
+ features.add(loggingFeature);
+ features.add(new GZIPFeature());
+ this.features = features;
+ this.properties = new LinkedHashMap<String, Object>(properties);
+ }
+
+ @Override
+ public void configureBean(JaxRsClientConfig config, String serverAddress, JAXRSClientFactoryBean bean) {
+ Conditions.checkNotNullOrEmpty(serverAddress, "server address");
+ bean.setAddress(serverAddress);
+
+ bean.setProviders(getProviders());
+ bean.setFeatures(getFeatures());
+ bean.setProperties(getProperties());
+
+ /**
+ * If threadSafe is true then multiple threads can invoke on the same proxy or WebClient instance.
+ */
+ boolean threadSafe = config.isCreateThreadSafeProxyClients();
+ if (threadSafe) {
+ bean.setInitialState(new ThreadLocalClientState(serverAddress));
+ }
+
+ /**
+ * InheritHeaders, indicates if the headers set by a current proxy will be inherited when a sub-resource proxy is
+ * created vice versa.
+ */
+ boolean inheritHeaders = config.isProxyClientSubResourcesInheritHeaders();
+ bean.setInheritHeaders(inheritHeaders);
+ }
+
+ @Override
+ public void configureClientBuilder(JaxRsClientConfig config, ClientBuilder builder) {
+ register(builder, getProviders());
+ register(builder, getFeatures());
+ register(builder, getProperties());
+ }
+
+ @Override
+ public void configureConnection(JaxRsClientConfig config, HTTPConduit conduit) {
+ HTTPClientPolicy policy1 = getClientPolicy(conduit);
+
+ //@formatter:off
+ policy1.setAllowChunking(config.isChunkingAllowed());
+ policy1.setAsyncExecuteTimeout(config.getAsyncExecuteTimeout());
+ policy1.setAsyncExecuteTimeoutRejection(config.isAsyncExecuteTimeoutRejection());
+ policy1.setAutoRedirect(config.isFollowRedirectsAllowed());
+ policy1.setChunkingThreshold(config.getChunkingThreshold());
+ policy1.setChunkLength(config.getChunkLength());
+ policy1.setConnection(asCxfConnectionType(config.getConnectionType()));
+ policy1.setConnectionTimeout(config.getConnectionTimeout());
+ policy1.setMaxRetransmits(config.getMaxRetransmits());
+ policy1.setReceiveTimeout(config.getReceiveTimeout());
+ //@formatter:on
+
+ if (config.isServerAuthorizationRequired()) {
+ AuthorizationPolicy policy2 = getAuthorizationPolicy(conduit);
+ policy2.setUserName(config.getServerUsername());
+ policy2.setPassword(config.getServerPassword());
+ policy2.setAuthorizationType(config.getServerAuthorizationType());
+ }
+ }
+
+ @Override
+ public void configureProxy(JaxRsClientConfig config, HTTPConduit conduit) {
+ if (config.isProxyRequired()) {
+ HTTPClientPolicy policy1 = getClientPolicy(conduit);
+
+ policy1.setProxyServer(config.getProxyAddress());
+ int proxyPort = config.getProxyPort();
+ if (proxyPort > 0) {
+ policy1.setProxyServerPort(proxyPort);
+ }
+ policy1.setNonProxyHosts(config.getNonProxyHosts());
+ policy1.setProxyServerType(asProxyServerType(config.getProxyType()));
+
+ if (config.isProxyAuthorizationRequired()) {
+ ProxyAuthorizationPolicy policy3 = getProxyAuthorizationPolicy(conduit);
+ policy3.setUserName(config.getProxyUsername());
+ policy3.setPassword(config.getProxyPassword());
+ policy3.setAuthorizationType(config.getProxyAuthorizationType());
+ }
+ }
+ }
+
+ private static void register(ClientBuilder builder, Map<String, Object> properties) {
+ for (Entry<String, Object> entry : properties.entrySet()) {
+ builder.property(entry.getKey(), entry.getValue());
+ }
+ }
+
+ private static void register(ClientBuilder builder, Iterable<? extends Object> objects) {
+ for (Object object : objects) {
+ builder.register(object);
+ }
+ }
+
+ private static HTTPClientPolicy getClientPolicy(HTTPConduit conduit) {
+ HTTPClientPolicy toReturn = conduit.getClient();
+ if (toReturn == null) {
+ toReturn = new HTTPClientPolicy();
+ conduit.setClient(toReturn);
+ }
+ return toReturn;
+ }
+
+ private static AuthorizationPolicy getAuthorizationPolicy(HTTPConduit conduit) {
+ AuthorizationPolicy toReturn = conduit.getAuthorization();
+ if (toReturn == null) {
+ toReturn = new AuthorizationPolicy();
+ conduit.setAuthorization(toReturn);
+ }
+ return toReturn;
+ }
+
+ private static ProxyAuthorizationPolicy getProxyAuthorizationPolicy(HTTPConduit conduit) {
+ ProxyAuthorizationPolicy toReturn = conduit.getProxyAuthorization();
+ if (toReturn == null) {
+ toReturn = new ProxyAuthorizationPolicy();
+ conduit.setProxyAuthorization(toReturn);
+ }
+ return toReturn;
+ }
+
+ private static ProxyServerType asProxyServerType(ProxyType type) {
+ ProxyServerType toReturn = ProxyServerType.HTTP;
+ if (ProxyType.SOCKS == type) {
+ toReturn = ProxyServerType.SOCKS;
+ }
+ return toReturn;
+ }
+
+ private static org.apache.cxf.transports.http.configuration.ConnectionType asCxfConnectionType(ConnectionType type) {
+ org.apache.cxf.transports.http.configuration.ConnectionType toReturn =
+ org.apache.cxf.transports.http.configuration.ConnectionType.KEEP_ALIVE;
+ if (ConnectionType.CLOSE == type) {
+ toReturn = org.apache.cxf.transports.http.configuration.ConnectionType.CLOSE;
+ }
+ return toReturn;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.jaxrs.client/src/org/eclipse/osee/jaxrs/client/internal/ext/CxfJaxRsClientFactory.java b/plugins/org.eclipse.osee.jaxrs.client/src/org/eclipse/osee/jaxrs/client/internal/ext/CxfJaxRsClientFactory.java
new file mode 100644
index 00000000000..98e60cf1d21
--- /dev/null
+++ b/plugins/org.eclipse.osee.jaxrs.client/src/org/eclipse/osee/jaxrs/client/internal/ext/CxfJaxRsClientFactory.java
@@ -0,0 +1,85 @@
+/*******************************************************************************
+ * Copyright (c) 2014 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.jaxrs.client.internal.ext;
+
+import javax.ws.rs.client.Client;
+import javax.ws.rs.client.ClientBuilder;
+import javax.ws.rs.client.WebTarget;
+import org.apache.cxf.jaxrs.client.ClientConfiguration;
+import org.apache.cxf.jaxrs.client.JAXRSClientFactoryBean;
+import org.apache.cxf.jaxrs.client.WebClient;
+import org.apache.cxf.transport.http.HTTPConduit;
+import org.eclipse.osee.jaxrs.client.JaxRsClient.JaxRsClientFactory;
+import org.eclipse.osee.jaxrs.client.internal.JaxRsClientConfigurator;
+import org.eclipse.osee.jaxrs.client.JaxRsClientConfig;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class CxfJaxRsClientFactory implements JaxRsClientFactory {
+
+ private final JaxRsClientConfigurator configurator;
+
+ public CxfJaxRsClientFactory(JaxRsClientConfigurator configurator) {
+ super();
+ this.configurator = configurator;
+ }
+
+ /**
+ * Creates a JAX-RS WebTarget
+ *
+ * @param properties - configuration options
+ * @param baseAddress - optional base target address
+ * @return target
+ */
+ @Override
+ public WebTarget newTarget(JaxRsClientConfig config, String serverAddress) {
+ ClientBuilder builder = ClientBuilder.newBuilder();
+ configurator.configureClientBuilder(config, builder);
+
+ Client client = builder.build();
+ String baseAddress = serverAddress != null ? serverAddress : "";
+ WebTarget target = client.target(baseAddress);
+
+ // This is here to force a webClient creation so we can configure the conduit
+ target.request();
+
+ configureConnection(config, target);
+ return target;
+ }
+
+ /**
+ * Proxy sub-resource methods returning Objects can not be invoked. Prefer to have sub-resource methods returning
+ * typed classes: interfaces, abstract classes or concrete implementations.
+ *
+ * @param properties - configuration options
+ * @param baseAddress - proxy base address
+ * @param clazz - JAX-RS annotated class used to create the client interface
+ * @return targetProxy
+ */
+ @Override
+ public <T> T newClient(JaxRsClientConfig config, String serverAddress, Class<T> clazz) {
+ JAXRSClientFactoryBean bean = new JAXRSClientFactoryBean();
+ configurator.configureBean(config, serverAddress, bean);
+ bean.setServiceClass(clazz);
+ T client = bean.create(clazz);
+ configureConnection(config, client);
+ return client;
+ }
+
+ private void configureConnection(JaxRsClientConfig config, Object client) {
+ ClientConfiguration clientConfig = WebClient.getConfig(client);
+ HTTPConduit conduit = clientConfig.getHttpConduit();
+ configurator.configureConnection(config, conduit);
+ configurator.configureProxy(config, conduit);
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.jaxrs.client/src/org/eclipse/osee/jaxrs/client/internal/ext/GenericResponseExceptionMapper.java b/plugins/org.eclipse.osee.jaxrs.client/src/org/eclipse/osee/jaxrs/client/internal/ext/GenericResponseExceptionMapper.java
new file mode 100644
index 00000000000..0ae95181d3b
--- /dev/null
+++ b/plugins/org.eclipse.osee.jaxrs.client/src/org/eclipse/osee/jaxrs/client/internal/ext/GenericResponseExceptionMapper.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2014 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.jaxrs.client.internal.ext;
+
+import javax.ws.rs.core.Response;
+import javax.ws.rs.ext.Provider;
+import org.apache.cxf.jaxrs.client.ResponseExceptionMapper;
+import org.eclipse.osee.jaxrs.client.JaxRsExceptions;
+
+/**
+ * @author Roberto E. Escobar
+ */
+@Provider
+public class GenericResponseExceptionMapper implements ResponseExceptionMapper<Throwable> {
+
+ @Override
+ public Throwable fromResponse(Response response) {
+ return JaxRsExceptions.asOseeException(response);
+ }
+
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.jaxrs.server.test/pom.xml b/plugins/org.eclipse.osee.jaxrs.server.test/pom.xml
index 8646be265e9..16fb0065077 100644
--- a/plugins/org.eclipse.osee.jaxrs.server.test/pom.xml
+++ b/plugins/org.eclipse.osee.jaxrs.server.test/pom.xml
@@ -21,8 +21,11 @@
<artifactId>tycho-surefire-plugin</artifactId>
<version>${tycho-version}</version>
<configuration>
- <testSuite>org.eclipse.osee.jaxrs.server.test</testSuite>
- <testClass>org.eclipse.osee.jaxrs.server.test.JaxRsServerTestSuite</testClass>
+ <testSuite>org.eclipse.osee.jaxrs.server.test</testSuite>
+ <testClass>org.eclipse.osee.jaxrs.server.test.JaxRsServerTestSuite</testClass>
+ <systemProperties combine.children="append">
+ <javax.ws.rs.ext.RuntimeDelegate>org.apache.cxf.jaxrs.impl.RuntimeDelegateImpl</javax.ws.rs.ext.RuntimeDelegate>
+ </systemProperties>
</configuration>
</plugin>
</plugins>
diff --git a/plugins/org.eclipse.osee.jaxrs.server.test/src/org/eclipse/osee/jaxrs/server/internal/filters/SecurityContextProviderImplTest.java b/plugins/org.eclipse.osee.jaxrs.server.test/src/org/eclipse/osee/jaxrs/server/internal/filters/SecurityContextProviderImplTest.java
index 6c063e8ee06..9223c0ef3f1 100644
--- a/plugins/org.eclipse.osee.jaxrs.server.test/src/org/eclipse/osee/jaxrs/server/internal/filters/SecurityContextProviderImplTest.java
+++ b/plugins/org.eclipse.osee.jaxrs.server.test/src/org/eclipse/osee/jaxrs/server/internal/filters/SecurityContextProviderImplTest.java
@@ -12,20 +12,22 @@ package org.eclipse.osee.jaxrs.server.internal.filters;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
-import static org.mockito.Matchers.any;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import static org.mockito.MockitoAnnotations.initMocks;
+import java.net.URI;
+import java.net.URISyntaxException;
import java.security.Principal;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.TimeZone;
+import javax.ws.rs.container.ContainerRequestContext;
import javax.ws.rs.core.SecurityContext;
+import javax.ws.rs.core.UriInfo;
import org.eclipse.osee.authorization.admin.Authorization;
import org.eclipse.osee.authorization.admin.AuthorizationAdmin;
import org.eclipse.osee.authorization.admin.AuthorizationRequest;
import org.eclipse.osee.jaxrs.OseeWebApplicationException;
-import org.eclipse.osee.jaxrs.server.internal.filters.SecurityContextProviderImpl;
import org.eclipse.osee.logger.Log;
import org.junit.Before;
import org.junit.Rule;
@@ -33,8 +35,8 @@ import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.mockito.ArgumentCaptor;
import org.mockito.Captor;
+import org.mockito.Matchers;
import org.mockito.Mock;
-import com.sun.jersey.api.core.HttpRequestContext;
/**
* Unit Test for {@link SecurityContextProviderImpl}
@@ -55,7 +57,8 @@ public class SecurityContextProviderImplTest {
@Mock private Log logger;
@Mock private AuthorizationAdmin authorizationAdmin;
- @Mock private HttpRequestContext request;
+ @Mock private UriInfo uriInfo;
+ @Mock private ContainerRequestContext request;
@Mock private Authorization authorization;
@Mock private Principal principal;
@Captor private ArgumentCaptor<AuthorizationRequest> captor;
@@ -63,26 +66,31 @@ public class SecurityContextProviderImplTest {
private SecurityContextProviderImpl provider;
private SimpleDateFormat dateFormat;
+ private URI uriPath;
@Before
- public void setup() {
+ public void setup() throws URISyntaxException {
initMocks(this);
provider = new SecurityContextProviderImpl(logger, authorizationAdmin);
dateFormat = new SimpleDateFormat(SecurityContextProviderImpl.HTTP_DATE_FORMAT);
dateFormat.setTimeZone(TimeZone.getTimeZone("GMT"));
+
+ uriPath = new URI("https://someaddress.com");
}
@Test
public void testGetSecurityContext() {
- when(request.isSecure()).thenReturn(true);
- when(request.getHeaderValue(SecurityContextProviderImpl.AUTHORIZATION_HEADER)).thenReturn(AUTHORIZATION);
- when(request.getHeaderValue(SecurityContextProviderImpl.DATE_HEADER)).thenReturn(DATE_1);
- when(request.getPath()).thenReturn(PATH_1);
+ when(request.getUriInfo()).thenReturn(uriInfo);
+ when(uriInfo.getAbsolutePath()).thenReturn(uriPath);
+ when(uriInfo.getPath()).thenReturn(PATH_1);
+
+ when(request.getHeaderString(SecurityContextProviderImpl.AUTHORIZATION_HEADER)).thenReturn(AUTHORIZATION);
+ when(request.getHeaderString(SecurityContextProviderImpl.DATE_HEADER)).thenReturn(DATE_1);
when(request.getMethod()).thenReturn(METHOD_1);
- when(authorizationAdmin.authorize(any(AuthorizationRequest.class))).thenReturn(authorization);
+ when(authorizationAdmin.authorize(Matchers.any(AuthorizationRequest.class))).thenReturn(authorization);
when(authorization.getPrincipal()).thenReturn(principal);
when(authorization.isInRole(OK_ROLE)).thenReturn(true);
when(authorization.isSecure()).thenReturn(true);
@@ -110,12 +118,15 @@ public class SecurityContextProviderImplTest {
@Test
public void testGetSecurityContextException() {
- when(request.getHeaderValue(SecurityContextProviderImpl.AUTHORIZATION_HEADER)).thenReturn(AUTHORIZATION);
- when(request.getHeaderValue(SecurityContextProviderImpl.DATE_HEADER)).thenReturn(DATE_1);
- when(request.getPath()).thenReturn(PATH_1);
+ when(request.getUriInfo()).thenReturn(uriInfo);
+ when(uriInfo.getAbsolutePath()).thenReturn(uriPath);
+ when(uriInfo.getPath()).thenReturn(PATH_1);
+
+ when(request.getHeaderString(SecurityContextProviderImpl.AUTHORIZATION_HEADER)).thenReturn(AUTHORIZATION);
+ when(request.getHeaderString(SecurityContextProviderImpl.DATE_HEADER)).thenReturn(DATE_1);
when(request.getMethod()).thenReturn(METHOD_1);
- when(authorizationAdmin.authorize(any(AuthorizationRequest.class))).thenReturn(null);
+ when(authorizationAdmin.authorize(Matchers.any(AuthorizationRequest.class))).thenReturn(null);
SecurityContext context = provider.getSecurityContext(request);
diff --git a/plugins/org.eclipse.osee.jaxrs.server/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.jaxrs.server/META-INF/MANIFEST.MF
index e09aee57fe3..7d0eea2cb04 100644
--- a/plugins/org.eclipse.osee.jaxrs.server/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.osee.jaxrs.server/META-INF/MANIFEST.MF
@@ -6,24 +6,30 @@ Bundle-Version: 0.18.0.qualifier
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Service-Component: OSGI-INF/*.xml
Import-Package: com.google.common.io,
- com.sun.jersey.api.container.filter;version="1.18.0",
- com.sun.jersey.api.container.filter.servlet;version="1.18.0",
- com.sun.jersey.api.core;version="1.18.0",
- com.sun.jersey.api.model;version="1.18.0",
- com.sun.jersey.api.wadl.config;version="1.18.0",
- com.sun.jersey.server.wadl;version="1.18.0",
- com.sun.jersey.server.wadl.generators;version="1.18.0",
- com.sun.jersey.server.wadl.generators.resourcedoc;version="1.18.0",
- com.sun.jersey.server.wadl.generators.resourcedoc.model;version="1.18.0",
- com.sun.jersey.server.wadl.generators.resourcedoc.xhtml;version="1.18.0",
- com.sun.jersey.spi.container;version="1.18.0",
- com.sun.jersey.spi.container.servlet;version="1.18.0",
javax.annotation.security;version="1.1.0",
- javax.servlet;version="2.5.0",
- javax.servlet.http;version="2.5.0",
- javax.ws.rs,
- javax.ws.rs.core,
- javax.ws.rs.ext,
+ javax.servlet;version="2.6.0",
+ javax.servlet.http;version="2.6.0",
+ javax.ws.rs;version="2.0.0",
+ javax.ws.rs.container;version="2.0.0",
+ javax.ws.rs.core;version="2.0.0",
+ javax.ws.rs.ext;version="2.0.0",
+ org.apache.cxf;version="3.0.0",
+ org.apache.cxf.binding;version="3.0.0",
+ org.apache.cxf.endpoint;version="3.0.0",
+ org.apache.cxf.feature;version="3.0.0",
+ org.apache.cxf.interceptor;version="3.0.0",
+ org.apache.cxf.interceptor.security;version="3.0.0",
+ org.apache.cxf.jaxrs;version="3.0.0",
+ org.apache.cxf.jaxrs.impl;version="3.0.0",
+ org.apache.cxf.jaxrs.provider.json;version="3.0.0",
+ org.apache.cxf.jaxrs.utils;version="3.0.0",
+ org.apache.cxf.jaxrs.validation;version="3.0.0",
+ org.apache.cxf.service.factory;version="3.0.0",
+ org.apache.cxf.transport;version="3.0.0",
+ org.apache.cxf.transport.common.gzip;version="3.0.0",
+ org.apache.cxf.transport.http;version="3.0.0",
+ org.apache.cxf.transport.servlet;version="3.0.0",
+ org.codehaus.jackson.jaxrs;version="1.9.13",
org.eclipse.osee.authorization.admin,
org.eclipse.osee.framework.jdk.core.type,
org.eclipse.osee.framework.jdk.core.util,
@@ -32,6 +38,3 @@ Import-Package: com.google.common.io,
org.osgi.framework,
org.osgi.service.http
Bundle-Vendor: Eclipse Open System Engineering Environment
-Require-Bundle: org.codehaus.jackson.core,
- org.codehaus.jackson.jaxrs,
- org.codehaus.jackson.mapper
diff --git a/plugins/org.eclipse.osee.jaxrs.server/OSGI-INF/jaxrs.application.registry.xml b/plugins/org.eclipse.osee.jaxrs.server/OSGI-INF/jaxrs.application.registry.xml
index 6cf025dfa7b..7ffe90bbc33 100644
--- a/plugins/org.eclipse.osee.jaxrs.server/OSGI-INF/jaxrs.application.registry.xml
+++ b/plugins/org.eclipse.osee.jaxrs.server/OSGI-INF/jaxrs.application.registry.xml
@@ -4,7 +4,6 @@
<service>
<provide interface="org.eclipse.osee.jaxrs.server.internal.applications.JaxRsApplicationRegistry"/>
</service>
- <reference bind="setHttpService" cardinality="1..1" interface="org.osgi.service.http.HttpService" name="HttpService" policy="static" />
<reference bind="setLogger" cardinality="1..1" interface="org.eclipse.osee.logger.Log" name="Log" policy="static"/>
- <reference bind="setAuthorizationAdmin" cardinality="1..1" interface="org.eclipse.osee.authorization.admin.AuthorizationAdmin" name="AuthorizationAdmin" policy="static"/>
+ <reference bind="setJaxRsFactory" cardinality="1..1" interface="org.eclipse.osee.jaxrs.server.internal.applications.JaxRsFactory" name="JaxRsFactory" policy="static"/>
</scr:component>
diff --git a/plugins/org.eclipse.osee.jaxrs.server/OSGI-INF/jaxrs.factory.xml b/plugins/org.eclipse.osee.jaxrs.server/OSGI-INF/jaxrs.factory.xml
new file mode 100644
index 00000000000..de3aec8da1c
--- /dev/null
+++ b/plugins/org.eclipse.osee.jaxrs.server/OSGI-INF/jaxrs.factory.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" activate="start" deactivate="stop">
+ <implementation class="org.eclipse.osee.jaxrs.server.internal.ext.CxfJaxRsFactory" />
+ <service>
+ <provide interface="org.eclipse.osee.jaxrs.server.internal.applications.JaxRsFactory"/>
+ </service>
+ <reference bind="setHttpService" cardinality="1..1" interface="org.osgi.service.http.HttpService" name="HttpService" policy="static" />
+ <reference bind="setLogger" cardinality="1..1" interface="org.eclipse.osee.logger.Log" name="Log" policy="static"/>
+ <reference bind="setAuthorizationAdmin" cardinality="1..1" interface="org.eclipse.osee.authorization.admin.AuthorizationAdmin" name="AuthorizationAdmin" policy="static"/>
+</scr:component>
diff --git a/plugins/org.eclipse.osee.jaxrs.server/src/org/eclipse/osee/jaxrs/server/internal/applications/AbstractJaxRsContainer.java b/plugins/org.eclipse.osee.jaxrs.server/src/org/eclipse/osee/jaxrs/server/internal/applications/AbstractJaxRsContainer.java
index 15d7c35b8dd..4a497a305d1 100644
--- a/plugins/org.eclipse.osee.jaxrs.server/src/org/eclipse/osee/jaxrs/server/internal/applications/AbstractJaxRsContainer.java
+++ b/plugins/org.eclipse.osee.jaxrs.server/src/org/eclipse/osee/jaxrs/server/internal/applications/AbstractJaxRsContainer.java
@@ -57,6 +57,10 @@ public abstract class AbstractJaxRsContainer<H extends HttpServlet, C extends Ab
return props;
}
+ protected H getBaseServlet() {
+ return baseJaxsRsServlet;
+ }
+
@Override
public String getServletContext() {
return servletContextName.get();
diff --git a/plugins/org.eclipse.osee.jaxrs.server/src/org/eclipse/osee/jaxrs/server/internal/applications/JaxRsApplicationRegistry.java b/plugins/org.eclipse.osee.jaxrs.server/src/org/eclipse/osee/jaxrs/server/internal/applications/JaxRsApplicationRegistry.java
index 454aed30496..f30c1b62fe7 100644
--- a/plugins/org.eclipse.osee.jaxrs.server/src/org/eclipse/osee/jaxrs/server/internal/applications/JaxRsApplicationRegistry.java
+++ b/plugins/org.eclipse.osee.jaxrs.server/src/org/eclipse/osee/jaxrs/server/internal/applications/JaxRsApplicationRegistry.java
@@ -13,17 +13,12 @@ package org.eclipse.osee.jaxrs.server.internal.applications;
import java.util.Iterator;
import java.util.concurrent.ConcurrentHashMap;
import javax.ws.rs.core.Application;
-import org.eclipse.osee.authorization.admin.AuthorizationAdmin;
import org.eclipse.osee.jaxrs.server.internal.JaxRsConfiguration;
import org.eclipse.osee.jaxrs.server.internal.JaxRsConstants;
import org.eclipse.osee.jaxrs.server.internal.JaxRsVisitable;
import org.eclipse.osee.jaxrs.server.internal.JaxRsVisitor;
-import org.eclipse.osee.jaxrs.server.internal.ext.JerseyJaxRsFactory;
-import org.eclipse.osee.jaxrs.server.internal.filters.SecurityContextFilter;
-import org.eclipse.osee.jaxrs.server.internal.filters.SecurityContextProviderImpl;
import org.eclipse.osee.logger.Log;
import org.osgi.framework.Bundle;
-import org.osgi.service.http.HttpService;
/**
* @author Roberto E. Escobar
@@ -62,35 +57,24 @@ public class JaxRsApplicationRegistry implements JaxRsVisitable {
new ConcurrentHashMap<String, JaxRsContainerProvider>();
private Log logger;
- private HttpService httpService;
- private AuthorizationAdmin authorizationAdmin;
-
private JaxRsFactory factory;
- private String baseContext = JaxRsConstants.DEFAULT_JAXRS_BASE_CONTEXT;
- public void setHttpService(HttpService httpService) {
- this.httpService = httpService;
- }
+ private String baseContext = JaxRsConstants.DEFAULT_JAXRS_BASE_CONTEXT;
public void setLogger(Log logger) {
this.logger = logger;
}
- public void setAuthorizationAdmin(AuthorizationAdmin authorizationAdmin) {
- this.authorizationAdmin = authorizationAdmin;
+ public void setJaxRsFactory(JaxRsFactory factory) {
+ this.factory = factory;
}
public void start() {
logger.trace("Starting [%s]...", getClass().getSimpleName());
- SecurityContextProviderImpl provider = new SecurityContextProviderImpl(logger, authorizationAdmin);
- SecurityContextFilter filter = new SecurityContextFilter(provider);
-
- factory = new JerseyJaxRsFactory(logger, httpService, filter);
}
public void stop() {
logger.trace("Stopping [%s]...", getClass().getSimpleName());
- this.factory = null;
}
public String getBaseContext() {
diff --git a/plugins/org.eclipse.osee.jaxrs.server/src/org/eclipse/osee/jaxrs/server/internal/ext/CxfJaxRsFactory.java b/plugins/org.eclipse.osee.jaxrs.server/src/org/eclipse/osee/jaxrs/server/internal/ext/CxfJaxRsFactory.java
new file mode 100644
index 00000000000..7ee24a05fa5
--- /dev/null
+++ b/plugins/org.eclipse.osee.jaxrs.server/src/org/eclipse/osee/jaxrs/server/internal/ext/CxfJaxRsFactory.java
@@ -0,0 +1,264 @@
+/*******************************************************************************
+ * Copyright (c) 2014 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.jaxrs.server.internal.ext;
+
+import java.util.ArrayList;
+import java.util.Dictionary;
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.atomic.AtomicBoolean;
+import javax.ws.rs.core.Application;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response.Status;
+import javax.ws.rs.ext.RuntimeDelegate;
+import org.apache.cxf.Bus;
+import org.apache.cxf.endpoint.Server;
+import org.apache.cxf.feature.Feature;
+import org.apache.cxf.feature.LoggingFeature;
+import org.apache.cxf.jaxrs.JAXRSBindingFactory;
+import org.apache.cxf.jaxrs.JAXRSServerFactoryBean;
+import org.apache.cxf.jaxrs.impl.WebApplicationExceptionMapper;
+import org.apache.cxf.jaxrs.utils.ResourceUtils;
+import org.apache.cxf.transport.common.gzip.GZIPFeature;
+import org.apache.cxf.transport.servlet.CXFNonSpringServlet;
+import org.eclipse.osee.authorization.admin.AuthorizationAdmin;
+import org.eclipse.osee.jaxrs.JacksonFeature;
+import org.eclipse.osee.jaxrs.OseeWebApplicationException;
+import org.eclipse.osee.jaxrs.server.internal.JaxRsUtils;
+import org.eclipse.osee.jaxrs.server.internal.JaxRsVisitable;
+import org.eclipse.osee.jaxrs.server.internal.applications.AbstractJaxRsApplicationContainer;
+import org.eclipse.osee.jaxrs.server.internal.applications.AbstractJaxRsContainer;
+import org.eclipse.osee.jaxrs.server.internal.applications.JaxRsApplicationRegistry.JaxRsContainer;
+import org.eclipse.osee.jaxrs.server.internal.applications.JaxRsApplicationRegistry.JaxRsContainerProvider;
+import org.eclipse.osee.jaxrs.server.internal.applications.JaxRsContainerProviderImpl;
+import org.eclipse.osee.jaxrs.server.internal.applications.JaxRsFactory;
+import org.eclipse.osee.jaxrs.server.internal.exceptions.GenericExceptionMapper;
+import org.eclipse.osee.jaxrs.server.internal.filters.SecurityContextFilter;
+import org.eclipse.osee.jaxrs.server.internal.filters.SecurityContextProviderImpl;
+import org.eclipse.osee.logger.Log;
+import org.osgi.service.http.HttpService;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public final class CxfJaxRsFactory implements JaxRsFactory {
+
+ private static final String APACHE_CXF_LOGGER = "org.apache.cxf.Logger";
+ private static final String DEFAULT_CXF_LOGGING_IMPL = "org.apache.cxf.common.logging.Slf4jLogger";
+
+ private Log logger;
+ private HttpService httpService;
+ private AuthorizationAdmin authorizationAdmin;
+
+ private List<Feature> features;
+ private List<? extends Object> providers;
+ private Map<String, Object> properties;
+ private Map<Object, Object> extensionMappings;
+
+ public void setLogger(Log logger) {
+ this.logger = logger;
+ }
+
+ public void setHttpService(HttpService httpService) {
+ this.httpService = httpService;
+ }
+
+ public void setAuthorizationAdmin(AuthorizationAdmin authorizationAdmin) {
+ this.authorizationAdmin = authorizationAdmin;
+ }
+
+ public void start(Map<String, Object> props) {
+ logger.debug("Starting [%s]...", getClass().getSimpleName());
+
+ System.setProperty(APACHE_CXF_LOGGER, DEFAULT_CXF_LOGGING_IMPL);
+
+ // Ensure CXF JAX-RS implementation is loaded
+ RuntimeDelegate runtimeDelegate = new org.apache.cxf.jaxrs.impl.RuntimeDelegateImpl();
+ RuntimeDelegate.setInstance(runtimeDelegate);
+
+ SecurityContextProviderImpl provider = new SecurityContextProviderImpl(logger, authorizationAdmin);
+ SecurityContextFilter filter = new SecurityContextFilter(provider);
+
+ List<Object> providers = new ArrayList<Object>();
+ WebApplicationExceptionMapper waem = new WebApplicationExceptionMapper();
+ waem.setPrintStackTrace(true);
+ waem.setAddMessageToResponse(true);
+
+ providers.add(waem);
+ providers.add(new GenericExceptionMapper(logger));
+ providers.addAll(JacksonFeature.getProviders());
+ providers.add(filter);
+ this.providers = providers;
+
+ List<Feature> features = new ArrayList<Feature>();
+ LoggingFeature loggingFeature = new LoggingFeature();
+ loggingFeature.setPrettyLogging(true);
+
+ features.add(loggingFeature);
+ features.add(new GZIPFeature());
+ this.features = features;
+
+ Map<Object, Object> extensionMappings = new HashMap<Object, Object>(4);
+ extensionMappings.put("xml", MediaType.APPLICATION_XML);
+ extensionMappings.put("json", MediaType.APPLICATION_JSON);
+ extensionMappings.put("gzip", "application/gzip");
+ extensionMappings.put("zip", "application/zip");
+ this.extensionMappings = extensionMappings;
+ this.properties = props;
+ }
+
+ public void stop() {
+ RuntimeDelegate.setInstance(null);
+ if (providers != null) {
+ providers.clear();
+ providers = null;
+ }
+ if (features != null) {
+ features.clear();
+ features = null;
+ }
+ if (extensionMappings != null) {
+ extensionMappings.clear();
+ extensionMappings = null;
+ }
+ properties = null;
+ }
+
+ private Map<Object, Object> getExtensionMappings() {
+ return extensionMappings;
+ }
+
+ private List<? extends Object> getProviders() {
+ return providers;
+ }
+
+ private List<Feature> getFeatures() {
+ return features;
+ }
+
+ private Map<String, Object> getProperties() {
+ return properties;
+ }
+
+ @Override
+ public JaxRsContainerProvider newJaxRsContainerProvider(String contextName) {
+ return new JaxRsContainerProviderImpl(this, contextName);
+ }
+
+ @Override
+ public JaxRsContainer newJaxRsContainer(String contextName) {
+ Dictionary<String, Object> props = new Hashtable<String, Object>();
+ CxfJaxRsContainer container = new CxfJaxRsContainer(logger, httpService, props);
+ container.setServletContext(contextName);
+ logger.trace("Create - [%s]", container);
+ return container;
+ }
+
+ private CxfJaxRsApplicationContainer newApplicationContainer(String applicationContext) {
+ return new CxfJaxRsApplicationContainer(applicationContext);
+ }
+
+ private CXFNonSpringServlet newBaseJaxsRsServlet(JaxRsVisitable visitable) {
+ return new CXFNonSpringServlet();
+ }
+
+ public Server newCxfServer(CXFNonSpringServlet servlet, String applicationPath, Application application) {
+ String contextName = servlet.getServletName();
+ Bus bus = servlet.getBus();
+ if (bus == null) {
+ throw new OseeWebApplicationException(Status.INTERNAL_SERVER_ERROR,
+ "Error initializing [%s] for application [%s] - bus was null", contextName, application);
+ }
+
+ boolean ignoreApplicationPath = true;
+ boolean staticSubresourceResolution = true;
+ JAXRSServerFactoryBean bean =
+ ResourceUtils.createApplication(application, ignoreApplicationPath, staticSubresourceResolution);
+
+ if (JaxRsUtils.hasPath(applicationPath)) {
+ String subAddress = JaxRsUtils.normalize(applicationPath);
+ bean.setAddress(subAddress);
+ }
+
+ bean.setProviders(getProviders());
+ bean.setFeatures(getFeatures());
+ bean.setProperties(getProperties());
+ bean.setExtensionMappings(getExtensionMappings());
+
+ bean.setBindingId(JAXRSBindingFactory.JAXRS_BINDING_ID);
+ bean.setTransportId("http://cxf.apache.org/transports/http");
+
+ bean.setBus(bus);
+ bean.setStart(false);
+
+ Server server = bean.create();
+ return server;
+ }
+
+ private final class CxfJaxRsContainer extends AbstractJaxRsContainer<CXFNonSpringServlet, CxfJaxRsApplicationContainer> {
+
+ public CxfJaxRsContainer(Log logger, HttpService httpService, Dictionary<String, Object> props) {
+ super(logger, httpService, props);
+ }
+
+ @Override
+ protected CxfJaxRsApplicationContainer createApplicationContainer(String applicationContext) {
+ return newApplicationContainer(applicationContext);
+ }
+
+ @Override
+ protected CXFNonSpringServlet createBaseJaxsRsServlet(JaxRsVisitable visitable) {
+ return newBaseJaxsRsServlet(visitable);
+ }
+
+ @Override
+ protected void startContainer(CxfJaxRsApplicationContainer container) {
+ CXFNonSpringServlet baseServlet = getBaseServlet();
+ container.startContainer(baseServlet);
+ }
+
+ @Override
+ protected void stopContainer(CxfJaxRsApplicationContainer container) {
+ container.stopContainer();
+ }
+
+ };
+
+ private final class CxfJaxRsApplicationContainer extends AbstractJaxRsApplicationContainer {
+
+ private final AtomicBoolean isRegistered = new AtomicBoolean(false);
+ private volatile Server server;
+
+ public CxfJaxRsApplicationContainer(String applicationContext) {
+ super(applicationContext);
+ }
+
+ public void startContainer(CXFNonSpringServlet servlet) {
+ if (!isRegistered.getAndSet(true)) {
+ Server newServer = newCxfServer(servlet, getApplicationContext(), getApplication());
+ newServer.start();
+ server = newServer;
+ }
+ }
+
+ public void stopContainer() {
+ if (isRegistered.getAndSet(false)) {
+ if (server != null) {
+ server.stop();
+ server.destroy();
+ }
+ }
+ }
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.jaxrs.server/src/org/eclipse/osee/jaxrs/server/internal/ext/JerseyJaxRsFactory.java b/plugins/org.eclipse.osee.jaxrs.server/src/org/eclipse/osee/jaxrs/server/internal/ext/JerseyJaxRsFactory.java
deleted file mode 100644
index a18e890b776..00000000000
--- a/plugins/org.eclipse.osee.jaxrs.server/src/org/eclipse/osee/jaxrs/server/internal/ext/JerseyJaxRsFactory.java
+++ /dev/null
@@ -1,210 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2014 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.jaxrs.server.internal.ext;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Dictionary;
-import java.util.HashMap;
-import java.util.Hashtable;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.atomic.AtomicBoolean;
-import javax.servlet.http.HttpServlet;
-import javax.ws.rs.core.Application;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response.Status;
-import org.eclipse.osee.jaxrs.OseeWebApplicationException;
-import org.eclipse.osee.jaxrs.server.internal.JaxRsUtils;
-import org.eclipse.osee.jaxrs.server.internal.JaxRsVisitable;
-import org.eclipse.osee.jaxrs.server.internal.applications.AbstractJaxRsApplicationContainer;
-import org.eclipse.osee.jaxrs.server.internal.applications.AbstractJaxRsContainer;
-import org.eclipse.osee.jaxrs.server.internal.applications.JaxRsApplicationRegistry.JaxRsContainer;
-import org.eclipse.osee.jaxrs.server.internal.applications.JaxRsApplicationRegistry.JaxRsContainerProvider;
-import org.eclipse.osee.jaxrs.server.internal.applications.JaxRsContainerProviderImpl;
-import org.eclipse.osee.jaxrs.server.internal.applications.JaxRsFactory;
-import org.eclipse.osee.jaxrs.server.internal.exceptions.GenericExceptionMapper;
-import org.eclipse.osee.jaxrs.server.internal.filters.SecureResourceFilterFactory;
-import org.eclipse.osee.jaxrs.server.internal.filters.SecurityContextFilter;
-import org.eclipse.osee.jaxrs.server.internal.resources.ServicesResource;
-import org.eclipse.osee.logger.Log;
-import org.osgi.service.http.HttpService;
-import com.sun.jersey.api.container.filter.UriConnegFilter;
-import com.sun.jersey.api.core.DefaultResourceConfig;
-import com.sun.jersey.api.core.ResourceConfig;
-import com.sun.jersey.spi.container.ResourceFilterFactory;
-import com.sun.jersey.spi.container.servlet.ServletContainer;
-
-/**
- * @author Roberto E. Escobar
- */
-public final class JerseyJaxRsFactory implements JaxRsFactory {
-
- private final Log logger;
- private final HttpService httpService;
- private final SecurityContextFilter securityContextFilter;
-
- private List<Object> singletons;
- private List<Object> requestFilters;
-
- public JerseyJaxRsFactory(Log logger, HttpService httpService, SecurityContextFilter securityContextFilter) {
- super();
- this.logger = logger;
- this.httpService = httpService;
- this.securityContextFilter = securityContextFilter;
- }
-
- @Override
- public JaxRsContainerProvider newJaxRsContainerProvider(String contextName) {
- return new JaxRsContainerProviderImpl(this, contextName);
- }
-
- @Override
- public JaxRsContainer newJaxRsContainer(String contextName) {
- Dictionary<String, Object> props = new Hashtable<String, Object>();
- JerseyJaxRsContainer container = new JerseyJaxRsContainer(logger, httpService, props);
- container.setServletContext(contextName);
- logger.trace("Create - [%s]", container);
- return container;
- }
-
- private List<Object> getResourceSingletons() {
- if (singletons == null) {
- List<Object> resources = new ArrayList<Object>();
- resources.add(new GenericExceptionMapper(logger));
- singletons = resources;
- }
- return singletons;
- }
-
- private List<Object> getRequestFilters() {
- if (requestFilters == null) {
- List<Object> resources = new ArrayList<Object>();
- Map<String, MediaType> mappings = new HashMap<String, MediaType>();
- mappings.put("xml", MediaType.APPLICATION_XML_TYPE);
- mappings.put("json", MediaType.APPLICATION_JSON_TYPE);
- UriConnegFilter filter1 = new UriConnegFilter(mappings);
- resources.add(filter1);
- requestFilters = resources;
- }
- return requestFilters;
- }
-
- private List<ResourceFilterFactory> getResourceFilterFactories() {
- SecureResourceFilterFactory filterFactory = new SecureResourceFilterFactory(logger, securityContextFilter);
- return Collections.<ResourceFilterFactory> singletonList(filterFactory);
- }
-
- private JerseyJaxRsApplicationContainer newApplicationContainer(String applicationContext) {
- return new JerseyJaxRsApplicationContainer(applicationContext);
- }
-
- private DefaultResourceConfig newResourceConfig() {
- DefaultResourceConfig config = new DefaultResourceConfig();
- Map<String, Object> properties = config.getProperties();
- properties.put(ResourceConfig.PROPERTY_CONTAINER_REQUEST_FILTERS, getRequestFilters());
- properties.put(ResourceConfig.PROPERTY_RESOURCE_FILTER_FACTORIES, getResourceFilterFactories());
- for (Object resource : getResourceSingletons()) {
- config.getSingletons().add(resource);
- }
- return config;
- }
-
- private HttpServlet newBaseJaxsRsServlet(JaxRsVisitable visitable) {
- DefaultResourceConfig config = newResourceConfig();
- config.getSingletons().add(new ServicesResource(visitable));
- return new ServletContainer(config);
- }
-
- private HttpServlet newApplicationServlet(JaxRsVisitable visitable, Application application) {
- DefaultResourceConfig config = newResourceConfig();
- config.add(application);
- JerseyWadlGeneratorConfig wadl = new JerseyWadlGeneratorConfig(logger, visitable);
- Map<String, Object> properties = config.getProperties();
- if (wadl.hasExtendedWadl()) {
- properties.put(ResourceConfig.PROPERTY_WADL_GENERATOR_CONFIG, wadl);
- } else {
- properties.remove(ResourceConfig.PROPERTY_WADL_GENERATOR_CONFIG);
- }
- return new ServletContainer(config);
- }
-
- private final class JerseyJaxRsContainer extends AbstractJaxRsContainer<HttpServlet, JerseyJaxRsApplicationContainer> {
-
- public JerseyJaxRsContainer(Log logger, HttpService httpService, Dictionary<String, Object> props) {
- super(logger, httpService, props);
- }
-
- @Override
- protected JerseyJaxRsApplicationContainer createApplicationContainer(String applicationContext) {
- return newApplicationContainer(applicationContext);
- }
-
- @Override
- protected HttpServlet createBaseJaxsRsServlet(JaxRsVisitable visitable) {
- return newBaseJaxsRsServlet(visitable);
- }
-
- @Override
- protected void startContainer(JerseyJaxRsApplicationContainer container) {
- String baseContext = getServletContext();
- Dictionary<String, Object> properties = getServletProperties();
- HttpService httpService = getHttpService();
- container.startContainer(httpService, baseContext, properties);
- }
-
- @Override
- protected void stopContainer(JerseyJaxRsApplicationContainer container) {
- String baseContext = getServletContext();
- HttpService httpService = getHttpService();
- container.stopContainer(httpService, baseContext);
- }
-
- };
-
- private final class JerseyJaxRsApplicationContainer extends AbstractJaxRsApplicationContainer {
-
- private final AtomicBoolean isRegistered = new AtomicBoolean(false);
-
- public JerseyJaxRsApplicationContainer(String applicationContext) {
- super(applicationContext);
- }
-
- public void startContainer(HttpService httpService, String baseContext, Dictionary<String, Object> props) {
- if (!isRegistered.getAndSet(true)) {
- String contextName = getAbsoluteContext(baseContext);
- Application application = getApplication();
- HttpServlet servlet = newApplicationServlet(this, application);
- try {
- httpService.registerServlet(contextName, servlet, props, null);
- } catch (Exception ex) {
- throw new OseeWebApplicationException(ex, Status.INTERNAL_SERVER_ERROR,
- "Error registering servlet [%s] ", contextName);
- }
- }
- }
-
- public void stopContainer(HttpService httpService, String baseContext) {
- if (isRegistered.getAndSet(false)) {
- String contextName = getAbsoluteContext(baseContext);
- httpService.unregister(contextName);
- }
- }
-
- private String getAbsoluteContext(String baseContext) {
- String appPath = JaxRsUtils.normalize(getApplicationContext());
- String path = String.format("%s%s", baseContext, appPath);
- path = path.replaceAll("//", "/");
- return path;
- }
- }
-
-}
diff --git a/plugins/org.eclipse.osee.jaxrs.server/src/org/eclipse/osee/jaxrs/server/internal/ext/JerseyWadlGeneratorConfig.java b/plugins/org.eclipse.osee.jaxrs.server/src/org/eclipse/osee/jaxrs/server/internal/ext/JerseyWadlGeneratorConfig.java
deleted file mode 100644
index 8a9b431c946..00000000000
--- a/plugins/org.eclipse.osee.jaxrs.server/src/org/eclipse/osee/jaxrs/server/internal/ext/JerseyWadlGeneratorConfig.java
+++ /dev/null
@@ -1,139 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2013 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.jaxrs.server.internal.ext;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import javax.ws.rs.core.Application;
-import org.eclipse.osee.framework.jdk.core.util.Lib;
-import org.eclipse.osee.jaxrs.server.internal.JaxRsVisitable;
-import org.eclipse.osee.jaxrs.server.internal.JaxRsVisitor;
-import org.eclipse.osee.logger.Log;
-import org.osgi.framework.Bundle;
-import com.google.common.io.InputSupplier;
-import com.sun.jersey.api.wadl.config.WadlGeneratorConfig;
-import com.sun.jersey.api.wadl.config.WadlGeneratorDescription;
-import com.sun.jersey.server.wadl.generators.WadlGeneratorApplicationDoc;
-import com.sun.jersey.server.wadl.generators.WadlGeneratorGrammarsSupport;
-import com.sun.jersey.server.wadl.generators.resourcedoc.WadlGeneratorResourceDocSupport;
-
-/**
- * @author Roberto E. Escobar
- */
-public class JerseyWadlGeneratorConfig extends WadlGeneratorConfig {
-
- private final Log logger;
- private final JaxRsVisitable visitable;
-
- public JerseyWadlGeneratorConfig(Log logger, JaxRsVisitable visitable) {
- this.logger = logger;
- this.visitable = visitable;
- }
-
- private Iterable<Bundle> getBundles() {
- final List<Bundle> bundles = new ArrayList<Bundle>();
- visitable.accept(new JaxRsVisitor() {
-
- @Override
- public void onApplication(String applicationContext, String componentName, Bundle bundle, Application application) {
- bundles.add(bundle);
- }
- });
- return bundles;
- }
-
- public boolean hasExtendedWadl() {
- boolean result = false;
- Iterable<Bundle> bundles = getBundles();
- for (Bundle bundle : bundles) {
- result = hasExtendedWadl(bundle);
- if (result) {
- break;
- }
- }
- return result;
- }
-
- @Override
- public List<WadlGeneratorDescription> configure() {
- List<WadlGeneratorDescription> toReturn;
-
- InputStream appDocsStream = null;
- InputStream grammarsStream = null;
- InputStream resourceDocStream = null;
- try {
- appDocsStream = getAsInputStream("REST-INF/application-doc.xml", "applicationDocs");
- grammarsStream = getAsInputStream("REST-INF/application-grammars.xml", "grammars");
- resourceDocStream = getAsInputStream("REST-INF/resourcedoc.xml", "resourceDoc");
-
- toReturn = generator(WadlGeneratorApplicationDoc.class) //
- .prop("applicationDocsStream", appDocsStream) //
- .generator(WadlGeneratorGrammarsSupport.class) //
- .prop("grammarsStream", grammarsStream) //
- .generator(WadlGeneratorResourceDocSupport.class) //
- .prop("resourceDocStream", resourceDocStream) //
- .descriptions();
- } catch (Exception ex) {
- logger.error(ex, "Error generating wadl");
- toReturn = Collections.emptyList();
- } finally {
- Lib.close(appDocsStream);
- Lib.close(grammarsStream);
- Lib.close(resourceDocStream);
- }
- return toReturn;
- }
-
- private static InputSupplier<InputStream> newSupplier(final URL url) {
- return new InputSupplier<InputStream>() {
- @Override
- public InputStream getInput() throws IOException {
- return url.openStream();
- }
- };
- }
-
- private InputStream getAsInputStream(String path, String xmlRoot) throws Exception {
- RestResourceConcatenator concat = new RestResourceConcatenator();
- concat.initialize(xmlRoot);
- Iterable<Bundle> bundles = getBundles();
- for (Bundle bundle : bundles) {
- if (hasExtendedWadl(bundle)) {
- URL url = bundle.getResource(path);
- concat.addResource(newSupplier(url));
- }
- }
- return concat.getAsInputStream();
- }
-
- private boolean hasEntries(Bundle bundle, String... paths) {
- // if you don't pass in any paths, this will return true
- for (String path : paths) {
- if (!hasEntry(bundle, path)) {
- return false;
- }
- }
- return true;
- }
-
- private boolean hasExtendedWadl(Bundle bundle) {
- return hasEntries(bundle, "REST-INF/application-doc.xml", "REST-INF/application-grammars.xml",
- "REST-INF/resourcedoc.xml");
- }
-
- private boolean hasEntry(Bundle bundle, String path) {
- return bundle.getEntry(path) != null;
- }
-}
diff --git a/plugins/org.eclipse.osee.jaxrs.server/src/org/eclipse/osee/jaxrs/server/internal/filters/SecureResourceFilterFactory.java b/plugins/org.eclipse.osee.jaxrs.server/src/org/eclipse/osee/jaxrs/server/internal/filters/SecureResourceFilterFactory.java
deleted file mode 100644
index 3aafaa82778..00000000000
--- a/plugins/org.eclipse.osee.jaxrs.server/src/org/eclipse/osee/jaxrs/server/internal/filters/SecureResourceFilterFactory.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2013 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.jaxrs.server.internal.filters;
-
-import java.util.ArrayList;
-import java.util.List;
-import org.eclipse.osee.jaxrs.NoSecurityFilter;
-import org.eclipse.osee.logger.Log;
-import com.sun.jersey.api.container.filter.servlet.RolesAllowedResourceFilterFactory;
-import com.sun.jersey.api.model.AbstractMethod;
-import com.sun.jersey.spi.container.ResourceFilter;
-
-/**
- * Ensures the security context filter {@link SecurityContextFilter} is always the first filter in the chain.
- *
- * @author Roberto E. Escobar
- */
-public class SecureResourceFilterFactory extends RolesAllowedResourceFilterFactory {
-
- private static final String SECURE = "SECURE";
- private static final String INSECURE = "SKIPPED";
-
- private final Log logger;
- private final SecurityContextFilter securityContextFilter;
-
- public SecureResourceFilterFactory(Log logger, SecurityContextFilter securityContextFilter) {
- super();
- this.logger = logger;
- this.securityContextFilter = securityContextFilter;
- }
-
- @Override
- public List<ResourceFilter> create(AbstractMethod am) {
- List<ResourceFilter> securityFilters = super.create(am);
- if (securityFilters == null) {
- securityFilters = new ArrayList<ResourceFilter>();
- } else {
- securityFilters = new ArrayList<ResourceFilter>(securityFilters);
- }
-
- boolean secure = isSecured(am);
- if (secure) {
- securityFilters.add(0, securityContextFilter);
- }
- logger.info("REST Security Filter: [%s] [%s]", secure ? SECURE : INSECURE, am);
- return securityFilters;
- }
-
- private boolean isSecured(AbstractMethod am) {
- return !am.isAnnotationPresent(NoSecurityFilter.class) && //
- !am.getResource().isAnnotationPresent(NoSecurityFilter.class);
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.jaxrs.server/src/org/eclipse/osee/jaxrs/server/internal/filters/SecurityContextFilter.java b/plugins/org.eclipse.osee.jaxrs.server/src/org/eclipse/osee/jaxrs/server/internal/filters/SecurityContextFilter.java
index d63babbd6b9..5218f8f665a 100644
--- a/plugins/org.eclipse.osee.jaxrs.server/src/org/eclipse/osee/jaxrs/server/internal/filters/SecurityContextFilter.java
+++ b/plugins/org.eclipse.osee.jaxrs.server/src/org/eclipse/osee/jaxrs/server/internal/filters/SecurityContextFilter.java
@@ -10,18 +10,16 @@
*******************************************************************************/
package org.eclipse.osee.jaxrs.server.internal.filters;
+import javax.ws.rs.container.ContainerRequestContext;
+import javax.ws.rs.container.ContainerRequestFilter;
import javax.ws.rs.core.SecurityContext;
import javax.ws.rs.ext.Provider;
-import com.sun.jersey.spi.container.ContainerRequest;
-import com.sun.jersey.spi.container.ContainerRequestFilter;
-import com.sun.jersey.spi.container.ContainerResponseFilter;
-import com.sun.jersey.spi.container.ResourceFilter;
/**
* @author Roberto E. Escobar
*/
@Provider
-public class SecurityContextFilter implements ResourceFilter, ContainerRequestFilter {
+public class SecurityContextFilter implements ContainerRequestFilter {
private final SecurityContextProvider contextProvider;
@@ -31,22 +29,11 @@ public class SecurityContextFilter implements ResourceFilter, ContainerRequestFi
}
@Override
- public ContainerRequest filter(ContainerRequest request) {
+ public void filter(ContainerRequestContext request) {
SecurityContext securityContext = contextProvider.getSecurityContext(request);
if (securityContext != null) {
request.setSecurityContext(securityContext);
}
- return request;
- }
-
- @Override
- public ContainerRequestFilter getRequestFilter() {
- return this;
- }
-
- @Override
- public ContainerResponseFilter getResponseFilter() {
- return null;
}
}
diff --git a/plugins/org.eclipse.osee.jaxrs.server/src/org/eclipse/osee/jaxrs/server/internal/filters/SecurityContextProvider.java b/plugins/org.eclipse.osee.jaxrs.server/src/org/eclipse/osee/jaxrs/server/internal/filters/SecurityContextProvider.java
index e6a6e60d03c..0329308490a 100644
--- a/plugins/org.eclipse.osee.jaxrs.server/src/org/eclipse/osee/jaxrs/server/internal/filters/SecurityContextProvider.java
+++ b/plugins/org.eclipse.osee.jaxrs.server/src/org/eclipse/osee/jaxrs/server/internal/filters/SecurityContextProvider.java
@@ -10,14 +10,14 @@
*******************************************************************************/
package org.eclipse.osee.jaxrs.server.internal.filters;
+import javax.ws.rs.container.ContainerRequestContext;
import javax.ws.rs.core.SecurityContext;
-import com.sun.jersey.api.core.HttpRequestContext;
/**
* @author Roberto E. Escobar
*/
public interface SecurityContextProvider {
- SecurityContext getSecurityContext(HttpRequestContext requestContext);
+ SecurityContext getSecurityContext(ContainerRequestContext requestContext);
}
diff --git a/plugins/org.eclipse.osee.jaxrs.server/src/org/eclipse/osee/jaxrs/server/internal/filters/SecurityContextProviderImpl.java b/plugins/org.eclipse.osee.jaxrs.server/src/org/eclipse/osee/jaxrs/server/internal/filters/SecurityContextProviderImpl.java
index c4703a6192a..b6db993d006 100644
--- a/plugins/org.eclipse.osee.jaxrs.server/src/org/eclipse/osee/jaxrs/server/internal/filters/SecurityContextProviderImpl.java
+++ b/plugins/org.eclipse.osee.jaxrs.server/src/org/eclipse/osee/jaxrs/server/internal/filters/SecurityContextProviderImpl.java
@@ -14,8 +14,10 @@ import java.security.Principal;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
+import javax.ws.rs.container.ContainerRequestContext;
import javax.ws.rs.core.Response.Status;
import javax.ws.rs.core.SecurityContext;
+import javax.ws.rs.core.UriInfo;
import org.eclipse.osee.authorization.admin.Authorization;
import org.eclipse.osee.authorization.admin.AuthorizationAdmin;
import org.eclipse.osee.authorization.admin.AuthorizationRequest;
@@ -23,7 +25,6 @@ import org.eclipse.osee.authorization.admin.AuthorizationRequestBuilder;
import org.eclipse.osee.framework.jdk.core.util.Strings;
import org.eclipse.osee.jaxrs.OseeWebApplicationException;
import org.eclipse.osee.logger.Log;
-import com.sun.jersey.api.core.HttpRequestContext;
/**
* @author Roberto E. Escobar
@@ -44,11 +45,12 @@ public class SecurityContextProviderImpl implements SecurityContextProvider {
}
@Override
- public SecurityContext getSecurityContext(HttpRequestContext request) {
- boolean isSecure = request.isSecure();
- Date requestDate = asDate(request.getHeaderValue(DATE_HEADER));
- String authType = request.getHeaderValue(AUTHORIZATION_HEADER);
- String path = request.getPath();
+ public SecurityContext getSecurityContext(ContainerRequestContext request) {
+ UriInfo uriInfo = request.getUriInfo();
+ boolean isSecure = isSecure(uriInfo);
+ Date requestDate = asDate(request.getHeaderString(DATE_HEADER));
+ String authType = request.getHeaderString(AUTHORIZATION_HEADER);
+ String path = uriInfo.getPath();
String method = request.getMethod();
AuthorizationRequest authRequest = AuthorizationRequestBuilder.newBuilder()//
@@ -63,6 +65,10 @@ public class SecurityContextProviderImpl implements SecurityContextProvider {
return new SecurityContextImpl(authorized);
}
+ private boolean isSecure(UriInfo uriInfo) {
+ return uriInfo.getAbsolutePath().toASCIIString().startsWith("https");
+ }
+
private Date asDate(String value) {
Date toReturn = null;
if (Strings.isValid(value)) {
diff --git a/plugins/org.eclipse.osee.jaxrs.server/src/org/eclipse/osee/jaxrs/server/internal/resources/ApplicationResource.java b/plugins/org.eclipse.osee.jaxrs.server/src/org/eclipse/osee/jaxrs/server/internal/resources/ApplicationResource.java
index 2cefbedf407..51211216649 100644
--- a/plugins/org.eclipse.osee.jaxrs.server/src/org/eclipse/osee/jaxrs/server/internal/resources/ApplicationResource.java
+++ b/plugins/org.eclipse.osee.jaxrs.server/src/org/eclipse/osee/jaxrs/server/internal/resources/ApplicationResource.java
@@ -65,7 +65,7 @@ public class ApplicationResource {
String absolutePath = getServletPath();
- URI build = UriBuilder.fromPath(absolutePath).path(applicationContext).path("application.wadl").build();
+ URI build = UriBuilder.fromPath(absolutePath).path(applicationContext).queryParam("_wadl").build();
String path = build.toASCIIString();
info.setUri(path);
toReturn.add(info);
diff --git a/plugins/org.eclipse.osee.jaxrs.server/src/org/eclipse/osee/jaxrs/server/internal/resources/ServicesResource.java b/plugins/org.eclipse.osee.jaxrs.server/src/org/eclipse/osee/jaxrs/server/internal/resources/ServicesResource.java
deleted file mode 100644
index 2342c48520d..00000000000
--- a/plugins/org.eclipse.osee.jaxrs.server/src/org/eclipse/osee/jaxrs/server/internal/resources/ServicesResource.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2014 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.jaxrs.server.internal.resources;
-
-import javax.annotation.security.PermitAll;
-import javax.ws.rs.GET;
-import javax.ws.rs.Path;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.Application;
-import javax.ws.rs.core.Context;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.UriBuilder;
-import javax.ws.rs.core.UriInfo;
-import org.eclipse.osee.jaxrs.server.internal.JaxRsVisitable;
-import org.eclipse.osee.jaxrs.server.internal.JaxRsVisitor;
-import org.osgi.framework.Bundle;
-
-/**
- * @author Roberto E. Escobar
- */
-@Path("services")
-public class ServicesResource {
-
- private static final String CSS = "<style>" + "@CHARSET \"ISO-8859-1\"; " + //
- ".heading { font-size: large; } " + //
- ".field { font-weight: bold; } " + //
- ".value { font-weight: normal; } " + //
- ".porttypename { font-weight: bold; } " + //
- "table { border: solid; border-collapse: collapse; border-width: 2px; } " + //
- "td { border: solid; border-width: 1px; vertical-align: text-top; padding: 5px; } " + //
- "</style>";
-
- private final JaxRsVisitable visitable;
-
- public ServicesResource(JaxRsVisitable visitable) {
- super();
- this.visitable = visitable;
- }
-
- @PermitAll
- @GET
- @Produces(MediaType.TEXT_HTML)
- public String getServices(final @Context UriInfo uriInfo) {
- final StringBuilder builder = new StringBuilder();
- builder.append("<html>");
- builder.append("<head>");
- builder.append(CSS);
- builder.append("<meta http-equiv=content-type content=\"text/html; charset=UTF-8\">");
- builder.append("<title>JAX-RS - Service list</title>");
- builder.append("</head>");
- builder.append("<br/><span class=\"heading\">Available RESTful services:</span><br/>");
- builder.append("<table cellpadding=\"1\" cellspacing=\"1\" border=\"1\" width=\"100%\">");
-
- visitable.accept(new JaxRsVisitor() {
-
- @Override
- public void onApplication(String applicationContext, String componentName, Bundle bundle, Application application) {
- String absolutePath = getServletPath();
- UriBuilder uriBuilder = UriBuilder.fromPath(absolutePath).path(applicationContext);
- String baseApplicationPath = uriBuilder.build().toASCIIString();
- String wadlPath = uriBuilder.path("application.wadl").build().toASCIIString();
-
- builder.append("<tr><td>");
- builder.append("<span class=\"field\">Endpoint address:</span>");
- builder.append("<span class=\"value\">");
- builder.append(baseApplicationPath);
- builder.append("</span>");
- builder.append("<br />");
- builder.append("<span class=\"field\">WADL :</span>");
- builder.append("<a href=\"");
- builder.append(wadlPath);
- builder.append("\">");
- builder.append(wadlPath);
- builder.append("</a></td></tr>");
- }
-
- private String getServletPath() {
- String absolutePath = uriInfo.getAbsolutePath().toASCIIString();
- absolutePath = absolutePath.replaceAll("/services", "");
- return absolutePath;
- }
- });
- builder.append("</table>");
- builder.append("</html>");
- return builder.toString();
- }
-
-}
diff --git a/plugins/org.eclipse.osee.jaxrs/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.jaxrs/META-INF/MANIFEST.MF
index 5bd233abb24..8db4cb38000 100644
--- a/plugins/org.eclipse.osee.jaxrs/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.osee.jaxrs/META-INF/MANIFEST.MF
@@ -11,4 +11,7 @@ Import-Package: javax.ws.rs,
javax.ws.rs.ext,
org.eclipse.osee.framework.jdk.core.util
Export-Package: org.eclipse.osee.jaxrs
-
+Require-Bundle: org.codehaus.jackson.core;bundle-version="1.9.13",
+ org.codehaus.jackson.jaxrs;bundle-version="1.9.13",
+ org.codehaus.jackson.mapper;bundle-version="1.9.13",
+ org.codehaus.jackson.xc;bundle-version="1.9.13"
diff --git a/plugins/org.eclipse.osee.jaxrs/src/org/eclipse/osee/jaxrs/JacksonFeature.java b/plugins/org.eclipse.osee.jaxrs/src/org/eclipse/osee/jaxrs/JacksonFeature.java
new file mode 100644
index 00000000000..a0b75c8e446
--- /dev/null
+++ b/plugins/org.eclipse.osee.jaxrs/src/org/eclipse/osee/jaxrs/JacksonFeature.java
@@ -0,0 +1,114 @@
+/*******************************************************************************
+ * Copyright (c) 2014 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.jaxrs;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import javax.ws.rs.RuntimeType;
+import javax.ws.rs.core.Configuration;
+import javax.ws.rs.core.Feature;
+import javax.ws.rs.core.FeatureContext;
+import javax.ws.rs.ext.Provider;
+import org.codehaus.jackson.jaxrs.JacksonJaxbJsonProvider;
+import org.codehaus.jackson.jaxrs.JacksonJsonProvider;
+import org.codehaus.jackson.jaxrs.JsonMappingExceptionMapper;
+import org.codehaus.jackson.jaxrs.JsonParseExceptionMapper;
+import org.codehaus.jackson.map.DeserializationConfig;
+import org.codehaus.jackson.map.ObjectMapper;
+import org.codehaus.jackson.map.SerializationConfig;
+
+/**
+ * @author Roberto E. Escobar
+ */
+@Provider
+public class JacksonFeature implements Feature {
+
+ private final static String JSON_FEATURE = JacksonFeature.class.getName();
+
+ public static final String JAXRS_CONFIG_PREFIX = "jaxrs";
+ public static final String JAXRS_CONFIG_PREFIX_AND_DOT = JAXRS_CONFIG_PREFIX + ".";
+ public static final String JSON_FEATURE_KEY = JAXRS_CONFIG_PREFIX_AND_DOT + "jsonFeature";
+
+ @Override
+ public boolean configure(FeatureContext context) {
+ boolean configured = false;
+ Configuration config = context.getConfiguration();
+
+ String propertyKey = getPropertyNameForRuntime(JSON_FEATURE_KEY, config.getRuntimeType());
+
+ String jsonFeature = getJsonFeature(config, propertyKey, JSON_FEATURE);
+ if (JSON_FEATURE.equalsIgnoreCase(jsonFeature)) {
+ context.property(propertyKey, JSON_FEATURE);
+
+ if (!config.isRegistered(JacksonJaxbJsonProvider.class)) {
+ for (Object object : getProviders()) {
+ context.register(object);
+ }
+ }
+ configured = true;
+ }
+ return configured;
+ }
+
+ private String getJsonFeature(Configuration config, String propertyKey, String defaultValue) {
+ String toReturn = defaultValue;
+ Map<String, Object> props = config.getProperties();
+ Object value = props != null ? props.get(propertyKey) : null;
+ if (value != null) {
+ toReturn = String.valueOf(value);
+ }
+ return toReturn;
+ }
+
+ public static String getPropertyNameForRuntime(String key, RuntimeType runtimeType) {
+ if (runtimeType != null && key.startsWith(JAXRS_CONFIG_PREFIX)) {
+ RuntimeType[] types = RuntimeType.values();
+ for (RuntimeType type : types) {
+ if (key.startsWith(JAXRS_CONFIG_PREFIX_AND_DOT + type.name().toLowerCase())) {
+ return key;
+ }
+ }
+ return key.replace(JAXRS_CONFIG_PREFIX, JAXRS_CONFIG_PREFIX_AND_DOT + runtimeType.name().toLowerCase());
+ }
+ return key;
+ }
+
+ public static List<? extends Object> getProviders() {
+ List<Object> providers = new ArrayList<Object>();
+ providers.add(JacksonFeature.newJacksonJsonProvider());
+ providers.add(JsonParseExceptionMapper.class);
+ providers.add(JsonMappingExceptionMapper.class);
+ return providers;
+ }
+
+ private static JacksonJsonProvider newJacksonJsonProvider() {
+ ObjectMapper objectMapper = new ObjectMapper();
+ objectMapper.configure(SerializationConfig.Feature.CAN_OVERRIDE_ACCESS_MODIFIERS, true);
+ objectMapper.configure(SerializationConfig.Feature.AUTO_DETECT_FIELDS, true);
+ objectMapper.configure(SerializationConfig.Feature.AUTO_DETECT_GETTERS, true);
+ objectMapper.configure(SerializationConfig.Feature.AUTO_DETECT_IS_GETTERS, true);
+ objectMapper.configure(SerializationConfig.Feature.USE_ANNOTATIONS, true);
+ objectMapper.configure(SerializationConfig.Feature.WRAP_ROOT_VALUE, true);
+ objectMapper.configure(SerializationConfig.Feature.WRITE_CHAR_ARRAYS_AS_JSON_ARRAYS, true);
+
+ objectMapper.configure(DeserializationConfig.Feature.CAN_OVERRIDE_ACCESS_MODIFIERS, true);
+ objectMapper.configure(DeserializationConfig.Feature.AUTO_DETECT_FIELDS, true);
+ objectMapper.configure(DeserializationConfig.Feature.AUTO_DETECT_SETTERS, true);
+ objectMapper.configure(DeserializationConfig.Feature.AUTO_DETECT_CREATORS, true);
+ objectMapper.configure(DeserializationConfig.Feature.USE_ANNOTATIONS, true);
+ objectMapper.configure(DeserializationConfig.Feature.USE_JAVA_ARRAY_FOR_JSON_ARRAY, true);
+ objectMapper.configure(DeserializationConfig.Feature.UNWRAP_ROOT_VALUE, true);
+ objectMapper.configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+ return new JacksonJaxbJsonProvider(objectMapper, JacksonJaxbJsonProvider.DEFAULT_ANNOTATIONS);
+ }
+
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.jaxrs/src/org/eclipse/osee/jaxrs/JaxRsConstants.java b/plugins/org.eclipse.osee.jaxrs/src/org/eclipse/osee/jaxrs/JaxRsConstants.java
new file mode 100644
index 00000000000..2c8a841f426
--- /dev/null
+++ b/plugins/org.eclipse.osee.jaxrs/src/org/eclipse/osee/jaxrs/JaxRsConstants.java
@@ -0,0 +1,24 @@
+/*******************************************************************************
+ * Copyright (c) 2014 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.jaxrs;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public final class JaxRsConstants {
+
+ private JaxRsConstants() {
+ // Constants
+ }
+
+ public static final String OSEE_ERROR_REPONSE_HEADER = "osee-jaxrs-error-response";
+
+}
diff --git a/plugins/org.eclipse.osee.jaxrs/src/org/eclipse/osee/jaxrs/OseeWebApplicationException.java b/plugins/org.eclipse.osee.jaxrs/src/org/eclipse/osee/jaxrs/OseeWebApplicationException.java
index a9a120b05f2..eb8687973f1 100644
--- a/plugins/org.eclipse.osee.jaxrs/src/org/eclipse/osee/jaxrs/OseeWebApplicationException.java
+++ b/plugins/org.eclipse.osee.jaxrs/src/org/eclipse/osee/jaxrs/OseeWebApplicationException.java
@@ -11,7 +11,6 @@
package org.eclipse.osee.jaxrs;
import javax.ws.rs.WebApplicationException;
-import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.Status;
import javax.ws.rs.core.Response.StatusType;
@@ -58,7 +57,8 @@ public class OseeWebApplicationException extends WebApplicationException {
@Override
public Response getResponse() {
- return Response.status(getErrorStatus()).type(MediaType.APPLICATION_JSON_TYPE).entity(getErrorResponse()).build();
+ return Response.status(getErrorStatus()).entity(getErrorResponse()).header(
+ JaxRsConstants.OSEE_ERROR_REPONSE_HEADER, Boolean.TRUE).build();
}
public StatusType getErrorStatus() {
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 566320f3cb8..7ec3e073881 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
@@ -6,15 +6,15 @@ Bundle-Version: 0.18.0.qualifier
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-Vendor: Eclipse Open System Engineering Environment
Service-Component: OSGI-INF/*.xml
-Import-Package: com.sun.jersey.api.client,
- javax.ws.rs.core,
+Import-Package: 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.data,
org.eclipse.osee.framework.core.enums,
org.eclipse.osee.framework.jdk.core.type,
+ org.eclipse.osee.jaxrs.client,
org.eclipse.osee.orcs.rest.model,
- org.eclipse.osee.orcs.rest.model.search.artifact,
- org.eclipse.osee.jaxrs.client
+ org.eclipse.osee.orcs.rest.model.search.artifact
Export-Package: org.eclipse.osee.orcs.rest.client
Bundle-ActivationPolicy: lazy
-Require-Bundle: com.google.inject,
- com.sun.jersey;bundle-version="1.18.0"
+Require-Bundle: com.google.inject
diff --git a/plugins/org.eclipse.osee.orcs.rest.client/src/org/eclipse/osee/orcs/rest/client/OseeClientStandaloneSetup.java b/plugins/org.eclipse.osee.orcs.rest.client/src/org/eclipse/osee/orcs/rest/client/OseeClientStandaloneSetup.java
index 42f8a772516..b448cb3608c 100644
--- a/plugins/org.eclipse.osee.orcs.rest.client/src/org/eclipse/osee/orcs/rest/client/OseeClientStandaloneSetup.java
+++ b/plugins/org.eclipse.osee.orcs.rest.client/src/org/eclipse/osee/orcs/rest/client/OseeClientStandaloneSetup.java
@@ -11,10 +11,7 @@
package org.eclipse.osee.orcs.rest.client;
import java.util.Map;
-import org.eclipse.osee.jaxrs.client.JaxRsClientFactory;
-import org.eclipse.osee.orcs.rest.client.internal.OrcsClientModule;
import org.eclipse.osee.orcs.rest.client.internal.OseeClientImpl;
-import com.google.inject.Module;
/**
* Class to use when using the API in a non-OSGI environment
@@ -28,7 +25,8 @@ public final class OseeClientStandaloneSetup {
}
public static OseeClient createClient(Map<String, Object> config) {
- Module module = new OrcsClientModule(config);
- return JaxRsClientFactory.createClient(OseeClientImpl.class, config, module);
+ OseeClientImpl client = new OseeClientImpl();
+ client.start(config);
+ return client;
}
}
diff --git a/plugins/org.eclipse.osee.orcs.rest.client/src/org/eclipse/osee/orcs/rest/client/internal/OrcsClientModule.java b/plugins/org.eclipse.osee.orcs.rest.client/src/org/eclipse/osee/orcs/rest/client/internal/OrcsClientModule.java
deleted file mode 100644
index 654ec465bac..00000000000
--- a/plugins/org.eclipse.osee.orcs.rest.client/src/org/eclipse/osee/orcs/rest/client/internal/OrcsClientModule.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2013 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.orcs.rest.client.internal;
-
-import java.util.Map;
-import org.eclipse.osee.orcs.rest.client.OseeClient;
-import com.google.inject.AbstractModule;
-import com.google.inject.TypeLiteral;
-import com.google.inject.matcher.AbstractMatcher;
-import com.google.inject.matcher.Matcher;
-import com.google.inject.spi.InjectionListener;
-import com.google.inject.spi.TypeEncounter;
-import com.google.inject.spi.TypeListener;
-
-/**
- * @author Roberto E. Escobar
- */
-public class OrcsClientModule extends AbstractModule {
-
- private final Map<String, Object> config;
-
- public OrcsClientModule(Map<String, Object> config) {
- super();
- this.config = config;
- }
-
- @Override
- protected void configure() {
- bind(OseeClient.class).to(OseeClientImpl.class);
- TypeListener listener = new TypeListener() {
-
- @Override
- public <I> void hear(TypeLiteral<I> type, TypeEncounter<I> encounter) {
- encounter.register(new InjectionListener<I>() {
-
- @Override
- public void afterInjection(I injectee) {
- OseeClientImpl client = (OseeClientImpl) injectee;
- client.start(config);
- }
- });
- }
- };
- bindListener(subtypeOf(OseeClientImpl.class), listener);
- }
-
- private static Matcher<? super TypeLiteral<?>> subtypeOf(Class<?> superclass) {
- return new SubTypeOfMatcher(TypeLiteral.get(OseeClientImpl.class));
- }
-
- private static final class SubTypeOfMatcher extends AbstractMatcher<TypeLiteral<?>> {
- private final TypeLiteral<OseeClientImpl> superType;
-
- public SubTypeOfMatcher(TypeLiteral<OseeClientImpl> superType) {
- super();
- this.superType = superType;
- }
-
- @Override
- public boolean matches(TypeLiteral<?> subType) {
- return subType.equals(superType) || superType.getRawType().isAssignableFrom(subType.getRawType());
- }
- }
-
-}
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 66b6a7abc75..6832bf9095b 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
@@ -10,43 +10,38 @@
*******************************************************************************/
package org.eclipse.osee.orcs.rest.client.internal;
-import static org.eclipse.osee.jaxrs.client.JaxRsClientConstants.JAXRS_CLIENT_SERVER_ADDRESS;
import java.net.URI;
import java.util.ArrayList;
-import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import javax.ws.rs.client.WebTarget;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriBuilder;
import org.eclipse.osee.framework.core.data.IOseeBranch;
import org.eclipse.osee.framework.core.data.OseeCodeVersion;
import org.eclipse.osee.jaxrs.client.JaxRsClient;
-import org.eclipse.osee.jaxrs.client.JaxRsClientFactory;
-import org.eclipse.osee.jaxrs.client.JaxRsClientUtils;
+import org.eclipse.osee.jaxrs.client.JaxRsExceptions;
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;
import org.eclipse.osee.orcs.rest.client.internal.search.PredicateFactoryImpl;
import org.eclipse.osee.orcs.rest.client.internal.search.QueryBuilderImpl;
import org.eclipse.osee.orcs.rest.client.internal.search.QueryExecutorV1;
-import org.eclipse.osee.orcs.rest.client.internal.search.QueryExecutorV1.BaseUriBuilder;
import org.eclipse.osee.orcs.rest.client.internal.search.QueryOptions;
import org.eclipse.osee.orcs.rest.model.Client;
import org.eclipse.osee.orcs.rest.model.search.artifact.Predicate;
-import com.sun.jersey.api.client.UniformInterfaceException;
-import com.sun.jersey.api.client.WebResource;
/**
* @author John Misinco
* @author Roberto E. Escobar
*/
-public class OseeClientImpl implements OseeClient, BaseUriBuilder {
+public class OseeClientImpl implements OseeClient {
private static final String OSEE_APPLICATION_SERVER = "osee.application.server";
private volatile PredicateFactory predicateFactory;
private volatile QueryExecutorV1 executor;
- private volatile JaxRsClient client;
+ private volatile WebTarget baseTarget;
public void start(Map<String, Object> properties) {
predicateFactory = new PredicateFactoryImpl();
@@ -56,24 +51,21 @@ public class OseeClientImpl implements OseeClient, BaseUriBuilder {
public void stop() {
executor = null;
- client = null;
+ baseTarget = null;
predicateFactory = null;
}
public void update(Map<String, Object> properties) {
- Map<String, Object> propsToUse = properties;
- String newServerAddress = JaxRsClientUtils.get(propsToUse, JAXRS_CLIENT_SERVER_ADDRESS, null);
- if (newServerAddress == null) {
- propsToUse = new HashMap<String, Object>(properties);
- propsToUse.put(JAXRS_CLIENT_SERVER_ADDRESS, System.getProperty(OSEE_APPLICATION_SERVER, ""));
+ JaxRsClient 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, "");
}
- client = JaxRsClientFactory.createClient(propsToUse);
- executor = new QueryExecutorV1(client, this);
- }
- @Override
- public UriBuilder newBuilder() {
- return UriBuilder.fromPath("orcs");
+ URI uri = UriBuilder.fromUri(address).path("orcs").build();
+ baseTarget = client.target(uri);
+ executor = new QueryExecutorV1(baseTarget);
}
@Override
@@ -86,16 +78,15 @@ public class OseeClientImpl implements OseeClient, BaseUriBuilder {
@Override
public boolean isClientVersionSupportedByApplicationServer() {
boolean result = false;
- URI uri = newBuilder().path("client").build();
- WebResource resource = client.createResource(uri);
+ WebTarget resource = baseTarget.path("client");
Client clientResult = null;
try {
- clientResult = resource.accept(MediaType.APPLICATION_XML).get(Client.class);
- if (clientResult != null) {
- result = clientResult.getSupportedVersions().contains(OseeCodeVersion.getVersion());
- }
- } catch (UniformInterfaceException ex) {
- throw client.handleException(ex);
+ clientResult = resource.request(MediaType.APPLICATION_JSON).get(Client.class);
+ } catch (Exception ex) {
+ throw JaxRsExceptions.asOseeException(ex);
+ }
+ if (clientResult != null) {
+ result = clientResult.getSupportedVersions().contains(OseeCodeVersion.getVersion());
}
return result;
}
diff --git a/plugins/org.eclipse.osee.orcs.rest.client/src/org/eclipse/osee/orcs/rest/client/internal/search/QueryExecutorV1.java b/plugins/org.eclipse.osee.orcs.rest.client/src/org/eclipse/osee/orcs/rest/client/internal/search/QueryExecutorV1.java
index 54793ebf061..e2eb08a8a13 100644
--- a/plugins/org.eclipse.osee.orcs.rest.client/src/org/eclipse/osee/orcs/rest/client/internal/search/QueryExecutorV1.java
+++ b/plugins/org.eclipse.osee.orcs.rest.client/src/org/eclipse/osee/orcs/rest/client/internal/search/QueryExecutorV1.java
@@ -10,21 +10,20 @@
*******************************************************************************/
package org.eclipse.osee.orcs.rest.client.internal.search;
-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.data.IOseeBranch;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
-import org.eclipse.osee.jaxrs.client.JaxRsClient;
+import org.eclipse.osee.jaxrs.client.JaxRsExceptions;
import org.eclipse.osee.orcs.rest.model.search.artifact.OutputFormat;
import org.eclipse.osee.orcs.rest.model.search.artifact.Predicate;
import org.eclipse.osee.orcs.rest.model.search.artifact.RequestType;
import org.eclipse.osee.orcs.rest.model.search.artifact.SearchRequest;
import org.eclipse.osee.orcs.rest.model.search.artifact.SearchResponse;
import org.eclipse.osee.orcs.rest.model.search.artifact.SearchResult;
-import com.sun.jersey.api.client.UniformInterfaceException;
-import com.sun.jersey.api.client.WebResource;
/**
* @author John Misinco
@@ -35,13 +34,11 @@ public class QueryExecutorV1 implements QueryExecutor {
UriBuilder newBuilder();
}
- private final JaxRsClient client;
- private final BaseUriBuilder baseUriBuilder;
+ private final WebTarget target;
- public QueryExecutorV1(JaxRsClient client, BaseUriBuilder baseUriBuilder) {
+ public QueryExecutorV1(WebTarget target) {
super();
- this.client = client;
- this.baseUriBuilder = baseUriBuilder;
+ this.target = target;
}
@Override
@@ -56,11 +53,6 @@ public class QueryExecutorV1 implements QueryExecutor {
return result;
}
- private URI getQueryUri(long branchUuid) {
- UriBuilder builder = baseUriBuilder.newBuilder().path("branch/{branch-uuid}/artifact/search/v1");
- return builder.build(branchUuid);
- }
-
private SearchResponse performSearch(RequestType requestType, OutputFormat outputFormat, IOseeBranch branch, List<Predicate> predicates, QueryOptions options) throws OseeCoreException {
int fromTx = 0;
if (options.isHistorical()) {
@@ -76,16 +68,12 @@ public class QueryExecutorV1 implements QueryExecutor {
new SearchRequest(branch.getUuid(), predicates, outputFormat.name().toLowerCase(),
requestType.name().toLowerCase(), fromTx, includeDeleted);
- URI uri = getQueryUri(branch.getUuid());
- WebResource resource = client.createResource(uri);
- SearchResponse searchResult = null;
+ WebTarget resource =
+ target.path("branch/{branch-uuid}/artifact/search/v1").resolveTemplate("branch-uuid", branch.getUuid());
try {
- searchResult =
- resource.accept(MediaType.APPLICATION_JSON_TYPE).type(MediaType.APPLICATION_JSON_TYPE).post(
- SearchResponse.class, params);
- } catch (UniformInterfaceException ex) {
- throw client.handleException(ex);
+ return resource.request(MediaType.APPLICATION_JSON_TYPE).post(Entity.json(params), SearchResponse.class);
+ } catch (Exception ex) {
+ throw JaxRsExceptions.asOseeException(ex);
}
- return searchResult;
}
}
diff --git a/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/ArtifactSearchResource.java b/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/ArtifactSearchResource.java
deleted file mode 100644
index 65e4115af1a..00000000000
--- a/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/ArtifactSearchResource.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.orcs.rest.internal;
-
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.core.Context;
-import javax.ws.rs.core.Request;
-import javax.ws.rs.core.UriInfo;
-import org.eclipse.osee.orcs.rest.internal.search.artifact.ArtifactSearch;
-import org.eclipse.osee.orcs.rest.internal.search.artifact.ArtifactSearch_V1;
-
-/**
- * @author Roberto E. Escobar
- */
-public class ArtifactSearchResource {
-
- @Context
- UriInfo uriInfo;
- @Context
- Request request;
-
- Long branchUuid;
-
- public ArtifactSearchResource(UriInfo uriInfo, Request request, Long branchUuid) {
- this.uriInfo = uriInfo;
- this.request = request;
- this.branchUuid = branchUuid;
- }
-
- @Path("{version}")
- public ArtifactSearch getArtifact(@PathParam("version") String version) {
- String versionToMatch = version.toUpperCase();
-
- ArtifactSearch toReturn = null;
- if ("V1".equals(versionToMatch)) {
- toReturn = new ArtifactSearch_V1(uriInfo, request, branchUuid);
- }
- return toReturn;
- }
-}
diff --git a/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/ArtifactsResource.java b/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/ArtifactsResource.java
index d09863aab05..936ae4c0b81 100644
--- a/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/ArtifactsResource.java
+++ b/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/ArtifactsResource.java
@@ -23,6 +23,7 @@ import org.eclipse.osee.framework.core.data.TokenFactory;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.framework.jdk.core.type.ResultSet;
import org.eclipse.osee.orcs.data.ArtifactReadable;
+import org.eclipse.osee.orcs.rest.internal.search.artifact.ArtifactSearch_V1;
import org.eclipse.osee.orcs.search.QueryFactory;
/**
@@ -45,9 +46,9 @@ public class ArtifactsResource {
this.branchUuid = branchUuid;
}
- @Path("search")
- public ArtifactSearchResource getSearch() {
- return new ArtifactSearchResource(uriInfo, request, branchUuid);
+ @Path("search/v1")
+ public ArtifactSearch_V1 getSearch() {
+ return new ArtifactSearch_V1(uriInfo, request, branchUuid);
}
@Path("{uuid}")
diff --git a/plugins/org.eclipse.osee.ote.core/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.ote.core/META-INF/MANIFEST.MF
index 6065b1b101e..3f4bf9e8768 100644
--- a/plugins/org.eclipse.osee.ote.core/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.osee.ote.core/META-INF/MANIFEST.MF
@@ -63,11 +63,11 @@ Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-Activator: org.eclipse.osee.ote.core.internal.Activator
Import-Package: javax.xml.parsers,
org.apache.xml.serialize,
- org.codehaus.jackson;version="1.9.2",
- org.codehaus.jackson.annotate;version="1.9.2",
- org.codehaus.jackson.map;version="1.9.2",
- org.codehaus.jackson.map.annotate;version="1.9.2",
- org.codehaus.jackson.map.module;version="1.9.2",
+ org.codehaus.jackson;version="1.9.13",
+ org.codehaus.jackson.annotate;version="1.9.13",
+ org.codehaus.jackson.map;version="1.9.13",
+ org.codehaus.jackson.map.annotate;version="1.9.13",
+ org.codehaus.jackson.map.module;version="1.9.13",
org.eclipse.osee.framework.core.data,
org.eclipse.osee.framework.core.exception,
org.eclipse.osee.framework.core.util,
diff --git a/plugins/org.eclipse.osee.ote.master.rest.client/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.ote.master.rest.client/META-INF/MANIFEST.MF
index eb830fe1d77..348c902aacf 100644
--- a/plugins/org.eclipse.osee.ote.master.rest.client/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.osee.ote.master.rest.client/META-INF/MANIFEST.MF
@@ -6,10 +6,8 @@ Bundle-Version: 0.18.0.qualifier
Require-Bundle: org.eclipse.core.runtime
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
-Import-Package: com.sun.jersey.api.client,
- com.sun.jersey.api.client.config,
- com.sun.jersey.client.apache,
- com.sun.jersey.client.apache.config,
+Import-Package: javax.ws.rs;version="2.0.0",
+ javax.ws.rs.client;version="2.0.0",
javax.ws.rs.core,
org.eclipse.osee.framework.jdk.core.type,
org.eclipse.osee.jaxrs.client,
diff --git a/plugins/org.eclipse.osee.ote.master.rest.client/src/org/eclipse/osee/ote/master/rest/client/internal/AddServer.java b/plugins/org.eclipse.osee.ote.master.rest.client/src/org/eclipse/osee/ote/master/rest/client/internal/AddServer.java
index d05e927ffd3..bd41d4dd545 100644
--- a/plugins/org.eclipse.osee.ote.master.rest.client/src/org/eclipse/osee/ote/master/rest/client/internal/AddServer.java
+++ b/plugins/org.eclipse.osee.ote.master.rest.client/src/org/eclipse/osee/ote/master/rest/client/internal/AddServer.java
@@ -2,11 +2,12 @@ package org.eclipse.osee.ote.master.rest.client.internal;
import java.net.URI;
import java.util.concurrent.Callable;
+import javax.ws.rs.client.Entity;
+import javax.ws.rs.client.WebTarget;
import javax.ws.rs.core.MediaType;
import org.eclipse.osee.jaxrs.client.JaxRsClient;
import org.eclipse.osee.ote.master.rest.client.OTEMasterServerResult;
import org.eclipse.osee.ote.master.rest.model.OTEServer;
-import com.sun.jersey.api.client.WebResource;
public class AddServer implements Callable<OTEMasterServerResult> {
@@ -24,10 +25,9 @@ public class AddServer implements Callable<OTEMasterServerResult> {
public OTEMasterServerResult call() throws Exception {
OTEMasterServerResult result = new OTEMasterServerResult();
try {
- WebResource resource = webClientProvider.createResource(uri);
- resource.path(OTEMasterServerImpl.CONTEXT_NAME).path(OTEMasterServerImpl.CONTEXT_SERVERS).accept(
- MediaType.APPLICATION_XML).post(server);
-
+ WebTarget resource = webClientProvider.target(uri);
+ resource.path(OTEMasterServerImpl.CONTEXT_NAME).path(OTEMasterServerImpl.CONTEXT_SERVERS).request(
+ MediaType.APPLICATION_JSON).post(Entity.json(server));
} catch (Throwable th) {
result.setSuccess(false);
result.setThrowable(th);
diff --git a/plugins/org.eclipse.osee.ote.master.rest.client/src/org/eclipse/osee/ote/master/rest/client/internal/GetAvailableServers.java b/plugins/org.eclipse.osee.ote.master.rest.client/src/org/eclipse/osee/ote/master/rest/client/internal/GetAvailableServers.java
index d1fbe75b596..6a5065de95d 100644
--- a/plugins/org.eclipse.osee.ote.master.rest.client/src/org/eclipse/osee/ote/master/rest/client/internal/GetAvailableServers.java
+++ b/plugins/org.eclipse.osee.ote.master.rest.client/src/org/eclipse/osee/ote/master/rest/client/internal/GetAvailableServers.java
@@ -2,11 +2,11 @@ package org.eclipse.osee.ote.master.rest.client.internal;
import java.net.URI;
import java.util.concurrent.Callable;
+import javax.ws.rs.client.WebTarget;
import javax.ws.rs.core.MediaType;
import org.eclipse.osee.jaxrs.client.JaxRsClient;
import org.eclipse.osee.ote.master.rest.client.OTEMasterServerAvailableNodes;
import org.eclipse.osee.ote.master.rest.model.OTEServer;
-import com.sun.jersey.api.client.WebResource;
public class GetAvailableServers implements Callable<OTEMasterServerAvailableNodes> {
@@ -22,10 +22,10 @@ public class GetAvailableServers implements Callable<OTEMasterServerAvailableNod
public OTEMasterServerAvailableNodes call() throws Exception {
OTEMasterServerAvailableNodes result = new OTEMasterServerAvailableNodes();
try {
- WebResource resource = webClientProvider.createResource(uri);
+ WebTarget resource = webClientProvider.target(uri);
OTEServer[] servers =
- resource.path(OTEMasterServerImpl.CONTEXT_NAME).path(OTEMasterServerImpl.CONTEXT_SERVERS).accept(
- MediaType.APPLICATION_XML).get(OTEServer[].class);
+ resource.path(OTEMasterServerImpl.CONTEXT_NAME).path(OTEMasterServerImpl.CONTEXT_SERVERS).request(
+ MediaType.APPLICATION_JSON).get(OTEServer[].class);
result.setServers(servers);
result.setSuccess(true);
} catch (Throwable th) {
diff --git a/plugins/org.eclipse.osee.ote.master.rest.client/src/org/eclipse/osee/ote/master/rest/client/internal/OTEMasterServerImpl.java b/plugins/org.eclipse.osee.ote.master.rest.client/src/org/eclipse/osee/ote/master/rest/client/internal/OTEMasterServerImpl.java
index 3456be01f3f..685fb888a02 100644
--- a/plugins/org.eclipse.osee.ote.master.rest.client/src/org/eclipse/osee/ote/master/rest/client/internal/OTEMasterServerImpl.java
+++ b/plugins/org.eclipse.osee.ote.master.rest.client/src/org/eclipse/osee/ote/master/rest/client/internal/OTEMasterServerImpl.java
@@ -7,7 +7,6 @@ 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.jaxrs.client.JaxRsClientFactory;
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;
@@ -42,7 +41,7 @@ public class OTEMasterServerImpl implements OTEMasterServer {
}
public void update(Map<String, Object> props) {
- client = JaxRsClientFactory.createClient(props);
+ client = JaxRsClient.newBuilder().properties(props).build();
}
@Override
diff --git a/plugins/org.eclipse.osee.ote.master.rest.client/src/org/eclipse/osee/ote/master/rest/client/internal/RemoveServer.java b/plugins/org.eclipse.osee.ote.master.rest.client/src/org/eclipse/osee/ote/master/rest/client/internal/RemoveServer.java
index e29a6b00ee4..ebf257a8fc7 100644
--- a/plugins/org.eclipse.osee.ote.master.rest.client/src/org/eclipse/osee/ote/master/rest/client/internal/RemoveServer.java
+++ b/plugins/org.eclipse.osee.ote.master.rest.client/src/org/eclipse/osee/ote/master/rest/client/internal/RemoveServer.java
@@ -2,11 +2,13 @@ package org.eclipse.osee.ote.master.rest.client.internal;
import java.net.URI;
import java.util.concurrent.Callable;
+import javax.ws.rs.HttpMethod;
+import javax.ws.rs.client.Entity;
+import javax.ws.rs.client.WebTarget;
import javax.ws.rs.core.MediaType;
import org.eclipse.osee.jaxrs.client.JaxRsClient;
import org.eclipse.osee.ote.master.rest.client.OTEMasterServerResult;
import org.eclipse.osee.ote.master.rest.model.OTEServer;
-import com.sun.jersey.api.client.WebResource;
public class RemoveServer implements Callable<OTEMasterServerResult> {
@@ -24,9 +26,9 @@ public class RemoveServer implements Callable<OTEMasterServerResult> {
public OTEMasterServerResult call() throws Exception {
OTEMasterServerResult result = new OTEMasterServerResult();
try {
- WebResource resource = webClientProvider.createResource(uri);
- resource.path(OTEMasterServerImpl.CONTEXT_NAME).path(OTEMasterServerImpl.CONTEXT_SERVERS).accept(
- MediaType.APPLICATION_XML).delete(server);
+ WebTarget resource = webClientProvider.target(uri);
+ resource.path(OTEMasterServerImpl.CONTEXT_NAME).path(OTEMasterServerImpl.CONTEXT_SERVERS).request(
+ MediaType.APPLICATION_JSON).method(HttpMethod.DELETE, Entity.json(server));
} catch (Throwable th) {
result.setSuccess(false);
result.setThrowable(th);
diff --git a/plugins/org.eclipse.osee.ote.rest.client/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.ote.rest.client/META-INF/MANIFEST.MF
index f92576cbd3d..dc50d9a42c2 100644
--- a/plugins/org.eclipse.osee.ote.rest.client/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.osee.ote.rest.client/META-INF/MANIFEST.MF
@@ -6,8 +6,9 @@ Bundle-Version: 0.18.0.qualifier
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-Vendor: Eclipse Open System Engineering Environment
Service-Component: OSGI-INF/*.xml
-Import-Package: javax.ws.rs,
- javax.ws.rs.core,
+Import-Package: javax.ws.rs;version="2.0.0",
+ javax.ws.rs.client;version="2.0.0",
+ javax.ws.rs.core;version="2.0.0",
org.apache.commons.lang.time,
org.eclipse.core.net.proxy,
org.eclipse.osee.framework.core.data,
@@ -26,7 +27,4 @@ Export-Package: org.eclipse.osee.ote.rest.client
Bundle-ActivationPolicy: lazy
Require-Bundle: org.eclipse.core.runtime,
org.eclipse.osee.ote.rest.model,
- com.sun.jersey;bundle-version="1.18.0",
- com.sun.jersey.client.apache;bundle-version="1.18.0",
- javax.servlet,
- org.codehaus.jackson.core
+ javax.servlet
diff --git a/plugins/org.eclipse.osee.ote.rest.client/src/org/eclipse/osee/ote/rest/client/internal/ConfigureOteServer.java b/plugins/org.eclipse.osee.ote.rest.client/src/org/eclipse/osee/ote/rest/client/internal/ConfigureOteServer.java
index c0d3bb6e6b1..5ed3c9433a0 100644
--- a/plugins/org.eclipse.osee.ote.rest.client/src/org/eclipse/osee/ote/rest/client/internal/ConfigureOteServer.java
+++ b/plugins/org.eclipse.osee.ote.rest.client/src/org/eclipse/osee/ote/rest/client/internal/ConfigureOteServer.java
@@ -4,6 +4,8 @@ import java.io.File;
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 org.eclipse.osee.framework.jdk.core.util.network.PortUtil;
import org.eclipse.osee.jaxrs.client.JaxRsClient;
@@ -14,7 +16,6 @@ import org.eclipse.osee.ote.rest.model.OTEConfiguration;
import org.eclipse.osee.ote.rest.model.OTEConfigurationIdentity;
import org.eclipse.osee.ote.rest.model.OTEConfigurationItem;
import org.eclipse.osee.ote.rest.model.OTEJobStatus;
-import com.sun.jersey.api.client.WebResource;
public class ConfigureOteServer extends BaseClientCallable<Progress> {
@@ -64,18 +65,18 @@ public class ConfigureOteServer extends BaseClientCallable<Progress> {
private void waitForJobComplete() throws Exception {
URI jobUri = status.getUpdatedJobStatus().toURI();
- final WebResource service = factory.createResource(jobUri);
+ final WebTarget service = factory.target(jobUri);
while (!status.isJobComplete()) {
Thread.sleep(POLLING_RATE);
- status = service.accept(MediaType.APPLICATION_XML).get(OTEJobStatus.class);
+ status = service.request(MediaType.APPLICATION_JSON).get(OTEJobStatus.class);
progress.setUnitsOfWork(status.getTotalUnitsOfWork());
progress.setUnitsWorked(status.getUnitsWorked());
}
}
private OTEJobStatus sendBundleConfiguration() throws Exception {
- WebResource baseService = factory.createResource(uri);
+ WebTarget baseService = factory.target(uri);
if (configuration == null) {
OTEConfiguration localConfiguration = new OTEConfiguration();
OTEConfigurationIdentity identity = new OTEConfigurationIdentity();
@@ -91,20 +92,19 @@ public class ConfigureOteServer extends BaseClientCallable<Progress> {
localConfiguration.addItem(item);
}
OTEConfiguration currentConfig =
- baseService.path("ote").path("config").accept(MediaType.APPLICATION_XML).get(OTEConfiguration.class);
+ baseService.path("ote").path("config").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 baseService.path("ote").path("config").accept(MediaType.APPLICATION_XML).post(OTEJobStatus.class,
- localConfiguration);
+ return baseService.path("ote").path("config").request(MediaType.APPLICATION_JSON).post(
+ Entity.xml(localConfiguration), OTEJobStatus.class);
}
} else {
- return baseService.path("ote").path("config").accept(MediaType.APPLICATION_XML).post(OTEJobStatus.class,
- this.configuration);
+ return baseService.path("ote").path("config").request(MediaType.APPLICATION_JSON).post(
+ Entity.xml(configuration), OTEJobStatus.class);
}
}
-
}
diff --git a/plugins/org.eclipse.osee.ote.rest.client/src/org/eclipse/osee/ote/rest/client/internal/GetOteServerFile.java b/plugins/org.eclipse.osee.ote.rest.client/src/org/eclipse/osee/ote/rest/client/internal/GetOteServerFile.java
index 8210d9c5cf8..f1e23d5f4f2 100644
--- a/plugins/org.eclipse.osee.ote.rest.client/src/org/eclipse/osee/ote/rest/client/internal/GetOteServerFile.java
+++ b/plugins/org.eclipse.osee.ote.rest.client/src/org/eclipse/osee/ote/rest/client/internal/GetOteServerFile.java
@@ -4,12 +4,13 @@ import java.io.File;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.net.URI;
+import javax.ws.rs.client.WebTarget;
import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.Response.Status;
import org.eclipse.osee.framework.jdk.core.util.Lib;
import org.eclipse.osee.jaxrs.client.JaxRsClient;
import org.eclipse.osee.ote.rest.client.Progress;
-import com.sun.jersey.api.client.ClientResponse;
-import com.sun.jersey.api.client.WebResource;
public class GetOteServerFile extends BaseClientCallable<Progress> {
@@ -31,12 +32,11 @@ public class GetOteServerFile extends BaseClientCallable<Progress> {
@Override
public void doWork() throws Exception {
- WebResource client = factory.createResource(uri);
- ClientResponse response =
- client.queryParam("path", filePath).path("ote").path("file").accept(MediaType.APPLICATION_XML).get(
- ClientResponse.class);
- if (response.getStatus() == ClientResponse.Status.OK.getStatusCode()) {
- InputStream is = response.getEntityInputStream();
+ WebTarget client = factory.target(uri);
+ Response response =
+ client.queryParam("path", filePath).path("ote").path("file").request(MediaType.APPLICATION_JSON).get();
+ if (response.getStatus() == Status.OK.getStatusCode()) {
+ InputStream is = (InputStream) response.getEntity();
FileOutputStream fos = new FileOutputStream(destination);
try {
byte[] data = new byte[2048];
diff --git a/plugins/org.eclipse.osee.ote.rest.client/src/org/eclipse/osee/ote/rest/client/internal/OteClientImpl.java b/plugins/org.eclipse.osee.ote.rest.client/src/org/eclipse/osee/ote/rest/client/internal/OteClientImpl.java
index b717364f334..27c78ec8c84 100644
--- a/plugins/org.eclipse.osee.ote.rest.client/src/org/eclipse/osee/ote/rest/client/internal/OteClientImpl.java
+++ b/plugins/org.eclipse.osee.ote.rest.client/src/org/eclipse/osee/ote/rest/client/internal/OteClientImpl.java
@@ -19,7 +19,6 @@ 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.jaxrs.client.JaxRsClientFactory;
import org.eclipse.osee.ote.rest.client.OTECacheItem;
import org.eclipse.osee.ote.rest.client.OteClient;
import org.eclipse.osee.ote.rest.client.Progress;
@@ -56,7 +55,7 @@ public class OteClientImpl implements OteClient {
}
public void update(Map<String, Object> props) {
- client = JaxRsClientFactory.createClient(props);
+ client = JaxRsClient.newBuilder().properties(props).build();
}
@Override
diff --git a/plugins/org.eclipse.osee.ote.rest.client/src/org/eclipse/osee/ote/rest/client/internal/PrepareOteServerFile.java b/plugins/org.eclipse.osee.ote.rest.client/src/org/eclipse/osee/ote/rest/client/internal/PrepareOteServerFile.java
index 3d249bd7a90..5faab98df70 100644
--- a/plugins/org.eclipse.osee.ote.rest.client/src/org/eclipse/osee/ote/rest/client/internal/PrepareOteServerFile.java
+++ b/plugins/org.eclipse.osee.ote.rest.client/src/org/eclipse/osee/ote/rest/client/internal/PrepareOteServerFile.java
@@ -2,6 +2,8 @@ package org.eclipse.osee.ote.rest.client.internal;
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 org.eclipse.osee.jaxrs.client.JaxRsClient;
import org.eclipse.osee.ote.rest.client.OTECacheItem;
@@ -10,7 +12,6 @@ import org.eclipse.osee.ote.rest.model.OTEConfiguration;
import org.eclipse.osee.ote.rest.model.OTEConfigurationIdentity;
import org.eclipse.osee.ote.rest.model.OTEConfigurationItem;
import org.eclipse.osee.ote.rest.model.OTEJobStatus;
-import com.sun.jersey.api.client.WebResource;
public class PrepareOteServerFile extends BaseClientCallable<Progress> {
@@ -46,11 +47,11 @@ public class PrepareOteServerFile extends BaseClientCallable<Progress> {
private void waitForJobComplete() throws Exception {
URI jobUri = status.getUpdatedJobStatus().toURI();
- final WebResource service = factory.createResource(jobUri);
+ final WebTarget service = factory.target(jobUri);
while (!status.isJobComplete()) {
Thread.sleep(POLLING_RATE);
- status = service.accept(MediaType.APPLICATION_JSON).get(OTEJobStatus.class);
+ status = service.request(MediaType.APPLICATION_JSON).get(OTEJobStatus.class);
progress.setUnitsOfWork(status.getTotalUnitsOfWork());
progress.setUnitsWorked(status.getUnitsWorked());
}
@@ -69,10 +70,10 @@ public class PrepareOteServerFile extends BaseClientCallable<Progress> {
item.setMd5Digest(bundleInfo.getMd5());
configuration.addItem(item);
}
- WebResource baseService = factory.createResource(uri);
+ WebTarget baseService = factory.target(uri);
- return baseService.path("ote").path("cache").accept(MediaType.APPLICATION_XML).post(OTEJobStatus.class,
- configuration);
+ return baseService.path("ote").path("cache").request(MediaType.APPLICATION_JSON).post(Entity.json(configuration),
+ OTEJobStatus.class);
}
}
diff --git a/plugins/org.eclipse.osee.ote.rest.client/src/org/eclipse/osee/ote/rest/client/internal/RunTests.java b/plugins/org.eclipse.osee.ote.rest.client/src/org/eclipse/osee/ote/rest/client/internal/RunTests.java
index 77aec5cac23..775c76c31d7 100644
--- a/plugins/org.eclipse.osee.ote.rest.client/src/org/eclipse/osee/ote/rest/client/internal/RunTests.java
+++ b/plugins/org.eclipse.osee.ote.rest.client/src/org/eclipse/osee/ote/rest/client/internal/RunTests.java
@@ -3,6 +3,8 @@ package org.eclipse.osee.ote.rest.client.internal;
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 org.eclipse.osee.framework.logging.OseeLog;
import org.eclipse.osee.jaxrs.client.JaxRsClient;
@@ -10,8 +12,6 @@ import org.eclipse.osee.ote.rest.client.Progress;
import org.eclipse.osee.ote.rest.client.ProgressWithCancel;
import org.eclipse.osee.ote.rest.model.OTEJobStatus;
import org.eclipse.osee.ote.rest.model.OTETestRun;
-import com.sun.jersey.api.client.WebResource;
-
public class RunTests implements ProgressWithCancel, Callable<ProgressWithCancel> {
private final URI uri;
@@ -38,11 +38,12 @@ public class RunTests implements ProgressWithCancel, Callable<ProgressWithCancel
@Override
public boolean cancelSingle() {
- WebResource baseService;
+ WebTarget baseService;
try {
- baseService = factory.createResource(uri);
+ baseService = factory.target(uri);
OTEJobStatus cancelStatus =
- baseService.path("ote").path("run").path(id).accept(MediaType.APPLICATION_JSON).put(OTEJobStatus.class);
+ baseService.path("ote").path("run").path(id).request(MediaType.APPLICATION_JSON).put(Entity.json(""),
+ OTEJobStatus.class);
return cancelStatus.isSuccess();
} catch (Exception e) {
OseeLog.log(getClass(), Level.SEVERE, e);
@@ -51,17 +52,18 @@ public class RunTests implements ProgressWithCancel, Callable<ProgressWithCancel
}
private OTEJobStatus sendCommand() throws Exception {
- WebResource baseService = factory.createResource(uri);
- return baseService.path("ote").path("run").accept(MediaType.APPLICATION_JSON).post(OTEJobStatus.class, tests);
+ WebTarget baseService = factory.target(uri);
+ return baseService.path("ote").path("run").request(MediaType.APPLICATION_JSON).post(Entity.json(tests),
+ OTEJobStatus.class);
}
@Override
public boolean cancelAll() {
- WebResource baseService;
+ WebTarget baseService;
try {
- baseService = factory.createResource(uri);
+ baseService = factory.target(uri);
OTEJobStatus cancelStatus =
- baseService.path("ote").path("run").path(id).accept(MediaType.APPLICATION_JSON).delete(OTEJobStatus.class);
+ baseService.path("ote").path("run").path(id).request(MediaType.APPLICATION_JSON).delete(OTEJobStatus.class);
return cancelStatus.isSuccess();
} catch (Exception e) {
OseeLog.log(getClass(), Level.SEVERE, e);
diff --git a/plugins/org.eclipse.osee.x.core.parent/pom.xml b/plugins/org.eclipse.osee.x.core.parent/pom.xml
index b809e90e4d2..d570ef0bcfc 100644
--- a/plugins/org.eclipse.osee.x.core.parent/pom.xml
+++ b/plugins/org.eclipse.osee.x.core.parent/pom.xml
@@ -64,7 +64,8 @@
<module>../../plugins/org.eclipse.osee.jaxrs.server</module>
<module>../../plugins/org.eclipse.osee.jaxrs.server.test</module>
<module>../../plugins/org.eclipse.osee.jaxrs.client</module>
-
+ <module>../../plugins/org.eclipse.osee.jaxrs.client.test</module>
+
<module>../../plugins/org.eclipse.osee.account.rest.model</module>
<module>../../plugins/org.eclipse.osee.account.rest</module>
<module>../../plugins/org.eclipse.osee.account.rest.test</module>
diff --git a/plugins/org.eclipse.osee.x.server.integration.tests/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.x.server.integration.tests/META-INF/MANIFEST.MF
index fb3adbcb069..a259dcf5408 100644
--- a/plugins/org.eclipse.osee.x.server.integration.tests/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.osee.x.server.integration.tests/META-INF/MANIFEST.MF
@@ -5,16 +5,22 @@ Bundle-SymbolicName: org.eclipse.osee.x.server.integration.tests
Bundle-Version: 0.18.0.qualifier
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-Vendor: Eclipse Open System Engineering Environment
-Require-Bundle: org.junit,
- org.eclipse.osee.orcs.rest.model,
- org.eclipse.osee.orcs.rest.client,
- org.databene.contiperf
Import-Package: org.apache.commons.lang.math,
+ org.databene.contiperf,
+ org.databene.contiperf.junit,
+ org.databene.contiperf.report,
org.eclipse.osee.account.rest.client,
org.eclipse.osee.account.rest.model,
org.eclipse.osee.framework.core.data,
org.eclipse.osee.framework.core.enums,
org.eclipse.osee.framework.core.exception,
org.eclipse.osee.framework.jdk.core.type,
+ org.eclipse.osee.jaxrs,
org.eclipse.osee.jaxrs.client,
- org.eclipse.osee.jaxrs
+ org.eclipse.osee.orcs.rest.client,
+ org.eclipse.osee.orcs.rest.model.search.artifact,
+ org.hamcrest.core,
+ org.junit,
+ org.junit.rules,
+ org.junit.runner,
+ org.junit.runners
diff --git a/plugins/org.eclipse.osee.x.server.integration.tests/pom.xml b/plugins/org.eclipse.osee.x.server.integration.tests/pom.xml
index 02eb9719da8..497d50e7179 100644
--- a/plugins/org.eclipse.osee.x.server.integration.tests/pom.xml
+++ b/plugins/org.eclipse.osee.x.server.integration.tests/pom.xml
@@ -53,8 +53,7 @@
<version>${tycho-version}</version>
<configuration>
<debugPort>${int-test-debug-port}</debugPort>
- <!-- <systemProperties combine.children="append"> <equinox.ds.debug>true</equinox.ds.debug>
- </systemProperties> -->
+ <!-- <systemProperties combine.children="append"> <equinox.ds.debug>true</equinox.ds.debug> </systemProperties> -->
</configuration>
</plugin>
</plugins>
@@ -115,18 +114,15 @@
</classpath>
</taskdef>
- <property name="xserver-project"
- value="${project.basedir}/../org.eclipse.osee.x.server.p2" />
+ <property name="xserver-project" value="${project.basedir}/../org.eclipse.osee.x.server.p2" />
<property name="xserver-home" value="${xserver-project}/target/server" />
<property name="xserver-port" value="${osee-server-port}" />
<property name="xserver-telnet-port" value="${osee-server-telnet-port}" />
<property name="xserver-authentication" value="demo" />
- <property name="xserver-data"
- value="${project.build.directory}/server-data" />
+ <property name="xserver-data" value="${project.build.directory}/server-data" />
<property name="xserver-log-config" value="${project.basedir}/logback-test.xml" />
- <property name="xserver-db-home"
- value="file:${xserver-project}/target/server/demo/hsql/osee.hsql.db" />
+ <property name="xserver-db-home" value="file:${xserver-project}/target/server/demo/hsql/osee.hsql.db" />
<property name="xserver-db-name" value="osee-test-db" />
<property name="xserver-db-username" value="public" />
<property name="xserver-db-password" value="" />
@@ -139,8 +135,7 @@
<property name="xserver-log-output" value="${xserver-data}/server-output.log" />
<mkdir dir="${xserver-data}" />
- <ant antfile="${osee-application-server-launch-ant}" target="run"
- inheritRefs="true" output="${xserver-log-output}" />
+ <ant antfile="${osee-application-server-launch-ant}" target="run" inheritRefs="true" output="${xserver-log-output}" />
</target>
</configuration>
<goals>
@@ -162,8 +157,7 @@
<property name="xserver-port" value="${osee-server-port}" />
<property name="xserver-telnet-port" value="${osee-server-telnet-port}" />
- <ant antfile="${osee-application-server-launch-ant}" target="stopServer"
- inheritRefs="true" />
+ <ant antfile="${osee-application-server-launch-ant}" target="stopServer" inheritRefs="true" />
</target>
</configuration>
<goals>
diff --git a/plugins/org.eclipse.osee.x.server.integration.tests/src/org/eclipse/osee/x/server/integration/tests/performance/IntegrationUtil.java b/plugins/org.eclipse.osee.x.server.integration.tests/src/org/eclipse/osee/x/server/integration/tests/performance/IntegrationUtil.java
index 13ee1d854e7..68758e1a3d7 100644
--- a/plugins/org.eclipse.osee.x.server.integration.tests/src/org/eclipse/osee/x/server/integration/tests/performance/IntegrationUtil.java
+++ b/plugins/org.eclipse.osee.x.server.integration.tests/src/org/eclipse/osee/x/server/integration/tests/performance/IntegrationUtil.java
@@ -18,7 +18,6 @@ import org.databene.contiperf.report.CSVSummaryReportModule;
import org.databene.contiperf.report.HtmlReportModule;
import org.eclipse.osee.account.rest.client.AccountClient;
import org.eclipse.osee.account.rest.client.AccountClientStandaloneSetup;
-import org.eclipse.osee.jaxrs.client.JaxRsClientConstants;
import org.eclipse.osee.orcs.rest.client.OseeClient;
import org.eclipse.osee.orcs.rest.client.OseeClientStandaloneSetup;
import org.junit.rules.MethodRule;
@@ -44,7 +43,7 @@ public final class IntegrationUtil {
private static Map<String, Object> createClientConfig() {
Map<String, Object> config = new HashMap<String, Object>();
String serverAddress = System.getProperty(OSEE_APPLICATION_SERVER, DEFAULT_OSEE_APPLICATION_SERVER);
- config.put(JaxRsClientConstants.JAXRS_CLIENT_SERVER_ADDRESS, serverAddress);
+ config.put(OSEE_APPLICATION_SERVER, serverAddress);
return config;
}

Back to the top