7 Commits

Author SHA1 Message Date
fd129b992c v2.0.3-cxf pom 2023-05-28 13:09:54 -04:00
c67a869fee v2.0.3-cxf pom 2023-05-28 13:07:58 -04:00
06de852f2a Merge branch 'develop-cxf' into stable-cxf 2023-05-28 13:07:26 -04:00
733310cf3e upgraded CXF version 2023-05-28 12:58:07 -04:00
1618d9956d Merge branch 'develop' into develop-cxf 2023-05-28 12:57:48 -04:00
c48c9531bf Merge branch 'develop-cxf' into stable-cxf 2022-10-03 10:34:12 -04:00
ade7e9b5a0 added CXF back 2022-10-03 10:25:10 -04:00
13 changed files with 53 additions and 277 deletions

50
pom.xml
View File

@@ -5,10 +5,10 @@
<groupId>com.inteligr8.alfresco</groupId>
<artifactId>aps-public-rest-client</artifactId>
<version>3.0.2-jersey</version>
<version>2.0.3-cxf</version>
<name>Alfresco Process Services ReST API Client for Java</name>
<description>An APS Client library for building Jersey-based REST API clients</description>
<description>An APS Client library for building CXF-based REST API clients</description>
<url>https://bitbucket.org/inteligr8/aps-public-rest-client</url>
<licenses>
@@ -38,27 +38,25 @@
<properties>
<project.build.sourceEncoding>utf-8</project.build.sourceEncoding>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<maven.compiler.release>11</maven.compiler.release>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
<maven.compiler.debuglevel>lines,vars,source</maven.compiler.debuglevel>
<junit.version>5.10.0</junit.version>
<spring.version>6.0.19</spring.version>
<jersey.version>3.1.8</jersey.version>
<jackson.version>2.17.2</jackson.version>
<junit.version>5.7.2</junit.version>
<spring.version>5.3.6</spring.version>
<cxf.version>3.5.6</cxf.version>
</properties>
<dependencies>
<dependency>
<groupId>com.inteligr8</groupId>
<artifactId>common-rest-client</artifactId>
<version>3.0.0-jersey</version>
<version>2.0.1-cxf</version>
</dependency>
<dependency>
<groupId>com.inteligr8.alfresco</groupId>
<artifactId>aps-public-rest-api</artifactId>
<version>3.0.5</version>
<version>2.0.8</version>
<scope>provided</scope> <!-- explicitly, bring your own version -->
</dependency>
<dependency>
@@ -82,28 +80,16 @@
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
<version>2.20.0</version>
<version>2.19.0</version>
<scope>test</scope>
</dependency>
<!-- Jersey libraries -->
<!-- Apache CXF libraries -->
<dependency>
<groupId>org.glassfish.jersey.inject</groupId>
<artifactId>jersey-hk2</artifactId>
<version>${jersey.version}</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-json-jackson</artifactId>
<version>${jersey.version}</version>
</dependency>
<!-- Jersey inclusion fallout -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>${jackson.version}</version>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-rs-client</artifactId>
<version>${cxf.version}</version>
<scope>provided</scope>
</dependency>
</dependencies>
@@ -119,7 +105,7 @@
<goals><goal>add-source</goal></goals>
<configuration>
<sources>
<source>src/main/jersey</source>
<source>src/main/cxf</source>
</sources>
</configuration>
</execution>
@@ -128,7 +114,7 @@
<goals><goal>add-test-source</goal></goals>
<configuration>
<sources>
<source>src/test/jersey</source>
<source>src/test/cxf</source>
</sources>
</configuration>
</execution>

View File

@@ -18,11 +18,11 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import com.inteligr8.rs.ClientJerseyConfiguration;
import com.inteligr8.rs.ClientCxfConfiguration;
/**
* This class provides a POJO &amp; Spring-based implementation of the
* ClientJerseyConfiguration interface. You can use it outside of the Spring
* ClientCxfConfiguration interface. You can use it outside of the Spring
* context, but you will need the spring-context and spring-beans libraries in
* your non-Spring application.
*
@@ -30,17 +30,17 @@ import com.inteligr8.rs.ClientJerseyConfiguration;
*/
@Configuration
@ComponentScan
public class ApsClientJerseyConfiguration extends ApsClientConfiguration implements ClientJerseyConfiguration {
public class ApsClientCxfConfiguration extends ApsClientConfiguration implements ClientCxfConfiguration {
@Value("${process.service.cxf.defaultBusEnabled:true}")
private boolean defaultBusEnabled;
@Value("${process.service.jersey.putBodyRequired:true}")
private boolean putBodyRequired;
public boolean isPutBodyRequired() {
return this.putBodyRequired;
public boolean isDefaultBusEnabled() {
return this.defaultBusEnabled;
}
public void setPutBodyRequired(boolean putBodyRequired) {
this.putBodyRequired = putBodyRequired;
public void setDefaultBusEnabled(boolean defaultBusEnabled) {
this.defaultBusEnabled = defaultBusEnabled;
}
}

View File

@@ -18,25 +18,25 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Component;
import com.inteligr8.rs.ClientJerseyImpl;
import com.inteligr8.rs.ClientCxfImpl;
/**
* This class provides a POJO &amp; Spring-based implementation of the Jersey
* client configured for APS. You can use it outside of the Spring context,
* but you will need the spring-context and spring-beans libraries in your
* non-Spring application.
* This class provides a POJO &amp; Spring-based implementation of the Apache
* CXF client. You can use it outside of the Spring context, but you will need
* the spring-context and spring-beans libraries in your non-Spring
* application.
*
* @author brian@inteligr8.com
*/
@Component("aps.client.jersey")
@Component("aps.client.cxf")
@Lazy
public class ApsClientJerseyImpl extends ClientJerseyImpl {
public class ApsClientCxfImpl extends ClientCxfImpl {
/**
* This constructor is for Spring and POJO use
* This constructor is for Spring or POJO use
*/
@Autowired
public ApsClientJerseyImpl(ApsClientJerseyConfiguration config) {
public ApsClientCxfImpl(ApsClientCxfConfiguration config) {
super(config);
}

View File

@@ -19,20 +19,20 @@ import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Component;
/**
* This class provides the Jersey client to the JAX-RS API for the APS Public
* ReST API.
* This class provides the Apache CXF client to the JAX-RS API for the APS
* Public ReST API.
*
* @author brian@inteligr8.com
*/
@Component("aps.api.jersey")
@Component("aps.api.cxf")
@Lazy
public class ApsPublicRestApiJerseyImpl extends ApsPublicRestApiImpl implements ApsPublicRestJerseyApi {
public class ApsPublicRestApiCxfImpl extends ApsPublicRestApiImpl implements ApsPublicRestCxfApi {
/**
* This constructor is for Spring or POJO use
*/
@Autowired
public ApsPublicRestApiJerseyImpl(ApsClientJerseyImpl client) {
public ApsPublicRestApiCxfImpl(ApsClientCxfImpl client) {
super(client);
}

View File

@@ -61,12 +61,6 @@ public abstract class ApsClientConfiguration implements ClientConfiguration {
@Value("${process.service.security.oauth.grantPassword:#{null}}")
private String oAuthPassword;
@Value("${process.service.http.connectTimeout:#{null}}")
private Integer connectTimeoutInMillis;
@Value("${process.service.http.responseTimeout:#{null}}")
private Integer responseTimeoutInMillis;
public String getBaseUrl() {
return this.baseUrl;
}
@@ -154,23 +148,5 @@ public abstract class ApsClientConfiguration implements ClientConfiguration {
public void setOAuthPassword(String oAuthPassword) {
this.oAuthPassword = oAuthPassword;
}
@Override
public Integer getConnectTimeoutInMillis() {
return this.connectTimeoutInMillis;
}
public void setConnectTimeoutInMillis(Integer connectTimeoutInMillis) {
this.connectTimeoutInMillis = connectTimeoutInMillis;
}
@Override
public Integer getResponseTimeoutInMillis() {
return this.responseTimeoutInMillis;
}
public void setResponseTimeoutInMillis(Integer responseTimeoutInMillis) {
this.responseTimeoutInMillis = responseTimeoutInMillis;
}
}

View File

@@ -1,41 +0,0 @@
/*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.inteligr8.alfresco.activiti;
import com.inteligr8.rs.Client;
/**
* This class serves as the entrypoint to the JAX-RS API for the APS Public
* ReST API.
*
* @author brian@inteligr8.com
*/
public class ApsProtectedRestApiImpl implements ApsProtectedRestApi {
private Client client;
public ApsProtectedRestApiImpl(Client client) {
this.client = client;
}
public Client getClient() {
return this.client;
}
public final <T> T getApi(Class<T> apiClass) {
return this.client.getApi(apiClass);
}
}

View File

@@ -1,39 +0,0 @@
/*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.inteligr8.alfresco.activiti;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Component;
/**
* This class provides the Jersey client to the JAX-RS API for the Activiti &
* APS public ReST API and some non-public APS ReST API.
*
* @author brian@inteligr8.com
*/
@Component("aps.protected-api.jersey")
@Lazy
public class ApsProtectedRestApiJerseyImpl extends ApsProtectedRestApiImpl implements ApsProtectedRestJerseyApi {
/**
* This constructor is for Spring or POJO use
*/
@Autowired
public ApsProtectedRestApiJerseyImpl(ApsClientJerseyImpl client) {
super(client);
}
}

View File

@@ -0,0 +1 @@
org.apache.cxf.jaxrs.client.spec.ClientBuilderImpl

View File

@@ -18,21 +18,22 @@ import org.junit.jupiter.api.BeforeAll;
import com.inteligr8.rs.ClientConfiguration;
public class ConnectionJerseyClientPojoIT extends ConnectionClientIT {
public class ConnectionCxfClientPojoIT extends ConnectionClientIT {
private static ApsPublicRestApiImpl api;
@BeforeAll
public static void initClient() {
ApsClientJerseyConfiguration config = new ApsClientJerseyConfiguration();
ApsClientCxfConfiguration config = new ApsClientCxfConfiguration();
config.setBaseUrl("http://localhost:8080/activiti-app");
config.setBasicAuthUsername("admin");
config.setBasicAuthPassword("admin");
api = new ApsPublicRestApiJerseyImpl(
new ApsClientJerseyImpl(config));
api = new ApsPublicRestApiCxfImpl(
new ApsClientCxfImpl(config));
}
@Override
public ApsPublicRestApiImpl getApi() {
return api;
}

View File

@@ -21,14 +21,15 @@ import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
import com.inteligr8.rs.ClientConfiguration;
@TestPropertySource(locations = {"/local.properties"})
@SpringJUnitConfig(classes = {ApsClientJerseyConfiguration.class, ApsPublicRestApiJerseyImpl.class, ApsClientJerseyImpl.class})
public class ConnectionJerseyClientSpringIT extends ConnectionClientIT {
@TestPropertySource(locations = {"/local-oauth.properties"})
@SpringJUnitConfig(classes = {ApsClientCxfConfiguration.class, ApsPublicRestApiCxfImpl.class, ApsClientCxfImpl.class})
public class ConnectionCxfClientSpringIT extends ConnectionClientIT {
@Autowired
@Qualifier("aps.api.jersey")
@Qualifier("aps.api.cxf")
private ApsPublicRestApiImpl api;
@Override
public ApsPublicRestApiImpl getApi() {
return this.api;
}

View File

@@ -1 +0,0 @@
org.glassfish.jersey.client.JerseyClientBuilder

View File

@@ -1,51 +0,0 @@
/*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.inteligr8.alfresco.activiti;
import java.util.List;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.EnabledIf;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.test.context.TestPropertySource;
import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
import com.inteligr8.alfresco.activiti.model.Tenant;
import com.inteligr8.rs.ClientConfiguration;
@TestPropertySource(locations = {"/local.properties"})
@SpringJUnitConfig(classes = {ApsClientJerseyConfiguration.class, ApsPublicRestApiJerseyImpl.class, ApsClientJerseyImpl.class})
public class ArrayResponseUnitTest extends ConditionalIT {
@Autowired
@Qualifier("aps.api.jersey")
private ApsPublicRestApiImpl api;
@Override
public ClientConfiguration getConfiguration() {
return this.api.getClient().getConfig();
}
@Test
@EnabledIf("hostExists")
public void testTenants() {
List<Tenant> objs = this.api.getAdminApi().getTenants();
Assertions.assertNotNull(objs);
}
}

View File

@@ -1,57 +0,0 @@
/*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.inteligr8.alfresco.activiti;
import java.util.List;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.EnabledIf;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.test.context.TestPropertySource;
import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
import com.inteligr8.alfresco.activiti.model.GroupLight;
import com.inteligr8.activiti.model.ResultList;
import com.inteligr8.alfresco.activiti.model.UserLight;
import com.inteligr8.rs.ClientConfiguration;
@TestPropertySource(locations = {"/local.properties"})
@SpringJUnitConfig(classes = {ApsClientJerseyConfiguration.class, ApsPublicRestApiJerseyImpl.class, ApsClientJerseyImpl.class})
public class ResultListResponseUnitTest extends ConditionalIT {
@Autowired
@Qualifier("aps.api.jersey")
private ApsPublicRestApiImpl api;
@Override
public ClientConfiguration getConfiguration() {
return this.api.getClient().getConfig();
}
@Test
@EnabledIf("hostExists")
public void testGroupMembers() {
List<GroupLight> groups = this.api.getAdminApi().getGroups(1L, false, false);
Assertions.assertFalse(groups.isEmpty());
for (GroupLight group : groups) {
ResultList<UserLight> users = this.api.getAdminApi().getMembers(group.getId(), null, null, null);
Assertions.assertNotNull(users);
}
}
}