Compare commits

..
8 changed files with 42 additions and 41 deletions
+6 -6
View File
@@ -6,10 +6,10 @@
<groupId>com.inteligr8.alfresco</groupId> <groupId>com.inteligr8.alfresco</groupId>
<artifactId>acs-public-rest-client</artifactId> <artifactId>acs-public-rest-client</artifactId>
<version>3.0-SNAPSHOT-cxf</version> <version>3.0-SNAPSHOT-jersey</version>
<name>Alfresco Content Services ReST API Client for Java</name> <name>Alfresco Content Services ReST API Client for Java</name>
<description>An ACS Client library for building CXF-based REST API clients</description> <description>An ACS Client library for building Jersey-based REST API clients</description>
<url>https://bitbucket.org/inteligr8/acs-public-rest-client</url> <url>https://bitbucket.org/inteligr8/acs-public-rest-client</url>
<licenses> <licenses>
@@ -45,7 +45,7 @@
<maven.compiler.debuglevel>lines,vars,source</maven.compiler.debuglevel> <maven.compiler.debuglevel>lines,vars,source</maven.compiler.debuglevel>
<acs.platform.tag>acs26</acs.platform.tag> <acs.platform.tag>acs26</acs.platform.tag>
<!-- for testing only --> <!-- for testing only -->
<spring.version>6.2.18</spring.version> <spring.version>6.2.18</spring.version>
</properties> </properties>
@@ -54,7 +54,7 @@
<dependency> <dependency>
<groupId>com.inteligr8</groupId> <groupId>com.inteligr8</groupId>
<artifactId>common-rest-client</artifactId> <artifactId>common-rest-client</artifactId>
<version>3.0.4-cxf</version> <version>3.0.4-jersey</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.inteligr8.alfresco</groupId> <groupId>com.inteligr8.alfresco</groupId>
@@ -117,7 +117,7 @@
<goals><goal>add-source</goal></goals> <goals><goal>add-source</goal></goals>
<configuration> <configuration>
<sources> <sources>
<source>src/main/cxf</source> <source>src/main/jersey</source>
</sources> </sources>
</configuration> </configuration>
</execution> </execution>
@@ -126,7 +126,7 @@
<goals><goal>add-test-source</goal></goals> <goals><goal>add-test-source</goal></goals>
<configuration> <configuration>
<sources> <sources>
<source>src/test/cxf</source> <source>src/test/jersey</source>
</sources> </sources>
</configuration> </configuration>
</execution> </execution>
@@ -18,11 +18,11 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import com.inteligr8.rs.ClientCxfConfiguration; import com.inteligr8.rs.ClientJerseyConfiguration;
/** /**
* This class provides a POJO &amp; Spring-based implementation of the * This class provides a POJO &amp; Spring-based implementation of the
* ClientCxfConfiguration interface. You can use it outside of the Spring * ClientJerseyConfiguration interface. You can use it outside of the Spring
* context, but you will need the spring-context and spring-beans libraries in * context, but you will need the spring-context and spring-beans libraries in
* your non-Spring application. * your non-Spring application.
* *
@@ -30,17 +30,17 @@ import com.inteligr8.rs.ClientCxfConfiguration;
*/ */
@Configuration @Configuration
@ComponentScan @ComponentScan
public class AcsClientCxfConfiguration extends AcsClientConfiguration implements ClientCxfConfiguration { public class AcsClientJerseyConfiguration extends AcsClientConfiguration implements ClientJerseyConfiguration {
@Value("${content.service.cxf.defaultBusEnabled:true}")
private boolean defaultBusEnabled;
public boolean isDefaultBusEnabled() { @Value("${content.service.jersey.putBodyRequired:true}")
return this.defaultBusEnabled; private boolean putBodyRequired;
public boolean isPutBodyRequired() {
return this.putBodyRequired;
} }
public void setDefaultBusEnabled(boolean defaultBusEnabled) { public void setPutBodyRequired(boolean putBodyRequired) {
this.defaultBusEnabled = defaultBusEnabled; this.putBodyRequired = putBodyRequired;
} }
} }
@@ -18,25 +18,25 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy; import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import com.inteligr8.rs.ClientCxfImpl; import com.inteligr8.rs.ClientJerseyImpl;
/** /**
* This class provides a POJO &amp; Spring-based implementation of the Apache * This class provides a POJO &amp; Spring-based implementation of the Jersey
* CXF client. You can use it outside of the Spring context, but you will need * client configured for APS. You can use it outside of the Spring context,
* the spring-context and spring-beans libraries in your non-Spring * but you will need the spring-context and spring-beans libraries in your
* application. * non-Spring application.
* *
* @author brian@inteligr8.com * @author brian@inteligr8.com
*/ */
@Component("acs.client.cxf") @Component("acs.client.jersey")
@Lazy @Lazy
public class AcsClientCxfImpl extends ClientCxfImpl { public class AcsClientJerseyImpl extends ClientJerseyImpl {
/** /**
* This constructor is for Spring or POJO use * This constructor is for Spring and POJO use
*/ */
@Autowired @Autowired
public AcsClientCxfImpl(AcsClientCxfConfiguration config) { public AcsClientJerseyImpl(AcsClientJerseyConfiguration config) {
super(config); super(config);
} }
@@ -19,20 +19,20 @@ import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
/** /**
* This class provides the Apache CXF client to the JAX-RS API for the ACS * This class provides the Jersey client to the JAX-RS API for the ACS Public
* Public ReST API. * ReST API.
* *
* @author brian@inteligr8.com * @author brian@inteligr8.com
*/ */
@Component("acs.api.cxf") @Component("acs.api.jersey")
@Lazy @Lazy
public class AcsPublicRestApiCxfImpl extends AcsPublicRestApiImpl implements AcsPublicRestCxfApi { public class AcsPublicRestApiJerseyImpl extends AcsPublicRestApiImpl implements AcsPublicRestJerseyApi {
/** /**
* This constructor is for Spring or POJO use * This constructor is for Spring or POJO use
*/ */
@Autowired @Autowired
public AcsPublicRestApiCxfImpl(AcsClientCxfImpl client) { public AcsPublicRestApiJerseyImpl(AcsClientJerseyImpl client) {
super(client); super(client);
} }
@@ -1 +0,0 @@
org.apache.cxf.jaxrs.client.spec.ClientBuilderImpl
@@ -0,0 +1 @@
org.glassfish.jersey.client.JerseyClientBuilder
@@ -22,11 +22,11 @@ import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
import com.inteligr8.rs.ClientConfiguration; import com.inteligr8.rs.ClientConfiguration;
@TestPropertySource(locations = {"/local.properties"}) @TestPropertySource(locations = {"/local.properties"})
@SpringJUnitConfig(classes = {AcsClientCxfConfiguration.class, AcsPublicRestApiCxfImpl.class, AcsClientCxfImpl.class}) @SpringJUnitConfig(classes = {AcsClientJerseyConfiguration.class, AcsPublicRestApiJerseyImpl.class, AcsClientJerseyImpl.class})
public class ConnectionCxfClientIT extends ConnectionClientIT { public class ConnectionJerseyClientIT extends ConnectionClientIT {
@Autowired @Autowired
@Qualifier("acs.api.cxf") @Qualifier("acs.api.jersey")
private AcsPublicRestApiImpl api; private AcsPublicRestApiImpl api;
@Override @Override
@@ -16,6 +16,7 @@ package com.inteligr8.alfresco.acs;
import java.io.ByteArrayInputStream; import java.io.ByteArrayInputStream;
import java.io.IOException; import java.io.IOException;
import java.text.ParseException;
import java.util.Collections; import java.util.Collections;
import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Assertions;
@@ -28,16 +29,16 @@ import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
import com.inteligr8.alfresco.acs.model.Node; import com.inteligr8.alfresco.acs.model.Node;
import com.inteligr8.alfresco.acs.model.NodeBodyCreate; import com.inteligr8.alfresco.acs.model.NodeBodyCreate;
import com.inteligr8.alfresco.acs.model.NodeBodyCreateMultipartCxf; import com.inteligr8.alfresco.acs.model.NodeBodyCreateMultipartJersey;
import com.inteligr8.rs.ClientConfiguration; import com.inteligr8.rs.ClientConfiguration;
@TestPropertySource(locations = {"/local.properties"}) @TestPropertySource(locations = {"/local.properties"})
@SpringJUnitConfig(classes = {AcsClientCxfConfiguration.class, AcsPublicRestApiCxfImpl.class, AcsClientCxfImpl.class}) @SpringJUnitConfig(classes = {AcsClientJerseyConfiguration.class, AcsPublicRestApiJerseyImpl.class, AcsClientJerseyImpl.class})
public class CxfUploadIT extends UploadIT { public class JerseyUploadIT extends UploadIT {
@Autowired @Autowired
@Qualifier("acs.api.cxf") @Qualifier("acs.api.jersey")
private AcsPublicRestApiCxfImpl api; private AcsPublicRestApiJerseyImpl api;
@Override @Override
public AcsPublicRestApi getApi() { public AcsPublicRestApi getApi() {
@@ -51,14 +52,14 @@ public class CxfUploadIT extends UploadIT {
@Test @Test
@EnabledIf("hostExists") @EnabledIf("hostExists")
public void uploadFile() throws IOException { public void uploadFile() throws IOException, ParseException {
String folderNodeId = this.getSharedFolder(); String folderNodeId = this.getSharedFolder();
NodeBodyCreate nodeBody = new NodeBodyCreate().nodeType("trx:transferReport").name("test-name1.txt") NodeBodyCreate nodeBody = new NodeBodyCreate().nodeType("trx:transferReport").name("test-name1.txt")
.properties(Collections.singletonMap("cm:author", "Brian")); .properties(Collections.singletonMap("cm:author", "Brian"));
ByteArrayInputStream istream = new ByteArrayInputStream("This is a test".getBytes()); ByteArrayInputStream istream = new ByteArrayInputStream("This is a test".getBytes());
NodeBodyCreateMultipartCxf body = NodeBodyCreateMultipartCxf.from(nodeBody, "test-name2.txt", istream, true, null, null); NodeBodyCreateMultipartJersey body = NodeBodyCreateMultipartJersey.from(nodeBody, "test-name2.txt", istream, true, null, null);
Node newNode = this.api.getNodesExtApi().createNode(folderNodeId, body).getEntry(); Node newNode = this.api.getNodesExtApi().createNode(folderNodeId, body).getEntry();
Assertions.assertNotNull(newNode); Assertions.assertNotNull(newNode);