diff --git a/.gitignore b/.gitignore
index 5ada6c6e1..d4f527872 100644
--- a/.gitignore
+++ b/.gitignore
@@ -17,3 +17,5 @@ pom-shade.xml
*.versionsBackup
*/bin/*
*.iml
+*.ipr
+*.iws
diff --git a/README.md b/README.md
index 96d0b248c..57e8d0d2e 100644
--- a/README.md
+++ b/README.md
@@ -38,7 +38,7 @@ OpenStack4j version 2.0.0+ is now modular. One of the benefits to this is the a
org.pacesys
openstack4j
- 3.0.4
+ 3.1.0
```
@@ -54,7 +54,7 @@ See notes above about connectors (same rules apply) to development branches.
org.pacesys
openstack4j
- 3.0.5-SNAPSHOT
+ 3.1.1-SNAPSHOT
```
diff --git a/connectors/http-connector/pom.xml b/connectors/http-connector/pom.xml
index 0ffda394d..9a470addb 100644
--- a/connectors/http-connector/pom.xml
+++ b/connectors/http-connector/pom.xml
@@ -4,7 +4,7 @@
org.pacesys.openstack4j.connectors
openstack4j-connectors
- 3.0.5-SNAPSHOT
+ 3.1.1-SNAPSHOT
OpenStack4j HttpURL Connector
openstack4j-http-connector
diff --git a/connectors/httpclient/pom.xml b/connectors/httpclient/pom.xml
index 86a445e73..1a57041e0 100644
--- a/connectors/httpclient/pom.xml
+++ b/connectors/httpclient/pom.xml
@@ -2,7 +2,7 @@
org.pacesys.openstack4j.connectors
openstack4j-connectors
- 3.0.5-SNAPSHOT
+ 3.1.1-SNAPSHOT
4.0.0
openstack4j-httpclient
diff --git a/connectors/jersey2/pom.xml b/connectors/jersey2/pom.xml
index e7fe0abf6..b68e08b27 100644
--- a/connectors/jersey2/pom.xml
+++ b/connectors/jersey2/pom.xml
@@ -2,7 +2,7 @@
org.pacesys.openstack4j.connectors
openstack4j-connectors
- 3.0.5-SNAPSHOT
+ 3.1.1-SNAPSHOT
4.0.0
openstack4j-jersey2
diff --git a/connectors/okhttp/pom.xml b/connectors/okhttp/pom.xml
index 2079b37b0..381fc6b62 100644
--- a/connectors/okhttp/pom.xml
+++ b/connectors/okhttp/pom.xml
@@ -2,7 +2,7 @@
org.pacesys.openstack4j.connectors
openstack4j-connectors
- 3.0.5-SNAPSHOT
+ 3.1.1-SNAPSHOT
4.0.0
openstack4j-okhttp
diff --git a/connectors/okhttp/src/main/java/org/openstack4j/connectors/okhttp/HttpExecutorServiceImpl.java b/connectors/okhttp/src/main/java/org/openstack4j/connectors/okhttp/HttpExecutorServiceImpl.java
index fdbe48fc9..d308c35c3 100644
--- a/connectors/okhttp/src/main/java/org/openstack4j/connectors/okhttp/HttpExecutorServiceImpl.java
+++ b/connectors/okhttp/src/main/java/org/openstack4j/connectors/okhttp/HttpExecutorServiceImpl.java
@@ -32,9 +32,11 @@ public HttpResponse execute(HttpRequest request) {
catch (ResponseException re) {
throw re;
}
+ catch (RuntimeException e) {
+ throw e;
+ }
catch (Exception e) {
- e.printStackTrace();
- return null;
+ throw new RuntimeException(e);
}
}
diff --git a/connectors/pom.xml b/connectors/pom.xml
index 311abad74..f89e8f23e 100644
--- a/connectors/pom.xml
+++ b/connectors/pom.xml
@@ -2,7 +2,7 @@
org.pacesys
openstack4j-parent
- 3.0.5-SNAPSHOT
+ 3.1.1-SNAPSHOT
4.0.0
org.pacesys.openstack4j.connectors
diff --git a/connectors/resteasy/pom.xml b/connectors/resteasy/pom.xml
index 2d04054b4..7712b34b8 100644
--- a/connectors/resteasy/pom.xml
+++ b/connectors/resteasy/pom.xml
@@ -2,7 +2,7 @@
org.pacesys.openstack4j.connectors
openstack4j-connectors
- 3.0.5-SNAPSHOT
+ 3.1.1-SNAPSHOT
4.0.0
openstack4j-resteasy
@@ -11,14 +11,20 @@
jar
- 2.3.7.Final
+ 3.1.4.Final
org.jboss.resteasy
- resteasy-jaxrs
+ resteasy-client
${resteasy-version}
+
+
+ httpclient
+ org.apache.httpcomponents
+
+
com.fasterxml.jackson.jaxrs
@@ -30,6 +36,11 @@
commons-logging
1.2
+
+ org.apache.httpcomponents
+ httpclient
+ 4.5.3
+
diff --git a/connectors/resteasy/src/main/java/org/openstack4j/connectors/resteasy/HttpCommand.java b/connectors/resteasy/src/main/java/org/openstack4j/connectors/resteasy/HttpCommand.java
index 945b61af3..1e02e7485 100644
--- a/connectors/resteasy/src/main/java/org/openstack4j/connectors/resteasy/HttpCommand.java
+++ b/connectors/resteasy/src/main/java/org/openstack4j/connectors/resteasy/HttpCommand.java
@@ -1,27 +1,30 @@
package org.openstack4j.connectors.resteasy;
-import java.util.List;
-import java.util.Map;
-
-import javax.ws.rs.core.UriBuilder;
-
-import org.jboss.resteasy.client.ClientRequest;
-import org.jboss.resteasy.client.ClientResponse;
-import org.openstack4j.connectors.resteasy.executors.ApacheHttpClientExecutor;
+import org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder;
+import org.jboss.resteasy.client.jaxrs.ResteasyWebTarget;
+import org.openstack4j.connectors.resteasy.executors.ApacheHttpClientEngine;
import org.openstack4j.core.transport.ClientConstants;
import org.openstack4j.core.transport.HttpRequest;
import org.openstack4j.core.transport.functions.EndpointURIFromRequestFunction;
+import javax.ws.rs.client.Entity;
+import javax.ws.rs.client.Invocation;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.UriBuilder;
+import java.util.List;
+import java.util.Map;
+
/**
- * HttpCommand is responsible for executing the actual request driven by the HttpExecutor.
- *
+ * HttpCommand is responsible for executing the actual request driven by the HttpExecutor.
+ *
* @param
*/
public final class HttpCommand {
private HttpRequest request;
- private ClientRequest client;
+ private ResteasyWebTarget resteasyWebTarget;
private int retries;
+ private Invocation.Builder resteasyRequest ;
private HttpCommand(HttpRequest request) {
this.request = request;
@@ -33,37 +36,39 @@ private HttpCommand(HttpRequest request) {
* @return the command
*/
public static HttpCommand create(HttpRequest request) {
- HttpCommand command = new HttpCommand(request);
+ HttpCommand command = new HttpCommand<>(request);
command.initialize();
return command;
}
private void initialize() {
- client = new ClientRequest(UriBuilder.fromUri(new EndpointURIFromRequestFunction().apply(request)),
- ApacheHttpClientExecutor.create(request.getConfig()), ResteasyClientFactory.getInstance());
-
- client.followRedirects(true);
-
+
+ resteasyWebTarget = new ResteasyClientBuilder().httpEngine(ApacheHttpClientEngine.create(request.getConfig()))
+ .providerFactory(ResteasyClientFactory.getInstance()).build()
+ .target(UriBuilder.fromUri(new EndpointURIFromRequestFunction().apply(request)));
+
populateQueryParams(request);
+ resteasyRequest = resteasyWebTarget.request();
populateHeaders(request);
}
/**
* Executes the command and returns the Response
- *
+ *
* @return the response
- * @throws Exception
*/
- public ClientResponse execute() throws Exception {
-
+ public Response execute(){
+
+ Invocation webRequest;
if (request.getEntity() != null) {
- client.body(request.getContentType(), request.getEntity());
+ webRequest = resteasyRequest.build(request.getMethod().name(), Entity.entity(request.getEntity(), request.getContentType()));
+ } else if (request.hasJson()) {
+ webRequest= resteasyRequest.build(request.getMethod().name() , Entity.entity(request.getJson(),ClientConstants.CONTENT_TYPE_JSON));
+ }else{
+ webRequest = resteasyRequest.build(request.getMethod().name());
}
- else if(request.hasJson()) {
- client.body(ClientConstants.CONTENT_TYPE_JSON, request.getJson());
- }
- ClientResponse response = client.httpMethod(request.getMethod().name(), request.getReturnType());
- return response;
+
+ return webRequest.invoke();
}
/**
@@ -72,21 +77,21 @@ else if(request.hasJson()) {
public boolean hasEntity() {
return request.getEntity() != null;
}
-
+
/**
* @return current retry execution count for this command
*/
public int getRetries() {
return retries;
}
-
+
/**
* @return incremement's the retry count and returns self
*/
public HttpCommand incrementRetriesAndReturn() {
- initialize();
- retries++;
- return this;
+ initialize();
+ retries++;
+ return this;
}
public HttpRequest getRequest() {
@@ -97,9 +102,9 @@ private void populateQueryParams(HttpRequest request) {
if (!request.hasQueryParams()) return;
- for(Map.Entry > entry : request.getQueryParams().entrySet()) {
+ for (Map.Entry> entry : request.getQueryParams().entrySet()) {
for (Object o : entry.getValue()) {
- client = client.queryParameter(entry.getKey(), o);
+ resteasyWebTarget = resteasyWebTarget.queryParam(entry.getKey(), o);
}
}
}
@@ -108,8 +113,8 @@ private void populateHeaders(HttpRequest request) {
if (!request.hasHeaders()) return;
- for(Map.Entry h : request.getHeaders().entrySet()) {
- client.header(h.getKey(), h.getValue());
+ for (Map.Entry h : request.getHeaders().entrySet()) {
+ resteasyRequest.header(h.getKey(), h.getValue());
}
}
}
diff --git a/connectors/resteasy/src/main/java/org/openstack4j/connectors/resteasy/HttpExecutorServiceImpl.java b/connectors/resteasy/src/main/java/org/openstack4j/connectors/resteasy/HttpExecutorServiceImpl.java
index fd044f860..59b5f1b30 100644
--- a/connectors/resteasy/src/main/java/org/openstack4j/connectors/resteasy/HttpExecutorServiceImpl.java
+++ b/connectors/resteasy/src/main/java/org/openstack4j/connectors/resteasy/HttpExecutorServiceImpl.java
@@ -1,6 +1,5 @@
package org.openstack4j.connectors.resteasy;
-import org.jboss.resteasy.client.ClientResponse;
import org.openstack4j.api.exceptions.ConnectionException;
import org.openstack4j.api.exceptions.ResponseException;
import org.openstack4j.core.transport.ClientConstants;
@@ -10,6 +9,8 @@
import org.openstack4j.openstack.internal.OSAuthenticator;
import org.openstack4j.openstack.internal.OSClientSession;
+import javax.ws.rs.core.Response;
+
/**
* HttpExecutor is the default implementation for HttpExecutorService which is responsible for interfacing with Resteasy and mapping common status codes, requests and responses
* back to the common API
@@ -58,7 +59,7 @@ private HttpResponse invoke(HttpRequest request) throws Exception {
}
private HttpResponse invokeRequest(HttpCommand command) throws Exception {
- ClientResponse response = command.execute();
+ Response response = command.execute();
if (command.getRetries() == 0 && response.getStatus() == 401 && !command.getRequest().getHeaders().containsKey(ClientConstants.HEADER_OS4J_AUTH))
{
OSAuthenticator.reAuthenticate();
diff --git a/connectors/resteasy/src/main/java/org/openstack4j/connectors/resteasy/HttpResponseImpl.java b/connectors/resteasy/src/main/java/org/openstack4j/connectors/resteasy/HttpResponseImpl.java
index 552139636..c523e56b5 100644
--- a/connectors/resteasy/src/main/java/org/openstack4j/connectors/resteasy/HttpResponseImpl.java
+++ b/connectors/resteasy/src/main/java/org/openstack4j/connectors/resteasy/HttpResponseImpl.java
@@ -6,8 +6,8 @@
import java.util.Map;
import javax.ws.rs.core.MultivaluedMap;
+import javax.ws.rs.core.Response;
-import org.jboss.resteasy.client.ClientResponse;
import org.openstack4j.core.transport.ClientConstants;
import org.openstack4j.core.transport.ExecutionOptions;
import org.openstack4j.core.transport.HttpEntityHandler;
@@ -15,9 +15,9 @@
public class HttpResponseImpl implements HttpResponse {
- private final ClientResponse> response;
+ private final Response response;
- private HttpResponseImpl(ClientResponse> response) {
+ private HttpResponseImpl(Response response) {
this.response = response;
}
@@ -27,7 +27,7 @@ private HttpResponseImpl(ClientResponse> response) {
* @param response the response
* @return the HttpResponse
*/
- public static HttpResponseImpl wrap(ClientResponse> response) {
+ public static HttpResponseImpl wrap(Response response) {
return new HttpResponseImpl(response);
}
@@ -36,7 +36,7 @@ public static HttpResponseImpl wrap(ClientResponse> response) {
*
* @return the response
*/
- public ClientResponse> unwrap() {
+ public Response unwrap() {
return response;
}
@@ -77,14 +77,15 @@ public int getStatus() {
*/
@Override
public String getStatusMessage() {
- return response.getResponseStatus().getReasonPhrase();
+ return response.getStatusInfo().getReasonPhrase();
}
/**
* @return the input stream
*/
public InputStream getInputStream() {
- return response.getEntity(InputStream.class);
+ response.bufferEntity();
+ return response.readEntity(InputStream.class);
}
/**
@@ -94,18 +95,18 @@ public InputStream getInputStream() {
* @return the header as a String or null if not found
*/
public String header(String name) {
- return response.getHeaders().getFirst(name);
+ return response.getStringHeaders().getFirst(name);
}
/**
* @return the a Map of Header Name to Header Value
*/
public Map headers() {
- Map headers = new HashMap();
- MultivaluedMap responseHeaders = response.getHeaders();
+ Map headers = new HashMap<>();
+ MultivaluedMap responseHeaders = response.getStringHeaders();
for (String key : responseHeaders.keySet()) {
- headers.put(key, responseHeaders.getFirst(key).toString());
+ headers.put(key, responseHeaders.getFirst(key));
}
return headers;
@@ -113,12 +114,13 @@ public Map headers() {
@Override
public T readEntity(Class typeToReadAs) {
- return response.getEntity(typeToReadAs);
+ response.bufferEntity();
+ return response.readEntity(typeToReadAs);
}
@Override
public void close() throws IOException {
- response.releaseConnection();
+ response.close();
}
@Override
diff --git a/connectors/resteasy/src/main/java/org/openstack4j/connectors/resteasy/executors/ApacheHttpClientEngine.java b/connectors/resteasy/src/main/java/org/openstack4j/connectors/resteasy/executors/ApacheHttpClientEngine.java
new file mode 100644
index 000000000..e32bd948c
--- /dev/null
+++ b/connectors/resteasy/src/main/java/org/openstack4j/connectors/resteasy/executors/ApacheHttpClientEngine.java
@@ -0,0 +1,79 @@
+package org.openstack4j.connectors.resteasy.executors;
+
+import org.apache.http.HttpHost;
+import org.apache.http.client.HttpClient;
+import org.apache.http.client.config.RequestConfig;
+import org.apache.http.conn.ssl.NoopHostnameVerifier;
+import org.apache.http.impl.client.DefaultRedirectStrategy;
+import org.apache.http.impl.client.HttpClientBuilder;
+import org.apache.http.impl.client.HttpClients;
+import org.jboss.resteasy.client.jaxrs.engines.ApacheHttpClient4Engine;
+import org.openstack4j.core.transport.Config;
+import org.openstack4j.core.transport.UntrustedSSL;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+
+/**
+ * Default Apache HttpClient based Executor
+ *
+ * @author Jeremy Unruh
+ */
+public class ApacheHttpClientEngine extends ApacheHttpClient4Engine {
+
+ ApacheHttpClientEngine(HttpClient client) {
+ super(client);
+ }
+ private static final Logger LOGGER = LoggerFactory.getLogger(ApacheHttpClientEngine.class);
+
+ public static ApacheHttpClientEngine create(Config config) {
+
+ RequestConfig.Builder requestConfigBuilder = RequestConfig.custom();
+
+ if (config.getReadTimeout() > 0) {
+ requestConfigBuilder.setConnectionRequestTimeout(config.getReadTimeout());
+ }
+
+ if (config.getConnectTimeout() > 0) {
+ requestConfigBuilder.setConnectTimeout(config.getConnectTimeout());
+ }
+
+ /*HttpClient client*/
+
+ HttpClientBuilder httpClientBuilder = HttpClients.custom();
+
+ if (config.isIgnoreSSLVerification()) {
+ httpClientBuilder.setSSLContext(UntrustedSSL.getSSLContext());
+ httpClientBuilder.setSSLHostnameVerifier(new NoopHostnameVerifier());
+ }
+
+ if (config.getHostNameVerifier() != null) {
+ httpClientBuilder.setSSLHostnameVerifier(config.getHostNameVerifier());
+ }
+
+ if (config.getProxy() != null) {
+ try {
+ URL url = new URL(config.getProxy().getHost());
+ HttpHost proxy = new HttpHost(url.getHost(), config.getProxy().getPort(), url.getProtocol());
+ requestConfigBuilder.setProxy(proxy);
+ } catch (MalformedURLException e) {
+ LOGGER.error("Invalid proxy Url :%s",config.getProxy(),e);
+ }
+ }
+
+ httpClientBuilder.setDefaultRequestConfig(requestConfigBuilder.build());
+ httpClientBuilder.setRedirectStrategy(new DefaultRedirectStrategy() {
+ @Override
+ protected boolean isRedirectable(String method)
+ {
+ return true;
+ }
+ });
+
+ HttpClient client = httpClientBuilder.build();
+ return new ApacheHttpClientEngine(client);
+ }
+
+}
diff --git a/connectors/resteasy/src/main/java/org/openstack4j/connectors/resteasy/executors/ApacheHttpClientExecutor.java b/connectors/resteasy/src/main/java/org/openstack4j/connectors/resteasy/executors/ApacheHttpClientExecutor.java
deleted file mode 100644
index 067229e6c..000000000
--- a/connectors/resteasy/src/main/java/org/openstack4j/connectors/resteasy/executors/ApacheHttpClientExecutor.java
+++ /dev/null
@@ -1,51 +0,0 @@
-package org.openstack4j.connectors.resteasy.executors;
-
-import java.net.MalformedURLException;
-import java.net.URL;
-
-import org.apache.http.HttpHost;
-import org.apache.http.client.HttpClient;
-import org.apache.http.conn.params.ConnRoutePNames;
-import org.apache.http.impl.client.DefaultHttpClient;
-import org.apache.http.params.BasicHttpParams;
-import org.apache.http.params.HttpConnectionParams;
-import org.apache.http.params.HttpParams;
-import org.jboss.resteasy.client.core.executors.ApacheHttpClient4Executor;
-import org.openstack4j.core.transport.Config;
-
-/**
- * Default Apache HttpClient based Executor
- *
- * @author Jeremy Unruh
- */
-public class ApacheHttpClientExecutor extends ApacheHttpClient4Executor {
-
- ApacheHttpClientExecutor(HttpClient client) {
- super(client);
- }
-
- public static ApacheHttpClientExecutor create(Config config) {
-
- HttpParams params = new BasicHttpParams();
- if (config.getReadTimeout() > 0)
- HttpConnectionParams.setSoTimeout(params, config.getReadTimeout());
-
- if (config.getConnectTimeout() > 0)
- HttpConnectionParams.setConnectionTimeout(params, config.getConnectTimeout());
-
- HttpClient client = new DefaultHttpClient(params);
-
- if (config.getProxy() != null) {
- try {
- URL url = new URL(config.getProxy().getHost());
- HttpHost proxy = new HttpHost(url.getHost(), config.getProxy().getPort(), url.getProtocol());
- client.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY,proxy);
- } catch (MalformedURLException e) {
- e.printStackTrace();
- }
- }
-
- return new ApacheHttpClientExecutor(client);
- }
-
-}
diff --git a/core-integration-test/it-httpclient/pom.xml b/core-integration-test/it-httpclient/pom.xml
index b2511e5e0..61ab7d793 100644
--- a/core-integration-test/it-httpclient/pom.xml
+++ b/core-integration-test/it-httpclient/pom.xml
@@ -4,7 +4,7 @@
org.pacesys
openstack4j-core-integration-test
- 3.0.5-SNAPSHOT
+ 3.1.1-SNAPSHOT
it-httpclient
OpenStack4j IntegrationTest Apache HttpClient
diff --git a/core-integration-test/it-jersey2/pom.xml b/core-integration-test/it-jersey2/pom.xml
index d82098c1b..da81a596b 100644
--- a/core-integration-test/it-jersey2/pom.xml
+++ b/core-integration-test/it-jersey2/pom.xml
@@ -4,7 +4,7 @@
org.pacesys
openstack4j-core-integration-test
- 3.0.5-SNAPSHOT
+ 3.1.1-SNAPSHOT
it-jersey2
OpenStack4j IntegrationTest Jersey2 Connector
diff --git a/core-integration-test/it-okhttp/pom.xml b/core-integration-test/it-okhttp/pom.xml
index b307b3fcf..d42256e62 100644
--- a/core-integration-test/it-okhttp/pom.xml
+++ b/core-integration-test/it-okhttp/pom.xml
@@ -4,7 +4,7 @@
org.pacesys
openstack4j-core-integration-test
- 3.0.5-SNAPSHOT
+ 3.1.1-SNAPSHOT
it-okhttp
OpenStack4j IntegrationTest OKHttp Connector
diff --git a/core-integration-test/it-resteasy/pom.xml b/core-integration-test/it-resteasy/pom.xml
index 8b40810bf..7539a5579 100644
--- a/core-integration-test/it-resteasy/pom.xml
+++ b/core-integration-test/it-resteasy/pom.xml
@@ -4,7 +4,7 @@
org.pacesys
openstack4j-core-integration-test
- 3.0.5-SNAPSHOT
+ 3.1.1-SNAPSHOT
it-resteasy
OpenStack4j IntegrationTest RestEasy Connector
diff --git a/core-integration-test/pom.xml b/core-integration-test/pom.xml
index 805ab3dd3..ed229f243 100644
--- a/core-integration-test/pom.xml
+++ b/core-integration-test/pom.xml
@@ -2,7 +2,7 @@
org.pacesys
openstack4j-parent
- 3.0.5-SNAPSHOT
+ 3.1.1-SNAPSHOT
4.0.0
openstack4j-core-integration-test
diff --git a/core-test/pom.xml b/core-test/pom.xml
index 7a9df8af5..5a41ef16f 100644
--- a/core-test/pom.xml
+++ b/core-test/pom.xml
@@ -2,7 +2,7 @@
org.pacesys
openstack4j-parent
- 3.0.5-SNAPSHOT
+ 3.1.1-SNAPSHOT
4.0.0
openstack4j-core-test
diff --git a/core-test/src/main/java/org/openstack4j/api/AbstractTest.java b/core-test/src/main/java/org/openstack4j/api/AbstractTest.java
index 302298930..b8b0b8e5a 100644
--- a/core-test/src/main/java/org/openstack4j/api/AbstractTest.java
+++ b/core-test/src/main/java/org/openstack4j/api/AbstractTest.java
@@ -38,10 +38,12 @@ public abstract class AbstractTest {
protected enum Service {
IDENTITY(5000),
NETWORK(9696),
+ OCTAVIA(9876),
COMPUTE(8774),
BLOCK_STORAGE(8776),
METERING(8087),
TELEMETRY(8087),
+ SAHARA(8386),
SHARE(8786),
OBJECT_STORAGE(8800),
BARBICAN(9311),
@@ -53,7 +55,8 @@ protected enum Service {
ARTIFACT(9494),
CLUSTERING(8778),
APP_CATALOG(8082),
- DNS(9001);
+ DNS(9001),
+ WORKFLOW(8989);
private final int port;
diff --git a/core-test/src/main/java/org/openstack4j/api/barbican/SecretTests.java b/core-test/src/main/java/org/openstack4j/api/barbican/SecretTests.java
new file mode 100644
index 000000000..902a41fe2
--- /dev/null
+++ b/core-test/src/main/java/org/openstack4j/api/barbican/SecretTests.java
@@ -0,0 +1,84 @@
+package org.openstack4j.api.barbican;
+
+import com.google.common.collect.ImmutableMap;
+import org.openstack4j.api.AbstractTest;
+import org.openstack4j.api.Builders;
+import org.openstack4j.model.barbican.Secret;
+import org.openstack4j.model.common.ActionResponse;
+import org.testng.annotations.Test;
+
+import java.io.IOException;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+import static org.testng.Assert.*;
+
+/**
+ * Created by reneschollmeyer on 18.08.17.
+ */
+@Test(suiteName = "Barbican/Secrets", enabled = true)
+public class SecretTests extends AbstractTest {
+
+ private static final String SECRET_JSON = "/barbican/secret.json";
+ private static final String SECRET_CREATE_JSON = "/barbican/secret_create.json";
+ private static final String SECRETS_JSON = "/barbican/secrets.json";
+
+ private final String secretId = "520405bc-c7c5-41ea-97ad-6c67a8d41a9e";
+ private final String secretName = "test_secret";
+ private final String content_type = "application/octet-stream";
+
+ private final Date expiration = new Date(1451330264394l);
+
+ public void testListSecretsByName() throws IOException {
+ respondWith(SECRETS_JSON);
+ List extends Secret> list = osv3().barbican().secrets().list("test-secret");
+ assertEquals(list.size(), 1);
+ assertEquals(list.get(0).getName(), secretName);
+ }
+
+ public void testListSecretWithFilter() throws IOException {
+ respondWith(SECRETS_JSON);
+ Map filters = ImmutableMap.of("limit", "1");
+ List extends Secret> list = osv3().barbican().secrets().list(filters);
+ assertEquals(list.size(), 1);
+ }
+
+ public void testGetSecret() throws IOException {
+ respondWith(SECRET_JSON);
+ Secret secret = osv3().barbican().secrets().get(secretId);
+ assertNotNull(secret);
+ assertNotNull(secret.getName());
+ assertEquals(secret.getExpiration(), expiration);
+ assertTrue(!secret.getContentTypes().isEmpty());
+ assertEquals(secret.getContentTypes().get("default"), content_type);
+ }
+
+ public void testCreateSecret() throws IOException {
+ respondWithCodeAndResource(201, SECRET_CREATE_JSON);
+ Secret test = Builders.secret()
+ .name("test-secret")
+ .algorithm("aes")
+ .bitLength(256)
+ .expiration(new Date())
+ .mode("cbc")
+ .secretType("opaque")
+ .payload("test-payload")
+ .payloadContentType("text/plain")
+ .build();
+ Secret result = osv3().barbican().secrets().create(test);
+ assertNotNull(result);
+ assertNotNull(result.getSecretReference());
+ }
+
+ public void testDeleteSecret() throws IOException {
+ respondWith(204);
+ ActionResponse result = osv3().barbican().secrets().delete(secretId);
+ assertTrue(result.isSuccess());
+ }
+
+ @Override
+ protected Service service() {
+ return Service.BARBICAN;
+ }
+}
diff --git a/core-test/src/main/java/org/openstack4j/api/compute/ServerTests.java b/core-test/src/main/java/org/openstack4j/api/compute/ServerTests.java
index 50a49b3b1..7a2633fd5 100644
--- a/core-test/src/main/java/org/openstack4j/api/compute/ServerTests.java
+++ b/core-test/src/main/java/org/openstack4j/api/compute/ServerTests.java
@@ -6,7 +6,9 @@
import static org.testng.Assert.assertNull;
import static org.testng.Assert.assertTrue;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import org.openstack4j.api.AbstractTest;
import org.openstack4j.api.Builders;
@@ -86,7 +88,33 @@ public void evacuateServer() throws Exception {
takeRequest();
}
-
+
+ @Test
+ public void createServerSnapshotWithNoMetadata() throws Exception {
+ createServerSnapshot(null);
+ }
+
+ @Test
+ public void createServerSnapshotWithMetadata() throws Exception {
+ Map metadata = new HashMap() {{ put("image_type", "image"); }};
+ createServerSnapshot(metadata);
+ }
+
+ private void createServerSnapshot(Map metadata) throws Exception {
+ final String serverSnapshotId = "72f759b3-2576-4bf0-9ac9-7cb4a5b9d541";
+ String serverId = "e565cbdb-8e74-4044-ba6e-0155500b2c46";
+ Map headers = new HashMap() {{
+ put("location", "http://127.0.0.1:9292/images/" + serverSnapshotId);
+ }};
+
+ respondWith(headers, 202);
+
+ String imageId = osv3().compute().servers().createSnapshot(serverId, "server-snapshot", metadata);
+ assertEquals(imageId, serverSnapshotId);
+
+ takeRequest();
+ }
+
@Test
public void getServerConsoleOutput() throws Exception {
// Get console output with explicit length
diff --git a/core-test/src/main/java/org/openstack4j/api/compute/ServiceTests.java b/core-test/src/main/java/org/openstack4j/api/compute/ServiceTests.java
index f93031842..e15a265ad 100644
--- a/core-test/src/main/java/org/openstack4j/api/compute/ServiceTests.java
+++ b/core-test/src/main/java/org/openstack4j/api/compute/ServiceTests.java
@@ -1,13 +1,14 @@
package org.openstack4j.api.compute;
import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNotNull;
import java.util.List;
import org.openstack4j.api.AbstractTest;
-import org.openstack4j.model.compute.ext.Service.Status;
import org.openstack4j.model.compute.ext.Service.State;
-
+import org.openstack4j.model.compute.ext.Service.Status;
+import org.openstack4j.openstack.compute.domain.ext.ExtService;
import org.testng.annotations.Test;
/**
@@ -18,26 +19,49 @@
@Test(suiteName = "Services")
public class ServiceTests extends AbstractTest {
- private static final String JSON_SERVICES = "/compute/services.json";
+ private static final String JSON_SERVICES = "/compute/services.json";
+ private static final String JSON_SERVICE_ENABLE = "/compute/service_enable.json";
+ private static final String JSON_SERVICE_DISABLE = "/compute/service_disable.json";
+
+ @Test
+ public void serviceListingTest() throws Exception {
+ respondWith(JSON_SERVICES);
+
+ List extends org.openstack4j.model.compute.ext.Service> services = osv3().compute().services().list();
+ assertEquals(4, services.size());
- public void serviceListingTest() throws Exception {
- respondWith(JSON_SERVICES);
+ org.openstack4j.model.compute.ext.Service s = services.get(0);
+ assertEquals("nova-scheduler", s.getBinary());
+ assertEquals("host1", s.getHost());
+ assertEquals(Status.DISABLED, s.getStatus());
+ assertEquals(State.UP, s.getState());
+ assertEquals("internal", s.getZone());
+ assertEquals("test1", s.getDisabledReason());
+ }
- List extends org.openstack4j.model.compute.ext.Service> services = osv3().compute().services().list();
- assertEquals(4, services.size());
+ @Test
+ public void serviceEnableTest() throws Exception {
+ respondWith(JSON_SERVICE_ENABLE);
+ ExtService s = osv3().compute().services().enableService("nova-compute", "some_host");
+ assertNotNull(s);
+ assertEquals("nova-compute", s.getBinary());
+ assertEquals("some_host", s.getHost());
+ assertEquals(Status.ENABLED, s.getStatus());
+ }
- org.openstack4j.model.compute.ext.Service s = services.get(0);
- assertEquals("nova-scheduler", s.getBinary());
- assertEquals("host1", s.getHost());
- assertEquals(Status.DISABLED, s.getStatus());
- assertEquals(State.UP, s.getState());
- assertEquals("internal", s.getZone());
- assertEquals("test1", s.getDisabledReason());
- }
+ @Test
+ public void serviceDisableTest() throws Exception {
+ respondWith(JSON_SERVICE_DISABLE);
+ ExtService s = osv3().compute().services().disableService("nova-compute", "some_host");
+ assertNotNull(s);
+ assertEquals("nova-compute", s.getBinary());
+ assertEquals("some_host", s.getHost());
+ assertEquals(Status.DISABLED, s.getStatus());
+ }
- @Override
- protected Service service() {
- return Service.COMPUTE;
- }
+ @Override
+ protected Service service() {
+ return Service.COMPUTE;
+ }
}
\ No newline at end of file
diff --git a/core-test/src/main/java/org/openstack4j/api/identity/v3/KeystoneAuthenticationTests.java b/core-test/src/main/java/org/openstack4j/api/identity/v3/KeystoneAuthenticationTests.java
index fe26b13fc..ef7518926 100644
--- a/core-test/src/main/java/org/openstack4j/api/identity/v3/KeystoneAuthenticationTests.java
+++ b/core-test/src/main/java/org/openstack4j/api/identity/v3/KeystoneAuthenticationTests.java
@@ -26,6 +26,7 @@ public class KeystoneAuthenticationTests extends AbstractTest {
private static final String JSON_AUTH_PROJECT = "/identity/v3/authv3_project.json";
private static final String JSON_AUTH_DOMAIN = "/identity/v3/authv3_domain.json";
private static final String JSON_AUTH_TOKEN = "/identity/v3/authv3_token.json";
+ private static final String JSON_AUTH_TOKEN_UNSCOPED = "/identity/v3/authv3_token_unscoped.json";
private static final String JSON_AUTH_UNSCOPED = "/identity/v3/authv3_unscoped.json";
private static final String JSON_AUTH_ERROR_401 = "/identity/v3/authv3_authorizationerror.json";
private static final String JSON_USERS = "/identity/v3/users.json";
@@ -43,6 +44,7 @@ public class KeystoneAuthenticationTests extends AbstractTest {
private static final String PROJECT_DOMAIN_ID = "default";
private static final String PASSWORD = "test";
private static final String REGION_EUROPE = "europe";
+ private static final String TOKEN_UNSCOPED_ID = "3ecb5c2063904566be4b10406c0f7568";
/**
* @return the identity service
@@ -349,6 +351,22 @@ public void reAuthentication_Test() throws Exception {
}
+ /*
+ * token based authentication
+ *
+ * @throws Exception
+ */
+ public void authenticate_token_unscoped() throws Exception {
+
+ respondWithHeaderAndResource(HEADER_AUTH_TOKEN_RESPONSE, 201, JSON_AUTH_TOKEN_UNSCOPED);
+ OSClientV3 osclient_token_unscoped = (OSFactory.builderV3()
+ .endpoint(authURL("/v3"))
+ .token(TOKEN_UNSCOPED_ID)
+ .authenticate());
+
+ assertEquals(osclient_token_unscoped.getToken().getId(),TOKEN_UNSCOPED_ID);
+
+ }
}
diff --git a/core-test/src/main/java/org/openstack4j/api/network/AvailabilityZoneTests.java b/core-test/src/main/java/org/openstack4j/api/network/AvailabilityZoneTests.java
new file mode 100644
index 000000000..78ee62d75
--- /dev/null
+++ b/core-test/src/main/java/org/openstack4j/api/network/AvailabilityZoneTests.java
@@ -0,0 +1,41 @@
+package org.openstack4j.api.network;
+
+import static org.testng.Assert.assertEquals;
+
+import java.util.List;
+
+import org.openstack4j.api.AbstractTest;
+import org.openstack4j.model.network.AvailabilityZone;
+import org.testng.annotations.Test;
+
+/**
+ * Tests the Neutron -> availability_zones API against the mock webserver and spec based
+ * json responses
+ *
+ * @author Taemin
+ */
+@Test(suiteName = "availability_zones")
+public class AvailabilityZoneTests extends AbstractTest {
+
+ private static final String JSON_GET_SUBNET = "/network/availability_zones.json";
+ private static final String STATE = "available";
+ private static final String RESOURCE = "network";
+ private static final String NAME = "nova";
+
+ @Test
+ public void getAvailabilityZones() throws Exception {
+ respondWith(JSON_GET_SUBNET);
+ List extends AvailabilityZone> az = osv3().networking().availabilityzone().list();
+ server.takeRequest();
+ assertEquals(az.get(0).getState(), STATE);
+ assertEquals(az.get(0).getResource(), RESOURCE);
+ assertEquals(az.get(0).getName(), NAME);
+
+ }
+
+ @Override
+ protected Service service() {
+ return Service.NETWORK;
+ }
+
+}
diff --git a/core-test/src/main/java/org/openstack4j/api/network/NetworkTests.java b/core-test/src/main/java/org/openstack4j/api/network/NetworkTests.java
index 6807b1882..ca2e95681 100644
--- a/core-test/src/main/java/org/openstack4j/api/network/NetworkTests.java
+++ b/core-test/src/main/java/org/openstack4j/api/network/NetworkTests.java
@@ -36,6 +36,7 @@ public class NetworkTests extends AbstractTest {
private static final String JSON_NETWORK = "/network/network.json";
private static final String JSON_AGENTS = "/network/agents.json";
private static final String JSON_NETWORK_EXTERNAL = "/network/network-external.json";
+ private static final String JSON_NETWORK_ZONE = "/network/network_zone.json";
private static final String NETWORK_NAME = "net1";
private static final String NETWORK_ID = "4e8e5957-649f-477b-9e5b-f1f75b21c03c";
@@ -59,6 +60,17 @@ public void createNetwork() throws Exception {
assertEquals(n.getStatus(), State.ACTIVE);
assertEquals(n.isRouterExternal(), true);
}
+
+ @Test
+ public void createNetworkWithZone() throws Exception {
+ respondWith(JSON_NETWORK_ZONE);
+ Network n = osv3().networking().network()
+ .create(Builders.network().name(NETWORK_NAME).isRouterExternal(true).adminStateUp(true).addAvailabilityZoneHints("nova").build());
+ server.takeRequest();
+ assertEquals(n.getName(), NETWORK_NAME);
+ assertEquals(n.getStatus(), State.ACTIVE);
+ assertEquals(n.getAvailabilityZoneHints().get(0), "nova");
+ }
@Test
public void agentList() throws Exception {
diff --git a/core-test/src/main/java/org/openstack4j/api/octavia/HealthMonitorV2Tests.java b/core-test/src/main/java/org/openstack4j/api/octavia/HealthMonitorV2Tests.java
new file mode 100644
index 000000000..ccc0779f5
--- /dev/null
+++ b/core-test/src/main/java/org/openstack4j/api/octavia/HealthMonitorV2Tests.java
@@ -0,0 +1,96 @@
+package org.openstack4j.api.octavia;
+
+import org.openstack4j.api.AbstractTest;
+import org.openstack4j.api.Builders;
+import org.openstack4j.model.common.ActionResponse;
+import org.openstack4j.model.octavia.HealthMonitorType;
+import org.openstack4j.model.octavia.HealthMonitorV2;
+import org.openstack4j.model.octavia.HealthMonitorV2Update;
+import org.testng.annotations.Test;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNotNull;
+import static org.testng.Assert.assertTrue;
+
+/**
+ *
+ * @author wei
+ *
+ */
+@Test(suiteName="Octavia/healthMonitor", enabled = true)
+public class HealthMonitorV2Tests extends AbstractTest {
+ private static final String HEALTHMONITORSV2_JSON = "/octavia/healthmonitorsv2.json";
+ private static final String HEALTHMONITORV2_JSON = "/octavia/healthmonitorv2.json";
+ private static final String HEALTHMONITORV2_UPDATE_JSON = "/octavia/healthmonitorv2_update.json";
+
+ public void testListHealthMonitorsV2() throws IOException {
+ respondWith(HEALTHMONITORSV2_JSON);
+ List extends HealthMonitorV2> list = osv3().octavia().healthMonitorV2().list();
+ assertEquals(list.size(), 3);
+ assertEquals("350576d8-5015-4d4e-b73f-23df2397e4c4", list.get(0).getId());
+ }
+
+ public void testListHealthMonitorsV2Filter() throws IOException {
+ respondWith(HEALTHMONITORSV2_JSON);
+ Map map = new HashMap<>();
+ map.put("project_id", "6f759d84e3ca496ab77f8c0ffaa0311e");
+ List extends HealthMonitorV2> list = osv3().octavia().healthMonitorV2().list(map);
+ assertEquals(list.size(), 3);
+ }
+
+ public void testGetHealthMonitorV2() throws IOException {
+ respondWith(HEALTHMONITORV2_JSON);
+ String id = "350576d8-5015-4d4e-b73f-23df2397e4c4";
+ HealthMonitorV2 hm = osv3().octavia().healthMonitorV2().get(id);
+ assertNotNull(hm);
+ assertEquals(hm.getId(), id);
+ }
+
+ public void testCreateHealthMonitorV2() throws IOException {
+ respondWith(HEALTHMONITORV2_JSON);
+ Integer delay = 2;
+ Integer timeout = 3;
+ HealthMonitorType type = HealthMonitorType.HTTP;
+ HealthMonitorV2 create = Builders.octavia().healthMonitorV2()
+ .adminStateUp(true)
+ .delay(delay)
+ .type(type)
+ .timeout(timeout)
+ .build();
+ HealthMonitorV2 result = osv3().octavia().healthMonitorV2().create(create);
+ assertEquals(result.getDelay(), delay);
+ assertEquals(result.getTimeout(), timeout);
+ assertEquals(result.getType(), type);
+ assertTrue(result.isAdminStateUp());
+ }
+
+ public void testUpdateHealthMonitorV2() throws IOException {
+ respondWith(HEALTHMONITORV2_UPDATE_JSON);
+ Integer delay = 10;
+ Integer timeout = 5;
+ String id = "350576d8-5015-4d4e-b73f-23df2397e4c4";
+ HealthMonitorV2Update update = Builders.octavia().healthMonitorV2Update()
+ .delay(delay)
+ .timeout(timeout)
+ .build();
+ HealthMonitorV2 result = osv3().octavia().healthMonitorV2().update(id, update);
+ assertEquals(result.getDelay(), delay);
+ assertEquals(result.getTimeout(), timeout);
+ }
+
+ public void testDeleteHealthMonitorV2() {
+ respondWith(204);
+ ActionResponse result = osv3().octavia().healthMonitorV2().delete("350576d8-5015-4d4e-b73f-23df2397e4c4");
+ assertTrue(result.isSuccess());
+ }
+
+ @Override
+ protected Service service() {
+ return Service.OCTAVIA;
+ }
+}
diff --git a/core-test/src/main/java/org/openstack4j/api/octavia/LbPoolV2Tests.java b/core-test/src/main/java/org/openstack4j/api/octavia/LbPoolV2Tests.java
new file mode 100644
index 000000000..ef02bec2f
--- /dev/null
+++ b/core-test/src/main/java/org/openstack4j/api/octavia/LbPoolV2Tests.java
@@ -0,0 +1,102 @@
+package org.openstack4j.api.octavia;
+
+import org.openstack4j.api.AbstractTest;
+import org.openstack4j.api.Builders;
+import org.openstack4j.model.common.ActionResponse;
+import org.openstack4j.model.octavia.LbMethod;
+import org.openstack4j.model.octavia.LbPoolV2;
+import org.openstack4j.model.octavia.LbPoolV2Update;
+import org.openstack4j.model.octavia.Protocol;
+import org.testng.annotations.Test;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertNotNull;
+import static org.testng.Assert.assertTrue;
+
+/**
+ *
+ * @author wei
+ *
+ */
+@Test(suiteName="Octavia/lbpoolv2", enabled=true)
+public class LbPoolV2Tests extends AbstractTest {
+ private static final String LBPOOLSV2_JSON = "/octavia/lbpoolsv2.json";
+ private static final String LBPOOLV2_JSON = "/octavia/lbpoolv2.json";
+ private static final String LBPOOLV2_UPDATE_JSON = "/octavia/lbpoolv2_update.json";
+
+ public void testListPoolV2() throws IOException {
+ respondWith(LBPOOLSV2_JSON);
+ List extends LbPoolV2> list = osv3().octavia().lbPoolV2().list();
+ assertEquals(list.size(), 2);
+ assertEquals(list.get(0).getId(), "b7f6a49f-ebd8-43c5-b792-5748366eff21");
+ }
+
+ public void testListPoolV2Filter() throws IOException {
+ respondWith(LBPOOLSV2_JSON);
+ Map map = new HashMap();
+ map.put("protocol", "HTTP");
+ List extends LbPoolV2> list = osv3().octavia().lbPoolV2().list(map);
+ assertEquals(list.size(), 2);
+ }
+
+ public void testGetPoolV2() throws IOException {
+ respondWith(LBPOOLV2_JSON);
+ String id = "b7f6a49f-ebd8-43c5-b792-5748366eff21";
+ LbPoolV2 pool = osv3().octavia().lbPoolV2().get(id);
+ assertNotNull(pool);
+ assertEquals(pool.getId(), id);
+ }
+
+ public void testCreatePoolV2() throws IOException {
+ respondWith(LBPOOLV2_JSON);
+ String name = "testlbpool";
+ Protocol protocol = Protocol.HTTP;
+ String projectId = "6f759d84e3ca496ab77f8c0ffaa0311e";
+ LbPoolV2 create = Builders.octavia().lbPoolV2()
+ .adminStateUp(true)
+ .description("im a swimming pool")
+ .lbMethod(LbMethod.LEAST_CONNECTIONS)
+ .name(name)
+ .projectId(projectId)
+ .protocol(protocol)
+ .build();
+ LbPoolV2 result = osv3().octavia().lbPoolV2().create(create);
+ assertEquals(result.getName(), name);
+ assertEquals(result.getLbMethod(), LbMethod.LEAST_CONNECTIONS);
+ assertEquals(result.getProtocol(), protocol);
+ assertEquals(result.getProjectId(), projectId);
+ }
+
+ public void testUpdatePoolV2() throws IOException {
+ respondWith(LBPOOLV2_UPDATE_JSON);
+ String poolId = "b7f6a49f-ebd8-43c5-b792-5748366eff21";
+ String name = "v2update";
+ LbPoolV2Update update = Builders.octavia().lbPoolV2Update()
+ .adminStateUp(false)
+ .description("im a carpool")
+ .lbMethod(LbMethod.ROUND_ROBIN)
+ .name(name)
+ .build();
+ LbPoolV2 result = osv3().octavia().lbPoolV2().update(poolId, update);
+ assertEquals(result.getName(), name);
+ assertEquals(result.getLbMethod(), LbMethod.ROUND_ROBIN);
+ assertFalse(result.isAdminStateUp());
+ }
+
+ public void testDeletePoolV2() {
+ respondWith(204);
+ ActionResponse result = osv3().octavia().lbPoolV2().delete("b7f6a49f-ebd8-43c5-b792-5748366eff21");
+ assertTrue(result.isSuccess());
+ }
+
+ @Override
+ protected Service service() {
+ return Service.OCTAVIA;
+ }
+}
diff --git a/core-test/src/main/java/org/openstack4j/api/octavia/ListenerV2Tests.java b/core-test/src/main/java/org/openstack4j/api/octavia/ListenerV2Tests.java
new file mode 100644
index 000000000..396a9181e
--- /dev/null
+++ b/core-test/src/main/java/org/openstack4j/api/octavia/ListenerV2Tests.java
@@ -0,0 +1,109 @@
+package org.openstack4j.api.octavia;
+
+
+import org.openstack4j.api.AbstractTest;
+import org.openstack4j.api.Builders;
+import org.openstack4j.model.common.ActionResponse;
+import org.openstack4j.model.octavia.ListenerV2;
+import org.openstack4j.model.octavia.ListenerV2Update;
+import org.openstack4j.model.octavia.ListenerProtocol;
+import org.testng.annotations.Test;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertNotNull;
+import static org.testng.Assert.assertTrue;
+
+/**
+ *
+ * @author wei
+ *
+ */
+@Test(suiteName="Octavia/listener", enabled = true)
+public class ListenerV2Tests extends AbstractTest {
+ private static final String LISTENERSV2_JSON = "/octavia/listenersv2.json";
+ private static final String LISTENERV2_JSON = "/octavia/listenerv2.json";
+ private static final String LISTENERV2_UPDATE_JSON = "/octavia/listenerv2_update.json";
+
+ public void testListListenersV2() throws IOException {
+ respondWith(LISTENERSV2_JSON);
+ List extends ListenerV2> list = osv3().octavia().listenerV2().list();
+ assertEquals(list.size(), 2);
+ assertEquals(list.get(0).getName(), "listener1");
+ }
+
+ public void testListListenersV2Filter() throws IOException {
+ respondWith(LISTENERSV2_JSON);
+ Map map = new HashMap<>();
+ map.put("tenantId", "6f759d84e3ca496ab77f8c0ffaa0311e");
+ List extends ListenerV2> list = osv3().octavia().listenerV2().list(map);
+ assertEquals(list.size(), 2);
+ }
+
+ public void testGetListenerV2() throws IOException {
+ respondWith(LISTENERV2_JSON);
+ String id = "c07058a9-8d84-4443-b8f5-508d0facfe10";
+ ListenerV2 listener = osv3().octavia().listenerV2().get(id);
+ assertNotNull(listener);
+ assertEquals(listener.getId(), id);
+ }
+
+ public void testCreateListenerV2() throws IOException {
+ respondWith(LISTENERV2_JSON);
+ String name = "listener1";
+ String description = "";
+ ListenerProtocol protocol = ListenerProtocol.HTTP;
+ String tlsContainerRef = "http://0.0.0.0:9311/v1/containers/52594300-d996-49e4-8bf1-a4e000171ad8";
+ ListenerV2 create = Builders.octavia().listenerV2()
+ .adminStateUp(true)
+ .name(name)
+ .description(description)
+ .protocol(protocol)
+ .defaultTlsContainerRef(tlsContainerRef)
+ .build();
+ ListenerV2 result = osv3().octavia().listenerV2().create(create);
+ assertEquals(result.getName(), name);
+ assertEquals(result.getDescription(), description);
+ assertEquals(result.getProtocol(), protocol);
+ assertEquals(result.getDefaultTlsContainerRef(), tlsContainerRef);
+ assertTrue(result.isAdminStateUp());
+ }
+
+ public void testUpdateListenerV2() throws IOException {
+ respondWith(LISTENERV2_UPDATE_JSON);
+ String name = "listener_updated";
+ String description = "im a good listener";
+ Integer connectionLimit = 20;
+ String tlsContainerRef = "http://0.0.0.0:9311/v1/containers/52594300-d996-49e4-8bf1-a4e000171ad9";
+ ListenerV2Update update = Builders.octavia().listenerV2Update()
+ .adminStateUp(false)
+ .description(description)
+ .name(name)
+ .connectionLimit(connectionLimit)
+ .defaultTlsContainerRef(tlsContainerRef)
+ .build();
+ ListenerV2 result = osv3().octavia().listenerV2().update("c07058a9-8d84-4443-b8f5-508d0facfe10", update);
+ assertFalse(result.isAdminStateUp());
+ assertEquals(result.getName(), name);
+ assertEquals(result.getDescription(), description);
+ assertEquals(result.getConnectionLimit(), connectionLimit);
+ assertEquals(result.getDefaultTlsContainerRef(), tlsContainerRef);
+
+ }
+
+ public void testDeleteListenerV2() {
+ respondWith(204);
+ ActionResponse result = osv3().octavia().listenerV2().delete("c07058a9-8d84-4443-b8f5-508d0facfe10");
+ assertTrue(result.isSuccess());
+ }
+
+ @Override
+ protected Service service() {
+ return Service.OCTAVIA;
+ }
+}
diff --git a/core-test/src/main/java/org/openstack4j/api/octavia/LoadBalancerV2Tests.java b/core-test/src/main/java/org/openstack4j/api/octavia/LoadBalancerV2Tests.java
new file mode 100644
index 000000000..bbd961d64
--- /dev/null
+++ b/core-test/src/main/java/org/openstack4j/api/octavia/LoadBalancerV2Tests.java
@@ -0,0 +1,126 @@
+package org.openstack4j.api.octavia;
+
+
+import org.openstack4j.api.AbstractTest;
+import org.openstack4j.api.Builders;
+import org.openstack4j.model.common.ActionResponse;
+import org.openstack4j.model.octavia.LoadBalancerV2;
+import org.openstack4j.model.octavia.LoadBalancerV2Stats;
+import org.openstack4j.model.octavia.LoadBalancerV2StatusTree;
+import org.openstack4j.model.octavia.LoadBalancerV2Update;
+import org.testng.annotations.Test;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNotNull;
+import static org.testng.Assert.assertTrue;
+import static org.testng.Assert.assertFalse;
+
+/**
+ *
+ * @author wei
+ *
+ */
+@Test(suiteName="Octavia/loadBalancerV2", enabled = true)
+public class LoadBalancerV2Tests extends AbstractTest {
+ private static final String LOADBALANCERSV2_JSON = "/octavia/loadbalancersv2.json";
+ private static final String LOADBALANCERV2_JSON = "/octavia/loadbalancerv2.json";
+ private static final String LOADBALANCERV2_UPDATE_JSON = "/octavia/loadbalancerv2_update.json";
+ private static final String LOADBALANCERV2_STATS_JSON = "/octavia/loadbalancerv2_stats.json";
+ private static final String LOADBALANCERV2_STATUSES_JSON = "/octavia/loadbalancerv2_statuses.json";
+
+ public void testListLoadBalancersV2() throws IOException {
+ respondWith(LOADBALANCERSV2_JSON);
+ List extends LoadBalancerV2> list = osv3().octavia().loadBalancerV2().list();
+ assertEquals(list.size(), 3);
+ assertEquals(list.get(0).getName(), "lb1");
+ }
+
+ public void testListLoadBalancersV2Filter() throws IOException {
+ respondWith(LOADBALANCERSV2_JSON);
+ Map map = new HashMap<>();
+ map.put("provider", "octavia");
+ List extends LoadBalancerV2> list = osv3().octavia().loadBalancerV2().list(map);
+ assertEquals(list.size(), 3);
+ }
+
+ public void testGetLoadBalancerV2() throws IOException {
+ respondWith(LOADBALANCERV2_JSON);
+ String id = "282b71ea-9ceb-4cd6-8881-cb511af2edb5";
+ LoadBalancerV2 lb = osv3().octavia().loadBalancerV2().get(id);
+ assertNotNull(lb);
+ assertNotNull(lb.getVipPortId());
+ assertEquals(lb.getId(), id);
+ }
+
+ public void testCreateLoadBalancerV2() throws IOException {
+ respondWith(LOADBALANCERV2_JSON);
+ String name = "lb1";
+ String description = "im a baby lb";
+ String address = "10.0.0.13";
+ String subnetId = "388c5684-86b0-49ab-90ef-944b1f7328f8";
+ String projectId = "6f759d84e3ca496ab77f8c0ffaa0311e";
+ LoadBalancerV2 create = Builders.octavia().loadBalancerV2()
+ .adminStateUp(false)
+ .name(name)
+ .description(description)
+ .address(address)
+ .subnetId(subnetId)
+ .projectId(projectId)
+ .build();
+ LoadBalancerV2 result = osv3().octavia().loadBalancerV2().create(create);
+ assertEquals(result.getName(), name);
+ assertEquals(result.getDescription(), description);
+ assertEquals(result.getVipAddress(), address);
+ assertEquals(result.getVipSubnetId(), subnetId);
+ assertFalse(result.isAdminStateUp());
+ assertEquals(result.getProjectId(), projectId);
+ }
+
+ public void testUpdateLoadBalancerV2() throws IOException {
+ respondWith(LOADBALANCERV2_UPDATE_JSON);
+ String name = "lb_updated";
+ String description = "im no longer a baby lb";
+ LoadBalancerV2Update update = Builders.octavia().loadBalancerV2Update()
+ .adminStateUp(true)
+ .description(description)
+ .name(name)
+ .build();
+ LoadBalancerV2 result = osv3().octavia().loadBalancerV2().update("282b71ea-9ceb-4cd6-8881-cb511af2edb5", update);
+ assertTrue(result.isAdminStateUp());
+ assertEquals(result.getName(), name);
+ assertEquals(result.getDescription(), description);
+ }
+
+ public void testDeleteLoadbalancerV2() {
+ respondWith(204);
+ ActionResponse result = osv3().octavia().loadBalancerV2().delete("282b71ea-9ceb-4cd6-8881-cb511af2edb5");
+ assertTrue(result.isSuccess());
+ }
+
+ public void testGetLoadBalancerV2Stats() throws IOException {
+ respondWith(LOADBALANCERV2_STATS_JSON);
+ String id = "d8b09924-d223-42a8-b7e7-410e60fd04c5";
+ LoadBalancerV2Stats stats = osv3().octavia().loadBalancerV2().stats(id);
+ assertNotNull(stats);
+ }
+
+ public void testGetLoadBalancerV2Statuses() throws IOException {
+ respondWith(LOADBALANCERV2_STATUSES_JSON);
+ String id = "d8b09924-d223-42a8-b7e7-410e60fd04c5";
+ LoadBalancerV2StatusTree statuses = osv3().octavia().loadBalancerV2().statusTree(id);
+ assertNotNull(statuses);
+ assertNotNull(statuses.getLoadBalancerV2Status());
+ assertNotNull(statuses.getLoadBalancerV2Status().getListenerStatuses());
+ assertEquals(statuses.getLoadBalancerV2Status().getId(), id);
+ }
+
+ @Override
+ protected Service service() {
+ return Service.OCTAVIA;
+ }
+}
diff --git a/core-test/src/main/java/org/openstack4j/api/octavia/MemberV2Tests.java b/core-test/src/main/java/org/openstack4j/api/octavia/MemberV2Tests.java
new file mode 100644
index 000000000..6b3a451f9
--- /dev/null
+++ b/core-test/src/main/java/org/openstack4j/api/octavia/MemberV2Tests.java
@@ -0,0 +1,94 @@
+package org.openstack4j.api.octavia;
+import org.openstack4j.api.AbstractTest;
+import org.openstack4j.api.Builders;
+import org.openstack4j.model.common.ActionResponse;
+import org.openstack4j.model.octavia.MemberV2;
+import org.openstack4j.model.octavia.MemberV2Update;
+import org.testng.annotations.Test;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNotNull;
+import static org.testng.Assert.assertTrue;
+import static org.testng.Assert.assertFalse;
+
+/**
+ *
+ * @author wei
+ *
+ */
+@Test(suiteName="Octavia/memberV2", enabled = true)
+public class MemberV2Tests extends AbstractTest {
+ private static final String MEMBERSV2_JSON = "/octavia/membersv2.json";
+ private static final String MEMBERV2_JSON = "/octavia/memberv2.json";
+ private static final String MEMBERV2_UPDATE_JSON = "/octavia/memberv2_update.json";
+
+ public void testListMembersV2() throws IOException {
+ respondWith(MEMBERSV2_JSON);
+ List extends MemberV2> list = osv3().octavia().lbPoolV2().listMembers("4c0a0a5f-cf8f-44b7-b912-957daa8ce5e5");
+ assertEquals(list.size(), 2);
+ assertEquals("9a7aff27-fd41-4ec1-ba4c-3eb92c629313", list.get(0).getId());
+ }
+
+ public void testListMembersV2Filter() throws IOException {
+ respondWith(MEMBERSV2_JSON);
+ Map map = new HashMap<>();
+ map.put("weight", "1");
+ List extends MemberV2> list = osv3().octavia().lbPoolV2().listMembers("4c0a0a5f-cf8f-44b7-b912-957daa8ce5e5", map);
+ assertEquals(list.size(), 2);
+ }
+
+ public void testGetMemberV2() throws IOException {
+ respondWith(MEMBERV2_JSON);
+ String id = "9a7aff27-fd41-4ec1-ba4c-3eb92c629313";
+ MemberV2 hm = osv3().octavia().lbPoolV2().getMember("4c0a0a5f-cf8f-44b7-b912-957daa8ce5e5", id);
+ assertNotNull(hm);
+ assertEquals(hm.getId(), id);
+ }
+
+ public void testCreateMemberV2() throws IOException {
+ respondWith(MEMBERV2_JSON);
+ String address = "10.0.0.8";
+ Integer port = 80;
+ Integer weight = 1;
+ MemberV2 create = Builders.octavia().memberV2()
+ .adminStateUp(true)
+ .address(address)
+ .protocolPort(port)
+ .weight(weight)
+ .build();
+ MemberV2 result = osv3().octavia().lbPoolV2().createMember("4c0a0a5f-cf8f-44b7-b912-957daa8ce5e5", create);
+ assertEquals(result.getAddress(), address);
+ assertEquals(result.getProtocolPort(), port);
+ assertEquals(result.getWeight(), weight);
+ assertTrue(result.isAdminStateUp());
+ }
+
+ public void testUpdateMemberV2() throws IOException {
+ respondWith(MEMBERV2_UPDATE_JSON);
+ Integer weight = 2;
+ String id = "9a7aff27-fd41-4ec1-ba4c-3eb92c629313";
+ MemberV2Update update = Builders.octavia().memberV2Update()
+ .weight(weight)
+ .adminStateUp(false)
+ .build();
+ MemberV2 result = osv3().octavia().lbPoolV2().updateMember("4c0a0a5f-cf8f-44b7-b912-957daa8ce5e5", id, update);
+ assertEquals(result.getWeight(), weight);
+ assertFalse(result.isAdminStateUp());
+ }
+
+ public void testDeleteMemberV2() {
+ respondWith(204);
+ ActionResponse result = osv3().octavia().lbPoolV2().deleteMember("4c0a0a5f-cf8f-44b7-b912-957daa8ce5e5", "9a7aff27-fd41-4ec1-ba4c-3eb92c629313");
+ assertTrue(result.isSuccess());
+ }
+
+ @Override
+ protected Service service() {
+ return Service.OCTAVIA;
+ }
+}
\ No newline at end of file
diff --git a/core-test/src/main/java/org/openstack4j/api/sahara/ClusterTests.java b/core-test/src/main/java/org/openstack4j/api/sahara/ClusterTests.java
new file mode 100644
index 000000000..af2047186
--- /dev/null
+++ b/core-test/src/main/java/org/openstack4j/api/sahara/ClusterTests.java
@@ -0,0 +1,95 @@
+package org.openstack4j.api.sahara;
+
+import org.openstack4j.model.sahara.Cluster;
+import org.openstack4j.model.sahara.NodeGroup;
+import org.openstack4j.model.sahara.ServiceConfig;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertTrue;
+
+import org.openstack4j.api.AbstractTest;
+import org.openstack4j.api.Builders;
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+import okhttp3.mockwebserver.RecordedRequest;
+
+/**
+ * Test cases for Server based Services
+ *
+ * @author Ekasit Kijsipongse
+ */
+@Test(suiteName="Sahara/Cluster")
+public class ClusterTests extends AbstractTest {
+
+ private static final String JSON_CLUSTER_CREATE_REQUEST = "/sahara/cluster_create_req.json";
+ private static final String JSON_CLUSTER_CREATE_RESPONSE = "/sahara/cluster_create_resp.json";
+
+ @Test
+ public void createCluster() throws Exception {
+ respondWith(JSON_CLUSTER_CREATE_RESPONSE);
+
+ // Create a new cluster from node group template
+ NodeGroup workerGroup = Builders.nodeGroup().name("worker")
+ .count(2)
+ .flavor("ef7f4d7f-267f-4762-abe2-729fe350256c")
+ .nodeGroupTemplateId("f78dda4d-17e1-48cd-ab85-ee56261382ef")
+ .build();
+
+ NodeGroup masterGroup = Builders.nodeGroup().name("master")
+ .count(1)
+ .flavor("ef7f4d7f-267f-4762-abe2-729fe350256c")
+ .nodeGroupTemplateId("0febf422-98ee-47e6-a1c5-60f90f1f9c96")
+ .build();
+
+ ServiceConfig hdfsConf = Builders.serviceConfig()
+ .set("dfs.replication",1)
+ .build();
+ ServiceConfig sparkConf = Builders.serviceConfig()
+ .set("spark.executor.memory","1g")
+ .set("spark.executor.cores",2)
+ .build();
+
+ Cluster cluster = Builders.cluster().name("cluster-test-1")
+ .hadoopVersion("1.6.2")
+ .pluginName("spark")
+ .image("f56cc7c5-9588-49fa-8bcd-5c5d5eda5466")
+ .keypairName("tester")
+ .managementNetworkId("4c065f9c-ad1b-43c4-ba1e-893d330da079")
+ .addNodeGroup(workerGroup)
+ .addNodeGroup(masterGroup)
+ .addServiceConfig("HDFS",hdfsConf)
+ .addServiceConfig("Spark",sparkConf)
+ .build();
+
+
+ cluster = osv2().sahara().clusters().create(cluster);
+
+ // Check that the request is the one we expect
+ RecordedRequest request = server.takeRequest();
+
+ String requestBody = request.getBody().readUtf8();
+ assertTrue(requestBody.contains("\"spark.executor.memory\" : \"1g\""));
+ assertTrue(requestBody.contains("\"spark.executor.cores\" : 2"));
+
+
+ assertEquals("cluster-test-1", cluster.getName());
+ assertEquals("1.6.2", cluster.getHadoopVersion());
+ assertEquals("spark", cluster.getPluginName());
+ assertEquals(2, cluster.getNodeGroups().size());
+ assertEquals(2, cluster.getClusterConfigs().size());
+ assertEquals(1, cluster.getClusterConfigs().get("HDFS").getConfigs().size());
+ assertEquals(2, cluster.getClusterConfigs().get("Spark").getConfigs().size());
+ assertEquals(2, cluster.getClusterConfigs().get("Spark").get("spark.executor.cores"));
+ assertEquals("1g", cluster.getClusterConfigs().get("Spark").get("spark.executor.memory"));
+
+ }
+
+ @Override
+ protected Service service() {
+ return Service.SAHARA;
+ }
+
+
+
+}
diff --git a/core-test/src/main/java/org/openstack4j/api/storage/VolumeTests.java b/core-test/src/main/java/org/openstack4j/api/storage/VolumeTests.java
index 055848f4f..5596dcf24 100644
--- a/core-test/src/main/java/org/openstack4j/api/storage/VolumeTests.java
+++ b/core-test/src/main/java/org/openstack4j/api/storage/VolumeTests.java
@@ -10,9 +10,11 @@
import okhttp3.mockwebserver.RecordedRequest;
import org.openstack4j.api.AbstractTest;
+import org.openstack4j.api.Builders;
import org.openstack4j.api.SkipTest;
import org.openstack4j.model.storage.block.Volume;
import org.openstack4j.model.storage.block.VolumeAttachment;
+import org.openstack4j.model.storage.block.builder.VolumeBuilder;
import org.testng.annotations.Test;
@@ -63,8 +65,8 @@ public void getVolumeV1() throws Exception {
assertTrue(getRequest.getPath().matches("/v[12]/\\p{XDigit}*/volumes/8a9287b7-4f4d-4213-8d75-63470f19f27c"));
assertEquals(volume.getId(), "8a9287b7-4f4d-4213-8d75-63470f19f27c");
- assertEquals(volume.getName(), "vol-test");
- assertEquals(volume.getDescription(), "a description");
+ assertEquals(volume.getDisplayName(), "vol-test");
+ assertEquals(volume.getDisplayDescription(), "a description");
assertNotNull(volume.getCreated());
assertEquals(volume.getZone(), "nova");
assertEquals(volume.getSize(), 100);
@@ -91,7 +93,6 @@ public void getVolumeV1() throws Exception {
@SuppressWarnings("unchecked")
@Test
- @SkipTest(connector = ".*", issue = 395, description = "Volume attribute not recognized when using cinder v2 api")
public void getVolumeV2() throws Exception {
// Check get volume
respondWith("/storage/v2/volume.json");
@@ -101,7 +102,7 @@ public void getVolumeV2() throws Exception {
assertTrue(getRequest.getPath().matches("/v[12]/\\p{XDigit}*/volumes/8a9287b7-4f4d-4213-8d75-63470f19f27c"));
assertEquals(volume.getId(), "8a9287b7-4f4d-4213-8d75-63470f19f27c");
- assertEquals(volume.getName(), "vol-test");
+ assertEquals(volume.getName(), "test-volume");
assertEquals(volume.getDescription(), "a description");
assertNotNull(volume.getCreated());
assertEquals(volume.getZone(), "nova");
@@ -142,4 +143,23 @@ public void testVolumesWithBootableAndEncyrpted() throws Exception {
}
+
+
+ @Test
+ public void CreateVolumeV2WithMultiattach() throws Exception {
+
+ respondWith("/storage/v2/createVolume-muitiattach.json");
+
+ VolumeBuilder volumeBuilder = Builders.volume();
+ volumeBuilder.size(10);
+ volumeBuilder.name("test_openstack4j");
+ volumeBuilder.description("test");
+ volumeBuilder.multiattach(true);
+ Volume volume = osv2().blockStorage().volumes().create(volumeBuilder.build());
+
+ server.takeRequest();
+
+ assertEquals(volume.getSize(), 10);
+ assertEquals(volume.multiattach(), Boolean.TRUE);
+ }
}
diff --git a/core-test/src/main/java/org/openstack4j/api/telemetry/MeterSampleTests.java b/core-test/src/main/java/org/openstack4j/api/telemetry/MeterSampleTests.java
index c6c8b3d2e..f302aa50f 100644
--- a/core-test/src/main/java/org/openstack4j/api/telemetry/MeterSampleTests.java
+++ b/core-test/src/main/java/org/openstack4j/api/telemetry/MeterSampleTests.java
@@ -2,14 +2,18 @@
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertNotNull;
+import static org.testng.Assert.assertTrue;
import java.io.IOException;
import java.util.List;
import org.openstack4j.api.AbstractTest;
import org.openstack4j.model.telemetry.MeterSample;
+import org.openstack4j.model.telemetry.SampleCriteria;
import org.testng.annotations.Test;
+import okhttp3.mockwebserver.RecordedRequest;
+
@Test(suiteName = "Meter Sample Tests")
public class MeterSampleTests extends AbstractTest {
@@ -21,17 +25,45 @@ protected Service service() {
}
@Test
- public void listMeterSampleTest() throws IOException {
+ public void listMeterSampleTest() throws IOException, InterruptedException {
respondWith(JSON_METER_SAMPLES);
List extends MeterSample> samples = osv3().telemetry().meters().samples("cpu");
assertEquals(samples.size(), 3);
+ RecordedRequest listRequest = server.takeRequest();
MeterSample sample = samples.get(0);
assertEquals(sample.getCounterName(), "cpu");
assertNotNull(sample.getMetadata());
assertEquals(sample.getMetadata().size(), 26);
+ }
+
+ @Test
+ public void listMeterSampleWithLimitTest() throws IOException, InterruptedException {
+ respondWith(JSON_METER_SAMPLES);
+
+ SampleCriteria sampleCriteria = SampleCriteria.create().limit(3);
+
+ osv3().telemetry().meters().samples("cpu",sampleCriteria);
+
+ // Check that the list request is the one we expect
+ RecordedRequest listRequest = server.takeRequest();
+ assertNotNull(listRequest.getHeader("X-Auth-Token"));
+ assertTrue(listRequest.getRequestLine().contains("limit=3"));
+ }
+
+ @Test
+ public void listMeterSampleWithLargerLimitTest() throws IOException, InterruptedException {
+ respondWith(JSON_METER_SAMPLES);
+
+ SampleCriteria sampleCriteria = SampleCriteria.create().limit(100);
+
+ osv3().telemetry().meters().samples("cpu", sampleCriteria);
+ // Check that the list request is the one we expect
+ RecordedRequest listRequest = server.takeRequest();
+ assertNotNull(listRequest.getHeader("X-Auth-Token"));
+ assertTrue(listRequest.getRequestLine().contains("limit=100"));
}
}
diff --git a/core-test/src/main/java/org/openstack4j/api/workflow/ActionDefinitionTest.java b/core-test/src/main/java/org/openstack4j/api/workflow/ActionDefinitionTest.java
new file mode 100644
index 000000000..0b16a080b
--- /dev/null
+++ b/core-test/src/main/java/org/openstack4j/api/workflow/ActionDefinitionTest.java
@@ -0,0 +1,128 @@
+package org.openstack4j.api.workflow;
+
+import org.openstack4j.model.common.ActionResponse;
+import org.openstack4j.model.workflow.ActionDefinition;
+import org.openstack4j.model.workflow.Scope;
+import org.testng.annotations.BeforeTest;
+import org.testng.annotations.Test;
+
+import java.util.List;
+
+import static org.testng.Assert.*;
+
+/**
+ * Test cases for {@link ActionDefinitionService}.
+ *
+ * @author Renat Akhmerov
+ */
+@Test(suiteName = "ActionDefinitions")
+public class ActionDefinitionTest extends WorkflowBaseTest {
+
+ private static final String JSON_ACTION_DEF = "/workflow/action_def.json";
+ private static final String JSON_ACTION_DEFS = "/workflow/action_defs.json";
+ private static final String NEW_ACTION = "/workflow/new_action.yaml";
+ private static final String JSON_ACTION_DEF_CREATE = "/workflow/action_def_create.json";
+
+ private ActionDefinitionService service;
+
+ @BeforeTest
+ public void setUp() {
+ this.service = osv3().workflow().actionDefinitions();
+ }
+
+ @Test
+ public void list() throws Exception {
+ respondWith(JSON_ACTION_DEFS);
+
+ List extends ActionDefinition> actionDefs = service.list();
+
+ assertEquals(actionDefs.size(), 2);
+
+ // Check first action definition.
+ ActionDefinition actionDef = actionDefs.get(0);
+
+ assertNotNull(actionDef);
+ assertIsUUID(actionDef.getId());
+ assertNotEmptyString(actionDef.getProjectId());
+ assertEquals(actionDef.getName(), "concat");
+ assertNotNull(actionDef.getTags());
+ assertEquals(actionDef.getTags().get(0), "test");
+ assertEquals(actionDef.getTags().get(1), "custom");
+ assertNotNull(actionDef.getCreatedAt());
+ assertNull(actionDef.getUpdatedAt());
+ assertNotEmptyString(actionDef.getDefinition());
+ assertTrue(actionDef.getDefinition().contains("base: std.echo"));
+ assertEquals(actionDef.getInput(), "s1, s2");
+
+ // Check second action definition.
+ actionDef = actionDefs.get(1);
+
+ assertNotNull(actionDef);
+ assertIsUUID(actionDef.getId());
+ assertNotEmptyString(actionDef.getProjectId());
+ assertEquals(actionDef.getName(), "concat_twice");
+ assertNotNull(actionDef.getTags());
+ assertEquals(actionDef.getTags().size(), 0);
+ assertNotNull(actionDef.getCreatedAt());
+ assertNull(actionDef.getUpdatedAt());
+ assertNotEmptyString(actionDef.getDefinition());
+ assertTrue(actionDef.getDefinition().contains("<% $ %> and <% $ %>"));
+ assertEquals(actionDef.getInput(), "s1, s2");
+ }
+
+ @Test
+ public void get() throws Exception {
+ respondWith(JSON_ACTION_DEF);
+
+ ActionDefinition actionDef = service.get("eecf6cad-65af-4a11-9e6f-692b23ffac08");
+
+ assertNotNull(actionDef);
+ assertIsUUID(actionDef.getId());
+ assertNotEmptyString(actionDef.getProjectId());
+ assertEquals(actionDef.getName(), "concat");
+ assertNotNull(actionDef.getTags());
+ assertEquals(actionDef.getTags().get(0), "test");
+ assertEquals(actionDef.getTags().get(1), "custom");
+ assertNotNull(actionDef.getCreatedAt());
+ assertNull(actionDef.getUpdatedAt());
+ assertNotEmptyString(actionDef.getDefinition());
+ assertTrue(actionDef.getDefinition().contains("base: std.echo"));
+ assertEquals(actionDef.getInput(), "s1, s2");
+ }
+
+ @Test
+ public void create() throws Exception {
+ respondWith(JSON_ACTION_DEF_CREATE);
+
+ List extends ActionDefinition> actionDefs = service.create(
+ getClass().getResourceAsStream(NEW_ACTION),
+ Scope.PRIVATE
+ );
+
+ assertEquals(actionDefs.size(), 1);
+
+ ActionDefinition actionDef = actionDefs.get(0);
+
+ assertNotNull(actionDef);
+ assertIsUUID(actionDef.getId());
+ assertNotEmptyString(actionDef.getProjectId());
+ assertEquals(actionDef.getName(), "concat");
+ assertNotNull(actionDef.getTags());
+ assertEquals(actionDef.getTags().get(0), "test");
+ assertEquals(actionDef.getTags().get(1), "custom");
+ assertNotNull(actionDef.getCreatedAt());
+ assertNull(actionDef.getUpdatedAt());
+ assertNotEmptyString(actionDef.getDefinition());
+ assertTrue(actionDef.getDefinition().contains("base: std.echo"));
+ assertEquals(actionDef.getInput(), "s1, s2");
+ }
+
+ @Test
+ public void delete() throws Exception {
+ respondWith(204); // No content.
+
+ ActionResponse resp = service.delete("concat");
+
+ assertEquals(resp.getCode(), 204);
+ }
+}
diff --git a/core-test/src/main/java/org/openstack4j/api/workflow/ActionExecutionTest.java b/core-test/src/main/java/org/openstack4j/api/workflow/ActionExecutionTest.java
new file mode 100644
index 000000000..0b30f5efb
--- /dev/null
+++ b/core-test/src/main/java/org/openstack4j/api/workflow/ActionExecutionTest.java
@@ -0,0 +1,144 @@
+package org.openstack4j.api.workflow;
+
+import org.openstack4j.model.common.ActionResponse;
+import org.openstack4j.model.workflow.ActionExecution;
+import org.openstack4j.model.workflow.State;
+import org.openstack4j.openstack.workflow.domain.MistralActionExecution;
+import org.testng.annotations.BeforeTest;
+import org.testng.annotations.Test;
+
+import java.util.Collections;
+import java.util.List;
+
+import static org.testng.Assert.*;
+
+/**
+ * Test cases for {@link ActionExecutionService}.
+ *
+ * @author Renat Akhmerov
+ */
+@Test(suiteName = "ActionExecutions")
+public class ActionExecutionTest extends WorkflowBaseTest {
+
+ private static final String JSON_ACTION_EXEC = "/workflow/action_exec.json";
+ private static final String JSON_ACTION_EXECS = "/workflow/action_execs.json";
+ private static final String JSON_ACTION_EXEC_CREATE = "/workflow/action_exec_create.json";
+
+ private ActionExecutionService service;
+
+ @BeforeTest
+ public void setUp() {
+ this.service = osv3().workflow().actionExecutions();
+ }
+
+ @Test
+ public void list() throws Exception {
+ respondWith(JSON_ACTION_EXECS);
+
+ List extends ActionExecution> actionExecs = service.list();
+
+ assertEquals(actionExecs.size(), 2);
+
+ // Check first action execution.
+ ActionExecution actionExec = actionExecs.get(0);
+
+ assertNotNull(actionExec);
+ assertIsUUID(actionExec.getId());
+ assertEquals(actionExec.getName(), "std.noop");
+ assertEquals(actionExec.getTaskName(), "task_1");
+ assertEquals(actionExec.getDescription(), "");
+ assertNotNull(actionExec.getCreatedAt());
+ assertNotNull(actionExec.getUpdatedAt());
+ assertEquals(actionExec.getWorkflowName(), "parallel_join_2");
+ assertEquals(actionExec.getTaskExecutionId(), "c40c26cb-f695-4f20-8455-c57ca5c0770a");
+ assertEquals(actionExec.getInput().size(), 1);
+ assertEquals(actionExec.getInput().get("param1"), "val1");
+ assertEquals(actionExec.getOutput().size(), 1);
+ assertNull(actionExec.getOutput().get("result"));
+ assertEquals(actionExec.getState(), State.SUCCESS);
+ assertNull(actionExec.getStateInfo());
+ assertTrue(actionExec.isAccepted());
+
+ // Check second action execution.
+ actionExec = actionExecs.get(1);
+
+ assertNotNull(actionExec);
+ assertIsUUID(actionExec.getId());
+ assertEquals(actionExec.getName(), "std.noop");
+ assertEquals(actionExec.getTaskName(), "task_2");
+ assertEquals(actionExec.getDescription(), "");
+ assertNotNull(actionExec.getCreatedAt());
+ assertNotNull(actionExec.getUpdatedAt());
+ assertEquals(actionExec.getWorkflowName(), "parallel_join_2");
+ assertEquals(actionExec.getTaskExecutionId(), "c40c26cb-f695-4f20-8455-c57ca5c0770a");
+ assertEquals(actionExec.getInput().size(), 1);
+ assertEquals(actionExec.getInput().get("param1"), "val1");
+ assertEquals(actionExec.getOutput().size(), 1);
+ assertNull(actionExec.getOutput().get("result"));
+ assertEquals(actionExec.getState(), State.ERROR);
+ assertEquals(actionExec.getStateInfo(), "Some error info");
+ assertTrue(actionExec.isAccepted());
+ }
+
+ @Test
+ public void get() throws Exception {
+ respondWith(JSON_ACTION_EXEC);
+
+ ActionExecution actionExec = service.get("294725fa-980d-436f-b882-a75cfeffa8c0");
+
+ assertNotNull(actionExec);
+ assertIsUUID(actionExec.getId());
+ assertEquals(actionExec.getName(), "std.noop");
+ assertEquals(actionExec.getTaskName(), "task_1");
+ assertEquals(actionExec.getDescription(), "");
+ assertNotNull(actionExec.getCreatedAt());
+ assertNotNull(actionExec.getUpdatedAt());
+ assertEquals(actionExec.getWorkflowName(), "parallel_join_2");
+ assertEquals(actionExec.getTaskExecutionId(), "c40c26cb-f695-4f20-8455-c57ca5c0770a");
+ assertEquals(actionExec.getInput().size(), 1);
+ assertEquals(actionExec.getInput().get("param1"), "val1");
+ assertEquals(actionExec.getOutput().size(), 1);
+ assertNull(actionExec.getOutput().get("result"));
+ assertEquals(actionExec.getState(), State.SUCCESS);
+ assertNull(actionExec.getStateInfo());
+ assertTrue(actionExec.isAccepted());
+ }
+
+ @Test
+ public void create() throws Exception {
+ respondWith(JSON_ACTION_EXEC_CREATE);
+
+ ActionExecution actionExec = new MistralActionExecution.MistralActionExecutionBuilder().
+ name("std.echo").
+ input(Collections.singletonMap("output", "Hello Mistral Java Client!")).
+ build();
+
+ actionExec = service.create(actionExec);
+
+ assertNotNull(actionExec);
+ assertIsUUID(actionExec.getId());
+ assertEquals(actionExec.getName(), "std.noop");
+ assertEquals(actionExec.getTaskName(), "task_1");
+ assertEquals(actionExec.getDescription(), "");
+ assertNotNull(actionExec.getCreatedAt());
+ assertNotNull(actionExec.getUpdatedAt());
+ assertEquals(actionExec.getWorkflowName(), "parallel_join_2");
+ assertEquals(actionExec.getTaskExecutionId(), "c40c26cb-f695-4f20-8455-c57ca5c0770a");
+ assertEquals(actionExec.getInput().size(), 1);
+ assertEquals(actionExec.getInput().get("param1"), "val1");
+ assertEquals(actionExec.getOutput().size(), 1);
+ assertNull(actionExec.getOutput().get("result"));
+ assertEquals(actionExec.getState(), State.SUCCESS);
+ assertNull(actionExec.getStateInfo());
+ assertTrue(actionExec.isAccepted());
+ }
+
+ @Test
+ public void delete() throws Exception {
+ respondWith(204); // No content.
+
+ ActionResponse resp = service.delete("294725fa-980d-436f-b882-a75cfeffa8c0");
+
+ assertEquals(resp.getCode(), 204);
+ }
+}
diff --git a/core-test/src/main/java/org/openstack4j/api/workflow/CronTriggerTest.java b/core-test/src/main/java/org/openstack4j/api/workflow/CronTriggerTest.java
new file mode 100644
index 000000000..7175e703e
--- /dev/null
+++ b/core-test/src/main/java/org/openstack4j/api/workflow/CronTriggerTest.java
@@ -0,0 +1,143 @@
+package org.openstack4j.api.workflow;
+
+import org.openstack4j.model.common.ActionResponse;
+import org.openstack4j.model.workflow.Scope;
+import org.openstack4j.model.workflow.CronTrigger;
+import org.openstack4j.openstack.workflow.domain.MistralCronTrigger;
+import org.testng.annotations.BeforeTest;
+import org.testng.annotations.Test;
+
+import java.util.Collections;
+import java.util.List;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNotNull;
+import static org.testng.Assert.assertNull;
+
+/**
+ * Test cases for {@link CronTriggerService}.
+ *
+ * @author Renat Akhmerov
+ */
+@Test(suiteName = "WorkflowEnvironments")
+public class CronTriggerTest extends WorkflowBaseTest {
+
+ private static final String JSON_CRON_TRIGGER = "/workflow/cron_trigger.json";
+ private static final String JSON_CRON_TRIGGERS = "/workflow/cron_triggers.json";
+ private static final String JSON_CRON_TRIGGER_CREATE = "/workflow/cron_trigger_create.json";
+
+ private CronTriggerService service;
+
+ @BeforeTest
+ public void setUp() {
+ this.service = osv3().workflow().cronTriggers();
+ }
+
+ @Test
+ public void list() throws Exception {
+ respondWith(JSON_CRON_TRIGGERS);
+
+ List extends CronTrigger> triggers = service.list();
+
+ assertEquals(triggers.size(), 2);
+
+ // Check first environment.
+ CronTrigger trigger = triggers.get(0);
+
+ assertNotNull(trigger);
+ assertIsUUID(trigger.getId());
+ assertEquals(trigger.getName(), "my_trigger1");
+ assertEquals(trigger.getPattern(), "* * * * *");
+ assertEquals(trigger.getScope(), Scope.PRIVATE);
+ assertNotNull(trigger.getCreatedAt());
+ assertNotNull(trigger.getUpdatedAt());
+ assertEquals(trigger.getWorkflowName(), "my_wf");
+ assertIsUUID(trigger.getWorkflowId());
+ assertEquals(trigger.getWorkflowParameters().size(), 0);
+ assertEquals(trigger.getWorkflowInput().size(), 2);
+ assertEquals(trigger.getWorkflowInput().get("param1"), "val1");
+ assertEquals(trigger.getWorkflowInput().get("param2"), "val2");
+ assertNotNull(trigger.getFirstExecutionTime());
+ assertNotNull(trigger.getNextExecutionTime());
+
+ // Check second environment.
+ trigger = triggers.get(1);
+
+ assertNotNull(trigger);
+ assertIsUUID(trigger.getId());
+ assertEquals(trigger.getName(), "my_trigger2");
+ assertEquals(trigger.getPattern(), "* * * * */5");
+ assertEquals(trigger.getScope(), Scope.PUBLIC);
+ assertNotNull(trigger.getCreatedAt());
+ assertNotNull(trigger.getUpdatedAt());
+ assertEquals(trigger.getWorkflowName(), "my_wf");
+ assertIsUUID(trigger.getWorkflowId());
+ assertEquals(trigger.getWorkflowParameters().size(), 0);
+ assertEquals(trigger.getWorkflowInput().size(), 1);
+ assertEquals(trigger.getWorkflowInput().get("param1"), "val1");
+ assertNotNull(trigger.getFirstExecutionTime());
+ assertNotNull(trigger.getNextExecutionTime());
+ }
+
+ @Test
+ public void get() throws Exception {
+ respondWith(JSON_CRON_TRIGGER);
+
+ CronTrigger trigger = service.get("eecf6cad-65af-4a11-9e6f-692b23ffac08");
+
+ assertNotNull(trigger);
+ assertIsUUID(trigger.getId());
+ assertEquals(trigger.getName(), "my_trigger");
+ assertEquals(trigger.getPattern(), "* * * * *");
+ assertEquals(trigger.getScope(), Scope.PRIVATE);
+ assertNotNull(trigger.getCreatedAt());
+ assertNotNull(trigger.getUpdatedAt());
+ assertEquals(trigger.getWorkflowName(), "my_wf");
+ assertIsUUID(trigger.getWorkflowId());
+ assertEquals(trigger.getWorkflowParameters().size(), 0);
+ assertEquals(trigger.getWorkflowInput().size(), 2);
+ assertEquals(trigger.getWorkflowInput().get("param1"), "val1");
+ assertEquals(trigger.getWorkflowInput().get("param2"), "val2");
+ assertNotNull(trigger.getFirstExecutionTime());
+ assertNotNull(trigger.getNextExecutionTime());
+ }
+
+ @Test
+ public void create() throws Exception {
+ respondWith(JSON_CRON_TRIGGER_CREATE);
+
+ CronTrigger trigger = MistralCronTrigger.builder().
+ name("my_trigger").
+ workflowName("my_wf").
+ workflowInput(Collections.singletonMap("param1", "val1")).
+ pattern("* * * * *").
+ build();
+
+ trigger = service.create(trigger);
+
+ assertNotNull(trigger);
+ assertIsUUID(trigger.getId());
+ assertEquals(trigger.getName(), "my_trigger");
+ assertEquals(trigger.getPattern(), "* * * * *");
+ assertEquals(trigger.getScope(), Scope.PRIVATE);
+ assertNotNull(trigger.getCreatedAt());
+ assertNull(trigger.getUpdatedAt());
+ assertEquals(trigger.getWorkflowName(), "my_wf");
+ assertIsUUID(trigger.getWorkflowId());
+ assertEquals(trigger.getWorkflowParameters().size(), 0);
+ assertEquals(trigger.getWorkflowInput().size(), 2);
+ assertEquals(trigger.getWorkflowInput().get("param1"), "val1");
+ assertEquals(trigger.getWorkflowInput().get("param2"), "val2");
+ assertNotNull(trigger.getFirstExecutionTime());
+ assertNotNull(trigger.getNextExecutionTime());
+ }
+
+ @Test
+ public void delete() throws Exception {
+ respondWith(204); // No content.
+
+ ActionResponse resp = service.delete("concat");
+
+ assertEquals(resp.getCode(), 204);
+ }
+}
diff --git a/core-test/src/main/java/org/openstack4j/api/workflow/TaskExecutionTest.java b/core-test/src/main/java/org/openstack4j/api/workflow/TaskExecutionTest.java
new file mode 100644
index 000000000..12131da53
--- /dev/null
+++ b/core-test/src/main/java/org/openstack4j/api/workflow/TaskExecutionTest.java
@@ -0,0 +1,106 @@
+package org.openstack4j.api.workflow;
+
+import org.openstack4j.model.workflow.State;
+import org.openstack4j.model.workflow.TaskExecution;
+import org.testng.annotations.BeforeTest;
+import org.testng.annotations.Test;
+
+import java.util.List;
+
+import static org.testng.Assert.*;
+
+/**
+ * Test cases for {@link TaskExecutionService}.
+ *
+ * @author Renat Akhmerov
+ */
+@Test(suiteName = "TaskExecutions")
+public class TaskExecutionTest extends WorkflowBaseTest {
+
+ private static final String JSON_TASK_EXEC = "/workflow/task_exec.json";
+ private static final String JSON_TASK_EXECS = "/workflow/task_execs.json";
+
+ private TaskExecutionService service;
+
+ @BeforeTest
+ public void setUp() {
+ this.service = osv3().workflow().taskExecutions();
+ }
+
+ @Test
+ public void list() throws Exception {
+ respondWith(JSON_TASK_EXECS);
+
+ List extends TaskExecution> taskExecs = service.list();
+
+ assertEquals(taskExecs.size(), 2);
+
+ // Check first task execution.
+ TaskExecution taskExec = taskExecs.get(0);
+
+ assertNotNull(taskExec);
+ assertIsUUID(taskExec.getId());
+ assertEquals(taskExec.getName(), "join_task");
+ assertEquals(taskExec.getType(), "ACTION");
+ assertNotNull(taskExec.getCreatedAt());
+ assertNotNull(taskExec.getUpdatedAt());
+ assertEquals(taskExec.getWorkflowName(), "parallel_join_2");
+ assertIsUUID(taskExec.getWorkflowDefinitionId());
+ assertIsUUID(taskExec.getWorkflowExecutionId());
+ assertEquals(taskExec.getState(), State.SUCCESS);
+ assertNull(taskExec.getStateInfo());
+ assertEquals(taskExec.getRuntimeContext().size(), 1);
+ assertEquals(taskExec.getRuntimeContext().get("retry_cnt"), 1);
+ assertEquals(taskExec.getPublished().size(), 1);
+ assertEquals(taskExec.getPublished().get("my_var"), "my_val");
+ assertEquals(taskExec.getResult(), "my task result");
+ assertTrue(taskExec.isProcessed());
+
+ // Check second task execution.
+ taskExec = taskExecs.get(1);
+
+ assertNotNull(taskExec);
+ assertIsUUID(taskExec.getId());
+ assertEquals(taskExec.getName(), "task1");
+ assertEquals(taskExec.getType(), "WORKFLOW");
+ assertNotNull(taskExec.getCreatedAt());
+ assertNotNull(taskExec.getUpdatedAt());
+ assertEquals(taskExec.getWorkflowName(), "parallel_join_2");
+ assertIsUUID(taskExec.getWorkflowDefinitionId());
+ assertIsUUID(taskExec.getWorkflowExecutionId());
+ assertEquals(taskExec.getState(), State.ERROR);
+ assertEquals(taskExec.getStateInfo(), "Some error info");
+ assertEquals(taskExec.getRuntimeContext().size(), 1);
+ assertEquals(taskExec.getRuntimeContext().get("retry_cnt"), 1);
+ assertEquals(taskExec.getPublished().size(), 1);
+ assertEquals(taskExec.getPublished().get("my_var"), "my_val");
+ assertEquals(taskExec.getResult(), "my task result");
+ assertFalse(taskExec.isProcessed());
+
+ }
+
+ @Test
+ public void get() throws Exception {
+ respondWith(JSON_TASK_EXEC);
+
+ TaskExecution taskExec = service.get("6e7cce36-1ab2-45c8-baf5-88d5d726ea1d");
+
+ assertNotNull(taskExec);
+ assertIsUUID(taskExec.getId());
+ assertEquals(taskExec.getName(), "join_task");
+ assertEquals(taskExec.getType(), "ACTION");
+ assertNotNull(taskExec.getCreatedAt());
+ assertNotNull(taskExec.getUpdatedAt());
+ assertEquals(taskExec.getWorkflowName(), "parallel_join_2");
+ assertIsUUID(taskExec.getWorkflowDefinitionId());
+ assertIsUUID(taskExec.getWorkflowExecutionId());
+ assertEquals(taskExec.getState(), State.SUCCESS);
+ assertNull(taskExec.getStateInfo());
+ assertEquals(taskExec.getRuntimeContext().size(), 1);
+ assertEquals(taskExec.getRuntimeContext().get("retry_cnt"), 1);
+ assertEquals(taskExec.getPublished().size(), 1);
+ assertEquals(taskExec.getPublished().get("my_var"), "my_val");
+ assertEquals(taskExec.getResult(), "my task result");
+ assertTrue(taskExec.isProcessed());
+ }
+}
diff --git a/core-test/src/main/java/org/openstack4j/api/workflow/WorkbookDefinitionTest.java b/core-test/src/main/java/org/openstack4j/api/workflow/WorkbookDefinitionTest.java
new file mode 100644
index 000000000..ed037987b
--- /dev/null
+++ b/core-test/src/main/java/org/openstack4j/api/workflow/WorkbookDefinitionTest.java
@@ -0,0 +1,117 @@
+package org.openstack4j.api.workflow;
+
+import org.openstack4j.model.common.ActionResponse;
+import org.openstack4j.model.workflow.Scope;
+import org.openstack4j.model.workflow.WorkbookDefinition;
+import org.testng.annotations.BeforeTest;
+import org.testng.annotations.Test;
+
+import java.util.List;
+
+import static org.testng.Assert.*;
+
+/**
+ * Test cases for {@link WorkbookDefinitionService}.
+ *
+ * @author Renat Akhmerov
+ */
+@Test(suiteName = "WorkbookDefinitions")
+public class WorkbookDefinitionTest extends WorkflowBaseTest {
+
+ private static final String JSON_WB_DEF = "/workflow/wb_def.json";
+ private static final String JSON_WB_DEFS = "/workflow/wb_defs.json";
+ private static final String NEW_WB = "/workflow/new_wb.yaml";
+ private static final String JSON_WB_DEF_CREATE = "/workflow/wb_def_create.json";
+
+ private WorkbookDefinitionService service;
+
+ @BeforeTest
+ public void setUp() {
+ this.service = osv3().workflow().workbookDefinitions();
+ }
+
+ @Test
+ public void list() throws Exception {
+ respondWith(JSON_WB_DEFS);
+
+ List extends WorkbookDefinition> wbDefs = service.list();
+
+ assertEquals(wbDefs.size(), 2);
+
+ // Check first workbook definition.
+ WorkbookDefinition wbDef = wbDefs.get(0);
+
+ assertNotNull(wbDef);
+ assertIsUUID(wbDef.getId());
+ assertNotEmptyString(wbDef.getProjectId());
+ assertEquals(wbDef.getName(), "my_wb0");
+ assertNotNull(wbDef.getTags());
+ assertEquals(wbDef.getTags().get(0), "test");
+ assertEquals(wbDef.getTags().get(1), "private");
+ assertNotNull(wbDef.getCreatedAt());
+ assertNull(wbDef.getUpdatedAt());
+ assertNotEmptyString(wbDef.getDefinition());
+ assertTrue(wbDef.getDefinition().contains("join: all"));
+
+ // Check second workbook definition.
+ wbDef = wbDefs.get(1);
+
+ assertNotNull(wbDef);
+ assertIsUUID(wbDef.getId());
+ assertNotEmptyString(wbDef.getProjectId());
+ assertEquals(wbDef.getName(), "my_wb1");
+ assertNotNull(wbDef.getTags());
+ assertEquals(wbDef.getTags().size(), 0);
+ assertNotNull(wbDef.getCreatedAt());
+ assertNull(wbDef.getUpdatedAt());
+ assertNotEmptyString(wbDef.getDefinition());
+ assertTrue(wbDef.getDefinition().contains("with-items: i in <% range(0, 40) %>"));
+ }
+
+ @Test
+ public void get() throws Exception {
+ respondWith(JSON_WB_DEF);
+
+ WorkbookDefinition wbDef = service.get("eecf6cad-65af-4a11-9e6f-692b23ffac08");
+
+ assertNotNull(wbDef);
+ assertIsUUID(wbDef.getId());
+ assertNotEmptyString(wbDef.getProjectId());
+ assertEquals(wbDef.getName(), "my_wb");
+ assertNotNull(wbDef.getTags());
+ assertEquals(wbDef.getTags().get(0), "test");
+ assertEquals(wbDef.getTags().get(1), "private");
+ assertNotNull(wbDef.getCreatedAt());
+ assertNull(wbDef.getUpdatedAt());
+ assertNotEmptyString(wbDef.getDefinition());
+ assertTrue(wbDef.getDefinition().contains("with-items: i in <% range(0, 40) %>"));
+ }
+
+ @Test
+ public void create() throws Exception {
+ respondWith(JSON_WB_DEF_CREATE);
+
+ WorkbookDefinition wbDef = service.create(getClass().getResourceAsStream(NEW_WB), Scope.PRIVATE);
+
+ assertNotNull(wbDef);
+ assertIsUUID(wbDef.getId());
+ assertNotEmptyString(wbDef.getProjectId());
+ assertEquals(wbDef.getName(), "my_wb");
+ assertNotNull(wbDef.getTags());
+ assertEquals(wbDef.getTags().get(0), "test");
+ assertEquals(wbDef.getTags().get(1), "private");
+ assertNotNull(wbDef.getCreatedAt());
+ assertNull(wbDef.getUpdatedAt());
+ assertNotEmptyString(wbDef.getDefinition());
+ assertTrue(wbDef.getDefinition().contains("with-items: i in <% range(0, 40) %>"));
+ }
+
+ @Test
+ public void delete() throws Exception {
+ respondWith(204); // No content.
+
+ ActionResponse resp = service.delete("my_wb");
+
+ assertEquals(resp.getCode(), 204);
+ }
+}
diff --git a/core-test/src/main/java/org/openstack4j/api/workflow/WorkflowBaseTest.java b/core-test/src/main/java/org/openstack4j/api/workflow/WorkflowBaseTest.java
new file mode 100644
index 000000000..36df74f7a
--- /dev/null
+++ b/core-test/src/main/java/org/openstack4j/api/workflow/WorkflowBaseTest.java
@@ -0,0 +1,34 @@
+package org.openstack4j.api.workflow;
+
+import org.openstack4j.api.AbstractTest;
+
+import java.util.UUID;
+
+import static org.testng.Assert.assertNotNull;
+import static org.testng.Assert.assertTrue;
+
+/**
+ * Base class for all Workflow Service tests.
+ *
+ * @author Renat Akhmerov
+ */
+public class WorkflowBaseTest extends AbstractTest {
+
+ static void assertIsUUID(String value) {
+ try {
+ UUID.fromString(value);
+ } catch (IllegalArgumentException e) {
+ throw new AssertionError(e);
+ }
+ }
+
+ static void assertNotEmptyString(String value) {
+ assertNotNull(value);
+ assertTrue(value.length() > 0);
+ }
+
+ @Override
+ protected Service service() {
+ return Service.WORKFLOW;
+ }
+}
diff --git a/core-test/src/main/java/org/openstack4j/api/workflow/WorkflowDefinitionTest.java b/core-test/src/main/java/org/openstack4j/api/workflow/WorkflowDefinitionTest.java
new file mode 100644
index 000000000..008b116aa
--- /dev/null
+++ b/core-test/src/main/java/org/openstack4j/api/workflow/WorkflowDefinitionTest.java
@@ -0,0 +1,132 @@
+package org.openstack4j.api.workflow;
+
+import org.openstack4j.model.common.ActionResponse;
+import org.openstack4j.model.workflow.Scope;
+import org.openstack4j.model.workflow.WorkflowDefinition;
+import org.testng.annotations.BeforeTest;
+import org.testng.annotations.Test;
+
+import java.util.List;
+
+import static org.testng.Assert.*;
+
+/**
+ * Test cases for {@link WorkflowDefinitionService}.
+ *
+ * @author Renat Akhmerov
+ */
+@Test(suiteName = "WorkflowDefinitions")
+public class WorkflowDefinitionTest extends WorkflowBaseTest {
+
+ private static final String JSON_WF_DEF = "/workflow/wf_def.json";
+ private static final String JSON_WF_DEFS = "/workflow/wf_defs.json";
+ private static final String NEW_WF = "/workflow/new_wf.yaml";
+ private static final String JSON_WF_DEF_CREATE = "/workflow/wf_def_create.json";
+
+ private WorkflowDefinitionService service;
+
+ @BeforeTest
+ public void setUp() {
+ this.service = osv3().workflow().workflowDefinitions();
+ }
+
+ @Test
+ public void list() throws Exception {
+ respondWith(JSON_WF_DEFS);
+
+ List extends WorkflowDefinition> wfDefs = service.list();
+
+ assertEquals(wfDefs.size(), 2);
+
+ // Check first workflow definition.
+ WorkflowDefinition wfDef = wfDefs.get(0);
+
+ assertNotNull(wfDef);
+ assertIsUUID(wfDef.getId());
+ assertNotEmptyString(wfDef.getProjectId());
+ assertEquals(wfDef.getName(), "parallel_join_2");
+ assertNotNull(wfDef.getTags());
+ assertEquals(wfDef.getTags().get(0), "test");
+ assertEquals(wfDef.getTags().get(1), "private");
+ assertNotNull(wfDef.getCreatedAt());
+ assertNull(wfDef.getUpdatedAt());
+ assertNotEmptyString(wfDef.getDefinition());
+ assertTrue(wfDef.getDefinition().contains("join: all"));
+ assertNotNull(wfDef.getInput());
+ assertEquals(wfDef.getInput().length(), 0);
+
+ // Check second workflow definition.
+ wfDef = wfDefs.get(1);
+
+ assertNotNull(wfDef);
+ assertIsUUID(wfDef.getId());
+ assertNotEmptyString(wfDef.getProjectId());
+ assertEquals(wfDef.getName(), "with_items_50");
+ assertNotNull(wfDef.getTags());
+ assertEquals(wfDef.getTags().size(), 0);
+ assertNull(wfDef.getCreatedAt());
+ assertNotNull(wfDef.getUpdatedAt());
+ assertNotEmptyString(wfDef.getDefinition());
+ assertTrue(wfDef.getDefinition().contains("with-items: i in <% range(0, 50) %>"));
+ assertNotNull(wfDef.getInput());
+ assertEquals(wfDef.getInput().length(), 0);
+ }
+
+ @Test
+ public void get() throws Exception {
+ respondWith(JSON_WF_DEF);
+
+ WorkflowDefinition wfDef = service.get("eecf6cad-65af-4a11-9e6f-692b23ffac08");
+
+ assertNotNull(wfDef);
+ assertIsUUID(wfDef.getId());
+ assertNotEmptyString(wfDef.getProjectId());
+ assertEquals(wfDef.getName(), "parallel_join_2");
+ assertNotNull(wfDef.getTags());
+ assertEquals(wfDef.getTags().get(0), "test");
+ assertEquals(wfDef.getTags().get(1), "private");
+ assertNotNull(wfDef.getCreatedAt());
+ assertNull(wfDef.getUpdatedAt());
+ assertNotEmptyString(wfDef.getDefinition());
+ assertTrue(wfDef.getDefinition().contains("join: all"));
+ assertNotNull(wfDef.getInput());
+ assertEquals(wfDef.getInput().length(), 0);
+ }
+
+ @Test
+ public void create() throws Exception {
+ respondWith(JSON_WF_DEF_CREATE);
+
+ List extends WorkflowDefinition> wfDefs = service.create(
+ getClass().getResourceAsStream(NEW_WF),
+ Scope.PRIVATE
+ );
+
+ assertEquals(wfDefs.size(), 1);
+
+ WorkflowDefinition wfDef = wfDefs.get(0);
+
+ assertNotNull(wfDef);
+ assertIsUUID(wfDef.getId());
+ assertNotEmptyString(wfDef.getProjectId());
+ assertEquals(wfDef.getName(), "with_items_40");
+ assertNotNull(wfDef.getTags());
+ assertEquals(wfDef.getTags().get(0), "test");
+ assertEquals(wfDef.getTags().get(1), "private");
+ assertNotNull(wfDef.getCreatedAt());
+ assertNull(wfDef.getUpdatedAt());
+ assertNotEmptyString(wfDef.getDefinition());
+ assertTrue(wfDef.getDefinition().contains("with-items: i in <% range(0, 40) %>"));
+ assertNotNull(wfDef.getInput());
+ assertEquals(wfDef.getInput().length(), 0);
+ }
+
+ @Test
+ public void delete() throws Exception {
+ respondWith(204); // No content.
+
+ ActionResponse resp = service.delete("with_items_40");
+
+ assertEquals(resp.getCode(), 204);
+ }
+}
diff --git a/core-test/src/main/java/org/openstack4j/api/workflow/WorkflowEnvironmentTest.java b/core-test/src/main/java/org/openstack4j/api/workflow/WorkflowEnvironmentTest.java
new file mode 100644
index 000000000..58df70f07
--- /dev/null
+++ b/core-test/src/main/java/org/openstack4j/api/workflow/WorkflowEnvironmentTest.java
@@ -0,0 +1,122 @@
+package org.openstack4j.api.workflow;
+
+import org.openstack4j.model.common.ActionResponse;
+import org.openstack4j.model.workflow.Scope;
+import org.openstack4j.model.workflow.WorkflowEnvironment;
+import org.openstack4j.openstack.workflow.domain.MistralWorkflowEnvironment;
+import org.testng.annotations.BeforeTest;
+import org.testng.annotations.Test;
+
+import java.util.Collections;
+import java.util.List;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNotNull;
+
+/**
+ * Test cases for {@link WorkflowEnvironmentService}.
+ *
+ * @author Renat Akhmerov
+ */
+@Test(suiteName = "WorkflowEnvironments")
+public class WorkflowEnvironmentTest extends WorkflowBaseTest {
+
+ private static final String JSON_WF_ENV = "/workflow/wf_env.json";
+ private static final String JSON_WF_ENVS = "/workflow/wf_envs.json";
+ private static final String JSON_WF_ENV_CREATE = "/workflow/wf_env_create.json";
+
+ private WorkflowEnvironmentService service;
+
+ @BeforeTest
+ public void setUp() {
+ this.service = osv3().workflow().environments();
+ }
+
+ @Test
+ public void list() throws Exception {
+ respondWith(JSON_WF_ENVS);
+
+ List extends WorkflowEnvironment> envs = service.list();
+
+ assertEquals(envs.size(), 2);
+
+ // Check first environment.
+ WorkflowEnvironment env = envs.get(0);
+
+ assertNotNull(env);
+ assertIsUUID(env.getId());
+ assertEquals(env.getName(), "my_env1");
+ assertEquals(env.getDescription(), "This is my test environment 1");
+ assertEquals(env.getProjectId(), "");
+ assertEquals(env.getScope(), Scope.PRIVATE);
+ assertNotNull(env.getCreatedAt());
+ assertNotNull(env.getUpdatedAt());
+ assertEquals(env.getVariables().get("var1"), "val1");
+ assertEquals(env.getVariables().get("var2"), "val2");
+
+ // Check second environment.
+ env = envs.get(1);
+
+ assertNotNull(env);
+ assertIsUUID(env.getId());
+ assertEquals(env.getName(), "my_env2");
+ assertEquals(env.getDescription(), "This is my test environment 2");
+ assertEquals(env.getProjectId(), "");
+ assertEquals(env.getScope(), Scope.PUBLIC);
+ assertNotNull(env.getCreatedAt());
+ assertNotNull(env.getUpdatedAt());
+ assertEquals(env.getVariables().get("var3"), "val3");
+ assertEquals(env.getVariables().get("var4"), "val4");
+ }
+
+ @Test
+ public void get() throws Exception {
+ respondWith(JSON_WF_ENV);
+
+ WorkflowEnvironment env = service.get("eecf6cad-65af-4a11-9e6f-692b23ffac08");
+
+ assertNotNull(env);
+ assertIsUUID(env.getId());
+ assertEquals(env.getName(), "my_env");
+ assertEquals(env.getDescription(), "This is my test environment");
+ assertEquals(env.getProjectId(), "");
+ assertEquals(env.getScope(), Scope.PRIVATE);
+ assertNotNull(env.getCreatedAt());
+ assertNotNull(env.getUpdatedAt());
+ assertEquals(env.getVariables().get("var1"), "val1");
+ assertEquals(env.getVariables().get("var2"), "val2");
+ }
+
+ @Test
+ public void create() throws Exception {
+ respondWith(JSON_WF_ENV_CREATE);
+
+ WorkflowEnvironment env = MistralWorkflowEnvironment.builder().
+ name("my_env").
+ description("This is my test environment").
+ variables(Collections.singletonMap("var1", 1)).
+ build();
+
+ env = service.create(env);
+
+ assertNotNull(env);
+ assertIsUUID(env.getId());
+ assertEquals(env.getName(), "my_env");
+ assertEquals(env.getDescription(), "This is my test environment");
+ assertEquals(env.getProjectId(), "");
+ assertEquals(env.getScope(), Scope.PRIVATE);
+ assertNotNull(env.getCreatedAt());
+ assertNotNull(env.getUpdatedAt());
+ assertEquals(env.getVariables().get("var1"), "val1");
+ assertEquals(env.getVariables().get("var2"), "val2");
+ }
+
+ @Test
+ public void delete() throws Exception {
+ respondWith(204); // No content.
+
+ ActionResponse resp = service.delete("concat");
+
+ assertEquals(resp.getCode(), 204);
+ }
+}
diff --git a/core-test/src/main/java/org/openstack4j/api/workflow/WorkflowExecutionTest.java b/core-test/src/main/java/org/openstack4j/api/workflow/WorkflowExecutionTest.java
new file mode 100644
index 000000000..bc9667ff4
--- /dev/null
+++ b/core-test/src/main/java/org/openstack4j/api/workflow/WorkflowExecutionTest.java
@@ -0,0 +1,130 @@
+package org.openstack4j.api.workflow;
+
+import org.openstack4j.model.common.ActionResponse;
+import org.openstack4j.model.workflow.State;
+import org.openstack4j.model.workflow.WorkflowExecution;
+import org.openstack4j.openstack.workflow.domain.MistralWorkflowExecution.MistralWorkflowExecutionBuilder;
+import org.testng.annotations.BeforeTest;
+import org.testng.annotations.Test;
+
+import java.util.Collections;
+import java.util.List;
+
+import static org.testng.Assert.*;
+
+/**
+ * Test cases for {@link WorkflowExecutionService}.
+ *
+ * @author Renat Akhmerov
+ */
+@Test(suiteName = "WorkflowExecutions")
+public class WorkflowExecutionTest extends WorkflowBaseTest {
+
+ private static final String JSON_WF_EXEC = "/workflow/wf_exec.json";
+ private static final String JSON_WF_EXECS = "/workflow/wf_execs.json";
+ private static final String JSON_WF_EXEC_CREATE = "/workflow/wf_exec_create.json";
+
+ private WorkflowExecutionService service;
+
+ @BeforeTest
+ public void setUp() {
+ this.service = osv3().workflow().workflowExecutions();
+ }
+
+ @Test
+ public void list() throws Exception {
+ respondWith(JSON_WF_EXECS);
+
+ List extends WorkflowExecution> wfExecs = service.list();
+
+ assertEquals(wfExecs.size(), 2);
+
+ // Check first workflow execution.
+ WorkflowExecution wfExec = wfExecs.get(0);
+
+ assertNotNull(wfExec);
+ assertIsUUID(wfExec.getId());
+ assertEquals(wfExec.getWorkflowName(), "parallel_join_2");
+ assertNull(wfExec.getTags());
+ assertNotNull(wfExec.getCreatedAt());
+ assertNotNull(wfExec.getUpdatedAt());
+ assertNotNull(wfExec.getInput());
+ assertEquals(wfExec.getInput().size(), 0);
+ assertNotNull(wfExec.getParameters());
+ assertEquals(wfExec.getParameters().size(), 0);
+ assertEquals(wfExec.getState(), State.SUCCESS);
+ assertNull(wfExec.getStateInfo());
+
+ // Check second workflow execution.
+ wfExec = wfExecs.get(1);
+
+ assertNotNull(wfExec);
+ assertIsUUID(wfExec.getId());
+ assertEquals(wfExec.getWorkflowName(), "parallel_join_2");
+ assertNotNull(wfExec.getTags());
+ assertEquals(wfExec.getTags().size(), 2);
+ assertEquals(wfExec.getTags().get(0), "test");
+ assertEquals(wfExec.getTags().get(1), "private");
+ assertNotNull(wfExec.getCreatedAt());
+ assertNotNull(wfExec.getUpdatedAt());
+ assertNotNull(wfExec.getInput());
+ assertEquals(wfExec.getInput().size(), 0);
+ assertEquals(wfExec.getState(), State.ERROR);
+ assertEquals(wfExec.getStateInfo(), "Failed for reason X");
+ }
+
+ @Test
+ public void get() throws Exception {
+ respondWith(JSON_WF_EXEC);
+
+ WorkflowExecution wfExec = service.get("79d187f4-b8e5-4288-b2cd-ed27ee31e4b0");
+
+ assertNotNull(wfExec);
+ assertIsUUID(wfExec.getId());
+ assertEquals(wfExec.getWorkflowName(), "parallel_join_2");
+ assertNull(wfExec.getTags());
+ assertNotNull(wfExec.getCreatedAt());
+ assertNotNull(wfExec.getUpdatedAt());
+ assertNotNull(wfExec.getInput());
+ assertEquals(wfExec.getInput().size(), 0);
+ assertNotNull(wfExec.getParameters());
+ assertEquals(wfExec.getParameters().size(), 0);
+ assertEquals(wfExec.getState(), State.SUCCESS);
+ assertNull(wfExec.getStateInfo());
+ }
+
+ @Test
+ public void create() throws Exception {
+ respondWith(JSON_WF_EXEC_CREATE);
+
+ WorkflowExecution wfExec = new MistralWorkflowExecutionBuilder().
+ workflowName("parallel_join_2").
+ parameters(Collections.singletonMap("env", "my_env")).
+ build();
+
+ wfExec = service.create(wfExec);
+
+ assertNotNull(wfExec);
+ assertIsUUID(wfExec.getId());
+ assertEquals(wfExec.getWorkflowName(), "parallel_join_2");
+ assertNull(wfExec.getTags());
+ assertNotNull(wfExec.getCreatedAt());
+ assertNull(wfExec.getUpdatedAt());
+ assertNotNull(wfExec.getInput());
+ assertEquals(wfExec.getInput().size(), 0);
+ assertNotNull(wfExec.getParameters());
+ assertEquals(wfExec.getParameters().size(), 1);
+ assertEquals(wfExec.getParameters().get("env"), "my_env");
+ assertEquals(wfExec.getState(), State.RUNNING);
+ assertNull(wfExec.getStateInfo());
+ }
+
+ @Test
+ public void delete() throws Exception {
+ respondWith(204); // No content.
+
+ ActionResponse resp = service.delete("parallel_join_2");
+
+ assertEquals(resp.getCode(), 204);
+ }
+}
diff --git a/core-test/src/main/java/org/openstack4j/openstack/common/ServiceTypeTest.java b/core-test/src/main/java/org/openstack4j/openstack/common/ServiceTypeTest.java
new file mode 100644
index 000000000..f5954a63a
--- /dev/null
+++ b/core-test/src/main/java/org/openstack4j/openstack/common/ServiceTypeTest.java
@@ -0,0 +1,50 @@
+package org.openstack4j.openstack.common;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+import org.openstack4j.api.types.ServiceType;
+import static org.testng.Assert.assertEquals;
+import org.testng.annotations.BeforeSuite;
+import org.testng.annotations.Test;
+
+public class ServiceTypeTest {
+
+ private Map> types;
+
+ @BeforeSuite
+ public void setup() {
+ types = new HashMap<>();
+ types.put(ServiceType.IDENTITY, Arrays.asList("identity","identityV2","identityv3"));
+ types.put(ServiceType.APP_CATALOG, Arrays.asList("application-catalog", "Application-catalogv2", "application-Catalogv3"));
+ types.put(ServiceType.COMPUTE, Arrays.asList("compute", "COMPUTEv2", "computeV3"));
+ types.put(ServiceType.IMAGE, Arrays.asList("image", "imageV2", "imagev3"));
+ types.put(ServiceType.BLOCK_STORAGE, Arrays.asList("volume", "volumev1", "volumev2"));
+ types.put(ServiceType.OBJECT_STORAGE, Arrays.asList("obJect-stOre", "object-storev2", "object-storev3"));
+ types.put(ServiceType.NETWORK, Arrays.asList("network", "networkv2.0", "networkV3"));
+ types.put(ServiceType.EC2, Arrays.asList("EC2","ec2V2","ec2v3"));
+ types.put(ServiceType.TELEMETRY, Arrays.asList("metering","meteringV2.0","meteringv3"));
+ types.put(ServiceType.TELEMETRY_AODH, Arrays.asList("alarming","alarmingV2","alarmingV3"));
+ types.put(ServiceType.ORCHESTRATION, Arrays.asList("orchestration","orchestrationv2","orchestrationv3"));
+ types.put(ServiceType.CLUSTERING, Arrays.asList("clustering","clusteringV2","clustering3"));
+ types.put(ServiceType.SAHARA, Arrays.asList("data_processing","data_processingV1","data_processingv3"));
+ types.put(ServiceType.SHARE, Arrays.asList("share","sharev2","shareV3"));
+ types.put(ServiceType.DATABASE, Arrays.asList("database","databaseV2","Databasev3"));
+ types.put(ServiceType.BARBICAN, Arrays.asList("key-manager","key-managerv2","key-managerv3"));
+ types.put(ServiceType.TACKER, Arrays.asList("nfv-orchestration","nfv-orchestrationv2","nfv-orchestration3"));
+ types.put(ServiceType.ARTIFACT, Arrays.asList("artifact","artifactv2","artifactv3"));
+ types.put(ServiceType.MAGNUM, Arrays.asList("container","ContainerV3","containerv1"));
+ types.put(ServiceType.DNS, Arrays.asList("dns","dnsv2","dnsV3"));
+ types.put(ServiceType.WORKFLOW, Arrays.asList("workflow","workflowv3","workflowv2"));
+ }
+
+ @Test
+ public void testNameResolveByType() {
+ for (Map.Entry> entry : types.entrySet()) {
+ for(String type : entry.getValue()){
+ assertEquals(entry.getKey(), ServiceType.forName(type));
+ }
+ }
+ }
+}
diff --git a/core-test/src/main/java/org/openstack4j/openstack/common/TelemetryDateDeserializerTest.java b/core-test/src/main/java/org/openstack4j/openstack/common/TelemetryDateDeserializerTest.java
new file mode 100644
index 000000000..ec64f0cb9
--- /dev/null
+++ b/core-test/src/main/java/org/openstack4j/openstack/common/TelemetryDateDeserializerTest.java
@@ -0,0 +1,61 @@
+package org.openstack4j.openstack.common;
+
+import static org.testng.Assert.assertEquals;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.TimeZone;
+
+import org.testng.annotations.BeforeSuite;
+import org.testng.annotations.Test;
+
+import com.fasterxml.jackson.core.JsonParseException;
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+public class TelemetryDateDeserializerTest {
+
+ private ObjectMapper mapper;
+ private TelemetryDateDeserializer deserializer;
+
+ @BeforeSuite
+ public void setup() {
+ mapper = new ObjectMapper();
+ deserializer = new TelemetryDateDeserializer();
+ }
+
+ @Test
+ public void testShortDateFormatDeserialize() throws JsonParseException, IOException, ParseException {
+ Date actual = deserializer.deserialize(getParser("2017-06-28T14:00:00"), mapper.getDeserializationContext());
+
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS");
+ sdf.setTimeZone(TimeZone.getTimeZone("UTC"));
+ Date expected = sdf.parse("2017-06-28T14:00:00.000");
+
+ assertEquals(actual, expected);
+ }
+
+ @Test
+ public void testLongDateFormatDeserialize() throws JsonParseException, IOException, ParseException {
+ Date actual = deserializer.deserialize(getParser("2017-06-28T14:00:00.123000"), mapper.getDeserializationContext());
+
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS");
+ sdf.setTimeZone(TimeZone.getTimeZone("UTC"));
+ Date expected = sdf.parse("2017-06-28T14:00:00.123");
+
+ assertEquals(actual, expected);
+ }
+
+ private JsonParser getParser(String dateString) throws JsonParseException, IOException {
+ JsonParser parser = mapper.getFactory().createParser(new ByteArrayInputStream(String
+ .format("{\"date\":\"%s\"}", dateString).getBytes(StandardCharsets.UTF_8)));
+ parser.nextToken();
+ parser.nextToken();
+ parser.nextToken();
+ return parser;
+ }
+}
diff --git a/core-test/src/main/resources/barbican/secret.json b/core-test/src/main/resources/barbican/secret.json
new file mode 100644
index 000000000..cc2d3f086
--- /dev/null
+++ b/core-test/src/main/resources/barbican/secret.json
@@ -0,0 +1,15 @@
+{
+ "status": "ACTIVE",
+ "created": "2015-03-23T20:46:51.650515",
+ "updated": "2015-03-23T20:46:51.654116",
+ "expiration": "2015-12-28T19:14:44.180394",
+ "algorithm": "aes",
+ "bit_length": 256,
+ "mode": "cbc",
+ "name": "AES key",
+ "secret_ref": "https://127.0.0.1:9311/v1/secrets/520405bc-c7c5-41ea-97ad-6c67a8d41a9e",
+ "secret_type": "opaque",
+ "content_types": {
+ "default": "application/octet-stream"
+ }
+}
\ No newline at end of file
diff --git a/core-test/src/main/resources/barbican/secret_create.json b/core-test/src/main/resources/barbican/secret_create.json
new file mode 100644
index 000000000..ddfbd5944
--- /dev/null
+++ b/core-test/src/main/resources/barbican/secret_create.json
@@ -0,0 +1,3 @@
+{
+ "secret_ref": "http://127.0.0.1:8080/v1/containers/0c735455-13b7-406d-80a6-b30deef8ab42"
+}
diff --git a/core-test/src/main/resources/barbican/secrets.json b/core-test/src/main/resources/barbican/secrets.json
new file mode 100644
index 000000000..08227272f
--- /dev/null
+++ b/core-test/src/main/resources/barbican/secrets.json
@@ -0,0 +1,21 @@
+{
+ "total": 1,
+ "secrets": [
+ {
+ "algorithm": null,
+ "bit_length": null,
+ "content_types": {
+ "default": "application/octet-stream"
+ },
+ "created": "2015-04-07T03:37:19.805835",
+ "creator_id": "3a7e3d2421384f56a8fb6cf082a8efab",
+ "expiration": null,
+ "mode": null,
+ "name": "test_secret",
+ "secret_ref": "http//:127.0.0.1:9311/v1/secrets/520405bc-c7c5-41ea-97ad-6c67a8d41a9e",
+ "secret_type": "opaque",
+ "status": "ACTIVE",
+ "updated": "2015-04-07T03:37:19.808337"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/core-test/src/main/resources/compute/service_disable.json b/core-test/src/main/resources/compute/service_disable.json
new file mode 100644
index 000000000..d42d6c657
--- /dev/null
+++ b/core-test/src/main/resources/compute/service_disable.json
@@ -0,0 +1,7 @@
+{
+ "service": {
+ "status": "disabled",
+ "binary": "nova-compute",
+ "host": "some_host"
+ }
+}
diff --git a/core-test/src/main/resources/compute/service_enable.json b/core-test/src/main/resources/compute/service_enable.json
new file mode 100644
index 000000000..939155f76
--- /dev/null
+++ b/core-test/src/main/resources/compute/service_enable.json
@@ -0,0 +1,7 @@
+{
+ "service": {
+ "status": "enabled",
+ "binary": "nova-compute",
+ "host": "some_host"
+ }
+}
\ No newline at end of file
diff --git a/core-test/src/main/resources/identity/v2/access.json b/core-test/src/main/resources/identity/v2/access.json
index 6ae0c7cc5..ff5ef9e4b 100644
--- a/core-test/src/main/resources/identity/v2/access.json
+++ b/core-test/src/main/resources/identity/v2/access.json
@@ -174,7 +174,33 @@
"endpoints_links": [],
"type": "database",
"name": "trove"
- }
+ }, {
+ "endpoints": [
+ {
+ "adminURL": "http:\/\/127.0.0.1:8989\/v2",
+ "region": "RegionOne",
+ "internalURL": "http:\/\/127.0.0.1:8989\/v2",
+ "id": "98d22770096a11e793ae92361f002671",
+ "publicURL": "http:\/\/127.0.0.1:8989\/v2"
+ }
+ ],
+ "endpoints_links": [],
+ "type": "workflow",
+ "name": "mistral"
+ }, {
+ "endpoints": [
+ {
+ "adminURL": "http:\/\/127.0.0.1:8386\/v2",
+ "region": "RegionOne",
+ "internalURL": "http:\/\/127.0.0.1:8386\/v2",
+ "id": "8707e3735d4415c97ae231b4841eb1d",
+ "publicURL": "http:\/\/127.0.0.1:8386\/v2"
+ }
+ ],
+ "endpoints_links": [],
+ "type": "data-processing",
+ "name": "sahara"
+ }
],
"user": {
"username": "admin",
@@ -196,4 +222,4 @@
"roles": ["3e9245e5660344e39328aa68fc9eb6e0", "2cce246750cf4e0da09ada919702e30c", "71713b8306ad4566996286ed8afda89e"]
}
}
-}
\ No newline at end of file
+}
diff --git a/core-test/src/main/resources/identity/v3/authv3_project.json b/core-test/src/main/resources/identity/v3/authv3_project.json
index 8beb3fc4b..17b07af63 100644
--- a/core-test/src/main/resources/identity/v3/authv3_project.json
+++ b/core-test/src/main/resources/identity/v3/authv3_project.json
@@ -397,6 +397,34 @@
"id": "0d56500210a24c38a3702b6825e12345",
"name": "neutron"
},
+ {
+ "endpoints": [
+ {
+ "region_id": "RegionOne",
+ "url": "http://127.0.0.1:9876",
+ "region": "RegionOne",
+ "interface": "public",
+ "id": "6e82c8912d3f49a09df51035681d9012"
+ },
+ {
+ "region_id": "RegionOne",
+ "url": "http://127.0.0.1:9876",
+ "region": "RegionOne",
+ "interface": "admin",
+ "id": "7e44d321ae80457abc3728fa1e6f5678"
+ },
+ {
+ "region_id": "RegionOne",
+ "url": "http://127.0.0.1:9876",
+ "region": "RegionOne",
+ "interface": "internal",
+ "id": "c9a090a4597040849c03bc1358809876"
+ }
+ ],
+ "type": "load-balancer",
+ "id": "0d56500210a24c38a3702b6825e67890",
+ "name": "octavia"
+ },
{
"endpoints": [
{
@@ -648,6 +676,62 @@
"type": "nfv-orchestration",
"id": "83dd97cc45b7417886ad4940189b2b86",
"name": "tacker"
+ },
+ {
+ "endpoints": [
+ {
+ "region_id": "RegionOne",
+ "url": "http://127.0.0.1:8989",
+ "region": "RegionOne",
+ "interface": "public",
+ "id": "2241f1ee096a11e793ae92361f002671"
+ },
+ {
+ "region_id": "RegionOne",
+ "url": "http://127.0.0.1:8989",
+ "region": "RegionOne",
+ "interface": "admin",
+ "id": "2241f446096a11e793ae92361f002671"
+ },
+ {
+ "region_id": "RegionOne",
+ "url": "http://127.0.0.1:8989",
+ "region": "RegionOne",
+ "interface": "internal",
+ "id": "2241f55e096a11e793ae92361f002671"
+ }
+ ],
+ "type": "workflow",
+ "id": "2241f6c6096a11e793ae92361f002671",
+ "name": "mistral"
+ },
+ {
+ "endpoints": [
+ {
+ "region_id": "RegionOne",
+ "url": "http://127.0.0.1:8386",
+ "region": "RegionOne",
+ "interface": "public",
+ "id": "8707e3735d4415c97ae231b4841eb1a"
+ },
+ {
+ "region_id": "RegionOne",
+ "url": "http://127.0.0.1:8386",
+ "region": "RegionOne",
+ "interface": "admin",
+ "id": "8707e3735d4415c97ae231b4841eb1b"
+ },
+ {
+ "region_id": "RegionOne",
+ "url": "http://127.0.0.1:8386",
+ "region": "RegionOne",
+ "interface": "internal",
+ "id": "8707e3735d4415c97ae231b4841eb1c"
+ }
+ ],
+ "type": "data-processing",
+ "id": "8707e3735d4415c97ae231b4841eb1d",
+ "name": "sahara"
}
],
"extras": {},
diff --git a/core-test/src/main/resources/identity/v3/authv3_token_unscoped.json b/core-test/src/main/resources/identity/v3/authv3_token_unscoped.json
new file mode 100644
index 000000000..5bc113b82
--- /dev/null
+++ b/core-test/src/main/resources/identity/v3/authv3_token_unscoped.json
@@ -0,0 +1,16 @@
+{
+"token": {
+ "methods": ["token"],
+ "expires_at": "2015-08-26T14:14:13.719898Z",
+ "extras": {},
+ "user": {
+ "domain": {
+ "id": "default",
+ "name": "Default"},
+ "id": "aa9f25defa6d4cafb48466df83106065",
+ "name": "admin"
+ },
+ "audit_ids": ["VtEJDKwAS6G1PE1cJZBTGw"],
+ "issued_at": "2015-08-26T13:14:13.779668Z"
+ }
+}
\ No newline at end of file
diff --git a/core-test/src/main/resources/network/availability_zones.json b/core-test/src/main/resources/network/availability_zones.json
new file mode 100644
index 000000000..26012a65c
--- /dev/null
+++ b/core-test/src/main/resources/network/availability_zones.json
@@ -0,0 +1,9 @@
+{
+ "availability_zones": [
+ {
+ "state": "available",
+ "resource": "network",
+ "name": "nova"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/core-test/src/main/resources/network/network_zone.json b/core-test/src/main/resources/network/network_zone.json
new file mode 100644
index 000000000..97c922546
--- /dev/null
+++ b/core-test/src/main/resources/network/network_zone.json
@@ -0,0 +1,22 @@
+{
+ "network": {
+ "admin_state_up": true,
+ "availability_zone_hints": ["nova"],
+ "availability_zones": [],
+ "created_at": "2016-03-08T20:19:41",
+ "id": "4e8e5957-649f-477b-9e5b-f1f75b21c03c",
+ "mtu": 0,
+ "name": "net1",
+ "port_security_enabled": true,
+ "project_id": "9bacb3c5d39d41a79512987f338cf177",
+ "qos_policy_id": "6a8454ade84346f59e8d40665f878b2e",
+ "router:external": false,
+ "shared": false,
+ "status": "ACTIVE",
+ "subnets": [],
+ "tenant_id": "9bacb3c5d39d41a79512987f338cf177",
+ "updated_at": "2016-03-08T20:19:41",
+ "vlan_transparent": false,
+ "description": ""
+ }
+}
\ No newline at end of file
diff --git a/core-test/src/main/resources/octavia/healthmonitorsv2.json b/core-test/src/main/resources/octavia/healthmonitorsv2.json
new file mode 100644
index 000000000..9bd3a37cd
--- /dev/null
+++ b/core-test/src/main/resources/octavia/healthmonitorsv2.json
@@ -0,0 +1,55 @@
+{
+ "healthmonitors": [
+ {
+ "admin_state_up": true,
+ "project_id": "6f759d84e3ca496ab77f8c0ffaa0311e",
+ "delay": 2,
+ "expected_codes": "200",
+ "max_retries": 10,
+ "http_method": "GET",
+ "timeout": 3,
+ "pools": [
+ {
+ "id": "b7f6a49f-ebd8-43c5-b792-5748366eff21"
+ }
+ ],
+ "url_path": "\/",
+ "type": "PING",
+ "id": "350576d8-5015-4d4e-b73f-23df2397e4c4"
+ },
+ {
+ "admin_state_up": false,
+ "project_id": "6f759d84e3ca496ab77f8c0ffaa0311e",
+ "delay": 3,
+ "expected_codes": "200",
+ "max_retries": 6,
+ "http_method": "GET",
+ "timeout": 2,
+ "pools": [
+ {
+ "id": "7552cd8f-b854-47f2-9674-88975a5ae3fa"
+ }
+ ],
+ "url_path": "\/",
+ "type": "HTTP",
+ "id": "8a0742e8-9d4e-4dc8-be7e-71a0e00eff67"
+ },
+ {
+ "admin_state_up": true,
+ "project_id": "6f759d84e3ca496ab77f8c0ffaa0311e",
+ "delay": 3,
+ "expected_codes": "200",
+ "max_retries": 3,
+ "http_method": "GET",
+ "timeout": 3,
+ "pools": [
+ {
+ "id": "ff2f9954-2481-4e11-93ee-72b77b6c5c98"
+ }
+ ],
+ "url_path": "\/",
+ "type": "HTTP",
+ "id": "95a76977-a50e-42e8-b7a6-ef75ccf9dc39"
+ }
+ ]
+}
diff --git a/core-test/src/main/resources/octavia/healthmonitorv2.json b/core-test/src/main/resources/octavia/healthmonitorv2.json
new file mode 100644
index 000000000..84ab83e11
--- /dev/null
+++ b/core-test/src/main/resources/octavia/healthmonitorv2.json
@@ -0,0 +1,19 @@
+{
+ "healthmonitor": {
+ "admin_state_up": true,
+ "project_id": "6f759d84e3ca496ab77f8c0ffaa0311e",
+ "delay": 2,
+ "expected_codes": "200",
+ "max_retries": 10,
+ "http_method": "GET",
+ "timeout": 3,
+ "pools": [
+ {
+ "id": "b7f6a49f-ebd8-43c5-b792-5748366eff21"
+ }
+ ],
+ "url_path": "\/",
+ "type": "HTTP",
+ "id": "350576d8-5015-4d4e-b73f-23df2397e4c4"
+ }
+}
diff --git a/core-test/src/main/resources/octavia/healthmonitorv2_update.json b/core-test/src/main/resources/octavia/healthmonitorv2_update.json
new file mode 100644
index 000000000..ba1c2ee24
--- /dev/null
+++ b/core-test/src/main/resources/octavia/healthmonitorv2_update.json
@@ -0,0 +1,19 @@
+{
+ "healthmonitor": {
+ "admin_state_up": true,
+ "project_id": "6f759d84e3ca496ab77f8c0ffaa0311e",
+ "delay": 10,
+ "expected_codes": "200",
+ "max_retries": 10,
+ "http_method": "GET",
+ "timeout": 5,
+ "pools": [
+ {
+ "id": "b7f6a49f-ebd8-43c5-b792-5748366eff21"
+ }
+ ],
+ "url_path": "\/",
+ "type": "HTTP",
+ "id": "350576d8-5015-4d4e-b73f-23df2397e4c4"
+ }
+}
diff --git a/core-test/src/main/resources/octavia/lbpoolsv2.json b/core-test/src/main/resources/octavia/lbpoolsv2.json
new file mode 100644
index 000000000..6545a7f20
--- /dev/null
+++ b/core-test/src/main/resources/octavia/lbpoolsv2.json
@@ -0,0 +1,42 @@
+{
+ "pools": [
+ {
+ "lb_algorithm": "LEAST_CONNECTIONS",
+ "protocol": "HTTP",
+ "description": "im a swimming pool",
+ "admin_state_up": true,
+ "project_id": "6f759d84e3ca496ab77f8c0ffaa0311e",
+ "session_persistence": null,
+ "healthmonitor_id": "350576d8-5015-4d4e-b73f-23df2397e4c4",
+ "listeners": [
+ {
+ "id": "c07058a9-8d84-4443-b8f5-508d0facfe10"
+ }
+ ],
+ "members": [
+
+ ],
+ "id": "b7f6a49f-ebd8-43c5-b792-5748366eff21",
+ "name": "testlbpool"
+ },
+ {
+ "lb_algorithm": "ROUND_ROBIN",
+ "protocol": "HTTP",
+ "description": "",
+ "admin_state_up": true,
+ "project_id": "6f759d84e3ca496ab77f8c0ffaa0311e",
+ "session_persistence": null,
+ "healthmonitor_id": "95a76977-a50e-42e8-b7a6-ef75ccf9dc39",
+ "listeners": [
+ {
+ "id": "342b876f-b6d5-4eb7-badf-40cbae263305"
+ }
+ ],
+ "members": [
+
+ ],
+ "id": "ff2f9954-2481-4e11-93ee-72b77b6c5c98",
+ "name": "pool1"
+ }
+ ]
+}
diff --git a/core-test/src/main/resources/octavia/lbpoolv2.json b/core-test/src/main/resources/octavia/lbpoolv2.json
new file mode 100644
index 000000000..462fbf032
--- /dev/null
+++ b/core-test/src/main/resources/octavia/lbpoolv2.json
@@ -0,0 +1,21 @@
+{
+ "pool": {
+ "lb_algorithm": "LEAST_CONNECTIONS",
+ "protocol": "HTTP",
+ "description": "im a swimming pool",
+ "admin_state_up": true,
+ "project_id": "6f759d84e3ca496ab77f8c0ffaa0311e",
+ "session_persistence": null,
+ "healthmonitor_id": "350576d8-5015-4d4e-b73f-23df2397e4c4",
+ "listeners": [
+ {
+ "id": "c07058a9-8d84-4443-b8f5-508d0facfe10"
+ }
+ ],
+ "members": [
+
+ ],
+ "id": "b7f6a49f-ebd8-43c5-b792-5748366eff21",
+ "name": "testlbpool"
+ }
+}
diff --git a/core-test/src/main/resources/octavia/lbpoolv2_update.json b/core-test/src/main/resources/octavia/lbpoolv2_update.json
new file mode 100644
index 000000000..d6148ff9b
--- /dev/null
+++ b/core-test/src/main/resources/octavia/lbpoolv2_update.json
@@ -0,0 +1,21 @@
+{
+ "pool": {
+ "lb_algorithm": "ROUND_ROBIN",
+ "protocol": "HTTP",
+ "description": "im a carpool",
+ "admin_state_up": false,
+ "project_id": "6f759d84e3ca496ab77f8c0ffaa0311e",
+ "session_persistence": null,
+ "healthmonitor_id": "350576d8-5015-4d4e-b73f-23df2397e4c4",
+ "listeners": [
+ {
+ "id": "c07058a9-8d84-4443-b8f5-508d0facfe10"
+ }
+ ],
+ "members": [
+
+ ],
+ "id": "b7f6a49f-ebd8-43c5-b792-5748366eff21",
+ "name": "v2update"
+ }
+}
diff --git a/core-test/src/main/resources/octavia/listenersv2.json b/core-test/src/main/resources/octavia/listenersv2.json
new file mode 100644
index 000000000..52b8548cf
--- /dev/null
+++ b/core-test/src/main/resources/octavia/listenersv2.json
@@ -0,0 +1,44 @@
+{
+ "listeners": [
+ {
+ "protocol_port": 80,
+ "protocol": "HTTP",
+ "description": "",
+ "default_tls_container_ref": null,
+ "admin_state_up": true,
+ "loadbalancers": [
+ {
+ "id": "bca64d34-945f-4282-9587-8f95722b58f1"
+ }
+ ],
+ "project_id": "6f759d84e3ca496ab77f8c0ffaa0311e",
+ "sni_container_refs": [
+
+ ],
+ "connection_limit": -1,
+ "default_pool_id": "b7f6a49f-ebd8-43c5-b792-5748366eff21",
+ "id": "c07058a9-8d84-4443-b8f5-508d0facfe10",
+ "name": "listener1"
+ },
+ {
+ "protocol_port": 80,
+ "protocol": "HTTP",
+ "description": "",
+ "default_tls_container_ref": null,
+ "admin_state_up": true,
+ "loadbalancers": [
+ {
+ "id": "bcecd8bd-a775-43f9-83c1-c0b5fd0cde47"
+ }
+ ],
+ "project_id": "6f759d84e3ca496ab77f8c0ffaa0311e",
+ "sni_container_refs": [
+
+ ],
+ "connection_limit": -1,
+ "default_pool_id": "e0467102-6406-484d-8262-3922a2f2b36b",
+ "id": "0ac794b9-0eb9-4cf6-a737-c8fc46e45acb",
+ "name": "listener2"
+ }
+ ]
+}
diff --git a/core-test/src/main/resources/octavia/listenerv2.json b/core-test/src/main/resources/octavia/listenerv2.json
new file mode 100644
index 000000000..131b36f22
--- /dev/null
+++ b/core-test/src/main/resources/octavia/listenerv2.json
@@ -0,0 +1,22 @@
+{
+ "listener": {
+ "protocol_port": 80,
+ "protocol": "HTTP",
+ "description": "",
+ "default_tls_container_ref": "http://0.0.0.0:9311/v1/containers/52594300-d996-49e4-8bf1-a4e000171ad8",
+ "admin_state_up": true,
+ "loadbalancers": [
+ {
+ "id": "bca64d34-945f-4282-9587-8f95722b58f1"
+ }
+ ],
+ "project_id": "6f759d84e3ca496ab77f8c0ffaa0311e",
+ "sni_container_refs": [
+ "http://0.0.0.0:9311/v1/containers/907f400c-d970-47f8-9900-db5796505e1f"
+ ],
+ "connection_limit": -1,
+ "default_pool_id": "b7f6a49f-ebd8-43c5-b792-5748366eff21",
+ "id": "c07058a9-8d84-4443-b8f5-508d0facfe10",
+ "name": "listener1"
+ }
+}
diff --git a/core-test/src/main/resources/octavia/listenerv2_update.json b/core-test/src/main/resources/octavia/listenerv2_update.json
new file mode 100644
index 000000000..23ea53d91
--- /dev/null
+++ b/core-test/src/main/resources/octavia/listenerv2_update.json
@@ -0,0 +1,22 @@
+{
+ "listener": {
+ "protocol_port": 80,
+ "protocol": "HTTP",
+ "description": "im a good listener",
+ "default_tls_container_ref": "http://0.0.0.0:9311/v1/containers/52594300-d996-49e4-8bf1-a4e000171ad9",
+ "admin_state_up": false,
+ "loadbalancers": [
+ {
+ "id": "bca64d34-945f-4282-9587-8f95722b58f1"
+ }
+ ],
+ "project_id": "6f759d84e3ca496ab77f8c0ffaa0311e",
+ "sni_container_refs": [
+ "http://0.0.0.0:9311/v1/containers/907f400c-d970-47f8-9900-db5796505e1f"
+ ],
+ "connection_limit": 20,
+ "default_pool_id": "b7f6a49f-ebd8-43c5-b792-5748366eff21",
+ "id": "c07058a9-8d84-4443-b8f5-508d0facfe10",
+ "name": "listener_updated"
+ }
+}
diff --git a/core-test/src/main/resources/octavia/loadbalancersv2.json b/core-test/src/main/resources/octavia/loadbalancersv2.json
new file mode 100644
index 000000000..ee8a19972
--- /dev/null
+++ b/core-test/src/main/resources/octavia/loadbalancersv2.json
@@ -0,0 +1,56 @@
+{
+ "loadbalancers": [
+ {
+ "description": "im a baby lb",
+ "admin_state_up": false,
+ "project_id": "6f759d84e3ca496ab77f8c0ffaa0311e",
+ "provisioning_status": "ACTIVE",
+ "listeners": [
+
+ ],
+ "vip_address": "10.0.0.13",
+ "vip_port_id": "82fbaa1c-a8af-47d3-94fe-a0ac1a33257b",
+ "provider": "octavia",
+ "vip_subnet_id": "388c5684-86b0-49ab-90ef-944b1f7328f8",
+ "id": "282b71ea-9ceb-4cd6-8881-cb511af2edb5",
+ "operating_status": "ONLINE",
+ "name": "lb1"
+ },
+ {
+ "description": "im a baby lb",
+ "admin_state_up": false,
+ "project_id": "6f759d84e3ca496ab77f8c0ffaa0311e",
+ "provisioning_status": "ACTIVE",
+ "listeners": [
+ {
+ "id": "37e23991-e2b3-4929-93d9-dc92e450fc31"
+ }
+ ],
+ "vip_address": "10.0.0.15",
+ "vip_port_id": "78eece66-6199-4bb0-970f-1f20a3982b1b",
+ "provider": "octavia",
+ "vip_subnet_id": "388c5684-86b0-49ab-90ef-944b1f7328f8",
+ "id": "40c5fc75-3df7-4e3f-abe4-41ded1ab387c",
+ "operating_status": "ONLINE",
+ "name": "lbtest"
+ },
+ {
+ "description": "",
+ "admin_state_up": true,
+ "project_id": "6f759d84e3ca496ab77f8c0ffaa0311e",
+ "provisioning_status": "ACTIVE",
+ "listeners": [
+ {
+ "id": "342b876f-b6d5-4eb7-badf-40cbae263305"
+ }
+ ],
+ "vip_address": "10.0.0.3",
+ "vip_port_id": "af578ae7-62cc-421b-a314-7f16601d5560",
+ "provider": "octavia",
+ "vip_subnet_id": "388c5684-86b0-49ab-90ef-944b1f7328f8",
+ "id": "863307e6-fe55-4fb3-97f7-b943c8072945",
+ "operating_status": "ONLINE",
+ "name": "myapp-detail-lb1"
+ }
+ ]
+}
diff --git a/core-test/src/main/resources/octavia/loadbalancerv2.json b/core-test/src/main/resources/octavia/loadbalancerv2.json
new file mode 100644
index 000000000..188e41961
--- /dev/null
+++ b/core-test/src/main/resources/octavia/loadbalancerv2.json
@@ -0,0 +1,18 @@
+{
+ "loadbalancer": {
+ "description": "im a baby lb",
+ "admin_state_up": false,
+ "project_id": "6f759d84e3ca496ab77f8c0ffaa0311e",
+ "provisioning_status": "ACTIVE",
+ "listeners": [
+
+ ],
+ "vip_address": "10.0.0.13",
+ "vip_port_id": "82fbaa1c-a8af-47d3-94fe-a0ac1a33257b",
+ "provider": "octavia",
+ "vip_subnet_id": "388c5684-86b0-49ab-90ef-944b1f7328f8",
+ "id": "282b71ea-9ceb-4cd6-8881-cb511af2edb5",
+ "operating_status": "ONLINE",
+ "name": "lb1"
+ }
+}
diff --git a/core-test/src/main/resources/octavia/loadbalancerv2_stats.json b/core-test/src/main/resources/octavia/loadbalancerv2_stats.json
new file mode 100644
index 000000000..bb9234995
--- /dev/null
+++ b/core-test/src/main/resources/octavia/loadbalancerv2_stats.json
@@ -0,0 +1,8 @@
+{
+ "stats": {
+ "bytes_in": 0,
+ "total_connections": 0,
+ "active_connections": 0,
+ "bytes_out": 0
+ }
+}
diff --git a/core-test/src/main/resources/octavia/loadbalancerv2_statuses.json b/core-test/src/main/resources/octavia/loadbalancerv2_statuses.json
new file mode 100644
index 000000000..474c0e8b4
--- /dev/null
+++ b/core-test/src/main/resources/octavia/loadbalancerv2_statuses.json
@@ -0,0 +1,40 @@
+{
+ "statuses": {
+ "loadbalancer": {
+ "name": "lb44",
+ "listeners": [
+ {
+ "pools": [
+ {
+ "name": "testlbpool44",
+ "provisioning_status": "ACTIVE",
+ "healthmonitor": {
+ "type": "HTTP",
+ "id": "0fe91da6-7815-44e2-9413-33f30f82b98b",
+ "provisioning_status": "ACTIVE"
+ },
+ "members": [
+ {
+ "protocol_port": 80,
+ "address": "10.0.0.17",
+ "id": "7abeda80-b9ff-4dfe-b4ee-1b7b9f8d70b1",
+ "operating_status": "DISABLED",
+ "provisioning_status": "ACTIVE"
+ }
+ ],
+ "id": "c245c7ed-9a58-4215-9572-39f767234e0c",
+ "operating_status": "DISABLED"
+ }
+ ],
+ "name": "listener44",
+ "id": "4e1dc45b-31b1-480d-850c-8ee86dd3713d",
+ "operating_status": "DISABLED",
+ "provisioning_status": "ACTIVE"
+ }
+ ],
+ "id": "d8b09924-d223-42a8-b7e7-410e60fd04c5",
+ "operating_status": "DISABLED",
+ "provisioning_status": "ACTIVE"
+ }
+ }
+}
diff --git a/core-test/src/main/resources/octavia/loadbalancerv2_update.json b/core-test/src/main/resources/octavia/loadbalancerv2_update.json
new file mode 100644
index 000000000..55475f302
--- /dev/null
+++ b/core-test/src/main/resources/octavia/loadbalancerv2_update.json
@@ -0,0 +1,18 @@
+{
+ "loadbalancer": {
+ "description": "im no longer a baby lb",
+ "admin_state_up": true,
+ "project_id": "6f759d84e3ca496ab77f8c0ffaa0311e",
+ "provisioning_status": "ACTIVE",
+ "listeners": [
+
+ ],
+ "vip_address": "10.0.0.13",
+ "vip_port_id": "82fbaa1c-a8af-47d3-94fe-a0ac1a33257b",
+ "provider": "octavia",
+ "vip_subnet_id": "388c5684-86b0-49ab-90ef-944b1f7328f8",
+ "id": "282b71ea-9ceb-4cd6-8881-cb511af2edb5",
+ "operating_status": "ONLINE",
+ "name": "lb_updated"
+ }
+}
diff --git a/core-test/src/main/resources/octavia/membersv2.json b/core-test/src/main/resources/octavia/membersv2.json
new file mode 100644
index 000000000..3ed756ec8
--- /dev/null
+++ b/core-test/src/main/resources/octavia/membersv2.json
@@ -0,0 +1,22 @@
+{
+ "members": [
+ {
+ "weight": 1,
+ "admin_state_up": true,
+ "subnet_id": "013d3059-87a4-45a5-91e9-d721068ae0b2",
+ "project_id": "1a3e005cf9ce40308c900bcb08e5320c",
+ "address": "10.0.0.8",
+ "protocol_port": 80,
+ "id": "9a7aff27-fd41-4ec1-ba4c-3eb92c629313"
+ },
+ {
+ "weight": 1,
+ "admin_state_up": false,
+ "subnet_id": "013d3059-87a4-45a5-91e9-d721068ae0b2",
+ "project_id": "1a3e005cf9ce40308c900bcb08e5320c",
+ "address": "10.0.0.9",
+ "protocol_port": 80,
+ "id": "4c0a0a5f-cf8f-44b7-b912-957daa8ce5e5"
+ }
+ ]
+}
diff --git a/core-test/src/main/resources/octavia/memberv2.json b/core-test/src/main/resources/octavia/memberv2.json
new file mode 100644
index 000000000..a3550116d
--- /dev/null
+++ b/core-test/src/main/resources/octavia/memberv2.json
@@ -0,0 +1,11 @@
+{
+ "member": {
+ "weight": 1,
+ "admin_state_up": true,
+ "subnet_id": "013d3059-87a4-45a5-91e9-d721068ae0b2",
+ "project_id": "1a3e005cf9ce40308c900bcb08e5320c",
+ "address": "10.0.0.8",
+ "protocol_port": 80,
+ "id": "9a7aff27-fd41-4ec1-ba4c-3eb92c629313"
+ }
+}
diff --git a/core-test/src/main/resources/octavia/memberv2_update.json b/core-test/src/main/resources/octavia/memberv2_update.json
new file mode 100644
index 000000000..6699b2fd8
--- /dev/null
+++ b/core-test/src/main/resources/octavia/memberv2_update.json
@@ -0,0 +1,11 @@
+{
+ "member": {
+ "weight": 2,
+ "admin_state_up": false,
+ "subnet_id": "013d3059-87a4-45a5-91e9-d721068ae0b2",
+ "project_id": "1a3e005cf9ce40308c900bcb08e5320c",
+ "address": "10.0.0.8",
+ "protocol_port": 80,
+ "id": "9a7aff27-fd41-4ec1-ba4c-3eb92c629313"
+ }
+}
diff --git a/core-test/src/main/resources/sahara/cluster_create_req.json b/core-test/src/main/resources/sahara/cluster_create_req.json
new file mode 100644
index 000000000..029964694
--- /dev/null
+++ b/core-test/src/main/resources/sahara/cluster_create_req.json
@@ -0,0 +1,29 @@
+{
+ "name" : "cluster-test-1",
+ "cluster_configs" : {
+ "HDFS" : {
+ "dfs.replication" : 1
+ },
+ "Spark" : {
+ "spark.executor.memory" : "1g",
+ "spark.executor.cores" : 2
+ }
+ },
+ "default_image_id" : "f56cc7c5-9588-49fa-8bcd-5c5d5eda5466",
+ "user_keypair_id" : "tester",
+ "plugin_name" : "spark",
+ "neutron_management_network" : "4c065f9c-ad1b-43c4-ba1e-893d330da079",
+ "node_groups" : [ {
+ "name" : "worker",
+ "count" : 2,
+ "node_group_template_id" : "f78dda4d-17e1-48cd-ab85-ee56261382ef",
+ "flavor_id" : "ef7f4d7f-267f-4762-abe2-729fe350256c"
+ }, {
+ "name" : "master",
+ "count" : 1,
+ "node_group_template_id" : "0febf422-98ee-47e6-a1c5-60f90f1f9c96",
+ "flavor_id" : "ef7f4d7f-267f-4762-abe2-729fe350256c"
+ } ],
+ "hadoop_version" : "1.6.2"
+}
+
diff --git a/core-test/src/main/resources/sahara/cluster_create_resp.json b/core-test/src/main/resources/sahara/cluster_create_resp.json
new file mode 100644
index 000000000..5154a807a
--- /dev/null
+++ b/core-test/src/main/resources/sahara/cluster_create_resp.json
@@ -0,0 +1,106 @@
+{
+ "cluster": {
+ "provision_progress": [],
+ "user_keypair_id": "tester",
+ "updated_at": "2017-08-04T08:33:44",
+ "is_transient": false,
+ "use_autoconfig": true,
+ "node_groups": [
+ {
+ "volume_local_to_instance": false,
+ "availability_zone": "nova",
+ "updated_at": null,
+ "instances": [],
+ "node_group_template_id": "f78dda4d-17e1-48cd-ab85-ee56261382ef",
+ "volumes_per_node": 0,
+ "id": "36f4ecc7-e098-4fbc-826b-e645a4e0561c",
+ "security_groups": [
+ "0a3f7e8d-3769-45ac-ac74-89efaa179404"
+ ],
+ "shares": [],
+ "node_configs": {
+ "HDFS": {}
+ },
+ "auto_security_group": false,
+ "volumes_availability_zone": null,
+ "volume_mount_prefix": "/volumes/disk",
+ "floating_ip_pool": "7c6358b6-11da-4da5-9ae6-cb42dd51f483",
+ "image_id": "f56cc7c5-9588-49fa-8bcd-5c5d5eda5466",
+ "volumes_size": null,
+ "is_proxy_gateway": false,
+ "count": 2,
+ "name": "worker",
+ "created_at": "2017-08-04T08:33:43",
+ "volume_type": null,
+ "node_processes": [
+ "datanode",
+ "slave"
+ ],
+ "flavor_id": "ef7f4d7f-267f-4762-abe2-729fe350256c",
+ "use_autoconfig": true
+ },
+ {
+ "volume_local_to_instance": false,
+ "availability_zone": "nova",
+ "updated_at": null,
+ "instances": [],
+ "node_group_template_id": "0febf422-98ee-47e6-a1c5-60f90f1f9c96",
+ "volumes_per_node": 0,
+ "id": "d4a382ca-6c9c-48ef-84c2-c9ad3360cd81",
+ "security_groups": [
+ "0a3f7e8d-3769-45ac-ac74-89efaa179404"
+ ],
+ "shares": [],
+ "node_configs": {
+ "HDFS": {}
+ },
+ "auto_security_group": false,
+ "volumes_availability_zone": null,
+ "volume_mount_prefix": "/volumes/disk",
+ "floating_ip_pool": "7c6358b6-11da-4da5-9ae6-cb42dd51f483",
+ "image_id": "f56cc7c5-9588-49fa-8bcd-5c5d5eda5466",
+ "volumes_size": null,
+ "is_proxy_gateway": false,
+ "count": 1,
+ "name": "master",
+ "created_at": "2017-08-04T08:33:43",
+ "volume_type": null,
+ "node_processes": [
+ "namenode",
+ "master"
+ ],
+ "flavor_id": "ef7f4d7f-267f-4762-abe2-729fe350256c",
+ "use_autoconfig": true
+ }
+ ],
+ "management_public_key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDaOGD3eWnT48rv3MlnF5D9z8B0Xw76IjlSt2fijRKUnlB3EAdMsi8QutO2Z+uPJXtZZsxfBvKabCpuSh5C6NWq2cjvEcb+HisXcRD5LDfJ7KUkNJRqJcHMiLMZv3WSfUSn37HXhPW09vz72Td8e0bkr7kbcbO5goc/hMoszP/Q5Yt62I6j6tgPBTr4mZuSXTlhIxg27RIvrHueWUhKL4iT3yCBgk+QU9PNRFDzHPg5ZLCAoQerOkj7yuN0iwWUvXx5McLQiLI5bB3th1Ov65rsLw+Me/WrTLHmbY2AK24gTQ8XtuLbKei84WGMkmZBQ15B27kC0uoos8EeiZcvO9cb Generated-by-Sahara\n",
+ "id": "c7ce1662-0ee7-4307-a7ed-a77fa1b0e667",
+ "trust_id": null,
+ "cluster_configs": {
+ "HDFS": {
+ "dfs.replication": 1
+ },
+ "Spark": {
+ "spark.executor.memory": "1g",
+ "spark.executor.cores": 2
+ }
+ },
+ "default_image_id": "f56cc7c5-9588-49fa-8bcd-5c5d5eda5466",
+ "domain_name": null,
+ "shares": null,
+ "status": "Validating",
+ "neutron_management_network": "4c065f9c-ad1b-43c4-ba1e-893d330da079",
+ "description": null,
+ "plugin_name": "spark",
+ "anti_affinity": [],
+ "is_public": false,
+ "status_description": "",
+ "hadoop_version": "1.6.2",
+ "info": {},
+ "cluster_template_id": null,
+ "name": "cluster-test-1",
+ "tenant_id": "31f13106bac54c1992077cca18f02c6e",
+ "created_at": "2017-08-04T08:33:43",
+ "is_protected": false
+ }
+}
diff --git a/core-test/src/main/resources/storage/v2/createVolume-muitiattach.json b/core-test/src/main/resources/storage/v2/createVolume-muitiattach.json
new file mode 100644
index 000000000..eba22690e
--- /dev/null
+++ b/core-test/src/main/resources/storage/v2/createVolume-muitiattach.json
@@ -0,0 +1,12 @@
+{
+ "volume": {
+ "id" : "ac9ae248-cf21-4301-87b1-568ff20a0a02",
+ "status" : "creating",
+ "size" : 10,
+ "zone" : "nova",
+ "created" : "Wed Aug 16 13:27:14 KST 2017",
+ "multiattach" : true,
+ "metadata" : {},
+ "bootable" : false
+ }
+}
\ No newline at end of file
diff --git a/core-test/src/main/resources/storage/v2/volume.json b/core-test/src/main/resources/storage/v2/volume.json
index 86d148068..366063e18 100644
--- a/core-test/src/main/resources/storage/v2/volume.json
+++ b/core-test/src/main/resources/storage/v2/volume.json
@@ -3,7 +3,7 @@
"status": "in-use",
"user_id": "92ac3530a6cb4d47aa406f1c2c90fca4",
"attachments": [{
- "host_name": null,
+ "host_name": "myhost",
"device": "/dev/vdd",
"server_id": "eaa6a54d-35c1-40ce-831d-bb61f991e1a9",
"id": "8a9287b7-4f4d-4213-8d75-63470f19f27c",
diff --git a/core-test/src/main/resources/workflow/action_def.json b/core-test/src/main/resources/workflow/action_def.json
new file mode 100644
index 000000000..c4fb5465e
--- /dev/null
+++ b/core-test/src/main/resources/workflow/action_def.json
@@ -0,0 +1,12 @@
+{
+ "id": "91fdedd9-43cd-4820-b017-a2b2fe600ef3",
+ "name": "concat",
+ "description": null,
+ "project_id": "",
+ "scope": "private",
+ "is_system": false,
+ "created_at": "2017-05-30 10:35:16",
+ "tags": ["test", "custom"],
+ "input": "s1, s2",
+ "definition": "---\nversion: '2.0'\n\nconcat:\n base: std.echo\n base-input:\n output: \"<% $.s1 %>+<% $.s2 %>\"\n input:\n - s1\n - s2\n"
+}
diff --git a/core-test/src/main/resources/workflow/action_def_create.json b/core-test/src/main/resources/workflow/action_def_create.json
new file mode 100644
index 000000000..38da6daa0
--- /dev/null
+++ b/core-test/src/main/resources/workflow/action_def_create.json
@@ -0,0 +1,16 @@
+{
+ "actions": [
+ {
+ "id": "91fdedd9-43cd-4820-b017-a2b2fe600ef3",
+ "name": "concat",
+ "description": null,
+ "project_id": "",
+ "scope": "private",
+ "is_system": false,
+ "created_at": "2017-05-30 10:35:16",
+ "tags": ["test", "custom"],
+ "input": "s1, s2",
+ "definition": "---\nversion: '2.0'\n\nconcat:\n base: std.echo\n base-input:\n output: \"<% $.s1 %>+<% $.s2 %>\"\n input:\n - s1\n - s2\n"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/core-test/src/main/resources/workflow/action_defs.json b/core-test/src/main/resources/workflow/action_defs.json
new file mode 100644
index 000000000..18369ad54
--- /dev/null
+++ b/core-test/src/main/resources/workflow/action_defs.json
@@ -0,0 +1,28 @@
+{
+ "actions": [
+ {
+ "id": "91fdedd9-43cd-4820-b017-a2b2fe600ef3",
+ "name": "concat",
+ "description": null,
+ "project_id": "",
+ "scope": "private",
+ "is_system": false,
+ "created_at": "2017-05-30 10:35:16",
+ "tags": ["test", "custom"],
+ "input": "s1, s2",
+ "definition": "---\nversion: '2.0'\n\nconcat:\n base: std.echo\n base-input:\n output: \"<% $.s1 %>+<% $.s2 %>\"\n input:\n - s1\n - s2\n"
+ },
+ {
+ "id": "91fdedd9-43cd-4820-b017-a2b2fe600ef4",
+ "name": "concat_twice",
+ "description": null,
+ "project_id": "",
+ "scope": "private",
+ "is_system": false,
+ "created_at": "2017-05-30 10:35:16",
+ "tags": [],
+ "input": "s1, s2",
+ "definition": "---\nversion: '2.0'\n\nconcat:\n base: std.echo\n base-input:\n output: \"<% $.s1 %>+<% $.s2 %>\"\n input:\n - s1\n - s2\n output: \"<% $ %> and <% $ %>\"\n"
+ }
+ ]
+}
diff --git a/core-test/src/main/resources/workflow/action_exec.json b/core-test/src/main/resources/workflow/action_exec.json
new file mode 100644
index 000000000..80fc7179c
--- /dev/null
+++ b/core-test/src/main/resources/workflow/action_exec.json
@@ -0,0 +1,20 @@
+{
+ "id": "294725fa-980d-436f-b882-a75cfeffa8c0",
+ "name": "std.noop",
+ "task_name": "task_1",
+ "description": "",
+ "created_at": "2016-08-17 10:34:00",
+ "updated_at": "2016-08-17 10:34:01",
+ "workflow_name": "parallel_join_2",
+ "task_execution_id": "c40c26cb-f695-4f20-8455-c57ca5c0770a",
+ "tags": null,
+ "input": {
+ "param1": "val1"
+ },
+ "output": {
+ "result": null
+ },
+ "state": "SUCCESS",
+ "state_info": null,
+ "accepted": true
+}
diff --git a/core-test/src/main/resources/workflow/action_exec_create.json b/core-test/src/main/resources/workflow/action_exec_create.json
new file mode 100644
index 000000000..80fc7179c
--- /dev/null
+++ b/core-test/src/main/resources/workflow/action_exec_create.json
@@ -0,0 +1,20 @@
+{
+ "id": "294725fa-980d-436f-b882-a75cfeffa8c0",
+ "name": "std.noop",
+ "task_name": "task_1",
+ "description": "",
+ "created_at": "2016-08-17 10:34:00",
+ "updated_at": "2016-08-17 10:34:01",
+ "workflow_name": "parallel_join_2",
+ "task_execution_id": "c40c26cb-f695-4f20-8455-c57ca5c0770a",
+ "tags": null,
+ "input": {
+ "param1": "val1"
+ },
+ "output": {
+ "result": null
+ },
+ "state": "SUCCESS",
+ "state_info": null,
+ "accepted": true
+}
diff --git a/core-test/src/main/resources/workflow/action_execs.json b/core-test/src/main/resources/workflow/action_execs.json
new file mode 100644
index 000000000..7db43476a
--- /dev/null
+++ b/core-test/src/main/resources/workflow/action_execs.json
@@ -0,0 +1,44 @@
+{
+ "action_executions": [
+ {
+ "id": "294725fa-980d-436f-b882-a75cfeffa8c0",
+ "name": "std.noop",
+ "task_name": "task_1",
+ "description": "",
+ "created_at": "2016-08-17 10:34:00",
+ "updated_at": "2016-08-17 10:34:01",
+ "workflow_name": "parallel_join_2",
+ "task_execution_id": "c40c26cb-f695-4f20-8455-c57ca5c0770a",
+ "tags": null,
+ "input": {
+ "param1": "val1"
+ },
+ "output": {
+ "result": null
+ },
+ "state": "SUCCESS",
+ "state_info": null,
+ "accepted": true
+ },
+ {
+ "id": "294725fa-980d-436f-b882-a75cfeffa8c0",
+ "name": "std.noop",
+ "task_name": "task_2",
+ "description": "",
+ "created_at": "2016-08-17 10:34:00",
+ "updated_at": "2016-08-17 10:34:01",
+ "workflow_name": "parallel_join_2",
+ "task_execution_id": "c40c26cb-f695-4f20-8455-c57ca5c0770a",
+ "tags": null,
+ "input": {
+ "param1": "val1"
+ },
+ "output": {
+ "result": null
+ },
+ "state": "ERROR",
+ "state_info": "Some error info",
+ "accepted": true
+ }
+ ]
+}
diff --git a/core-test/src/main/resources/workflow/cron_trigger.json b/core-test/src/main/resources/workflow/cron_trigger.json
new file mode 100644
index 000000000..cca5a7282
--- /dev/null
+++ b/core-test/src/main/resources/workflow/cron_trigger.json
@@ -0,0 +1,18 @@
+{
+ "id": "91fdedd9-43cd-4820-b017-a2b2fe600ef3",
+ "name": "my_trigger",
+ "scope": "private",
+ "created_at": "2017-05-30 10:35:16",
+ "updated_at": "2017-05-30 10:35:16",
+ "workflow_name": "my_wf",
+ "workflow_id" : "91fdedd9-43cd-4820-b017-a2b2fe600ef4",
+ "workflow_input": {
+ "param1": "val1",
+ "param2": "val2"
+ },
+ "workflow_params": {},
+ "pattern": "* * * * *",
+ "remaining_executions": 2,
+ "first_execution_time": "2017-05-30 10:35:16",
+ "next_execution_time": "2017-05-30 10:36:16"
+}
diff --git a/core-test/src/main/resources/workflow/cron_trigger_create.json b/core-test/src/main/resources/workflow/cron_trigger_create.json
new file mode 100644
index 000000000..4f053dbed
--- /dev/null
+++ b/core-test/src/main/resources/workflow/cron_trigger_create.json
@@ -0,0 +1,17 @@
+{
+ "id": "91fdedd9-43cd-4820-b017-a2b2fe600ef3",
+ "name": "my_trigger",
+ "scope": "private",
+ "created_at": "2017-05-30 10:35:16",
+ "workflow_name": "my_wf",
+ "workflow_id" : "91fdedd9-43cd-4820-b017-a2b2fe600ef4",
+ "workflow_input": {
+ "param1": "val1",
+ "param2": "val2"
+ },
+ "workflow_params": {},
+ "pattern": "* * * * *",
+ "remaining_executions": 2,
+ "first_execution_time": "2017-05-30 10:35:16",
+ "next_execution_time": "2017-05-30 10:36:16"
+}
diff --git a/core-test/src/main/resources/workflow/cron_triggers.json b/core-test/src/main/resources/workflow/cron_triggers.json
new file mode 100644
index 000000000..cdb71f7a9
--- /dev/null
+++ b/core-test/src/main/resources/workflow/cron_triggers.json
@@ -0,0 +1,40 @@
+{
+ "cron_triggers": [
+ {
+ "id": "91fdedd9-43cd-4820-b017-a2b2fe600ef3",
+ "name": "my_trigger1",
+ "scope": "private",
+ "created_at": "2017-05-30 10:35:16",
+ "updated_at": "2017-05-30 10:35:16",
+ "workflow_name": "my_wf",
+ "workflow_id": "91fdedd9-43cd-4820-b017-a2b2fe600ef4",
+ "workflow_input": {
+ "param1": "val1",
+ "param2": "val2"
+ },
+ "workflow_params": {},
+ "pattern": "* * * * *",
+ "remaining_executions": 2,
+ "first_execution_time": "2017-05-30 10:35:16",
+ "next_execution_time": "2017-05-30 10:36:16"
+ },
+ {
+ "id": "91fdedd9-43cd-4820-b017-a2b2fe600ef3",
+ "name": "my_trigger2",
+ "scope": "public",
+ "created_at": "2017-05-30 10:35:16",
+ "updated_at": "2017-05-30 10:35:16",
+ "workflow_name": "my_wf",
+ "workflow_id": "91fdedd9-43cd-4820-b017-a2b2fe600ef4",
+ "workflow_input": {
+ "param1": "val1"
+ },
+ "workflow_params": {},
+ "pattern": "* * * * */5",
+ "remaining_executions": 1,
+ "first_execution_time": "2017-05-30 10:35:16",
+ "next_execution_time": "2017-05-30 10:36:16"
+ }
+ ]
+}
+
diff --git a/core-test/src/main/resources/workflow/new_action.yaml b/core-test/src/main/resources/workflow/new_action.yaml
new file mode 100644
index 000000000..1ebed394a
--- /dev/null
+++ b/core-test/src/main/resources/workflow/new_action.yaml
@@ -0,0 +1,10 @@
+---
+version: '2.0'
+
+concat:
+ base: std.echo
+ base-input:
+ output: "<% $.s1 %>+<% $.s2 %>"
+ input:
+ - s1
+ - s2
diff --git a/core-test/src/main/resources/workflow/new_wb.yaml b/core-test/src/main/resources/workflow/new_wb.yaml
new file mode 100644
index 000000000..de779389b
--- /dev/null
+++ b/core-test/src/main/resources/workflow/new_wb.yaml
@@ -0,0 +1,11 @@
+---
+version: '2.0'
+
+name: my_wb
+
+workflows:
+ with_items_40:
+ tasks:
+ task1:
+ with-items: i in <% range(0, 40) %>
+ action: std.echo output=<% $.i %>
diff --git a/core-test/src/main/resources/workflow/new_wf.yaml b/core-test/src/main/resources/workflow/new_wf.yaml
new file mode 100644
index 000000000..5eedab4b2
--- /dev/null
+++ b/core-test/src/main/resources/workflow/new_wf.yaml
@@ -0,0 +1,8 @@
+---
+version: '2.0'
+
+with_items_40:
+ tasks:
+ task1:
+ with-items: i in <% range(0, 40) %>
+ action: std.echo output=<% $.i %>
diff --git a/core-test/src/main/resources/workflow/new_wf_exec.json b/core-test/src/main/resources/workflow/new_wf_exec.json
new file mode 100644
index 000000000..0d6f8213f
--- /dev/null
+++ b/core-test/src/main/resources/workflow/new_wf_exec.json
@@ -0,0 +1,5 @@
+{
+ "workflow_name": "parallel_join_2",
+ "params": "{}",
+ "input": "{}"
+}
diff --git a/core-test/src/main/resources/workflow/task_exec.json b/core-test/src/main/resources/workflow/task_exec.json
new file mode 100644
index 000000000..06895a908
--- /dev/null
+++ b/core-test/src/main/resources/workflow/task_exec.json
@@ -0,0 +1,16 @@
+{
+ "id": "6e7cce36-1ab2-45c8-baf5-88d5d726ea1d",
+ "name": "join_task",
+ "type": "ACTION",
+ "created_at": "2016-08-17 10:34:02",
+ "updated_at": "2016-08-17 10:34:04",
+ "workflow_name": "parallel_join_2",
+ "workflow_id": "0169affc-e6a1-4013-a59e-c89dfd5523f2",
+ "workflow_execution_id": "79d187f4-b8e5-4288-b2cd-ed27ee31e4b0",
+ "state": "SUCCESS",
+ "state_info": null,
+ "runtime_context": {"retry_cnt": 1},
+ "published": {"my_var": "my_val"},
+ "result": "my task result",
+ "processed": true
+}
diff --git a/core-test/src/main/resources/workflow/task_execs.json b/core-test/src/main/resources/workflow/task_execs.json
new file mode 100644
index 000000000..d8ea91bd2
--- /dev/null
+++ b/core-test/src/main/resources/workflow/task_execs.json
@@ -0,0 +1,36 @@
+{
+ "tasks": [
+ {
+ "id": "6e7cce36-1ab2-45c8-baf5-88d5d726ea1d",
+ "name": "join_task",
+ "type": "ACTION",
+ "created_at": "2016-08-17 10:34:02",
+ "updated_at": "2016-08-17 10:34:04",
+ "workflow_name": "parallel_join_2",
+ "workflow_id": "0169affc-e6a1-4013-a59e-c89dfd5523f2",
+ "workflow_execution_id": "79d187f4-b8e5-4288-b2cd-ed27ee31e4b0",
+ "state": "SUCCESS",
+ "state_info": null,
+ "runtime_context": {"retry_cnt": 1},
+ "published": {"my_var": "my_val"},
+ "result": "my task result",
+ "processed": true
+ },
+ {
+ "id": "6e7cce36-1ab2-45c8-baf5-88d5d726ea1d",
+ "name": "task1",
+ "type": "WORKFLOW",
+ "created_at": "2016-08-17 10:34:02",
+ "updated_at": "2016-08-17 10:34:04",
+ "workflow_name": "parallel_join_2",
+ "workflow_id": "0169affc-e6a1-4013-a59e-c89dfd5523f2",
+ "workflow_execution_id": "79d187f4-b8e5-4288-b2cd-ed27ee31e4b0",
+ "state": "ERROR",
+ "state_info": "Some error info",
+ "runtime_context": {"retry_cnt": 1},
+ "published": {"my_var": "my_val"},
+ "result": "my task result",
+ "processed": false
+ }
+ ]
+}
diff --git a/core-test/src/main/resources/workflow/wb_def.json b/core-test/src/main/resources/workflow/wb_def.json
new file mode 100644
index 000000000..99712d120
--- /dev/null
+++ b/core-test/src/main/resources/workflow/wb_def.json
@@ -0,0 +1,9 @@
+{
+ "id": "3882c3a2-9125-46ae-8c80-4d94982f4d73",
+ "name": "my_wb",
+ "created_at": "2017-05-30 08:40:29",
+ "project_id": "",
+ "scope": "private",
+ "tags": ["test", "private"],
+ "definition": "---\nversion: '2.0'\n\nname: my_wb\n\nworkflows:\n with_items_40:\n tasks:\n task1:\n with-items: i in <% range(0, 40) %>\n action: std.echo output=<% $.i %>\n"
+}
\ No newline at end of file
diff --git a/core-test/src/main/resources/workflow/wb_def_create.json b/core-test/src/main/resources/workflow/wb_def_create.json
new file mode 100644
index 000000000..99712d120
--- /dev/null
+++ b/core-test/src/main/resources/workflow/wb_def_create.json
@@ -0,0 +1,9 @@
+{
+ "id": "3882c3a2-9125-46ae-8c80-4d94982f4d73",
+ "name": "my_wb",
+ "created_at": "2017-05-30 08:40:29",
+ "project_id": "",
+ "scope": "private",
+ "tags": ["test", "private"],
+ "definition": "---\nversion: '2.0'\n\nname: my_wb\n\nworkflows:\n with_items_40:\n tasks:\n task1:\n with-items: i in <% range(0, 40) %>\n action: std.echo output=<% $.i %>\n"
+}
\ No newline at end of file
diff --git a/core-test/src/main/resources/workflow/wb_defs.json b/core-test/src/main/resources/workflow/wb_defs.json
new file mode 100644
index 000000000..95336d421
--- /dev/null
+++ b/core-test/src/main/resources/workflow/wb_defs.json
@@ -0,0 +1,22 @@
+{
+ "workbooks": [
+ {
+ "id": "3882c3a2-9125-46ae-8c80-4d94982f4d73",
+ "name": "my_wb0",
+ "created_at": "2017-05-30 08:40:29",
+ "project_id": "",
+ "scope": "private",
+ "tags": ["test", "private"],
+ "definition": "---\nversion: '2.0'\n\nparallel_join_2:\n tasks:\n join_task:\n join: all\n task_1:\n on-success: join_task\n task_2:\n on-success: join_task\n"
+ },
+ {
+ "id": "3882c3a2-9125-46ae-8c80-4d94982f4d73",
+ "name": "my_wb1",
+ "created_at": "2017-05-30 08:40:29",
+ "project_id": "",
+ "scope": "private",
+ "tags": [],
+ "definition": "---\nversion: '2.0'\n\nname: my_wb\n\nworkflows:\n with_items_40:\n tasks:\n task1:\n with-items: i in <% range(0, 40) %>\n action: std.echo output=<% $.i %>\n"
+ }
+ ]
+}
diff --git a/core-test/src/main/resources/workflow/wf_def.json b/core-test/src/main/resources/workflow/wf_def.json
new file mode 100644
index 000000000..43ef2e6b7
--- /dev/null
+++ b/core-test/src/main/resources/workflow/wf_def.json
@@ -0,0 +1,11 @@
+{
+ "id": "0169affc-e6a1-4013-a59e-c89dfd5523f2",
+ "name": "parallel_join_2",
+ "tags": ["test", "private"],
+ "project_id": "",
+ "scope": "private",
+ "created_at": "2016-08-17 10:33:24",
+ "updated_at": null,
+ "definition": "---\nversion: '2.0'\n\nparallel_join_2:\n tasks:\n join_task:\n join: all\n task_1:\n on-success: join_task\n task_2:\n on-success: join_task\n",
+ "input": ""
+}
\ No newline at end of file
diff --git a/core-test/src/main/resources/workflow/wf_def_create.json b/core-test/src/main/resources/workflow/wf_def_create.json
new file mode 100644
index 000000000..7b9eea0ce
--- /dev/null
+++ b/core-test/src/main/resources/workflow/wf_def_create.json
@@ -0,0 +1,14 @@
+{
+ "workflows": [
+ {
+ "id": "68d49c72-1297-44d2-a686-0296a45241cb",
+ "name": "with_items_40",
+ "tags": ["test", "private"],
+ "project_id": "",
+ "scope": "private",
+ "created_at": "2017-05-02 09:30:21",
+ "definition": "---\nversion: '2.0'\n\nwith_items_40:\n tasks:\n task1:\n with-items: i in <% range(0, 40) %>\n action: std.echo output=<% $.i %>\n",
+ "input": ""
+ }
+ ]
+}
\ No newline at end of file
diff --git a/core-test/src/main/resources/workflow/wf_defs.json b/core-test/src/main/resources/workflow/wf_defs.json
new file mode 100644
index 000000000..ff7febe99
--- /dev/null
+++ b/core-test/src/main/resources/workflow/wf_defs.json
@@ -0,0 +1,26 @@
+{
+ "workflows": [
+ {
+ "id": "0169affc-e6a1-4013-a59e-c89dfd5523f2",
+ "name": "parallel_join_2",
+ "tags": ["test", "private"],
+ "project_id": "",
+ "scope": "private",
+ "created_at": "2016-08-17 10:33:24",
+ "updated_at": null,
+ "definition": "---\nversion: '2.0'\n\nparallel_join_2:\n tasks:\n join_task:\n join: all\n task_1:\n on-success: join_task\n task_2:\n on-success: join_task\n",
+ "input": ""
+ },
+ {
+ "id": "108e5a8e-9af9-4d07-a454-3a856c3b4026",
+ "name": "with_items_50",
+ "tags": [],
+ "project_id": "",
+ "scope": "private",
+ "created_at": null,
+ "updated_at": "2016-12-20 07:02:17",
+ "definition": "---\nversion: '2.0'\n\nwith_items_50:\n tasks:\n task1:\n with-items: i in <% range(0, 50) %>\n action: std.echo output=<% $.i %>\n",
+ "input": ""
+ }
+ ]
+}
diff --git a/core-test/src/main/resources/workflow/wf_env.json b/core-test/src/main/resources/workflow/wf_env.json
new file mode 100644
index 000000000..97d36b2e0
--- /dev/null
+++ b/core-test/src/main/resources/workflow/wf_env.json
@@ -0,0 +1,13 @@
+{
+ "id": "91fdedd9-43cd-4820-b017-a2b2fe600ef3",
+ "name": "my_env",
+ "description": "This is my test environment",
+ "project_id": "",
+ "scope": "private",
+ "created_at": "2017-05-30 10:35:16",
+ "updated_at": "2017-05-30 10:35:16",
+ "variables": {
+ "var1": "val1",
+ "var2": "val2"
+ }
+}
diff --git a/core-test/src/main/resources/workflow/wf_env_create.json b/core-test/src/main/resources/workflow/wf_env_create.json
new file mode 100644
index 000000000..97d36b2e0
--- /dev/null
+++ b/core-test/src/main/resources/workflow/wf_env_create.json
@@ -0,0 +1,13 @@
+{
+ "id": "91fdedd9-43cd-4820-b017-a2b2fe600ef3",
+ "name": "my_env",
+ "description": "This is my test environment",
+ "project_id": "",
+ "scope": "private",
+ "created_at": "2017-05-30 10:35:16",
+ "updated_at": "2017-05-30 10:35:16",
+ "variables": {
+ "var1": "val1",
+ "var2": "val2"
+ }
+}
diff --git a/core-test/src/main/resources/workflow/wf_envs.json b/core-test/src/main/resources/workflow/wf_envs.json
new file mode 100644
index 000000000..39bd0e261
--- /dev/null
+++ b/core-test/src/main/resources/workflow/wf_envs.json
@@ -0,0 +1,30 @@
+{
+ "environments": [
+ {
+ "id": "91fdedd9-43cd-4820-b017-a2b2fe600ef3",
+ "name": "my_env1",
+ "description": "This is my test environment 1",
+ "project_id": "",
+ "scope": "private",
+ "created_at": "2017-05-30 10:35:16",
+ "updated_at": "2017-05-30 10:35:16",
+ "variables": {
+ "var1": "val1",
+ "var2": "val2"
+ }
+ },
+ {
+ "id": "91fdedd9-43cd-4820-b017-a2b2fe600ef3",
+ "name": "my_env2",
+ "description": "This is my test environment 2",
+ "project_id": "",
+ "scope": "public",
+ "created_at": "2017-05-30 10:35:16",
+ "updated_at": "2017-05-30 10:35:16",
+ "variables": {
+ "var3": "val3",
+ "var4": "val4"
+ }
+ }
+ ]
+}
diff --git a/core-test/src/main/resources/workflow/wf_exec.json b/core-test/src/main/resources/workflow/wf_exec.json
new file mode 100644
index 000000000..4f2c2ec28
--- /dev/null
+++ b/core-test/src/main/resources/workflow/wf_exec.json
@@ -0,0 +1,13 @@
+{
+ "id": "79d187f4-b8e5-4288-b2cd-ed27ee31e4b0",
+ "description": "",
+ "created_at": "2016-08-17 10:34:00",
+ "updated_at": "2016-08-17 10:34:02",
+ "workflow_id": "0169affc-e6a1-4013-a59e-c89dfd5523f2",
+ "workflow_name": "parallel_join_2",
+ "params": {},
+ "input": {},
+ "state": "SUCCESS",
+ "state_info": null,
+ "task_execution_id": null
+}
diff --git a/core-test/src/main/resources/workflow/wf_exec_create.json b/core-test/src/main/resources/workflow/wf_exec_create.json
new file mode 100644
index 000000000..5e6fb9b8e
--- /dev/null
+++ b/core-test/src/main/resources/workflow/wf_exec_create.json
@@ -0,0 +1,12 @@
+{
+ "id": "79d187f4-b8e5-4288-b2cd-ed27ee31e4b0",
+ "description": "",
+ "created_at": "2016-08-17 10:34:00",
+ "workflow_id": "0169affc-e6a1-4013-a59e-c89dfd5523f2",
+ "workflow_name": "parallel_join_2",
+ "params": {"env": "my_env"},
+ "input": {},
+ "state": "RUNNING",
+ "state_info": null,
+ "task_execution_id": null
+}
diff --git a/core-test/src/main/resources/workflow/wf_execs.json b/core-test/src/main/resources/workflow/wf_execs.json
new file mode 100644
index 000000000..f90dd41a2
--- /dev/null
+++ b/core-test/src/main/resources/workflow/wf_execs.json
@@ -0,0 +1,31 @@
+{
+ "executions": [
+ {
+ "id": "79d187f4-b8e5-4288-b2cd-ed27ee31e4b0",
+ "description": "",
+ "created_at": "2016-08-17 10:34:00",
+ "updated_at": "2016-08-17 10:34:02",
+ "workflow_id": "0169affc-e6a1-4013-a59e-c89dfd5523f2",
+ "workflow_name": "parallel_join_2",
+ "params": {},
+ "input": {},
+ "state": "SUCCESS",
+ "state_info": null,
+ "task_execution_id": null
+ },
+ {
+ "id": "7af6a8e3-96f1-4928-8363-e244032b5419",
+ "description": "",
+ "created_at": "2016-08-17 10:35:05",
+ "updated_at": "2016-08-17 10:35:05",
+ "tags": ["test", "private"],
+ "workflow_id": "0169affc-e6a1-4013-a59e-c89dfd5523f2",
+ "workflow_name": "parallel_join_2",
+ "params": {},
+ "input": {},
+ "state": "ERROR",
+ "state_info": "Failed for reason X",
+ "task_execution_id": null
+ }
+ ]
+}
diff --git a/core/pom.xml b/core/pom.xml
index eaededef9..6fc6cc9dc 100644
--- a/core/pom.xml
+++ b/core/pom.xml
@@ -2,7 +2,7 @@
org.pacesys
openstack4j-parent
- 3.0.5-SNAPSHOT
+ 3.1.1-SNAPSHOT
4.0.0
openstack4j-core
@@ -74,7 +74,6 @@
!org.openstack*,
- !com.fasterxml.jackson.dataformat.yaml.snakeyaml,
*