Compare commits
19 Commits
develop
...
stable-cxf
Author | SHA1 | Date | |
---|---|---|---|
5f3e30ea51 | |||
5aecea9809 | |||
4b8b537864 | |||
fd314a06b0 | |||
bfa007f2f3 | |||
7d1c7f92f2 | |||
2876d9ffe9 | |||
78d2d00886 | |||
d11f2fc1e2 | |||
42079274e1 | |||
238aeef92e | |||
cd262858b0 | |||
2aa3cd9639 | |||
073ca4a6b7 | |||
d36f4f920d | |||
18426e562d | |||
e342dfdcce | |||
24f7f54577 | |||
77c101d64a |
32
pom.xml
32
pom.xml
@ -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</version>
|
<version>3.0.0-cxf</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 REST API clients that support either the CXF and Jersey frameworks</description>
|
<description>An ACS Client library for building CXF-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>
|
||||||
@ -48,13 +48,14 @@
|
|||||||
|
|
||||||
<junit.version>5.10.0</junit.version>
|
<junit.version>5.10.0</junit.version>
|
||||||
<spring.version>6.0.19</spring.version>
|
<spring.version>6.0.19</spring.version>
|
||||||
|
<cxf.version>4.0.2</cxf.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.inteligr8</groupId>
|
<groupId>com.inteligr8</groupId>
|
||||||
<artifactId>common-rest-client</artifactId>
|
<artifactId>common-rest-client</artifactId>
|
||||||
<version>3.0.0</version>
|
<version>3.0.0-cxf</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.inteligr8.alfresco</groupId>
|
<groupId>com.inteligr8.alfresco</groupId>
|
||||||
@ -90,6 +91,31 @@
|
|||||||
|
|
||||||
<build>
|
<build>
|
||||||
<plugins>
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.codehaus.mojo</groupId>
|
||||||
|
<artifactId>build-helper-maven-plugin</artifactId>
|
||||||
|
<version>3.2.0</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>add-jaxrs-src</id>
|
||||||
|
<goals><goal>add-source</goal></goals>
|
||||||
|
<configuration>
|
||||||
|
<sources>
|
||||||
|
<source>src/main/cxf</source>
|
||||||
|
</sources>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
<execution>
|
||||||
|
<id>add-test-src</id>
|
||||||
|
<goals><goal>add-test-source</goal></goals>
|
||||||
|
<configuration>
|
||||||
|
<sources>
|
||||||
|
<source>src/test/cxf</source>
|
||||||
|
</sources>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
<artifactId>maven-surefire-plugin</artifactId>
|
<artifactId>maven-surefire-plugin</artifactId>
|
||||||
<version>3.1.0</version>
|
<version>3.1.0</version>
|
||||||
|
@ -0,0 +1,46 @@
|
|||||||
|
/*
|
||||||
|
* 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.acs;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.context.annotation.ComponentScan;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
|
import com.inteligr8.rs.ClientCxfConfiguration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class provides a POJO & Spring-based implementation of the
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* @author brian@inteligr8.com
|
||||||
|
*/
|
||||||
|
@Configuration
|
||||||
|
@ComponentScan
|
||||||
|
public class AcsClientCxfConfiguration extends AcsClientConfiguration implements ClientCxfConfiguration {
|
||||||
|
|
||||||
|
@Value("${content.service.cxf.defaultBusEnabled:true}")
|
||||||
|
private boolean defaultBusEnabled;
|
||||||
|
|
||||||
|
public boolean isDefaultBusEnabled() {
|
||||||
|
return this.defaultBusEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDefaultBusEnabled(boolean defaultBusEnabled) {
|
||||||
|
this.defaultBusEnabled = defaultBusEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,43 @@
|
|||||||
|
/*
|
||||||
|
* 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.acs;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Lazy;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import com.inteligr8.rs.ClientCxfImpl;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class provides a POJO & 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("acs.client.cxf")
|
||||||
|
@Lazy
|
||||||
|
public class AcsClientCxfImpl extends ClientCxfImpl {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This constructor is for Spring or POJO use
|
||||||
|
*/
|
||||||
|
@Autowired
|
||||||
|
public AcsClientCxfImpl(AcsClientCxfConfiguration config) {
|
||||||
|
super(config);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,39 @@
|
|||||||
|
/*
|
||||||
|
* 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.acs;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Lazy;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class provides the Apache CXF client to the JAX-RS API for the ACS
|
||||||
|
* Public ReST API.
|
||||||
|
*
|
||||||
|
* @author brian@inteligr8.com
|
||||||
|
*/
|
||||||
|
@Component("acs.api.cxf")
|
||||||
|
@Lazy
|
||||||
|
public class AcsPublicRestApiCxfImpl extends AcsPublicRestApiImpl implements AcsPublicRestCxfApi {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This constructor is for Spring or POJO use
|
||||||
|
*/
|
||||||
|
@Autowired
|
||||||
|
public AcsPublicRestApiCxfImpl(AcsClientCxfImpl client) {
|
||||||
|
super(client);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1 @@
|
|||||||
|
org.apache.cxf.jaxrs.client.spec.ClientBuilderImpl
|
@ -0,0 +1,42 @@
|
|||||||
|
/*
|
||||||
|
* 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.acs;
|
||||||
|
|
||||||
|
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.rs.ClientConfiguration;
|
||||||
|
|
||||||
|
@TestPropertySource(locations = {"/local.properties"})
|
||||||
|
@SpringJUnitConfig(classes = {AcsClientCxfConfiguration.class, AcsPublicRestApiCxfImpl.class, AcsClientCxfImpl.class})
|
||||||
|
public class ConnectionCxfClientIT extends ConnectionClientIT {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
@Qualifier("acs.api.cxf")
|
||||||
|
private AcsPublicRestApiImpl api;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AcsPublicRestApi getApi() {
|
||||||
|
return this.api;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ClientConfiguration getConfiguration() {
|
||||||
|
return this.api.getClient().getConfig();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
71
src/test/cxf/com/inteligr8/alfresco/acs/CxfUploadIT.java
Normal file
71
src/test/cxf/com/inteligr8/alfresco/acs/CxfUploadIT.java
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
/*
|
||||||
|
* 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.acs;
|
||||||
|
|
||||||
|
import java.io.ByteArrayInputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Collections;
|
||||||
|
|
||||||
|
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.acs.model.Node;
|
||||||
|
import com.inteligr8.alfresco.acs.model.NodeBodyCreate;
|
||||||
|
import com.inteligr8.alfresco.acs.model.NodeBodyCreateMultipartCxf;
|
||||||
|
import com.inteligr8.rs.ClientConfiguration;
|
||||||
|
|
||||||
|
@TestPropertySource(locations = {"/local.properties"})
|
||||||
|
@SpringJUnitConfig(classes = {AcsClientCxfConfiguration.class, AcsPublicRestApiCxfImpl.class, AcsClientCxfImpl.class})
|
||||||
|
public class CxfUploadIT extends UploadIT {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
@Qualifier("acs.api.cxf")
|
||||||
|
private AcsPublicRestApiCxfImpl api;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AcsPublicRestApi getApi() {
|
||||||
|
return this.api;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ClientConfiguration getConfiguration() {
|
||||||
|
return this.api.getClient().getConfig();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@EnabledIf("hostExists")
|
||||||
|
public void uploadFile() throws IOException {
|
||||||
|
String folderNodeId = this.getSharedFolder();
|
||||||
|
|
||||||
|
NodeBodyCreate nodeBody = new NodeBodyCreate().nodeType("trx:transferReport").name("test-name1.txt")
|
||||||
|
.properties(Collections.singletonMap("cm:author", "Brian"));
|
||||||
|
|
||||||
|
ByteArrayInputStream istream = new ByteArrayInputStream("This is a test".getBytes());
|
||||||
|
NodeBodyCreateMultipartCxf body = NodeBodyCreateMultipartCxf.from(nodeBody, "test-name2.txt", istream, true, null, null);
|
||||||
|
|
||||||
|
Node newNode = this.api.getNodesExtApi().createNode(folderNodeId, body).getEntry();
|
||||||
|
Assertions.assertNotNull(newNode);
|
||||||
|
Assertions.assertNotNull(newNode.getId());
|
||||||
|
Assertions.assertEquals(folderNodeId, newNode.getParentId());
|
||||||
|
Assertions.assertEquals(nodeBody.getNodeType(), newNode.getNodeType());
|
||||||
|
Assertions.assertTrue(newNode.getName().startsWith("test-name1"));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user