Compare commits
19 Commits
develop
...
stable-jer
Author | SHA1 | Date | |
---|---|---|---|
d2d2c0ab14 | |||
5db57ce4e6 | |||
ce95e77177 | |||
faa7f5fa39 | |||
4329034256 | |||
e0ba345686 | |||
5ba9c67406 | |||
9a6201ffce | |||
831dc43d9b | |||
9b8d4d2d33 | |||
3633da39e8 | |||
420bf47c2b | |||
c0ce11dd63 | |||
3d39f0db74 | |||
fc4a6a7355 | |||
a64b70acd9 | |||
18426e562d | |||
e87cc00722 | |||
77c101d64a |
55
pom.xml
55
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-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 REST API clients that support either the CXF and Jersey frameworks</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>
|
||||||
@ -48,13 +48,15 @@
|
|||||||
|
|
||||||
<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>
|
||||||
|
<jersey.version>3.1.8</jersey.version>
|
||||||
|
<jackson.version>2.17.2</jackson.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-jersey</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.inteligr8.alfresco</groupId>
|
<groupId>com.inteligr8.alfresco</groupId>
|
||||||
@ -86,10 +88,55 @@
|
|||||||
<version>2.20.0</version>
|
<version>2.20.0</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Jersey 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 library fallout -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.fasterxml.jackson.core</groupId>
|
||||||
|
<artifactId>jackson-annotations</artifactId>
|
||||||
|
<version>${jackson.version}</version>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<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/jersey</source>
|
||||||
|
</sources>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
<execution>
|
||||||
|
<id>add-test-src</id>
|
||||||
|
<goals><goal>add-test-source</goal></goals>
|
||||||
|
<configuration>
|
||||||
|
<sources>
|
||||||
|
<source>src/test/jersey</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.ClientJerseyConfiguration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class provides a POJO & Spring-based implementation of the
|
||||||
|
* ClientJerseyConfiguration 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 AcsClientJerseyConfiguration extends AcsClientConfiguration implements ClientJerseyConfiguration {
|
||||||
|
|
||||||
|
@Value("${content.service.jersey.putBodyRequired:true}")
|
||||||
|
private boolean putBodyRequired;
|
||||||
|
|
||||||
|
public boolean isPutBodyRequired() {
|
||||||
|
return this.putBodyRequired;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPutBodyRequired(boolean putBodyRequired) {
|
||||||
|
this.putBodyRequired = putBodyRequired;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -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.ClientJerseyImpl;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class provides a POJO & 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.
|
||||||
|
*
|
||||||
|
* @author brian@inteligr8.com
|
||||||
|
*/
|
||||||
|
@Component("acs.client.jersey")
|
||||||
|
@Lazy
|
||||||
|
public class AcsClientJerseyImpl extends ClientJerseyImpl {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This constructor is for Spring and POJO use
|
||||||
|
*/
|
||||||
|
@Autowired
|
||||||
|
public AcsClientJerseyImpl(AcsClientJerseyConfiguration 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 Jersey client to the JAX-RS API for the ACS Public
|
||||||
|
* ReST API.
|
||||||
|
*
|
||||||
|
* @author brian@inteligr8.com
|
||||||
|
*/
|
||||||
|
@Component("acs.api.jersey")
|
||||||
|
@Lazy
|
||||||
|
public class AcsPublicRestApiJerseyImpl extends AcsPublicRestApiImpl implements AcsPublicRestJerseyApi {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This constructor is for Spring or POJO use
|
||||||
|
*/
|
||||||
|
@Autowired
|
||||||
|
public AcsPublicRestApiJerseyImpl(AcsClientJerseyImpl client) {
|
||||||
|
super(client);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1 @@
|
|||||||
|
org.glassfish.jersey.client.JerseyClientBuilder
|
@ -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 = {AcsClientJerseyConfiguration.class, AcsPublicRestApiJerseyImpl.class, AcsClientJerseyImpl.class})
|
||||||
|
public class ConnectionJerseyClientIT extends ConnectionClientIT {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
@Qualifier("acs.api.jersey")
|
||||||
|
private AcsPublicRestApiImpl api;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AcsPublicRestApi getApi() {
|
||||||
|
return this.api;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ClientConfiguration getConfiguration() {
|
||||||
|
return this.api.getClient().getConfig();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,72 @@
|
|||||||
|
/*
|
||||||
|
* 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.text.ParseException;
|
||||||
|
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.NodeBodyCreateMultipartJersey;
|
||||||
|
import com.inteligr8.rs.ClientConfiguration;
|
||||||
|
|
||||||
|
@TestPropertySource(locations = {"/local.properties"})
|
||||||
|
@SpringJUnitConfig(classes = {AcsClientJerseyConfiguration.class, AcsPublicRestApiJerseyImpl.class, AcsClientJerseyImpl.class})
|
||||||
|
public class JerseyUploadIT extends UploadIT {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
@Qualifier("acs.api.jersey")
|
||||||
|
private AcsPublicRestApiJerseyImpl 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, ParseException {
|
||||||
|
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());
|
||||||
|
NodeBodyCreateMultipartJersey body = NodeBodyCreateMultipartJersey.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