Merge branch 'develop' into stable
This commit is contained in:
commit
4fe407de0f
30
pom.xml
30
pom.xml
@ -18,8 +18,8 @@
|
||||
|
||||
<junit.version>5.7.2</junit.version>
|
||||
<spring.version>5.2.14.RELEASE</spring.version>
|
||||
<spring-boot.version>2.3.10.RELEASE</spring-boot.version>
|
||||
<jersey.version>2.34</jersey.version>
|
||||
<cxf.version>3.3.2</cxf.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
@ -33,11 +33,33 @@
|
||||
<artifactId>jackson-databind</artifactId>
|
||||
<version>2.12.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.jaxrs</groupId>
|
||||
<artifactId>jackson-jaxrs-json-provider</artifactId>
|
||||
<version>2.12.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
<version>1.7.29</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>jakarta.ws.rs</groupId>
|
||||
<artifactId>jakarta.ws.rs-api</artifactId>
|
||||
<version>2.1.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.glassfish.jersey.ext</groupId>
|
||||
<artifactId>jersey-proxy-client</artifactId>
|
||||
<version>${jersey.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.cxf</groupId>
|
||||
<artifactId>cxf-rt-rs-client</artifactId>
|
||||
<version>${cxf.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.glassfish.jersey.core</groupId>
|
||||
<artifactId>jersey-client</artifactId>
|
||||
@ -68,6 +90,12 @@
|
||||
<version>${spring.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.httpcomponents</groupId>
|
||||
<artifactId>httpclient</artifactId>
|
||||
<version>4.5.9</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
@ -1,35 +1,71 @@
|
||||
package com.inteligr8.alfresco.activiti;
|
||||
|
||||
import javax.ws.rs.client.Client;
|
||||
import javax.ws.rs.client.ClientBuilder;
|
||||
import javax.ws.rs.client.ClientRequestFilter;
|
||||
import javax.ws.rs.client.WebTarget;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.inteligr8.alfresco.activiti.api.EnterpriseAPI;
|
||||
import com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider;
|
||||
import com.inteligr8.alfresco.activiti.api.AdminApi;
|
||||
import com.inteligr8.alfresco.activiti.api.AppVersionApi;
|
||||
import com.inteligr8.alfresco.activiti.api.ProcessInstancesApi;
|
||||
import com.inteligr8.alfresco.activiti.api.ProfileApi;
|
||||
import com.inteligr8.alfresco.activiti.api.TasksApi;
|
||||
|
||||
/**
|
||||
* Afresco Process Services Spring Client
|
||||
* Alfresco Process Services Spring Client
|
||||
*/
|
||||
@Component
|
||||
@Component("apsClient")
|
||||
public class ApsClient {
|
||||
|
||||
private static final ApsClient INSTANCE = new ApsClient();
|
||||
|
||||
public static ApsClient getInstance() {
|
||||
return ApsClient.INSTANCE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Autowired
|
||||
private ApsClientConfiguration config;
|
||||
|
||||
public EnterpriseAPI getEnterpriseAPI() {
|
||||
javax.ws.rs.client.Client client = ClientBuilder
|
||||
.newClient();
|
||||
protected ApsClientConfiguration getConfig() {
|
||||
return this.config;
|
||||
}
|
||||
|
||||
this.config.authorize(client);
|
||||
return new EnterpriseAPI(this.config.getBaseUrl() + "/api", client);
|
||||
public Client getClient() {
|
||||
ClientRequestFilter authFilter = this.config.getAuthorizationFilter();
|
||||
|
||||
ClientBuilder clientBuilder = ClientBuilder.newBuilder()
|
||||
.register(new JacksonJaxbJsonProvider());
|
||||
if (authFilter != null)
|
||||
clientBuilder.register(authFilter);
|
||||
|
||||
return clientBuilder.build();
|
||||
}
|
||||
|
||||
public WebTarget getTarget() {
|
||||
return this.getClient()
|
||||
.target(this.config.getBaseUrl());
|
||||
}
|
||||
|
||||
protected <T> T getApi(Class<T> apiClass) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public AdminApi getAdminApi() {
|
||||
return this.getApi(AdminApi.class);
|
||||
}
|
||||
|
||||
public AppVersionApi getAppVersionApi() {
|
||||
return this.getApi(AppVersionApi.class);
|
||||
}
|
||||
|
||||
public ProcessInstancesApi getProcessInstancesApi() {
|
||||
return this.getApi(ProcessInstancesApi.class);
|
||||
}
|
||||
|
||||
public ProfileApi getProfileApi() {
|
||||
return this.getApi(ProfileApi.class);
|
||||
}
|
||||
|
||||
public TasksApi getTasksApi() {
|
||||
return this.getApi(TasksApi.class);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
package com.inteligr8.alfresco.activiti;
|
||||
|
||||
import javax.ws.rs.client.Client;
|
||||
import javax.ws.rs.client.ClientRequestFilter;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
@ -10,27 +10,29 @@ import org.springframework.context.annotation.Configuration;
|
||||
@ComponentScan
|
||||
public class ApsClientConfiguration {
|
||||
|
||||
@Value("${process.service.baseUrl}")
|
||||
@Value("${process.service.baseUrl:http://localhost:8080/activiti-app}")
|
||||
private String baseUrl;
|
||||
|
||||
@Value("${process.service.security.basicAuth.username}")
|
||||
@Value("${process.service.security.basicAuth.username:admin@app.activiti.com}")
|
||||
private String basicAuthUsername;
|
||||
|
||||
@Value("${process.service.security.basicAuth.password}")
|
||||
@Value("${process.service.security.basicAuth.password:admin}")
|
||||
private String basicAuthPassword;
|
||||
|
||||
@Value("${process.service.security.accessToken}")
|
||||
@Value("${process.service.security.accessToken:#{null}}")
|
||||
private String accessToken;
|
||||
|
||||
public String getBaseUrl() {
|
||||
return this.baseUrl;
|
||||
}
|
||||
|
||||
public void authorize(Client client) {
|
||||
if (this.basicAuthUsername != null) {
|
||||
client.register(new BasicAuthRequestFilter(this.basicAuthUsername, this.basicAuthPassword));
|
||||
} else if (this.accessToken != null) {
|
||||
client.register(new AccessTokenRequestFilter(this.accessToken));
|
||||
public ClientRequestFilter getAuthorizationFilter() {
|
||||
if (this.accessToken != null) {
|
||||
return new AccessTokenRequestFilter(this.accessToken);
|
||||
} else if (this.basicAuthUsername != null) {
|
||||
return new BasicAuthRequestFilter(this.basicAuthUsername, this.basicAuthPassword);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,58 @@
|
||||
package com.inteligr8.alfresco.activiti;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.ws.rs.client.ClientRequestFilter;
|
||||
import javax.ws.rs.ext.RuntimeDelegate;
|
||||
|
||||
import org.apache.cxf.jaxrs.client.JAXRSClientFactory;
|
||||
import org.apache.cxf.jaxrs.client.WebClient;
|
||||
import org.apache.cxf.jaxrs.impl.RuntimeDelegateImpl;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider;
|
||||
|
||||
/**
|
||||
* Alfresco Process Services Spring Client for CXF
|
||||
*/
|
||||
@Component("apsClient.cxf")
|
||||
@Lazy
|
||||
public class ApsClientCxfImpl extends ApsClient implements InitializingBean {
|
||||
|
||||
private final Logger logger = LoggerFactory.getLogger(ApsClientCxfImpl.class);
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() {
|
||||
if (RuntimeDelegate.getInstance() == null) {
|
||||
this.logger.info("Setting JAX-RS runtime delegate to the CXF library");
|
||||
RuntimeDelegate.setInstance(new RuntimeDelegateImpl());
|
||||
} else if (RuntimeDelegate.getInstance() instanceof RuntimeDelegateImpl) {
|
||||
this.logger.info("JAX-RS runtime delegate already the CXF library");
|
||||
} else {
|
||||
this.logger.warn("Setting JAX-RS runtime delegate to the CXF library; was: " + RuntimeDelegate.getInstance().getClass().getName());
|
||||
RuntimeDelegate.setInstance(new RuntimeDelegateImpl());
|
||||
}
|
||||
}
|
||||
|
||||
public WebClient getCxfClient() {
|
||||
List<Object> providersAndFilters = new LinkedList<Object>();
|
||||
providersAndFilters.add(new JacksonJaxbJsonProvider());
|
||||
|
||||
ClientRequestFilter authFilter = this.getConfig().getAuthorizationFilter();
|
||||
if (authFilter != null)
|
||||
providersAndFilters.add(authFilter);
|
||||
|
||||
return WebClient.create(this.getConfig().getBaseUrl(), providersAndFilters);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected <T> T getApi(Class<T> apiClass) {
|
||||
return JAXRSClientFactory.fromClient(this.getCxfClient(), apiClass);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
package com.inteligr8.alfresco.activiti;
|
||||
|
||||
import javax.ws.rs.ext.RuntimeDelegate;
|
||||
|
||||
import org.glassfish.jersey.client.proxy.WebResourceFactory;
|
||||
import org.glassfish.jersey.internal.RuntimeDelegateImpl;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* Alfresco Process Services Spring Client for Jersey
|
||||
*/
|
||||
@Component("apsClient.jersey")
|
||||
@Lazy
|
||||
public class ApsClientJerseyImpl extends ApsClient implements InitializingBean {
|
||||
|
||||
private final Logger logger = LoggerFactory.getLogger(ApsClientJerseyImpl.class);
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() {
|
||||
if (RuntimeDelegate.getInstance() == null) {
|
||||
this.logger.info("Setting JAX-RS runtime delegate to the Jersey library");
|
||||
RuntimeDelegate.setInstance(new RuntimeDelegateImpl());
|
||||
} else if (RuntimeDelegate.getInstance() instanceof RuntimeDelegateImpl) {
|
||||
this.logger.info("JAX-RS runtime delegate already the Jersey library");
|
||||
} else {
|
||||
this.logger.warn("Setting JAX-RS runtime delegate to the Jersey library; was: " + RuntimeDelegate.getInstance().getClass().getName());
|
||||
RuntimeDelegate.setInstance(new RuntimeDelegateImpl());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected <T> T getApi(Class<T> apiClass) {
|
||||
return WebResourceFactory.newResource(apiClass, this.getTarget());
|
||||
}
|
||||
|
||||
}
|
@ -1,32 +0,0 @@
|
||||
package com.inteligr8.alfresco.activiti;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import javax.ws.rs.WebApplicationException;
|
||||
import javax.ws.rs.core.Response;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.node.ArrayNode;
|
||||
|
||||
public class ExtendedResponse {
|
||||
|
||||
private final Response response;
|
||||
|
||||
public ExtendedResponse(Response response) {
|
||||
this.response = response;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public <T> List<T> readArrayEntity(Class<T> genericType) {
|
||||
ArrayNode nodes = this.response.readEntity(ArrayNode.class);
|
||||
|
||||
ObjectMapper om = new ObjectMapper();
|
||||
try {
|
||||
return (List<T>)om.readerForListOf(genericType).readValue(nodes);
|
||||
} catch (IOException ie) {
|
||||
throw new WebApplicationException(ie);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -1,32 +0,0 @@
|
||||
|
||||
package com.inteligr8.alfresco.activiti.api;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.ws.rs.WebApplicationException;
|
||||
import javax.ws.rs.client.Client;
|
||||
import javax.ws.rs.core.Response;
|
||||
import javax.ws.rs.core.Response.Status.Family;
|
||||
|
||||
import com.inteligr8.alfresco.activiti.ExtendedResponse;
|
||||
import com.inteligr8.alfresco.activiti.model.Tenant;
|
||||
|
||||
public class AdminAPI extends PathElement {
|
||||
|
||||
private final Client client;
|
||||
|
||||
public AdminAPI(EnterpriseAPI api) {
|
||||
super(api, "admin");
|
||||
this.client = api.getClient();
|
||||
}
|
||||
|
||||
public List<Tenant> getTenants() {
|
||||
Response response = this.client.target(this.getBaseUrl() + "/tenants")
|
||||
.request()
|
||||
.get();
|
||||
if (!Family.SUCCESSFUL.equals(response.getStatusInfo().getFamily()))
|
||||
throw new WebApplicationException(response);
|
||||
return new ExtendedResponse(response).readArrayEntity(Tenant.class);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
|
||||
package com.inteligr8.alfresco.activiti.api;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.ws.rs.Consumes;
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.Produces;
|
||||
|
||||
import com.inteligr8.alfresco.activiti.model.Tenant;
|
||||
|
||||
@Path("/api/enterprise/admin")
|
||||
public interface AdminApi {
|
||||
|
||||
@GET
|
||||
@Path("/tenants")
|
||||
@Consumes({ "application/json" })
|
||||
@Produces({ "application/json" })
|
||||
public List<Tenant> getTenants();
|
||||
|
||||
}
|
@ -1,29 +0,0 @@
|
||||
|
||||
package com.inteligr8.alfresco.activiti.api;
|
||||
|
||||
import javax.ws.rs.WebApplicationException;
|
||||
import javax.ws.rs.client.Client;
|
||||
import javax.ws.rs.core.Response;
|
||||
import javax.ws.rs.core.Response.Status.Family;
|
||||
|
||||
import com.inteligr8.alfresco.activiti.model.AppVersion;
|
||||
|
||||
public class AppVersionAPI extends PathElement {
|
||||
|
||||
private final Client client;
|
||||
|
||||
public AppVersionAPI(EnterpriseAPI api) {
|
||||
super(api, "app-version");
|
||||
this.client = api.getClient();
|
||||
}
|
||||
|
||||
public AppVersion get() {
|
||||
Response response = this.client.target(this.getBaseUrl())
|
||||
.request()
|
||||
.get();
|
||||
if (!Family.SUCCESSFUL.equals(response.getStatusInfo().getFamily()))
|
||||
throw new WebApplicationException(response);
|
||||
return response.readEntity(AppVersion.class);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
|
||||
package com.inteligr8.alfresco.activiti.api;
|
||||
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.Produces;
|
||||
|
||||
import com.inteligr8.alfresco.activiti.model.AppVersion;
|
||||
|
||||
@Path("/api/enterprise/app-version")
|
||||
public interface AppVersionApi {
|
||||
|
||||
@GET
|
||||
@Produces({ "application/json" })
|
||||
public AppVersion get();
|
||||
|
||||
}
|
@ -1,44 +0,0 @@
|
||||
|
||||
package com.inteligr8.alfresco.activiti.api;
|
||||
|
||||
import javax.ws.rs.client.Client;
|
||||
|
||||
public class EnterpriseAPI extends PathElement {
|
||||
|
||||
private final Client client;
|
||||
|
||||
public EnterpriseAPI(String baseUrl, Client client) {
|
||||
super(baseUrl, "enterprise");
|
||||
this.client = client;
|
||||
}
|
||||
|
||||
public EnterpriseAPI(PathElement parent, Client client) {
|
||||
super(parent, "enterprise");
|
||||
this.client = client;
|
||||
}
|
||||
|
||||
protected Client getClient() {
|
||||
return this.client;
|
||||
}
|
||||
|
||||
public AdminAPI getAdminAPI() {
|
||||
return new AdminAPI(this);
|
||||
}
|
||||
|
||||
public AppVersionAPI getAppVersionAPI() {
|
||||
return new AppVersionAPI(this);
|
||||
}
|
||||
|
||||
public ProcessInstancesAPI getProcessInstanceAPI() {
|
||||
return new ProcessInstancesAPI(this);
|
||||
}
|
||||
|
||||
public ProfileAPI getProfileAPI() {
|
||||
return new ProfileAPI(this);
|
||||
}
|
||||
|
||||
public TasksAPI getTasksAPI() {
|
||||
return new TasksAPI(this);
|
||||
}
|
||||
|
||||
}
|
@ -1,25 +0,0 @@
|
||||
package com.inteligr8.alfresco.activiti.api;
|
||||
|
||||
public abstract class PathElement {
|
||||
|
||||
private final String baseUrl;
|
||||
private final String name;
|
||||
|
||||
public PathElement(String baseUrl, String name) {
|
||||
this.baseUrl = baseUrl + "/" + name;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public PathElement(PathElement pelement, String name) {
|
||||
this(pelement.getBaseUrl(), name);
|
||||
}
|
||||
|
||||
protected String getBaseUrl() {
|
||||
return this.baseUrl;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
}
|
@ -1,110 +0,0 @@
|
||||
|
||||
package com.inteligr8.alfresco.activiti.api;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.List;
|
||||
|
||||
import javax.ws.rs.WebApplicationException;
|
||||
import javax.ws.rs.client.Client;
|
||||
import javax.ws.rs.client.Entity;
|
||||
import javax.ws.rs.core.Response;
|
||||
import javax.ws.rs.core.Response.Status.Family;
|
||||
|
||||
import com.inteligr8.alfresco.activiti.ExtendedResponse;
|
||||
import com.inteligr8.alfresco.activiti.model.ProcessInstance;
|
||||
import com.inteligr8.alfresco.activiti.model.Variable;
|
||||
|
||||
public class ProcessInstanceAPI extends PathElement {
|
||||
|
||||
private final Client client;
|
||||
|
||||
public ProcessInstanceAPI(ProcessInstancesAPI api, String processInstanceId) throws UnsupportedEncodingException {
|
||||
super(api, URLEncoder.encode(processInstanceId, "utf-8"));
|
||||
this.client = api.getClient();
|
||||
}
|
||||
|
||||
protected Client getClient() {
|
||||
return this.client;
|
||||
}
|
||||
|
||||
public ProcessInstance get() {
|
||||
Response response = this.client.target(this.getBaseUrl())
|
||||
.request()
|
||||
.get();
|
||||
if (!Family.SUCCESSFUL.equals(response.getStatusInfo().getFamily()))
|
||||
throw new WebApplicationException(response);
|
||||
return response.readEntity(ProcessInstance.class);
|
||||
}
|
||||
|
||||
public void delete() {
|
||||
Response response = this.client.target(this.getBaseUrl())
|
||||
.request()
|
||||
.delete();
|
||||
if (!Family.SUCCESSFUL.equals(response.getStatusInfo().getFamily()))
|
||||
throw new WebApplicationException(response);
|
||||
}
|
||||
|
||||
public ProcessInstance activate() {
|
||||
Response response = this.client.target(this.getBaseUrl() + "/activate")
|
||||
.request()
|
||||
.put(null);
|
||||
if (!Family.SUCCESSFUL.equals(response.getStatusInfo().getFamily()))
|
||||
throw new WebApplicationException(response);
|
||||
return response.readEntity(ProcessInstance.class);
|
||||
}
|
||||
|
||||
public ProcessInstance suspend() {
|
||||
Response response = this.client.target(this.getBaseUrl() + "/suspend")
|
||||
.request()
|
||||
.put(null);
|
||||
if (!Family.SUCCESSFUL.equals(response.getStatusInfo().getFamily()))
|
||||
throw new WebApplicationException(response);
|
||||
return response.readEntity(ProcessInstance.class);
|
||||
}
|
||||
|
||||
public List<Variable> getVariables() {
|
||||
Response response = this.client.target(this.getBaseUrl() + "/variables")
|
||||
.request()
|
||||
.get();
|
||||
if (!Family.SUCCESSFUL.equals(response.getStatusInfo().getFamily()))
|
||||
throw new WebApplicationException(response);
|
||||
return new ExtendedResponse(response).readArrayEntity(Variable.class);
|
||||
}
|
||||
|
||||
public List<Variable> setVariables(List<Variable> variables) {
|
||||
Response response = this.client.target(this.getBaseUrl() + "/variables")
|
||||
.request()
|
||||
.put(Entity.json(variables));
|
||||
if (!Family.SUCCESSFUL.equals(response.getStatusInfo().getFamily()))
|
||||
throw new WebApplicationException(response);
|
||||
return new ExtendedResponse(response).readArrayEntity(Variable.class);
|
||||
}
|
||||
|
||||
public Variable getVariable(String variableName) throws UnsupportedEncodingException {
|
||||
Response response = this.client.target(this.getBaseUrl() + "/variables/" + URLEncoder.encode(variableName, "utf-8"))
|
||||
.request()
|
||||
.get();
|
||||
if (!Family.SUCCESSFUL.equals(response.getStatusInfo().getFamily()))
|
||||
throw new WebApplicationException(response);
|
||||
return response.readEntity(Variable.class);
|
||||
}
|
||||
|
||||
public Variable setVariable(String variableName, Variable variable) throws UnsupportedEncodingException {
|
||||
Response response = this.client.target(this.getBaseUrl() + "/variables/" + URLEncoder.encode(variableName, "utf-8"))
|
||||
.request()
|
||||
.put(Entity.json(variable));
|
||||
if (!Family.SUCCESSFUL.equals(response.getStatusInfo().getFamily()))
|
||||
throw new WebApplicationException(response);
|
||||
return response.readEntity(Variable.class);
|
||||
}
|
||||
|
||||
public void deleteVariable(String variableName) throws UnsupportedEncodingException {
|
||||
Response response = this.client.target(this.getBaseUrl() + "/variables/" + URLEncoder.encode(variableName, "utf-8"))
|
||||
.request()
|
||||
.delete();
|
||||
if (!Family.SUCCESSFUL.equals(response.getStatusInfo().getFamily()))
|
||||
throw new WebApplicationException(response);
|
||||
}
|
||||
|
||||
}
|
@ -1,35 +0,0 @@
|
||||
|
||||
package com.inteligr8.alfresco.activiti.api;
|
||||
|
||||
import javax.ws.rs.WebApplicationException;
|
||||
import javax.ws.rs.client.Client;
|
||||
import javax.ws.rs.client.Entity;
|
||||
import javax.ws.rs.core.Response;
|
||||
import javax.ws.rs.core.Response.Status.Family;
|
||||
|
||||
import com.inteligr8.alfresco.activiti.model.CreateProcessInstance;
|
||||
import com.inteligr8.alfresco.activiti.model.ProcessInstance;
|
||||
|
||||
public class ProcessInstancesAPI extends PathElement {
|
||||
|
||||
private final Client client;
|
||||
|
||||
public ProcessInstancesAPI(EnterpriseAPI api) {
|
||||
super(api, "process-instances");
|
||||
this.client = api.getClient();
|
||||
}
|
||||
|
||||
protected Client getClient() {
|
||||
return this.client;
|
||||
}
|
||||
|
||||
public ProcessInstance create(CreateProcessInstance processInstance) {
|
||||
Response response = this.client.target(this.getBaseUrl())
|
||||
.request()
|
||||
.post(Entity.json(processInstance));
|
||||
if (!Family.SUCCESSFUL.equals(response.getStatusInfo().getFamily()))
|
||||
throw new WebApplicationException(response);
|
||||
return response.readEntity(ProcessInstance.class);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,72 @@
|
||||
|
||||
package com.inteligr8.alfresco.activiti.api;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.ws.rs.Consumes;
|
||||
import javax.ws.rs.DELETE;
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.POST;
|
||||
import javax.ws.rs.PUT;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.PathParam;
|
||||
import javax.ws.rs.Produces;
|
||||
|
||||
import com.inteligr8.alfresco.activiti.model.CreateProcessInstance;
|
||||
import com.inteligr8.alfresco.activiti.model.ProcessInstance;
|
||||
import com.inteligr8.alfresco.activiti.model.Variable;
|
||||
|
||||
@Path("/api/enterprise/process-instances")
|
||||
public interface ProcessInstancesApi {
|
||||
|
||||
@POST
|
||||
@Consumes({ "application/json" })
|
||||
@Produces({ "application/json" })
|
||||
ProcessInstance create(CreateProcessInstance processInstance);
|
||||
|
||||
@GET
|
||||
@Path("{processInstanceId}")
|
||||
@Produces({ "application/json" })
|
||||
ProcessInstance get(@PathParam("processInstanceId") String processInstanceId);
|
||||
|
||||
@DELETE
|
||||
@Path("{processInstanceId}")
|
||||
void delete(@PathParam("processInstanceId") String processInstanceId);
|
||||
|
||||
@PUT
|
||||
@Path("{processInstanceId}/activate")
|
||||
@Produces({ "application/json" })
|
||||
ProcessInstance activate(@PathParam("processInstanceId") String processInstanceId);
|
||||
|
||||
@PUT
|
||||
@Path("{processInstanceId}/suspend")
|
||||
@Produces({ "application/json" })
|
||||
ProcessInstance suspend(@PathParam("processInstanceId") String processInstanceId);
|
||||
|
||||
@GET
|
||||
@Path("{processInstanceId}/variables")
|
||||
@Produces({ "application/json" })
|
||||
List<Variable> getVariables(@PathParam("processInstanceId") String processInstanceId);
|
||||
|
||||
@PUT
|
||||
@Path("{processInstanceId}/variables")
|
||||
@Consumes({ "application/json" })
|
||||
@Produces({ "application/json" })
|
||||
List<Variable> setVariables(@PathParam("processInstanceId") String processInstanceId, List<Variable> variables);
|
||||
|
||||
@GET
|
||||
@Path("{processInstanceId}/variables/{variableName}")
|
||||
@Produces({ "application/json" })
|
||||
Variable getVariable(@PathParam("processInstanceId") String processInstanceId, @PathParam("variableName") String variableName);
|
||||
|
||||
@PUT
|
||||
@Path("{processInstanceId}/variables/{variableName}")
|
||||
@Consumes({ "application/json" })
|
||||
@Produces({ "application/json" })
|
||||
Variable setVariable(@PathParam("processInstanceId") String processInstanceId, @PathParam("variableName") String variableName, Variable variable);
|
||||
|
||||
@DELETE
|
||||
@Path("{processInstanceId}/variables/{variableName}")
|
||||
void deleteVariable(@PathParam("processInstanceId") String processInstanceId, @PathParam("variableName") String variableName);
|
||||
|
||||
}
|
@ -1,29 +0,0 @@
|
||||
|
||||
package com.inteligr8.alfresco.activiti.api;
|
||||
|
||||
import javax.ws.rs.WebApplicationException;
|
||||
import javax.ws.rs.client.Client;
|
||||
import javax.ws.rs.core.Response;
|
||||
import javax.ws.rs.core.Response.Status.Family;
|
||||
|
||||
import com.inteligr8.alfresco.activiti.model.User;
|
||||
|
||||
public class ProfileAPI extends PathElement {
|
||||
|
||||
private final Client client;
|
||||
|
||||
public ProfileAPI(EnterpriseAPI api) {
|
||||
super(api, "profile");
|
||||
this.client = api.getClient();
|
||||
}
|
||||
|
||||
public User get() {
|
||||
Response response = this.client.target(this.getBaseUrl())
|
||||
.request()
|
||||
.get();
|
||||
if (!Family.SUCCESSFUL.equals(response.getStatusInfo().getFamily()))
|
||||
throw new WebApplicationException(response);
|
||||
return response.readEntity(User.class);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
|
||||
package com.inteligr8.alfresco.activiti.api;
|
||||
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.Produces;
|
||||
|
||||
import com.inteligr8.alfresco.activiti.model.User;
|
||||
|
||||
@Path("/api/enterprise/profile")
|
||||
public interface ProfileApi {
|
||||
|
||||
@GET
|
||||
@Produces({ "application/json" })
|
||||
User get();
|
||||
|
||||
}
|
@ -1,120 +0,0 @@
|
||||
|
||||
package com.inteligr8.alfresco.activiti.api;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.List;
|
||||
|
||||
import javax.ws.rs.WebApplicationException;
|
||||
import javax.ws.rs.client.Client;
|
||||
import javax.ws.rs.client.Entity;
|
||||
import javax.ws.rs.core.Response;
|
||||
import javax.ws.rs.core.Response.Status.Family;
|
||||
|
||||
import com.inteligr8.alfresco.activiti.ExtendedResponse;
|
||||
import com.inteligr8.alfresco.activiti.model.Task;
|
||||
import com.inteligr8.alfresco.activiti.model.TaskUpdate;
|
||||
import com.inteligr8.alfresco.activiti.model.Variable;
|
||||
|
||||
public class TaskAPI extends PathElement {
|
||||
|
||||
private final Client client;
|
||||
|
||||
public TaskAPI(TasksAPI api, String taskId) throws UnsupportedEncodingException {
|
||||
super(api, URLEncoder.encode(taskId, "utf-8"));
|
||||
this.client = api.getClient();
|
||||
}
|
||||
|
||||
protected Client getClient() {
|
||||
return this.client;
|
||||
}
|
||||
|
||||
public Task update(TaskUpdate taskUpdate) {
|
||||
Response response = this.client.target(this.getBaseUrl())
|
||||
.request()
|
||||
.put(Entity.json(taskUpdate));
|
||||
if (!Family.SUCCESSFUL.equals(response.getStatusInfo().getFamily()))
|
||||
throw new WebApplicationException(response);
|
||||
return response.readEntity(Task.class);
|
||||
}
|
||||
|
||||
public List<Variable> getVariables(String scope) {
|
||||
Response response = this.client.target(this.getBaseUrl() + "/variables")
|
||||
.queryParam("scope", scope)
|
||||
.request()
|
||||
.get();
|
||||
if (!Family.SUCCESSFUL.equals(response.getStatusInfo().getFamily()))
|
||||
throw new WebApplicationException(response);
|
||||
return new ExtendedResponse(response).readArrayEntity(Variable.class);
|
||||
}
|
||||
|
||||
public List<Variable> setVariables(List<Variable> variables) {
|
||||
Response response = this.client.target(this.getBaseUrl() + "/variables")
|
||||
.request()
|
||||
.post(Entity.json(variables));
|
||||
if (!Family.SUCCESSFUL.equals(response.getStatusInfo().getFamily()))
|
||||
throw new WebApplicationException(response);
|
||||
return new ExtendedResponse(response).readArrayEntity(Variable.class);
|
||||
}
|
||||
|
||||
public void deleteVariable(String variableName, String scope) throws UnsupportedEncodingException {
|
||||
Response response = this.client.target(this.getBaseUrl() + "/variables/" + URLEncoder.encode(variableName, "utf-8"))
|
||||
.queryParam("scope", scope)
|
||||
.request()
|
||||
.delete();
|
||||
if (!Family.SUCCESSFUL.equals(response.getStatusInfo().getFamily()))
|
||||
throw new WebApplicationException(response);
|
||||
}
|
||||
|
||||
public Variable getVariable(String variableName, String scope) throws UnsupportedEncodingException {
|
||||
Response response = this.client.target(this.getBaseUrl() + "/variables/" + URLEncoder.encode(variableName, "utf-8"))
|
||||
.queryParam("scope", scope)
|
||||
.request()
|
||||
.get();
|
||||
if (!Family.SUCCESSFUL.equals(response.getStatusInfo().getFamily()))
|
||||
throw new WebApplicationException(response);
|
||||
return response.readEntity(Variable.class);
|
||||
}
|
||||
|
||||
public Variable setVariable(String variableName, Variable variable) throws UnsupportedEncodingException {
|
||||
Response response = this.client.target(this.getBaseUrl() + "/variables/" + URLEncoder.encode(variableName, "utf-8"))
|
||||
.request()
|
||||
.put(Entity.json(variable));
|
||||
if (!Family.SUCCESSFUL.equals(response.getStatusInfo().getFamily()))
|
||||
throw new WebApplicationException(response);
|
||||
return response.readEntity(Variable.class);
|
||||
}
|
||||
|
||||
public void claim() {
|
||||
Response response = this.client.target(this.getBaseUrl() + "/action/claim")
|
||||
.request()
|
||||
.put(null);
|
||||
if (!Family.SUCCESSFUL.equals(response.getStatusInfo().getFamily()))
|
||||
throw new WebApplicationException(response);
|
||||
}
|
||||
|
||||
public void unclaim() {
|
||||
Response response = this.client.target(this.getBaseUrl() + "/action/unclaim")
|
||||
.request()
|
||||
.put(null);
|
||||
if (!Family.SUCCESSFUL.equals(response.getStatusInfo().getFamily()))
|
||||
throw new WebApplicationException(response);
|
||||
}
|
||||
|
||||
public void complete() {
|
||||
Response response = this.client.target(this.getBaseUrl() + "/action/complete")
|
||||
.request()
|
||||
.put(null);
|
||||
if (!Family.SUCCESSFUL.equals(response.getStatusInfo().getFamily()))
|
||||
throw new WebApplicationException(response);
|
||||
}
|
||||
|
||||
public void resolve() {
|
||||
Response response = this.client.target(this.getBaseUrl() + "/action/resolve")
|
||||
.request()
|
||||
.put(null);
|
||||
if (!Family.SUCCESSFUL.equals(response.getStatusInfo().getFamily()))
|
||||
throw new WebApplicationException(response);
|
||||
}
|
||||
|
||||
}
|
@ -1,19 +0,0 @@
|
||||
|
||||
package com.inteligr8.alfresco.activiti.api;
|
||||
|
||||
import javax.ws.rs.client.Client;
|
||||
|
||||
public class TasksAPI extends PathElement {
|
||||
|
||||
private final Client client;
|
||||
|
||||
public TasksAPI(EnterpriseAPI api) {
|
||||
super(api, "tasks");
|
||||
this.client = api.getClient();
|
||||
}
|
||||
|
||||
protected Client getClient() {
|
||||
return this.client;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,54 @@
|
||||
|
||||
package com.inteligr8.alfresco.activiti.api;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.ws.rs.Consumes;
|
||||
import javax.ws.rs.DELETE;
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.PUT;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.PathParam;
|
||||
import javax.ws.rs.Produces;
|
||||
import javax.ws.rs.QueryParam;
|
||||
|
||||
import com.inteligr8.alfresco.activiti.model.Task;
|
||||
import com.inteligr8.alfresco.activiti.model.TaskUpdate;
|
||||
import com.inteligr8.alfresco.activiti.model.Variable;
|
||||
|
||||
@Path("/api/enterprise/tasks")
|
||||
public interface TasksApi {
|
||||
|
||||
@PUT
|
||||
@Path("{taskId}")
|
||||
@Consumes({ "application/json" })
|
||||
@Produces({ "application/json" })
|
||||
public Task update(@PathParam("taskId") String taskId, TaskUpdate taskUpdate);
|
||||
|
||||
@GET
|
||||
@Path("{taskId}/variables")
|
||||
@Produces({ "application/json" })
|
||||
List<Variable> getVariables(@PathParam("taskId") String taskId, @QueryParam("scope") String scope);
|
||||
|
||||
@PUT
|
||||
@Path("{taskId}/variables")
|
||||
@Consumes({ "application/json" })
|
||||
@Produces({ "application/json" })
|
||||
List<Variable> setVariables(@PathParam("taskId") String taskId, List<Variable> variables);
|
||||
|
||||
@GET
|
||||
@Path("{taskId}/variables/{variableName}")
|
||||
@Produces({ "application/json" })
|
||||
Variable getVariable(@PathParam("taskId") String taskId, @PathParam("variableName") String variableName, @QueryParam("scope") String scope);
|
||||
|
||||
@PUT
|
||||
@Path("{taskId}/variables/{variableName}")
|
||||
@Consumes({ "application/json" })
|
||||
@Produces({ "application/json" })
|
||||
Variable setVariable(@PathParam("taskId") String taskId, @PathParam("variableName") String variableName, Variable variable);
|
||||
|
||||
@DELETE
|
||||
@Path("{taskId}/variables/{variableName}")
|
||||
void deleteVariable(@PathParam("taskId") String taskId, @PathParam("variableName") String variableName, @QueryParam("scope") String scope);
|
||||
|
||||
}
|
@ -1,60 +1,25 @@
|
||||
package com.inteligr8.alfresco.activiti;
|
||||
|
||||
import java.net.URI;
|
||||
import java.net.http.HttpClient;
|
||||
import java.net.http.HttpClient.Redirect;
|
||||
import java.net.http.HttpRequest;
|
||||
import java.net.http.HttpResponse;
|
||||
import java.net.http.HttpResponse.BodyHandlers;
|
||||
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.test.context.TestPropertySource;
|
||||
import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
|
||||
|
||||
import com.inteligr8.alfresco.activiti.model.Tenant;
|
||||
|
||||
@TestPropertySource(locations = {"/local.properties"})
|
||||
@SpringJUnitConfig(classes = {ApsClientConfiguration.class, ApsClient.class})
|
||||
public class ArrayResponseUnitTest {
|
||||
public class ArrayResponseUnitTest extends ConditionalIT {
|
||||
|
||||
@Autowired
|
||||
private ApsClient client;
|
||||
|
||||
@Autowired
|
||||
private ApsClientConfiguration config;
|
||||
|
||||
@Test
|
||||
@EnabledIf("hostExists")
|
||||
public void testTenants() {
|
||||
List<Tenant> objs = this.client
|
||||
.getEnterpriseAPI()
|
||||
.getAdminAPI()
|
||||
.getTenants();
|
||||
List<Tenant> objs = this.client.getAdminApi().getTenants();
|
||||
|
||||
Assertions.assertNotNull(objs);
|
||||
}
|
||||
|
||||
public boolean hostExists() {
|
||||
String baseUrl = this.config.getBaseUrl();
|
||||
|
||||
HttpRequest request = HttpRequest.newBuilder(URI.create(baseUrl))
|
||||
.GET()
|
||||
.build();
|
||||
|
||||
HttpClient client = HttpClient.newBuilder()
|
||||
.followRedirects(Redirect.ALWAYS)
|
||||
.build();
|
||||
|
||||
try {
|
||||
HttpResponse<?> response = client.send(request, BodyHandlers.discarding());
|
||||
return response.statusCode() < 300;
|
||||
} catch (Exception e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,39 @@
|
||||
package com.inteligr8.alfresco.activiti;
|
||||
|
||||
import org.apache.http.HttpResponse;
|
||||
import org.apache.http.client.HttpClient;
|
||||
import org.apache.http.client.methods.HttpUriRequest;
|
||||
import org.apache.http.client.methods.RequestBuilder;
|
||||
import org.apache.http.impl.client.DefaultRedirectStrategy;
|
||||
import org.apache.http.impl.client.HttpClientBuilder;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.TestPropertySource;
|
||||
|
||||
@TestPropertySource(locations = {"/local.properties"})
|
||||
@ContextConfiguration(classes = {ApsClientConfiguration.class, ApsClient.class})
|
||||
public class ConditionalIT {
|
||||
|
||||
@Autowired
|
||||
private ApsClient client;
|
||||
|
||||
public boolean hostExists() {
|
||||
String uri = this.client.getConfig().getBaseUrl();
|
||||
|
||||
HttpUriRequest request = RequestBuilder.get()
|
||||
.setUri(uri)
|
||||
.build();
|
||||
|
||||
HttpClient client = HttpClientBuilder.create()
|
||||
.setRedirectStrategy(DefaultRedirectStrategy.INSTANCE)
|
||||
.build();
|
||||
|
||||
try {
|
||||
HttpResponse response = client.execute(request);
|
||||
return response.getStatusLine().getStatusCode() < 300;
|
||||
} catch (Exception e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -1,74 +0,0 @@
|
||||
package com.inteligr8.alfresco.activiti;
|
||||
|
||||
import java.net.URI;
|
||||
import java.net.http.HttpClient;
|
||||
import java.net.http.HttpClient.Redirect;
|
||||
import java.net.http.HttpRequest;
|
||||
import java.net.http.HttpResponse;
|
||||
import java.net.http.HttpResponse.BodyHandlers;
|
||||
|
||||
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.test.context.TestPropertySource;
|
||||
import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
|
||||
|
||||
import com.inteligr8.alfresco.activiti.model.AppVersion;
|
||||
import com.inteligr8.alfresco.activiti.model.User;
|
||||
|
||||
@TestPropertySource(locations = {"/local.properties"})
|
||||
@SpringJUnitConfig(classes = {ApsClientConfiguration.class, ApsClient.class})
|
||||
public class ConnectionClientUnitTest {
|
||||
|
||||
@Autowired
|
||||
private ApsClient client;
|
||||
|
||||
@Autowired
|
||||
private ApsClientConfiguration config;
|
||||
|
||||
@Test
|
||||
@EnabledIf("hostExists")
|
||||
public void testAppVersion() {
|
||||
AppVersion obj = this.client
|
||||
.getEnterpriseAPI()
|
||||
.getAppVersionAPI()
|
||||
.get();
|
||||
|
||||
Assertions.assertNotNull(obj);
|
||||
Assertions.assertEquals("1", obj.getMajorVersion());
|
||||
Assertions.assertEquals("bpmSuite", obj.getType());
|
||||
}
|
||||
|
||||
@Test
|
||||
@EnabledIf("hostExists")
|
||||
public void testProfile() {
|
||||
User obj = this.client
|
||||
.getEnterpriseAPI()
|
||||
.getProfileAPI()
|
||||
.get();
|
||||
|
||||
Assertions.assertNotNull(obj);
|
||||
Assertions.assertEquals("admin@app.activiti.com", obj.getEmail());
|
||||
}
|
||||
|
||||
public boolean hostExists() {
|
||||
String baseUrl = this.config.getBaseUrl();
|
||||
|
||||
HttpRequest request = HttpRequest.newBuilder(URI.create(baseUrl))
|
||||
.GET()
|
||||
.build();
|
||||
|
||||
HttpClient client = HttpClient.newBuilder()
|
||||
.followRedirects(Redirect.ALWAYS)
|
||||
.build();
|
||||
|
||||
try {
|
||||
HttpResponse<?> response = client.send(request, BodyHandlers.discarding());
|
||||
return response.statusCode() < 300;
|
||||
} catch (Exception e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
package com.inteligr8.alfresco.activiti;
|
||||
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
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.AppVersion;
|
||||
import com.inteligr8.alfresco.activiti.model.User;
|
||||
|
||||
@TestPropertySource(locations = {"/local.properties"})
|
||||
@SpringJUnitConfig(classes = {ApsClientConfiguration.class, ApsClient.class, ApsClientCxfImpl.class})
|
||||
public class ConnectionCxfClientIT {
|
||||
|
||||
@Autowired
|
||||
@Qualifier("apsClient.cxf")
|
||||
private ApsClient client;
|
||||
|
||||
@Test
|
||||
//@EnabledIf("hostExists")
|
||||
public void testAppVersion() {
|
||||
AppVersion obj = this.client.getAppVersionApi().get();
|
||||
|
||||
Assertions.assertNotNull(obj);
|
||||
Assertions.assertEquals("1", obj.getMajorVersion());
|
||||
Assertions.assertEquals("bpmSuite", obj.getType());
|
||||
}
|
||||
|
||||
@Test
|
||||
//@EnabledIf("hostExists")
|
||||
public void testProfile() {
|
||||
User obj = this.client.getProfileApi().get();
|
||||
|
||||
Assertions.assertNotNull(obj);
|
||||
Assertions.assertEquals("admin@app.activiti.com", obj.getEmail());
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
package com.inteligr8.alfresco.activiti;
|
||||
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
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.AppVersion;
|
||||
import com.inteligr8.alfresco.activiti.model.User;
|
||||
|
||||
@TestPropertySource(locations = {"/local.properties"})
|
||||
@SpringJUnitConfig(classes = {ApsClientConfiguration.class, ApsClient.class, ApsClientJerseyImpl.class})
|
||||
public class ConnectionJerseyClientIT {
|
||||
|
||||
@Autowired
|
||||
@Qualifier("apsClient.jersey")
|
||||
private ApsClient client;
|
||||
|
||||
@Test
|
||||
//@EnabledIf("hostExists")
|
||||
public void testAppVersion() {
|
||||
AppVersion obj = this.client.getAppVersionApi().get();
|
||||
|
||||
Assertions.assertNotNull(obj);
|
||||
Assertions.assertEquals("1", obj.getMajorVersion());
|
||||
Assertions.assertEquals("bpmSuite", obj.getType());
|
||||
}
|
||||
|
||||
@Test
|
||||
//@EnabledIf("hostExists")
|
||||
public void testProfile() {
|
||||
User obj = this.client.getProfileApi().get();
|
||||
|
||||
Assertions.assertNotNull(obj);
|
||||
Assertions.assertEquals("admin@app.activiti.com", obj.getEmail());
|
||||
}
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user