--- /dev/null
+//required for groovy base path script in pom.xml
\ No newline at end of file
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.onap.so.libs</groupId>
- <artifactId>openstack-java-sdk</artifactId>
- <version>1.4.0-SNAPSHOT</version>
- </parent>
- <groupId>org.onap.so.libs.openstack-java-sdk</groupId>
- <artifactId>ceilometer-client</artifactId>
- <name>OpenStack Ceilometer Client</name>
- <description>OpenStack Ceilometer Client</description>
- <dependencies>
- <dependency>
- <groupId>org.onap.so.libs.openstack-java-sdk</groupId>
- <artifactId>openstack-client</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.onap.so.libs.openstack-java-sdk</groupId>
- <artifactId>ceilometer-model</artifactId>
- <version>${project.version}</version>
- </dependency>
- </dependencies>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.onap.so.libs</groupId>
+ <artifactId>openstack-java-sdk</artifactId>
+ <version>1.4.0-SNAPSHOT</version>
+ </parent>
+ <groupId>org.onap.so.libs.openstack-java-sdk</groupId>
+ <artifactId>ceilometer-client</artifactId>
+ <name>OpenStack Ceilometer Client</name>
+ <description>OpenStack Ceilometer Client</description>
+ <dependencies>
+ <dependency>
+ <groupId>org.onap.so.libs.openstack-java-sdk</groupId>
+ <artifactId>openstack-client</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.so.libs.openstack-java-sdk</groupId>
+ <artifactId>ceilometer-model</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
</project>
import com.woorea.openstack.ceilometer.v2.api.ResourcesResource;
public class Ceilometer extends OpenStackClient {
-
+
private final MetersResource meters;
-
+
private final ResourcesResource resources;
-
+
public Ceilometer(String endpoint, OpenStackClientConnector connector) {
super(endpoint, connector);
meters = new MetersResource(this);
resources = new ResourcesResource(this);
}
-
+
public Ceilometer(String endpoint) {
this(endpoint, null);
-
+
}
-
+
public ResourcesResource resources() {
return resources;
}
-
+
public MetersResource meters() {
return meters;
}
-
+
}
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
-
import com.woorea.openstack.base.client.OpenStackRequest;
-public abstract class QueriableCeilometerCommand<T,R> extends OpenStackRequest<R> {
+public abstract class QueriableCeilometerCommand<T, R> extends OpenStackRequest<R> {
protected List<String> fields = new ArrayList<>();
return filter(field, "gt", value);
}
-}
\ No newline at end of file
+}
}
-}
\ No newline at end of file
+}
package com.woorea.openstack.ceilometer.v2.api;
import java.util.List;
-
import com.woorea.openstack.base.client.OpenStackClient;
import com.woorea.openstack.base.client.OpenStackRequest;
import com.woorea.openstack.ceilometer.QueriableCeilometerCommand;
}
-}
\ No newline at end of file
+}
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.onap.so.libs</groupId>
- <artifactId>openstack-java-sdk</artifactId>
- <version>1.4.0-SNAPSHOT</version>
- </parent>
- <groupId>org.onap.so.libs.openstack-java-sdk</groupId>
- <artifactId>ceilometer-model</artifactId>
- <name>OpenStack Ceilometer Model</name>
- <description>OpenStack Ceilometer Model</description>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.onap.so.libs</groupId>
+ <artifactId>openstack-java-sdk</artifactId>
+ <version>1.4.0-SNAPSHOT</version>
+ </parent>
+ <groupId>org.onap.so.libs.openstack-java-sdk</groupId>
+ <artifactId>ceilometer-model</artifactId>
+ <name>OpenStack Ceilometer Model</name>
+ <description>OpenStack Ceilometer Model</description>
- <dependencies>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.skyscreamer</groupId>
- <artifactId>jsonassert</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.skyscreamer</groupId>
+ <artifactId>jsonassert</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
</project>
@JsonProperty("user_id")
private String user;
-
-
+
+
private String name;
-
+
@JsonProperty("resource_id")
private String resource;
-
+
@JsonProperty("project_id")
private String project;
-
+
private String type;
-
+
private String unit;
public String getUser() {
@Override
public String toString() {
- return "Meter [user=" + user + ", name=" + name + ", resource="
- + resource + ", project=" + project + ", type=" + type
- + ", unit=" + unit + "]";
+ return "Meter [user=" + user + ", name=" + name + ", resource=" + resource + ", project=" + project + ", type="
+ + type + ", unit=" + unit + "]";
}
}
package com.woorea.openstack.ceilometer.v2.model;
import java.util.Map;
-
import com.fasterxml.jackson.annotation.JsonProperty;
public class Resource {
-
+
@JsonProperty("resource_id")
private String resource;
-
+
private String timestamp;
-
+
@JsonProperty("project_id")
private String project;
-
+
@JsonProperty("user_id")
private String user;
-
+
private Map<String, Object> metadata;
public String getResource() {
@Override
public String toString() {
- return "Resource [resource=" + resource + ", timestamp=" + timestamp
- + ", project=" + project + ", user=" + user + ", metadata="
- + metadata + "]";
+ return "Resource [resource=" + resource + ", timestamp=" + timestamp + ", project=" + project + ", user=" + user
+ + ", metadata=" + metadata + "]";
}
-
+
}
package com.woorea.openstack.ceilometer.v2.model;
import java.util.Map;
-
import com.fasterxml.jackson.annotation.JsonProperty;
public class Sample {
@JsonProperty("counter_name")
private String counterName;
-
+
@JsonProperty("counter_unit")
private String counterUnit;
-
+
@JsonProperty("counter_volume")
private String counterVolume;
-
+
private String source;
-
+
@JsonProperty("project_id")
private String project;
-
+
@JsonProperty("user_id")
private String user;
-
+
@JsonProperty("resource_id")
private String resource;
-
+
private String timestamp;
-
+
@JsonProperty("message_id")
private String message;
-
+
@JsonProperty("resource_metadata")
private Map<String, Object> metadata;
@Override
public String toString() {
- return "Sample [counterType=" + counterType + ", counterName="
- + counterName + ", counterUnit=" + counterUnit
- + ", counterVolume=" + counterVolume + ", source=" + source
- + ", project=" + project + ", user=" + user + ", resource="
- + resource + ", timestamp=" + timestamp + ", message="
- + message + ", metadata=" + metadata + "]";
+ return "Sample [counterType=" + counterType + ", counterName=" + counterName + ", counterUnit=" + counterUnit
+ + ", counterVolume=" + counterVolume + ", source=" + source + ", project=" + project + ", user=" + user
+ + ", resource=" + resource + ", timestamp=" + timestamp + ", message=" + message + ", metadata="
+ + metadata + "]";
}
-
+
}
package com.woorea.openstack.ceilometer.v2.model;
import java.math.BigDecimal;
-
import com.fasterxml.jackson.annotation.JsonProperty;
public class Statistics {
-
+
private BigDecimal avg;
-
+
private BigDecimal count;
-
+
private BigDecimal duration;
-
+
@JsonProperty("duration_start")
private String durationStart;
-
+
@JsonProperty("duration_end")
private String durationEnd;
-
+
private BigDecimal max;
-
+
private BigDecimal min;
-
+
private BigDecimal period;
-
+
@JsonProperty("period_start")
private String periodStart;
-
+
@JsonProperty("period_end")
private String periodEnd;
-
+
private BigDecimal sum;
public BigDecimal getAvg() {
@Override
public String toString() {
- return "Statistics [avg=" + avg + ", count=" + count + ", duration="
- + duration + ", durationStart=" + durationStart
- + ", durationEnd=" + durationEnd + ", max=" + max + ", min="
- + min + ", period=" + period + ", periodStart=" + periodStart
- + ", periodEnd=" + periodEnd + ", sum=" + sum + "]";
+ return "Statistics [avg=" + avg + ", count=" + count + ", duration=" + duration + ", durationStart="
+ + durationStart + ", durationEnd=" + durationEnd + ", max=" + max + ", min=" + min + ", period="
+ + period + ", periodStart=" + periodStart + ", periodEnd=" + periodEnd + ", sum=" + sum + "]";
}
-
+
}
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"name\" : \"name\"," + EOL
- + " \"type\" : \"type\"," + EOL
- + " \"unit\" : \"unit\"," + EOL
- + " \"user_id\" : \"user\"," + EOL
- + " \"resource_id\" : \"resource\"," + EOL
- + " \"project_id\" : \"project\"" + EOL
- + "}";
+ private static final String JSON_FULL = "{" + EOL + " \"name\" : \"name\"," + EOL + " \"type\" : \"type\"," + EOL
+ + " \"unit\" : \"unit\"," + EOL + " \"user_id\" : \"user\"," + EOL + " \"resource_id\" : \"resource\","
+ + EOL + " \"project_id\" : \"project\"" + EOL + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
Meter meter = objectMapper.readValue(JSON_FULL, Meter.class);
meter.toString();
-
+
String unit = meter.getUnit();
Assert.assertNotNull(unit);
-
+
String resource = meter.getResource();
Assert.assertNotNull(resource);
-
+
String name = meter.getName();
Assert.assertNotNull(name);
-
+
String project = meter.getProject();
Assert.assertNotNull(project);
-
+
String type = meter.getType();
Assert.assertNotNull(type);
-
+
String user = meter.getUser();
Assert.assertNotNull(user);
}
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
-
import java.util.Map;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"timestamp\" : \"timestamp\"," + EOL
- + " \"metadata\" : {" + EOL
- + " \"metadata-k1\" : \"metadata-v1\"," + EOL
- + " \"metadata-k2\" : \"metadata-v2\"" + EOL
- + " }," + EOL
- + " \"resource_id\" : \"resource\"," + EOL
- + " \"project_id\" : \"project\"," + EOL
- + " \"user_id\" : \"user\"" + EOL
- + "}";
+ private static final String JSON_FULL = "{" + EOL + " \"timestamp\" : \"timestamp\"," + EOL + " \"metadata\" : {"
+ + EOL + " \"metadata-k1\" : \"metadata-v1\"," + EOL + " \"metadata-k2\" : \"metadata-v2\"" + EOL
+ + " }," + EOL + " \"resource_id\" : \"resource\"," + EOL + " \"project_id\" : \"project\"," + EOL
+ + " \"user_id\" : \"user\"" + EOL + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
Resource resource = objectMapper.readValue(JSON_FULL, Resource.class);
resource.toString();
-
- Map<String,Object> metadata = resource.getMetadata();
+
+ Map<String, Object> metadata = resource.getMetadata();
Assert.assertNotNull(metadata);
Assert.assertEquals(2, metadata.size());
-
+
String resourceProperty = resource.getResource();
Assert.assertNotNull(resourceProperty);
-
+
String project = resource.getProject();
Assert.assertNotNull(project);
-
+
String user = resource.getUser();
Assert.assertNotNull(user);
-
+
String timestamp = resource.getTimestamp();
Assert.assertNotNull(timestamp);
}
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
-
import java.util.Map;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"source\" : \"source\"," + EOL
- + " \"timestamp\" : \"timestamp\"," + EOL
- + " \"counter_type\" : \"countertype\"," + EOL
- + " \"counter_name\" : \"countername\"," + EOL
- + " \"counter_unit\" : \"counterunit\"," + EOL
- + " \"counter_volume\" : \"countervolume\"," + EOL
- + " \"project_id\" : \"project\"," + EOL
- + " \"user_id\" : \"user\"," + EOL
- + " \"resource_id\" : \"resource\"," + EOL
- + " \"message_id\" : \"message\"," + EOL
- + " \"resource_metadata\" : {" + EOL
- + " \"metadata-k1\" : \"metadata-v1\"," + EOL
- + " \"metadata-k2\" : \"metadata-v2\"" + EOL
- + " }" + EOL
- + "}";
-
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private static final String JSON_FULL =
+ "{" + EOL + " \"source\" : \"source\"," + EOL + " \"timestamp\" : \"timestamp\"," + EOL
+ + " \"counter_type\" : \"countertype\"," + EOL + " \"counter_name\" : \"countername\"," + EOL
+ + " \"counter_unit\" : \"counterunit\"," + EOL + " \"counter_volume\" : \"countervolume\"," + EOL
+ + " \"project_id\" : \"project\"," + EOL + " \"user_id\" : \"user\"," + EOL
+ + " \"resource_id\" : \"resource\"," + EOL + " \"message_id\" : \"message\"," + EOL
+ + " \"resource_metadata\" : {" + EOL + " \"metadata-k1\" : \"metadata-v1\"," + EOL
+ + " \"metadata-k2\" : \"metadata-v2\"" + EOL + " }" + EOL + "}";
+
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
Sample sample = objectMapper.readValue(JSON_FULL, Sample.class);
sample.toString();
-
+
String counterName = sample.getCounterName();
Assert.assertNotNull(counterName);
-
- Map<String,Object> metadata = sample.getMetadata();
+
+ Map<String, Object> metadata = sample.getMetadata();
Assert.assertNotNull(metadata);
Assert.assertEquals(2, metadata.size());
-
+
String resource = sample.getResource();
Assert.assertNotNull(resource);
-
+
String counterVolume = sample.getCounterVolume();
Assert.assertNotNull(counterVolume);
-
+
String project = sample.getProject();
Assert.assertNotNull(project);
-
+
String counterUnit = sample.getCounterUnit();
Assert.assertNotNull(counterUnit);
-
+
String source = sample.getSource();
Assert.assertNotNull(source);
-
+
String counterType = sample.getCounterType();
Assert.assertNotNull(counterType);
-
+
String message = sample.getMessage();
Assert.assertNotNull(message);
-
+
String user = sample.getUser();
Assert.assertNotNull(user);
-
+
String timestamp = sample.getTimestamp();
Assert.assertNotNull(timestamp);
}
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
-
import java.math.BigDecimal;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"avg\" : 79," + EOL
- + " \"count\" : 14," + EOL
- + " \"duration\" : 31," + EOL
- + " \"max\" : 87," + EOL
- + " \"min\" : 85," + EOL
- + " \"period\" : 4," + EOL
- + " \"sum\" : 2," + EOL
- + " \"duration_start\" : \"durationstart\"," + EOL
- + " \"duration_end\" : \"durationend\"," + EOL
- + " \"period_start\" : \"periodstart\"," + EOL
- + " \"period_end\" : \"periodend\"" + EOL
- + "}";
-
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private static final String JSON_FULL = "{" + EOL + " \"avg\" : 79," + EOL + " \"count\" : 14," + EOL
+ + " \"duration\" : 31," + EOL + " \"max\" : 87," + EOL + " \"min\" : 85," + EOL + " \"period\" : 4,"
+ + EOL + " \"sum\" : 2," + EOL + " \"duration_start\" : \"durationstart\"," + EOL
+ + " \"duration_end\" : \"durationend\"," + EOL + " \"period_start\" : \"periodstart\"," + EOL
+ + " \"period_end\" : \"periodend\"" + EOL + "}";
+
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
Statistics statistics = objectMapper.readValue(JSON_FULL, Statistics.class);
statistics.toString();
-
+
BigDecimal duration = statistics.getDuration();
Assert.assertNotNull(duration);
-
+
BigDecimal period = statistics.getPeriod();
Assert.assertNotNull(period);
-
+
BigDecimal avg = statistics.getAvg();
Assert.assertNotNull(avg);
-
+
BigDecimal min = statistics.getMin();
Assert.assertNotNull(min);
-
+
String durationStart = statistics.getDurationStart();
Assert.assertNotNull(durationStart);
-
+
BigDecimal max = statistics.getMax();
Assert.assertNotNull(max);
-
+
String durationEnd = statistics.getDurationEnd();
Assert.assertNotNull(durationEnd);
-
+
BigDecimal count = statistics.getCount();
Assert.assertNotNull(count);
-
+
BigDecimal sum = statistics.getSum();
Assert.assertNotNull(sum);
-
+
String periodStart = statistics.getPeriodStart();
Assert.assertNotNull(periodStart);
-
+
String periodEnd = statistics.getPeriodEnd();
Assert.assertNotNull(periodEnd);
}
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.onap.so.libs</groupId>
- <artifactId>openstack-java-sdk</artifactId>
- <version>1.4.0-SNAPSHOT</version>
- </parent>
- <artifactId>cinder-client</artifactId>
- <name>OpenStack Cinder Client</name>
- <description>OpenStack Cinder Client</description>
- <dependencies>
- <dependency>
- <groupId>org.onap.so.libs.openstack-java-sdk</groupId>
- <artifactId>openstack-client</artifactId>
- <version>${project.version}</version>
- </dependency>
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.onap.so.libs</groupId>
+ <artifactId>openstack-java-sdk</artifactId>
+ <version>1.4.0-SNAPSHOT</version>
+ </parent>
+ <artifactId>cinder-client</artifactId>
+ <name>OpenStack Cinder Client</name>
+ <description>OpenStack Cinder Client</description>
+ <dependencies>
+ <dependency>
+ <groupId>org.onap.so.libs.openstack-java-sdk</groupId>
+ <artifactId>openstack-client</artifactId>
+ <version>${project.version}</version>
+ </dependency>
- <dependency>
- <groupId>org.onap.so.libs.openstack-java-sdk</groupId>
- <artifactId>cinder-model</artifactId>
- <version>${project.version}</version>
- </dependency>
- </dependencies>
- <groupId>org.onap.so.libs.openstack-java-sdk</groupId>
+ <dependency>
+ <groupId>org.onap.so.libs.openstack-java-sdk</groupId>
+ <artifactId>cinder-model</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+ <groupId>org.onap.so.libs.openstack-java-sdk</groupId>
</project>
\ No newline at end of file
-/* ============LICENSE_START=======================================================
+/*-
+ * ============LICENSE_START=======================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* ============LICENSE_END=========================================================
*/
+
package com.woorea.openstack.cinder;
import com.woorea.openstack.base.client.OpenStackClient;
-/* ============LICENSE_START=======================================================
+/*-
+ * ============LICENSE_START=======================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* limitations under the License.
* ============LICENSE_END=========================================================
*/
+
package com.woorea.openstack.cinder;
import com.woorea.openstack.base.client.HttpMethod;
-/* ============LICENSE_START=======================================================
+/*-
+ * ============LICENSE_START=======================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* limitations under the License.
* ============LICENSE_END=========================================================
*/
+
package com.woorea.openstack.cinder;
import com.woorea.openstack.base.client.HttpMethod;
public class List extends OpenStackRequest<Pools> {
public List(boolean detail) {
- super(CLIENT, HttpMethod.GET, (new StringBuilder("/scheduler-stats/get_pools")).append(detail ? "?detail=True":""), null, Pools.class);
+ super(CLIENT, HttpMethod.GET,
+ (new StringBuilder("/scheduler-stats/get_pools")).append(detail ? "?detail=True" : ""), null,
+ Pools.class);
}
}
-/* ============LICENSE_START=======================================================
+/*-
+ * ============LICENSE_START=======================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* limitations under the License.
* ============LICENSE_END=========================================================
*/
+
package com.woorea.openstack.cinder;
import com.woorea.openstack.base.client.Entity;
public class Update extends OpenStackRequest<Void> {
public Update(String id, SnapshotForUpdate snapshot) {
- super(CLIENT, HttpMethod.PUT, new StringBuilder("/snapshots/").append(id).toString(),
- Entity.json(snapshot), Void.class);
+ super(CLIENT, HttpMethod.PUT, new StringBuilder("/snapshots/").append(id).toString(), Entity.json(snapshot),
+ Void.class);
}
}
public class ShowMetadata extends OpenStackRequest<Metadata> {
public ShowMetadata(String id) {
- super(CLIENT,
- HttpMethod.GET,
- new StringBuilder("/snapshots/").append(id).append("/metadata").toString(),
- null,
- Metadata.class);
+ super(CLIENT, HttpMethod.GET, new StringBuilder("/snapshots/").append(id).append("/metadata").toString(),
+ null, Metadata.class);
}
}
public class UpdateMetadata extends OpenStackRequest<Void> {
public UpdateMetadata(String snapshotId, Metadata metadata) {
- super(CLIENT, HttpMethod.PUT, new StringBuilder("/snapshots/").append(snapshotId)
- .append("/metadata")
- .toString(), Entity.json(metadata), Void.class);
+ super(CLIENT, HttpMethod.PUT,
+ new StringBuilder("/snapshots/").append(snapshotId).append("/metadata").toString(),
+ Entity.json(metadata), Void.class);
}
}
-/* ============LICENSE_START=======================================================
+/*-
+ * ============LICENSE_START=======================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* limitations under the License.
* ============LICENSE_END=========================================================
*/
+
package com.woorea.openstack.cinder;
import com.woorea.openstack.base.client.Entity;
-/* ============LICENSE_START=======================================================
+/*-
+ * ============LICENSE_START=======================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* limitations under the License.
* ============LICENSE_END=========================================================
*/
+
package com.woorea.openstack.cinder;
import com.woorea.openstack.base.client.Entity;
public class List extends OpenStackRequest<Volumes> {
public List(boolean detail) {
- super(CLIENT, HttpMethod.GET, detail ? "/volumes/detail"
- : "/volumes", null, Volumes.class);
+ super(CLIENT, HttpMethod.GET, detail ? "/volumes/detail" : "/volumes", null, Volumes.class);
}
}
public class Create extends OpenStackRequest<Volume> {
public Create(VolumeForCreate volume) {
- super(CLIENT, HttpMethod.POST, "/volumes", Entity.json(volume),
- Volume.class);
+ super(CLIENT, HttpMethod.POST, "/volumes", Entity.json(volume), Volume.class);
}
}
public class UploadToImage extends OpenStackRequest<Void> {
public UploadToImage(VolumeForImageCreate volumeForImageCreate) {
- super(CLIENT, HttpMethod.POST, new StringBuilder("/volumes/")
- .append(volumeForImageCreate.getVolumeId() + "/action").toString(),
+ super(CLIENT, HttpMethod.POST,
+ new StringBuilder("/volumes/").append(volumeForImageCreate.getVolumeId() + "/action").toString(),
Entity.json(volumeForImageCreate), Void.class);
}
public class Show extends OpenStackRequest<Volume> {
public Show(String id) {
- super(CLIENT, HttpMethod.GET, new StringBuilder("/volumes/")
- .append(id).toString(), null, Volume.class);
+ super(CLIENT, HttpMethod.GET, new StringBuilder("/volumes/").append(id).toString(), null, Volume.class);
}
}
public class ShowMetadata extends OpenStackRequest<Metadata> {
public ShowMetadata(String id) {
- super(CLIENT, HttpMethod.GET, new StringBuilder("/volumes/")
- .append(id).append("/metadata").toString(), null,
- Metadata.class);
+ super(CLIENT, HttpMethod.GET, new StringBuilder("/volumes/").append(id).append("/metadata").toString(),
+ null, Metadata.class);
}
}
public class Delete extends OpenStackRequest<Void> {
public Delete(String id) {
- super(CLIENT, HttpMethod.DELETE, new StringBuilder("/volumes/")
- .append(id).toString(), null, Void.class);
+ super(CLIENT, HttpMethod.DELETE, new StringBuilder("/volumes/").append(id).toString(), null, Void.class);
}
}
public class Update extends OpenStackRequest<Void> {
public Update(String id, VolumeForUpdate volume) {
- super(CLIENT, HttpMethod.PUT, new StringBuilder("/volumes/").append(id).toString(),
- Entity.json(volume), Void.class);
+ super(CLIENT, HttpMethod.PUT, new StringBuilder("/volumes/").append(id).toString(), Entity.json(volume),
+ Void.class);
}
}
public class InitializeConnection extends OpenStackRequest<ConnectionInfo> {
public InitializeConnection(String id, ConnectionForInitialize connectionForInitialize) {
- super(CLIENT, HttpMethod.POST, new StringBuilder("/volumes/")
- .append(id).append("/action").toString(),
+ super(CLIENT, HttpMethod.POST, new StringBuilder("/volumes/").append(id).append("/action").toString(),
Entity.json(connectionForInitialize), ConnectionInfo.class);
}
public class TerminateConnection extends OpenStackRequest<Void> {
public TerminateConnection(String id, ConnectionForTerminate connectionForTerminate) {
- super(CLIENT, HttpMethod.POST, new StringBuilder("/volumes/")
- .append(id).append("/action").toString(),
+ super(CLIENT, HttpMethod.POST, new StringBuilder("/volumes/").append(id).append("/action").toString(),
Entity.json(connectionForTerminate), Void.class);
}
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.onap.so.libs</groupId>
- <artifactId>openstack-java-sdk</artifactId>
- <version>1.4.0-SNAPSHOT</version>
- </parent>
- <groupId>org.onap.so.libs.openstack-java-sdk</groupId>
- <artifactId>cinder-model</artifactId>
- <name>OpenStack Cinder Model</name>
- <description>OpenStack Cinder Model</description>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.onap.so.libs</groupId>
+ <artifactId>openstack-java-sdk</artifactId>
+ <version>1.4.0-SNAPSHOT</version>
+ </parent>
+ <groupId>org.onap.so.libs.openstack-java-sdk</groupId>
+ <artifactId>cinder-model</artifactId>
+ <name>OpenStack Cinder Model</name>
+ <description>OpenStack Cinder Model</description>
</project>
\ No newline at end of file
-/* ============LICENSE_START=======================================================
+/*-
+ * ============LICENSE_START=======================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* limitations under the License.
* ============LICENSE_END=========================================================
*/
+
package com.woorea.openstack.cinder.model;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
-
import com.fasterxml.jackson.annotation.JsonProperty;
public abstract class BaseConnection implements Serializable {
}
/**
- * @param connector
- * the connector to set
+ * @param connector the connector to set
*/
public void setConnector(Map<String, Object> connector) {
this.connector = connector;
-/* ============LICENSE_START=======================================================
+/*-
+ * ============LICENSE_START=======================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* limitations under the License.
* ============LICENSE_END=========================================================
*/
+
package com.woorea.openstack.cinder.model;
import java.io.Serializable;
public String getPoolName() {
return poolName;
}
+
public void setPoolName(String poolName) {
this.poolName = poolName;
}
+
public boolean isQosSupport() {
return qosSupport;
}
+
public void setQosSupport(boolean qosSupport) {
this.qosSupport = qosSupport;
}
+
public Long getAllocatedCapacityGb() {
return allocatedCapacityGb;
}
+
public void setAllocatedCapacityGb(Long allocatedCapacityGb) {
this.allocatedCapacityGb = allocatedCapacityGb;
}
+
public String getDriverVersion() {
return driverVersion;
}
+
public void setDriverVersion(String driverVersion) {
this.driverVersion = driverVersion;
}
+
public Long getFreeCapacityGb() {
return freeCapacityGb;
}
+
public void setFreeCapacityGb(Long freeCapacityGb) {
this.freeCapacityGb = freeCapacityGb;
}
+
public String getLocationInfo() {
return locationInfo;
}
+
public void setLocationInfo(String locationInfo) {
this.locationInfo = locationInfo;
}
+
public String getTimestamp() {
return timestamp;
}
+
public void setTimestamp(String timestamp) {
this.timestamp = timestamp;
}
+
public String getVolumeBackendName() {
return volumeBackendName;
}
+
public void setVolumeBackendName(String volumeBackendName) {
this.volumeBackendName = volumeBackendName;
}
+
public Long getTotalCapacityGb() {
return totalCapacityGb;
}
+
public void setTotalCapacityGb(Long totalCapacityGb) {
this.totalCapacityGb = totalCapacityGb;
}
+
public Integer getReservedPercentage() {
return reservedPercentage;
}
+
public void setReservedPercentage(Integer reservedPercentage) {
this.reservedPercentage = reservedPercentage;
}
+
public String getVendorName() {
return vendorName;
}
+
public void setVendorName(String vendorName) {
this.vendorName = vendorName;
}
+
public String getStorageProtocol() {
return storageProtocol;
}
+
public void setStorageProtocol(String storageProtocol) {
this.storageProtocol = storageProtocol;
}
+
public Map<String, String> getExtraSpecs() {
return extraSpecs;
}
+
public void setExtraSpecs(Map<String, String> extraSpecs) {
this.extraSpecs = extraSpecs;
}
@Override
public String toString() {
- return "Capabilities{"
- + "poolName='" + poolName
- + ", qosSupport='" + qosSupport
- + ", allocatedCapacityGb='" + allocatedCapacityGb
- + ", driverVersion='" + driverVersion
- + ", freeCapacityGb='" + freeCapacityGb
- + ", locationInfo='" + locationInfo
- + ", timestamp='" + timestamp
- + ", volumeBackendName='" + volumeBackendName
- + ", totalCapacityGb='" + totalCapacityGb
- + ", reservedPercentage='" + reservedPercentage
- + ", vendorName='" + vendorName
- + ", storageProtocol='" + storageProtocol
- + ", extraSpecs='" + extraSpecs
- + '}';
+ return "Capabilities{" + "poolName='" + poolName + ", qosSupport='" + qosSupport + ", allocatedCapacityGb='"
+ + allocatedCapacityGb + ", driverVersion='" + driverVersion + ", freeCapacityGb='" + freeCapacityGb
+ + ", locationInfo='" + locationInfo + ", timestamp='" + timestamp + ", volumeBackendName='"
+ + volumeBackendName + ", totalCapacityGb='" + totalCapacityGb + ", reservedPercentage='"
+ + reservedPercentage + ", vendorName='" + vendorName + ", storageProtocol='" + storageProtocol
+ + ", extraSpecs='" + extraSpecs + '}';
}
}
-/* ============LICENSE_START=======================================================
+/*-
+ * ============LICENSE_START=======================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* limitations under the License.
* ============LICENSE_END=========================================================
*/
+
package com.woorea.openstack.cinder.model;
import com.fasterxml.jackson.annotation.JsonRootName;
-
import java.io.Serializable;
@JsonRootName("os-initialize_connection")
-/* ============LICENSE_START=======================================================
+/*-
+ * ============LICENSE_START=======================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* limitations under the License.
* ============LICENSE_END=========================================================
*/
+
package com.woorea.openstack.cinder.model;
import com.fasterxml.jackson.annotation.JsonRootName;
-
import java.io.Serializable;
@JsonRootName("os-terminate_connection")
-/* ============LICENSE_START=======================================================
+/*-
+ * ============LICENSE_START=======================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* limitations under the License.
* ============LICENSE_END=========================================================
*/
+
package com.woorea.openstack.cinder.model;
import java.io.Serializable;
import java.util.Map;
-
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonRootName;
}
/**
- * @param driverVolumeType
- * the driverVolumeType to set
+ * @param driverVolumeType the driverVolumeType to set
*/
public void setDriverVolumeType(String driverVolumeType) {
this.driverVolumeType = driverVolumeType;
}
/**
- * @param data
- * the data to set
+ * @param data the data to set
*/
public void setData(Map<String, Object> data) {
this.data = data;
*/
@Override
public String toString() {
- return "ConnectionInfo [driverVolumeType=" + driverVolumeType + "," +
- " data=" + data + "]";
+ return "ConnectionInfo [driverVolumeType=" + driverVolumeType + "," + " data=" + data + "]";
}
}
-/* ============LICENSE_START=======================================================
+/*-
+ * ============LICENSE_START=======================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* limitations under the License.
* ============LICENSE_END=========================================================
*/
+
package com.woorea.openstack.cinder.model;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonRootName;
-
import java.io.Serializable;
import java.util.Calendar;
import java.util.List;
@JsonRootName("limits")
public class Limits implements Serializable {
- public static final class RateLimit implements Serializable {
-
- public static final class LimitEntry implements Serializable {
-
- @JsonProperty("next-available")
- private Calendar nextAvailable;
-
- private String unit;
-
- private String verb;
-
- private Integer remaining;
-
- private Integer available;
-
- private Integer value;
-
- /**
- * @return the nextAvailable
- */
- public Calendar getNextAvailable() {
- return nextAvailable;
- }
-
- /**
- * @return the unit
- */
- public String getUnit() {
- return unit;
- }
-
- /**
- * @return the verb
- */
- public String getVerb() {
- return verb;
- }
-
- /**
- * @return the remaining
- */
- public Integer getRemaining() {
- return remaining;
- }
-
- /**
- * @return the available
- */
- public Integer getAvailable() {
- return available;
- }
-
- /**
- * @return the value
- */
- public Integer getValue() {
- return value;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Object#toString()
- */
- @Override
- public String toString() {
- return "LimitEntry [nextAvailable=" + nextAvailable + ", unit="
- + unit + ", verb=" + verb + ", remaining=" + remaining
- + ", available=" + available + ", value=" + value + "]";
- }
-
- }
-
- private String regex;
-
- private String uri;
-
- private List<LimitEntry> limit;
-
- /**
- * @return the regex
- */
- public String getRegex() {
- return regex;
- }
-
- /**
- * @return the uri
- */
- public String getUri() {
- return uri;
- }
-
- /**
- * @return the limit
- */
- public List<LimitEntry> getLimit() {
- return limit;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Object#toString()
- */
- @Override
- public String toString() {
- return "RateLimit [regex=" + regex + ", uri=" + uri + ", limit="
- + limit + "]";
- }
-
- }
-
- public static final class AbsoluteLimit {
-
- private Integer maxTotalVolumes;
- private Integer totalVolumesUsed;
-
- private Integer maxTotalSnapshots;
- private Integer totalSnapshotsUsed;
-
- private Integer maxTotalVolumeGigabytes;
- private Integer totalGigabytesUsed;
-
- private Integer maxTotalBackups;
- private Integer totalBackupsUsed;
-
- private Integer maxTotalBackupGigabytes;
- private Integer totalBackupGigabytesUsed;
-
- /**
- * @return the maxTotalVolumes
- */
- public Integer getMaxTotalVolumes() {
- return maxTotalVolumes;
- }
-
- /**
- * @return the totalVolumesUsed
- */
- public Integer getTotalVolumesUsed() {
- return totalVolumesUsed;
- }
-
- /**
- * @return the maxTotalSnapshots
- */
- public Integer getMaxTotalSnapshots() {
- return maxTotalSnapshots;
- }
-
- /**
- * @return the totalSnapshotsUsed
- */
- public Integer getTotalSnapshotsUsed() {
- return totalSnapshotsUsed;
- }
-
- /**
- * @return the maxTotalVolumeGigabytes
- */
- public Integer getMaxTotalVolumeGigabytes() {
- return maxTotalVolumeGigabytes;
- }
-
- /**
- * @return the totalGigabytesUsed
- */
- public Integer getTotalGigabytesUsed() {
- return totalGigabytesUsed;
- }
-
- /**
- * @return the maxTotalBackupGigabytes
- */
- public Integer getMaxTotalBackupGigabytes() {
- return maxTotalBackupGigabytes;
- }
-
- /**
- * @return the totalBackupGigabytesUsed
- */
- public Integer getTotalBackupGigabytesUsed() {
- return totalBackupGigabytesUsed;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Object#toString()
- */
- @Override
- public String toString() {
- return "AbsoluteLimit [maxTotalVolumes=" + maxTotalVolumes +
- ", totalVolumesUsed=" + totalVolumesUsed +
- ", maxTotalSnapshots=" + maxTotalSnapshots +
- ", totalSnapshotsUsed=" + totalSnapshotsUsed +
- ", maxTotalVolumeGigabytes=" + maxTotalVolumeGigabytes +
- ", totalGigabytesUsed=" + totalGigabytesUsed +
- ", maxTotalBackupGigabytes=" + maxTotalBackupGigabytes +
- ", totalBackupGigabytesUsed=" + totalBackupGigabytesUsed +"]";
- }
-
- }
-
- private List<RateLimit> rate;
-
- private AbsoluteLimit absolute;
-
- /**
- * @return the rate
- */
- public List<RateLimit> getRate() {
- return rate;
- }
-
- /**
- * @return the absolute
- */
- public AbsoluteLimit getAbsolute() {
- return absolute;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Object#toString()
- */
- @Override
- public String toString() {
- return "Limits [rate=" + rate + ", absolute=" + absolute + "]";
- }
+ public static final class RateLimit implements Serializable {
+
+ public static final class LimitEntry implements Serializable {
+
+ @JsonProperty("next-available")
+ private Calendar nextAvailable;
+
+ private String unit;
+
+ private String verb;
+
+ private Integer remaining;
+
+ private Integer available;
+
+ private Integer value;
+
+ /**
+ * @return the nextAvailable
+ */
+ public Calendar getNextAvailable() {
+ return nextAvailable;
+ }
+
+ /**
+ * @return the unit
+ */
+ public String getUnit() {
+ return unit;
+ }
+
+ /**
+ * @return the verb
+ */
+ public String getVerb() {
+ return verb;
+ }
+
+ /**
+ * @return the remaining
+ */
+ public Integer getRemaining() {
+ return remaining;
+ }
+
+ /**
+ * @return the available
+ */
+ public Integer getAvailable() {
+ return available;
+ }
+
+ /**
+ * @return the value
+ */
+ public Integer getValue() {
+ return value;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Object#toString()
+ */
+ @Override
+ public String toString() {
+ return "LimitEntry [nextAvailable=" + nextAvailable + ", unit=" + unit + ", verb=" + verb
+ + ", remaining=" + remaining + ", available=" + available + ", value=" + value + "]";
+ }
+
+ }
+
+ private String regex;
+
+ private String uri;
+
+ private List<LimitEntry> limit;
+
+ /**
+ * @return the regex
+ */
+ public String getRegex() {
+ return regex;
+ }
+
+ /**
+ * @return the uri
+ */
+ public String getUri() {
+ return uri;
+ }
+
+ /**
+ * @return the limit
+ */
+ public List<LimitEntry> getLimit() {
+ return limit;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Object#toString()
+ */
+ @Override
+ public String toString() {
+ return "RateLimit [regex=" + regex + ", uri=" + uri + ", limit=" + limit + "]";
+ }
+
+ }
+
+ public static final class AbsoluteLimit {
+
+ private Integer maxTotalVolumes;
+ private Integer totalVolumesUsed;
+
+ private Integer maxTotalSnapshots;
+ private Integer totalSnapshotsUsed;
+
+ private Integer maxTotalVolumeGigabytes;
+ private Integer totalGigabytesUsed;
+
+ private Integer maxTotalBackups;
+ private Integer totalBackupsUsed;
+
+ private Integer maxTotalBackupGigabytes;
+ private Integer totalBackupGigabytesUsed;
+
+ /**
+ * @return the maxTotalVolumes
+ */
+ public Integer getMaxTotalVolumes() {
+ return maxTotalVolumes;
+ }
+
+ /**
+ * @return the totalVolumesUsed
+ */
+ public Integer getTotalVolumesUsed() {
+ return totalVolumesUsed;
+ }
+
+ /**
+ * @return the maxTotalSnapshots
+ */
+ public Integer getMaxTotalSnapshots() {
+ return maxTotalSnapshots;
+ }
+
+ /**
+ * @return the totalSnapshotsUsed
+ */
+ public Integer getTotalSnapshotsUsed() {
+ return totalSnapshotsUsed;
+ }
+
+ /**
+ * @return the maxTotalVolumeGigabytes
+ */
+ public Integer getMaxTotalVolumeGigabytes() {
+ return maxTotalVolumeGigabytes;
+ }
+
+ /**
+ * @return the totalGigabytesUsed
+ */
+ public Integer getTotalGigabytesUsed() {
+ return totalGigabytesUsed;
+ }
+
+ /**
+ * @return the maxTotalBackupGigabytes
+ */
+ public Integer getMaxTotalBackupGigabytes() {
+ return maxTotalBackupGigabytes;
+ }
+
+ /**
+ * @return the totalBackupGigabytesUsed
+ */
+ public Integer getTotalBackupGigabytesUsed() {
+ return totalBackupGigabytesUsed;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Object#toString()
+ */
+ @Override
+ public String toString() {
+ return "AbsoluteLimit [maxTotalVolumes=" + maxTotalVolumes + ", totalVolumesUsed=" + totalVolumesUsed
+ + ", maxTotalSnapshots=" + maxTotalSnapshots + ", totalSnapshotsUsed=" + totalSnapshotsUsed
+ + ", maxTotalVolumeGigabytes=" + maxTotalVolumeGigabytes + ", totalGigabytesUsed="
+ + totalGigabytesUsed + ", maxTotalBackupGigabytes=" + maxTotalBackupGigabytes
+ + ", totalBackupGigabytesUsed=" + totalBackupGigabytesUsed + "]";
+ }
+
+ }
+
+ private List<RateLimit> rate;
+
+ private AbsoluteLimit absolute;
+
+ /**
+ * @return the rate
+ */
+ public List<RateLimit> getRate() {
+ return rate;
+ }
+
+ /**
+ * @return the absolute
+ */
+ public AbsoluteLimit getAbsolute() {
+ return absolute;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Object#toString()
+ */
+ @Override
+ public String toString() {
+ return "Limits [rate=" + rate + ", absolute=" + absolute + "]";
+ }
}
--- /dev/null
+/*-
+ * ============LICENSE_START=======================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package com.woorea.openstack.cinder.model;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+public class Link {
+ @JsonProperty("href")
+ private String href;
+
+ @JsonProperty("rel")
+ private String rel;
+
+ public String getHref() {
+ return href;
+ }
+
+ public void setHref(String href) {
+ this.href = href;
+ }
+
+ public String getRel() {
+ return rel;
+ }
+
+ public void setRel(String rel) {
+ this.rel = rel;
+ }
+
+ @Override
+ public String toString() {
+ return "Link{" + "href='" + href + '\'' + ", rel='" + rel + '\'' + '}';
+ }
+}
-/* ============LICENSE_START=======================================================
+/*-
+ * ============LICENSE_START=======================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* limitations under the License.
* ============LICENSE_END=========================================================
*/
+
package com.woorea.openstack.cinder.model;
import java.util.Map;
-/* ============LICENSE_START=======================================================
+/*-
+ * ============LICENSE_START=======================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* limitations under the License.
* ============LICENSE_END=========================================================
*/
+
package com.woorea.openstack.cinder.model;
import java.io.Serializable;
@Override
public String toString() {
- return "Pool{"
- + "name='" + name
- + ", capabilities='" + capabilities
- + '}';
+ return "Pool{" + "name='" + name + ", capabilities='" + capabilities + '}';
}
}
-/* ============LICENSE_START=======================================================
+/*-
+ * ============LICENSE_START=======================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* limitations under the License.
* ============LICENSE_END=========================================================
*/
+
package com.woorea.openstack.cinder.model;
import java.io.Serializable;
-/* ============LICENSE_START=======================================================
+/*-
+ * ============LICENSE_START=======================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* limitations under the License.
* ============LICENSE_END=========================================================
*/
+
package com.woorea.openstack.cinder.model;
import java.io.Serializable;
import java.util.Map;
-
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonRootName;
*/
@Override
public String toString() {
- return "Snapshot [id=" + id + ", status=" + status +
- ", name=" + name + ", description=" + description +
- ", volumeId=" + volumeId + ", size=" + size +
- ", createdAt=" + createdAt + ", metadata=" + metadata + "]";
+ return "Snapshot [id=" + id + ", status=" + status + ", name=" + name + ", description=" + description
+ + ", volumeId=" + volumeId + ", size=" + size + ", createdAt=" + createdAt + ", metadata=" + metadata
+ + "]";
}
}
-/* ============LICENSE_START=======================================================
+/*-
+ * ============LICENSE_START=======================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* limitations under the License.
* ============LICENSE_END=========================================================
*/
+
package com.woorea.openstack.cinder.model;
import java.io.Serializable;
-
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonRootName;
}
/**
- * @param volumeId
- * the volumeId to set
+ * @param volumeId the volumeId to set
*/
public void setVolumeId(String volumeId) {
this.volumeId = volumeId;
}
/**
- * @param force
- * the force to set
+ * @param force the force to set
*/
public void setForce(Boolean force) {
this.force = force;
}
/**
- * @param name
- * the name to set
+ * @param name the name to set
*/
public void setName(String name) {
this.name = name;
}
/**
- * @param description
- * the description to set
+ * @param description the description to set
*/
public void setDescription(String description) {
this.description = description;
*/
@Override
public String toString() {
- return "SnapshotForCreate [volumeId=" + volumeId + ", force=" + force
- + ", name=" + name + ", description=" + description + "]";
+ return "SnapshotForCreate [volumeId=" + volumeId + ", force=" + force + ", name=" + name + ", description="
+ + description + "]";
}
}
-/* ============LICENSE_START=======================================================
+/*-
+ * ============LICENSE_START=======================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* limitations under the License.
* ============LICENSE_END=========================================================
*/
+
package com.woorea.openstack.cinder.model;
import java.io.Serializable;
-
import com.fasterxml.jackson.annotation.JsonRootName;
@JsonRootName("snapshot")
}
/**
- * @param name
- * the name to set
+ * @param name the name to set
*/
public void setName(String name) {
this.name = name;
}
/**
- * @param description
- * the description to set
+ * @param description the description to set
*/
public void setDescription(String description) {
this.description = description;
-/* ============LICENSE_START=======================================================
+/*-
+ * ============LICENSE_START=======================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* limitations under the License.
* ============LICENSE_END=========================================================
*/
+
package com.woorea.openstack.cinder.model;
import java.io.Serializable;
import java.util.Iterator;
import java.util.List;
-
import com.fasterxml.jackson.annotation.JsonProperty;
public class Snapshots implements Iterable<Snapshot>, Serializable {
-/* ============LICENSE_START=======================================================
+/*-
+ * ============LICENSE_START=======================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-package com.woorea.openstack.cinder.model;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonRootName;
+
+package com.woorea.openstack.cinder.model;
import java.io.Serializable;
+import java.util.Date;
import java.util.List;
import java.util.Map;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonRootName;
@JsonRootName("volume")
public class Volume implements Serializable {
private String status;
+ @JsonProperty("name")
private String name;
+ @JsonProperty("description")
private String description;
@JsonProperty("availability_zone")
@JsonProperty("volume_type")
private String volumeType;
+ @JsonProperty("bootable")
+ private String bootable;
+
+ @JsonProperty("os-vol-host-attr:host")
+ private String osVolhostAttribute;
+
+ @JsonProperty("os-vol-tenant-attr:tenant_id")
+ private String tenantId;
+
@JsonProperty("snapshot_id")
private String snapshotId;
@JsonProperty("source_volid")
private String sourceVolid;
- @JsonProperty("bootable")
- private Boolean bootable;
+ private List<Link> links;
private List<Map<String, Object>> attachments;
private Map<String, String> metadata;
@JsonProperty("created_at")
- private String createdAt;
+ private Date createdAt;
private Integer size;
+ public String getBootable() {
+ return bootable;
+ }
+
+ public void setBootable(String bootable) {
+ this.bootable = bootable;
+ }
+
+ public String getOsVolhostAttribute() {
+ return osVolhostAttribute;
+ }
+
+ public void setOsVolhostAttribute(String osVolhostAttribute) {
+ this.osVolhostAttribute = osVolhostAttribute;
+ }
+
+ public String getTenantId() {
+ return tenantId;
+ }
+
+ public void setTenantId(String tenantId) {
+ this.tenantId = tenantId;
+ }
+
+ public String getSourceVolid() {
+ return sourceVolid;
+ }
+
+ public void setSourceVolid(String sourceVolid) {
+ this.sourceVolid = sourceVolid;
+ }
+
+ public List<Link> getLinks() {
+ return links;
+ }
+
+ public void setLinks(List<Link> links) {
+ this.links = links;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public void setStatus(String status) {
+ this.status = status;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public void setAvailabilityZone(String availabilityZone) {
+ this.availabilityZone = availabilityZone;
+ }
+
+ public void setVolumeType(String volumeType) {
+ this.volumeType = volumeType;
+ }
+
+ public void setSnapshotId(String snapshotId) {
+ this.snapshotId = snapshotId;
+ }
+
+ public void setAttachments(List<Map<String, Object>> attachments) {
+ this.attachments = attachments;
+ }
+
+ public void setMetadata(Map<String, String> metadata) {
+ this.metadata = metadata;
+ }
+
+ public void setCreatedAt(Date createdAt) {
+ this.createdAt = createdAt;
+ }
+
+ public void setSize(Integer size) {
+ this.size = size;
+ }
+
/**
* @return the id
*/
return snapshotId;
}
- /**
- * @return the ID of an existing volume (specify in order to create a volume from an existing volume)
- */
- public String getSourceVolid() {
- return sourceVolid;
- }
-
- /**
- * @param sourceVolid
- * to set
- */
- public void setSourceVolid(String sourceVolid) {
- this.sourceVolid = sourceVolid;
- }
-
- /**
- * @param volumeType
- * to set
- */
- public void setVolumeType(String volumeType) {
- this.volumeType = volumeType;
- }
-
- /**
- * @return the bootable flag to set
- */
- public Boolean getBootable() {
- return bootable;
- }
-
/**
* @return the attachments
*/
/**
* @return the createdAt
*/
- public String getCreatedAt() {
+ public Date getCreatedAt() {
return createdAt;
}
return size;
}
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Object#toString()
- */
- @Override
- public String toString() {
- return "Volume [id=" + id + ", status=" + status +
- ", name=" + name + ", description=" + description +
- ", availabilityZone=" + availabilityZone + ", volumeType=" + volumeType +
- ", snapshotId=" + snapshotId + ", attachments=" + attachments +
- ", metadata=" + metadata + ", createdAt=" + createdAt + ", size=" + size + "]";
- }
+
}
-/* ============LICENSE_START=======================================================
+/*-
+ * ============LICENSE_START=======================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* limitations under the License.
* ============LICENSE_END=========================================================
*/
+
package com.woorea.openstack.cinder.model;
import java.io.Serializable;
import java.util.Map;
-
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonRootName;
}
/**
- * @param size
- * the size to set
+ * @param size the size to set
*/
public void setSize(Integer size) {
this.size = size;
}
/**
- * @param availabilityZone
- * the availabilityZone to set
+ * @param availabilityZone the availabilityZone to set
*/
public void setAvailabilityZone(String availabilityZone) {
this.availabilityZone = availabilityZone;
}
/**
- * @param name
- * the name to set
+ * @param name the name to set
*/
public void setName(String name) {
this.name = name;
}
/**
- * @param description
- * the description to set
+ * @param description the description to set
*/
public void setDescription(String description) {
this.description = description;
}
/**
- * @param snapshotId
- * the snapshotId to set
+ * @param snapshotId the snapshotId to set
*/
public void setSnapshotId(String snapshotId) {
this.snapshotId = snapshotId;
}
/**
- * @param sourceVolid
- * to set
+ * @param sourceVolid to set
*/
public void setSourceVolid(String sourceVolid) {
this.sourceVolid = sourceVolid;
}
/**
- * @param imageRef
- * to set
+ * @param imageRef to set
*/
public void setImageRef(String imageRef) {
this.imageRef = imageRef;
}
/**
- * @param volumeType
- * to set
+ * @param volumeType to set
*/
public void setVolumeType(String volumeType) {
this.volumeType = volumeType;
/**
* Enables or disables the bootable attribute. You can boot an instance from a bootable volume.
*
- * @param bootable
- * flag
+ * @param bootable flag
*/
public void setBootable(Boolean bootable) {
this.bootable = bootable;
}
/**
- * @param metadata
- * the metadata to set
+ * @param metadata the metadata to set
*/
public void setMetadata(Map<String, String> metadata) {
this.metadata = metadata;
*/
@Override
public String toString() {
- return "VolumeForCreate [size=" + size +
- ", availabilityZone=" + availabilityZone +
- ", name=" + name +
- ", description=" + description +
- ", snapshotId=" + snapshotId +
- ", source_volid=" + sourceVolid +
- ", imageRef=" + imageRef +
- ", volume_type=" + volumeType +
- ", bootable=" + bootable +
- ", metadata=" + metadata + "]";
+ return "VolumeForCreate [size=" + size + ", availabilityZone=" + availabilityZone + ", name=" + name
+ + ", description=" + description + ", snapshotId=" + snapshotId + ", source_volid=" + sourceVolid
+ + ", imageRef=" + imageRef + ", volume_type=" + volumeType + ", bootable=" + bootable + ", metadata="
+ + metadata + "]";
}
}
-/* ============LICENSE_START=======================================================
+/*-
+ * ============LICENSE_START=======================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* limitations under the License.
* ============LICENSE_END=========================================================
*/
+
package com.woorea.openstack.cinder.model;
import java.io.Serializable;
-
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonRootName;
}
/**
- * @param size
- * the size to set
+ * @param size the size to set
*/
public void setSize(Integer size) {
this.size = size;
-/* ============LICENSE_START=======================================================
+/*-
+ * ============LICENSE_START=======================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* limitations under the License.
* ============LICENSE_END=========================================================
*/
+
package com.woorea.openstack.cinder.model;
import java.io.Serializable;
-
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonRootName;
-/* ============LICENSE_START=======================================================
+/*-
+ * ============LICENSE_START=======================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* limitations under the License.
* ============LICENSE_END=========================================================
*/
+
package com.woorea.openstack.cinder.model;
import java.io.Serializable;
-
import com.fasterxml.jackson.annotation.JsonRootName;
@JsonRootName("volume")
}
/**
- * @param name
- * the name to set
+ * @param name the name to set
*/
public void setName(String name) {
this.name = name;
}
/**
- * @param description
- * the description to set
+ * @param description the description to set
*/
public void setDescription(String description) {
this.description = description;
-/* ============LICENSE_START=======================================================
+/*-
+ * ============LICENSE_START=======================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* limitations under the License.
* ============LICENSE_END=========================================================
*/
+
package com.woorea.openstack.cinder.model;
import java.io.Serializable;
import java.util.Map;
-
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonRootName;
-/* ============LICENSE_START=======================================================
+/*-
+ * ============LICENSE_START=======================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* limitations under the License.
* ============LICENSE_END=========================================================
*/
+
package com.woorea.openstack.cinder.model;
import java.io.Serializable;
import java.util.Map;
-
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonRootName;
}
/**
- * @param name
- * the name to set
+ * @param name the name to set
*/
public void setName(String name) {
this.name = name;
}
/**
- * @param extraSpecs
- * the extra_specs to set
+ * @param extraSpecs the extra_specs to set
*/
public void setExtraSpecs(Map<String, String> extraSpecs) {
this.extraSpecs = extraSpecs;
-/* ============LICENSE_START=======================================================
+/*-
+ * ============LICENSE_START=======================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* limitations under the License.
* ============LICENSE_END=========================================================
*/
+
package com.woorea.openstack.cinder.model;
import java.io.Serializable;
import java.util.Iterator;
import java.util.List;
-
import com.fasterxml.jackson.annotation.JsonProperty;
public class VolumeTypes implements Iterable<VolumeType>, Serializable {
-/* ============LICENSE_START=======================================================
+/*-
+ * ============LICENSE_START=======================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* limitations under the License.
* ============LICENSE_END=========================================================
*/
+
package com.woorea.openstack.cinder.model;
import java.io.Serializable;
import java.util.Iterator;
import java.util.List;
-
import com.fasterxml.jackson.annotation.JsonProperty;
public class Volumes implements Iterable<Volume>, Serializable {
return list;
}
+ @JsonProperty("volumes_links")
+ private List<Link> links;
+
+ public List<Link> getLinks() {
+ return links;
+ }
+
+ public void setLinks(List<Link> links) {
+ this.links = links;
+ }
+
/*
* (non-Javadoc)
*
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.onap.so.libs</groupId>
<name>OpenStack Glance Client</name>
<description>OpenStack Glance Client</description>
<dependencies>
- <dependency>
- <groupId>org.onap.so.libs.openstack-java-sdk</groupId>
- <artifactId>openstack-client</artifactId>
- <version>${project.version}</version>
- </dependency>
+ <dependency>
+ <groupId>org.onap.so.libs.openstack-java-sdk</groupId>
+ <artifactId>openstack-client</artifactId>
+ <version>${project.version}</version>
+ </dependency>
- <dependency>
- <groupId>org.onap.so.libs.openstack-java-sdk</groupId>
- <artifactId>glance-model</artifactId>
- <version>${project.version}</version>
- </dependency>
+ <dependency>
+ <groupId>org.onap.so.libs.openstack-java-sdk</groupId>
+ <artifactId>glance-model</artifactId>
+ <version>${project.version}</version>
+ </dependency>
</dependencies>
</project>
public Update(String id, Image image) {
super(client, HttpMethod.PUT, new StringBuilder(IMAGES).append(id).toString(), Entity.json(image),
- Image.class);
+ Image.class);
}
}
public Upload(String id, ImageUpload imageUpload) {
super(client, HttpMethod.PUT, new StringBuilder(IMAGES).append(id).toString(),
- Entity.stream(imageUpload.getInputStream()), Image.class);
+ Entity.stream(imageUpload.getInputStream()), Image.class);
}
public Upload(ImageUpload imageUpload) {
header(entry.getKey(), entry.getValue());
}
- //file,s3,swift
+ // file,s3,swift
header("x-image-meta-store", imageUpload.getStore());
}
}
public class Download extends OpenStackRequest<ImageDownload> {
public Download(String id) {
- super(client, HttpMethod.GET, new StringBuilder(IMAGES).append(id).toString(), null,
- ImageDownload.class);
+ super(client, HttpMethod.GET, new StringBuilder(IMAGES).append(id).toString(), null, ImageDownload.class);
header("Accept", "application/octet-stream");
}
public ListMembers(String id) {
super(client, HttpMethod.GET, new StringBuilder(IMAGES).append(id).append(MEMBERS).toString(), null,
- ImageMembers.class);
+ ImageMembers.class);
}
}
public ReplaceMembers(String id, Collection<ImageMember> members) {
super(client, HttpMethod.PUT, new StringBuilder(IMAGES).append(id).append(MEMBERS).toString(),
- Entity.json(new Memberships(members)), Void.class);
+ Entity.json(new Memberships(members)), Void.class);
}
}
public AddMember(String id, String tenantId) {
super(client, HttpMethod.PUT,
- new StringBuilder(IMAGES).append(id).append(MEMBERS).append(tenantId).toString(), null,
- ImageMember.class);
+ new StringBuilder(IMAGES).append(id).append(MEMBERS).append(tenantId).toString(), null,
+ ImageMember.class);
}
}
public RemoveMember(String id, String tenantId) {
super(client, HttpMethod.DELETE,
- new StringBuilder(IMAGES).append(id).append("/members/").append(tenantId).toString(), null,
- Void.class);
+ new StringBuilder(IMAGES).append(id).append("/members/").append(tenantId).toString(), null,
+ Void.class);
}
}
public List(String tenantId, boolean detail) {
super(client, HttpMethod.GET,
- new StringBuffer(detail ? "/shared-images/detail" : "/shared-images/").append(tenantId).toString(),
- null, SharedImages.class);
+ new StringBuffer(detail ? "/shared-images/detail" : "/shared-images/").append(tenantId).toString(),
+ null, SharedImages.class);
}
}
}
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.onap.so.libs</groupId>
- <artifactId>openstack-java-sdk</artifactId>
- <version>1.4.0-SNAPSHOT</version>
- </parent>
- <groupId>org.onap.so.libs.openstack-java-sdk</groupId>
- <artifactId>glance-model</artifactId>
- <name>OpenStack Glance Model</name>
- <description>OpenStack Glance Model</description>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.onap.so.libs</groupId>
+ <artifactId>openstack-java-sdk</artifactId>
+ <version>1.4.0-SNAPSHOT</version>
+ </parent>
+ <groupId>org.onap.so.libs.openstack-java-sdk</groupId>
+ <artifactId>glance-model</artifactId>
+ <name>OpenStack Glance Model</name>
+ <description>OpenStack Glance Model</description>
- <dependencies>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.skyscreamer</groupId>
- <artifactId>jsonassert</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.skyscreamer</groupId>
+ <artifactId>jsonassert</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
</project>
import java.io.Serializable;
import java.util.Calendar;
import java.util.HashMap;
+import java.util.List;
import java.util.Map;
-
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonRootName;
@JsonIgnoreProperties(ignoreUnknown = true)
public class Image implements Serializable {
+ @JsonProperty("id")
private String id;
private String uri;
@JsonProperty("virtual_size")
private Long virtualSize;
+ @JsonProperty("checksum")
private String checksum;
@JsonProperty("created_at")
@JsonProperty("min_disk")
private Integer minDisk;
+ @JsonProperty("owner")
private String owner;
@JsonProperty("deleted")
@JsonProperty("protected")
private boolean isProtected;
+ @JsonProperty("visibility")
+ private String visibility;
+
+ @JsonProperty("file")
+ private String file;
+
+ @JsonProperty("schema")
+ private String schema;
+
+ @JsonProperty("self")
+ private String self;
+
+ @JsonProperty("hw_cdrom_bus")
+ private String hwCDROMBus;
+
+ @JsonProperty("hw_disk_bus")
+ private String hwDiskBus;
+
+ @JsonProperty("hw_vif_mode")
+ private String hwVIFMode;
+
+ @JsonProperty("post_processing_networking")
+ private String postProcessingNetworking;
+
+ @JsonProperty("post_processing_tools")
+ private String postProccesingTools;
+
+ @JsonProperty("bypass_meta_validation")
+ private String bypassMetaValidation;
+
+ @JsonProperty("application_name")
+ private String applicationName;
+
+ @JsonProperty("application_type")
+ private String applicationType;
+
+ @JsonProperty("application_version")
+ private String applicationVersion;
+
+ @JsonProperty("application_vendor")
+ private String applicationVendor;
+
+ @JsonProperty("hw_scsi_model")
+ private String hwSCSIModel;
+
+ @JsonProperty("description")
+ private String description;
+
+ @JsonProperty("meta")
+ private String meta;
+
+ @JsonProperty("tags")
+ private List<String> tags;
+
private Map<String, Object> properties;
+ public String getHwCDROMBus() {
+ return hwCDROMBus;
+ }
+
+ public void setHwCDROMBus(String hwCDROMBus) {
+ this.hwCDROMBus = hwCDROMBus;
+ }
+
+ public String getHwDiskBus() {
+ return hwDiskBus;
+ }
+
+ public void setHwDiskBus(String hwDiskBus) {
+ this.hwDiskBus = hwDiskBus;
+ }
+
+ public String getHwVIFMode() {
+ return hwVIFMode;
+ }
+
+ public void setHwVIFMode(String hwVIFMode) {
+ this.hwVIFMode = hwVIFMode;
+ }
+
+ public String getPostProcessingNetworking() {
+ return postProcessingNetworking;
+ }
+
+ public void setPostProcessingNetworking(String postProcessingNetworking) {
+ this.postProcessingNetworking = postProcessingNetworking;
+ }
+
+ public String getPostProccesingTools() {
+ return postProccesingTools;
+ }
+
+ public void setPostProccesingTools(String postProccesingTools) {
+ this.postProccesingTools = postProccesingTools;
+ }
+
+ public String getBypassMetaValidation() {
+ return bypassMetaValidation;
+ }
+
+ public void setBypassMetaValidation(String bypassMetaValidation) {
+ this.bypassMetaValidation = bypassMetaValidation;
+ }
+
+ public String getApplicationName() {
+ return applicationName;
+ }
+
+ public void setApplicationName(String applicationName) {
+ this.applicationName = applicationName;
+ }
+
+ public String getApplicationVersion() {
+ return applicationVersion;
+ }
+
+ public void setApplicationVersion(String applicationVersion) {
+ this.applicationVersion = applicationVersion;
+ }
+
+ public String getApplicationVendor() {
+ return applicationVendor;
+ }
+
+ public void setApplicationVendor(String applicationVendor) {
+ this.applicationVendor = applicationVendor;
+ }
+
+ public String getVisibility() {
+ return visibility;
+ }
+
+ public void setVisibility(String visibility) {
+ this.visibility = visibility;
+ }
+
+ public String getFile() {
+ return file;
+ }
+
+ public void setFile(String file) {
+ this.file = file;
+ }
+
+ public String getSchema() {
+ return schema;
+ }
+
+ public void setSchema(String schema) {
+ this.schema = schema;
+ }
+
+ public String getSelf() {
+ return self;
+ }
+
+ public void setSelf(String self) {
+ this.self = self;
+ }
+
+ public List<String> getTags() {
+ return tags;
+ }
+
+ public void setTags(List<String> tags) {
+ this.tags = tags;
+ }
+
/**
* @return the id
*/
return properties;
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
return String.format("Image [id=%s, uri=%s, name=%s, diskFormat=%s containerFormat=%s, size=%d, checksum=%s,"
+ " createdAt=%s, updatedAt=%s, deletedAt=%s, status=%s, isPublic=%s, minRam=%d, minDisk=%d, owner=%s,"
- + " isDeleted=%s, isProtected=%s, properties=%s]",
- id, uri, name, diskFormat, containerFormat, size, checksum,
- createdAt, updatedAt, deletedAt, status, isPublic, minRam, minDisk, owner,
- isDeleted, isProtected, properties);
+ + " isDeleted=%s, isProtected=%s, properties=%s]", id, uri, name, diskFormat, containerFormat, size,
+ checksum, createdAt, updatedAt, deletedAt, status, isPublic, minRam, minDisk, owner, isDeleted,
+ isProtected, properties);
}
}
import java.io.InputStream;
public class ImageDownload {
-
+
private Image image;
-
+
private InputStream inputStream;
/**
package com.woorea.openstack.glance.model;
import java.io.Serializable;
-
import com.fasterxml.jackson.annotation.JsonProperty;
public class ImageMember implements Serializable {
@JsonProperty("can_share")
private boolean canShare;
-
+
@JsonProperty("member_id")
private String memberId;
public ImageMember() {
-
+
}
public ImageMember(boolean canShare, String memberId) {
import java.io.Serializable;
import java.util.Iterator;
import java.util.List;
-
import com.fasterxml.jackson.annotation.JsonProperty;
public class ImageMembers implements Iterable<ImageMember>, Serializable {
public Iterator<ImageMember> iterator() {
return list.iterator();
}
-
+
}
* @return the properties
*/
public Map<String, Object> getProperties() {
- if(properties == null) {
+ if (properties == null) {
properties = new HashMap<>();
}
return properties;
import java.io.Serializable;
import java.util.Iterator;
import java.util.List;
-
import com.fasterxml.jackson.annotation.JsonProperty;
public class Images implements Iterable<Image>, Serializable {
@JsonProperty("images")
private List<Image> list;
+ @JsonProperty("next")
+ private String next;
+
+ @JsonProperty("first")
+ private String first;
+
+ @JsonProperty("schema")
+ private String schema;
+
/**
* @return the list
*/
return list;
}
+ public String getNext() {
+ return next;
+ }
+
+ public void setNext(String next) {
+ this.next = next;
+ }
+
+ public String getFirst() {
+ return first;
+ }
+
+ public void setFirst(String first) {
+ this.first = first;
+ }
+
+ public String getSchema() {
+ return schema;
+ }
+
+ public void setSchema(String schema) {
+ this.schema = schema;
+ }
+
@Override
public Iterator<Image> iterator() {
return list.iterator();
}
-
+
}
package com.woorea.openstack.glance.model;
public class SharedImage {
-
-}
\ No newline at end of file
+
+}
import java.io.Serializable;
import java.util.Iterator;
import java.util.List;
-
import com.fasterxml.jackson.annotation.JsonProperty;
public class SharedImages implements Iterable<SharedImage>, Serializable {
public Iterator<SharedImage> iterator() {
return list.iterator();
}
-
+
}
package com.woorea.openstack.glance.model;
import org.junit.Test;
-
import java.io.IOException;
import java.io.InputStream;
});
}
-}
\ No newline at end of file
+}
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"can_share\" : false," + EOL
- + " \"member_id\" : \"memberid\"" + EOL
- + "}";
+ private static final String JSON_FULL =
+ "{" + EOL + " \"can_share\" : false," + EOL + " \"member_id\" : \"memberid\"" + EOL + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
ImageMember imagemember = objectMapper.readValue(JSON_FULL, ImageMember.class);
imagemember.toString();
-
+
String memberId = imagemember.getMemberId();
Assert.assertNotNull(memberId);
imagemember.setMemberId(memberId);
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
-
import java.util.List;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"members\" : [ {" + EOL
- + " \"can_share\" : false," + EOL
- + " \"member_id\" : \"memberid\"" + EOL
- + " }, {" + EOL
- + " \"can_share\" : false," + EOL
- + " \"member_id\" : \"memberid\"" + EOL
- + " } ]" + EOL
- + "}";
+ private static final String JSON_FULL = "{" + EOL + " \"members\" : [ {" + EOL + " \"can_share\" : false," + EOL
+ + " \"member_id\" : \"memberid\"" + EOL + " }, {" + EOL + " \"can_share\" : false," + EOL
+ + " \"member_id\" : \"memberid\"" + EOL + " } ]" + EOL + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
ImageMembers imagemembers = objectMapper.readValue(JSON_FULL, ImageMembers.class);
imagemembers.toString();
-
+
List<ImageMember> list = imagemembers.getList();
Assert.assertNotNull(list);
Assert.assertEquals(2, list.size());
-
+
int cnt = 0;
- for (@SuppressWarnings("unused") ImageMember x : imagemembers) {
+ for (@SuppressWarnings("unused")
+ ImageMember x : imagemembers) {
++cnt;
}
Assert.assertEquals(2, cnt);
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
-
import java.util.Calendar;
import java.util.Map;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"image\" : {" + EOL
- + " \"id\" : \"id\"," + EOL
- + " \"uri\" : \"uri\"," + EOL
- + " \"name\" : \"name\"," + EOL
- + " \"size\" : 43," + EOL
- + " \"checksum\" : \"checksum\"," + EOL
- + " \"status\" : \"status\"," + EOL
- + " \"owner\" : \"owner\"," + EOL
- + " \"properties\" : {" + EOL
- + " \"properties-k1\" : \"properties-v1\"," + EOL
- + " \"properties-k2\" : \"properties-v2\"" + EOL
- + " }," + EOL
- + " \"public\" : false," + EOL
- + " \"deleted\" : false," + EOL
- + " \"protected\" : true," + EOL
- + " \"disk_format\" : \"diskformat\"," + EOL
- + " \"container_format\" : \"containerformat\"," + EOL
- + " \"virtual_size\" : 18," + EOL
- + " \"created_at\" : 1486296000000," + EOL
- + " \"updated_at\" : 1487592000000," + EOL
- + " \"deleted_at\" : 1486209600000," + EOL
- + " \"is_public\" : false," + EOL
- + " \"min_ram\" : 62," + EOL
- + " \"min_disk\" : 69" + EOL
- + " }" + EOL
- + "}";
-
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(SerializationFeature.WRAP_ROOT_VALUE)
- .enable(DeserializationFeature.UNWRAP_ROOT_VALUE)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private static final String JSON_FULL = "{" + EOL + " \"image\" : {" + EOL + " \"id\" : \"id\"," + EOL
+ + " \"uri\" : \"uri\"," + EOL + " \"name\" : \"name\"," + EOL + " \"size\" : 43," + EOL
+ + " \"checksum\" : \"checksum\"," + EOL + " \"status\" : \"status\"," + EOL
+ + " \"owner\" : \"owner\"," + EOL + " \"properties\" : {" + EOL
+ + " \"properties-k1\" : \"properties-v1\"," + EOL + " \"properties-k2\" : \"properties-v2\"" + EOL
+ + " }," + EOL + " \"public\" : false," + EOL + " \"deleted\" : false," + EOL
+ + " \"protected\" : true," + EOL + " \"disk_format\" : \"diskformat\"," + EOL
+ + " \"container_format\" : \"containerformat\"," + EOL + " \"virtual_size\" : 18," + EOL
+ + " \"created_at\" : 1486296000000," + EOL + " \"updated_at\" : 1487592000000," + EOL
+ + " \"deleted_at\" : 1486209600000," + EOL + " \"is_public\" : false," + EOL + " \"min_ram\" : 62,"
+ + EOL + " \"min_disk\" : 69" + EOL + " }" + EOL + "}";
+
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE)
+ .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
Image image = objectMapper.readValue(JSON_FULL, Image.class);
image.toString();
-
+
String owner = image.getOwner();
Assert.assertNotNull(owner);
image.setOwner(owner);
-
+
String containerFormat = image.getContainerFormat();
Assert.assertNotNull(containerFormat);
image.setContainerFormat(containerFormat);
-
+
String uri = image.getUri();
Assert.assertNotNull(uri);
image.setUri(uri);
-
+
Calendar createdAt = image.getCreatedAt();
Assert.assertNotNull(createdAt);
image.setCreatedAt(createdAt);
-
+
Calendar deletedAt = image.getDeletedAt();
Assert.assertNotNull(deletedAt);
image.setDeletedAt(deletedAt);
-
+
Long size = image.getSize();
Assert.assertNotNull(size);
image.setSize(size);
-
+
Integer minRam = image.getMinRam();
Assert.assertNotNull(minRam);
image.setMinRam(minRam);
-
+
String diskFormat = image.getDiskFormat();
Assert.assertNotNull(diskFormat);
image.setDiskFormat(diskFormat);
-
+
String checksum = image.getChecksum();
Assert.assertNotNull(checksum);
image.setChecksum(checksum);
-
+
String name = image.getName();
Assert.assertNotNull(name);
image.setName(name);
-
+
String id = image.getId();
Assert.assertNotNull(id);
image.setId(id);
-
+
Long virtualSize = image.getVirtualSize();
Assert.assertNotNull(virtualSize);
image.setVirtualSize(virtualSize);
-
- Map<String,Object> properties = image.getProperties();
+
+ Map<String, Object> properties = image.getProperties();
Assert.assertNotNull(properties);
Assert.assertEquals(2, properties.size());
-
+
Integer minDisk = image.getMinDisk();
Assert.assertNotNull(minDisk);
image.setMinDisk(minDisk);
-
+
String status = image.getStatus();
Assert.assertNotNull(status);
image.setStatus(status);
-
+
Calendar updatedAt = image.getUpdatedAt();
Assert.assertNotNull(updatedAt);
image.setUpdatedAt(updatedAt);
package com.woorea.openstack.glance.model;
import org.junit.Test;
-
import java.io.IOException;
import java.io.InputStream;
});
}
-}
\ No newline at end of file
+}
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
-
import java.util.List;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"images\" : [ {" + EOL
- + " \"id\" : \"id\"," + EOL
- + " \"uri\" : \"uri\"," + EOL
- + " \"name\" : \"name\"," + EOL
- + " \"size\" : 43," + EOL
- + " \"checksum\" : \"checksum\"," + EOL
- + " \"status\" : \"status\"," + EOL
- + " \"owner\" : \"owner\"," + EOL
- + " \"properties\" : {" + EOL
- + " \"properties-k1\" : \"properties-v1\"," + EOL
- + " \"properties-k2\" : \"properties-v2\"" + EOL
- + " }," + EOL
- + " \"public\" : false," + EOL
- + " \"deleted\" : false," + EOL
- + " \"protected\" : true," + EOL
- + " \"disk_format\" : \"diskformat\"," + EOL
- + " \"container_format\" : \"containerformat\"," + EOL
- + " \"virtual_size\" : 18," + EOL
- + " \"created_at\" : 1486296000000," + EOL
- + " \"updated_at\" : 1487592000000," + EOL
- + " \"deleted_at\" : 1486209600000," + EOL
- + " \"is_public\" : false," + EOL
- + " \"min_ram\" : 62," + EOL
- + " \"min_disk\" : 69" + EOL
- + " }, {" + EOL
- + " \"id\" : \"id\"," + EOL
- + " \"uri\" : \"uri\"," + EOL
- + " \"name\" : \"name\"," + EOL
- + " \"size\" : 43," + EOL
- + " \"checksum\" : \"checksum\"," + EOL
- + " \"status\" : \"status\"," + EOL
- + " \"owner\" : \"owner\"," + EOL
- + " \"properties\" : {" + EOL
- + " \"properties-k1\" : \"properties-v1\"," + EOL
- + " \"properties-k2\" : \"properties-v2\"" + EOL
- + " }," + EOL
- + " \"public\" : false," + EOL
- + " \"deleted\" : false," + EOL
- + " \"protected\" : true," + EOL
- + " \"disk_format\" : \"diskformat\"," + EOL
- + " \"container_format\" : \"containerformat\"," + EOL
- + " \"virtual_size\" : 18," + EOL
- + " \"created_at\" : 1486296000000," + EOL
- + " \"updated_at\" : 1487592000000," + EOL
- + " \"deleted_at\" : 1486209600000," + EOL
- + " \"is_public\" : false," + EOL
- + " \"min_ram\" : 62," + EOL
- + " \"min_disk\" : 69" + EOL
- + " } ]" + EOL
- + "}";
+ private static final String JSON_FULL = "{" + EOL + " \"images\" : [ {" + EOL + " \"id\" : \"id\"," + EOL
+ + " \"uri\" : \"uri\"," + EOL + " \"name\" : \"name\"," + EOL + " \"size\" : 43," + EOL
+ + " \"checksum\" : \"checksum\"," + EOL + " \"status\" : \"status\"," + EOL
+ + " \"owner\" : \"owner\"," + EOL + " \"properties\" : {" + EOL
+ + " \"properties-k1\" : \"properties-v1\"," + EOL + " \"properties-k2\" : \"properties-v2\"" + EOL
+ + " }," + EOL + " \"public\" : false," + EOL + " \"deleted\" : false," + EOL
+ + " \"protected\" : true," + EOL + " \"disk_format\" : \"diskformat\"," + EOL
+ + " \"container_format\" : \"containerformat\"," + EOL + " \"virtual_size\" : 18," + EOL
+ + " \"created_at\" : 1486296000000," + EOL + " \"updated_at\" : 1487592000000," + EOL
+ + " \"deleted_at\" : 1486209600000," + EOL + " \"is_public\" : false," + EOL + " \"min_ram\" : 62,"
+ + EOL + " \"min_disk\" : 69" + EOL + " }, {" + EOL + " \"id\" : \"id\"," + EOL
+ + " \"uri\" : \"uri\"," + EOL + " \"name\" : \"name\"," + EOL + " \"size\" : 43," + EOL
+ + " \"checksum\" : \"checksum\"," + EOL + " \"status\" : \"status\"," + EOL
+ + " \"owner\" : \"owner\"," + EOL + " \"properties\" : {" + EOL
+ + " \"properties-k1\" : \"properties-v1\"," + EOL + " \"properties-k2\" : \"properties-v2\"" + EOL
+ + " }," + EOL + " \"public\" : false," + EOL + " \"deleted\" : false," + EOL
+ + " \"protected\" : true," + EOL + " \"disk_format\" : \"diskformat\"," + EOL
+ + " \"container_format\" : \"containerformat\"," + EOL + " \"virtual_size\" : 18," + EOL
+ + " \"created_at\" : 1486296000000," + EOL + " \"updated_at\" : 1487592000000," + EOL
+ + " \"deleted_at\" : 1486209600000," + EOL + " \"is_public\" : false," + EOL + " \"min_ram\" : 62,"
+ + EOL + " \"min_disk\" : 69" + EOL + " } ]" + EOL + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
Images images = objectMapper.readValue(JSON_FULL, Images.class);
images.toString();
-
+
List<Image> list = images.getList();
Assert.assertNotNull(list);
Assert.assertEquals(2, list.size());
-
+
int cnt = 0;
- for (@SuppressWarnings("unused") Image x : images) {
+ for (@SuppressWarnings("unused")
+ Image x : images) {
++cnt;
}
Assert.assertEquals(2, cnt);
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
-
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
import org.skyscreamer.jsonassert.JSONCompareMode;
private static final String JSON_FULL = "{ }";
// FAIL_ON_EMPTY_BEANS set to false to conform to legacy behavior
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .disable(SerializationFeature.FAIL_ON_EMPTY_BEANS)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .disable(SerializationFeature.FAIL_ON_EMPTY_BEANS)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
-
import java.util.List;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"shared_images\" : [ { }, { } ]" + EOL
- + "}";
+ private static final String JSON_FULL = "{" + EOL + " \"shared_images\" : [ { }, { } ]" + EOL + "}";
// FAIL_ON_EMPTY_BEANS set to false to conform to legacy behavior
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .disable(SerializationFeature.FAIL_ON_EMPTY_BEANS)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .disable(SerializationFeature.FAIL_ON_EMPTY_BEANS)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
SharedImages sharedimages = objectMapper.readValue(JSON_FULL, SharedImages.class);
sharedimages.toString();
-
+
List<SharedImage> list = sharedimages.getList();
Assert.assertNotNull(list);
Assert.assertEquals(2, list.size());
-
+
int cnt = 0;
- for (@SuppressWarnings("unused") SharedImage x : sharedimages) {
+ for (@SuppressWarnings("unused")
+ SharedImage x : sharedimages) {
++cnt;
}
Assert.assertEquals(2, cnt);
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.onap.so.libs</groupId>
<name>OpenStack Heat Client</name>
<description>OpenStack Heat Client</description>
<dependencies>
- <dependency>
- <groupId>org.onap.so.libs.openstack-java-sdk</groupId>
- <artifactId>openstack-client</artifactId>
- <version>${project.version}</version>
- </dependency>
+ <dependency>
+ <groupId>org.onap.so.libs.openstack-java-sdk</groupId>
+ <artifactId>openstack-client</artifactId>
+ <version>${project.version}</version>
+ </dependency>
- <dependency>
- <groupId>org.onap.so.libs.openstack-java-sdk</groupId>
- <artifactId>heat-model</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.12</version>
- <scope>test</scope>
- </dependency>
+ <dependency>
+ <groupId>org.onap.so.libs.openstack-java-sdk</groupId>
+ <artifactId>heat-model</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.12</version>
+ <scope>test</scope>
+ </dependency>
</dependencies>
</project>
public ResourcesResource getResources() {
return resources;
}
-
+
public StackEvents getEvents() {
return events;
}
* v1/{tenant_id}/stacks/{stack_name}/{stack_id}/events
*/
public class StackEvents {
- private final OpenStackClient client;
+ private final OpenStackClient client;
- public StackEvents(OpenStackClient client) {
- this.client = client;
- }
+ public StackEvents(OpenStackClient client) {
+ this.client = client;
+ }
- public ListEvents listEvents(String name, String id) {
- return new ListEvents(name, id);
- }
+ public ListEvents listEvents(String name, String id) {
+ return new ListEvents(name, id);
+ }
- /**
- * v1/​{tenant_id}​/stacks/​{stack_name}​/resources
- */
- public class ListEvents extends OpenStackRequest<Events> {
- public ListEvents(String name, String id) {
- super(client, HttpMethod.GET, "/stacks/" + name + "/" + id + "/events", null, Events.class);
- }
- }
+ /**
+ * v1/​{tenant_id}​/stacks/​{stack_name}​/resources
+ */
+ public class ListEvents extends OpenStackRequest<Events> {
+ public ListEvents(String name, String id) {
+ super(client, HttpMethod.GET, "/stacks/" + name + "/" + id + "/events", null, Events.class);
+ }
+ }
}
heat.getResources();
}
-}
\ No newline at end of file
+}
resourcesResource.listResources("resource");
}
-}
\ No newline at end of file
+}
public class StackResourceTest {
StackResource stackResource = new StackResource(new OpenStackClient("os"));
+
@Test
public void create() throws Exception {
stackResource.create(new CreateStackParam());
stackResource.deleteByName("test");
}
-}
\ No newline at end of file
+}
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <dependencies>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.skyscreamer</groupId>
- <artifactId>jsonassert</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
- <parent>
- <groupId>org.onap.so.libs</groupId>
- <artifactId>openstack-java-sdk</artifactId>
- <version>1.4.0-SNAPSHOT</version>
- </parent>
- <groupId>org.onap.so.libs.openstack-java-sdk</groupId>
- <artifactId>heat-model</artifactId>
- <name>OpenStack Heat Model</name>
- <description>OpenStack Heat Model</description>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.skyscreamer</groupId>
+ <artifactId>jsonassert</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ <parent>
+ <groupId>org.onap.so.libs</groupId>
+ <artifactId>openstack-java-sdk</artifactId>
+ <version>1.4.0-SNAPSHOT</version>
+ </parent>
+ <groupId>org.onap.so.libs.openstack-java-sdk</groupId>
+ <artifactId>heat-model</artifactId>
+ <name>OpenStack Heat Model</name>
+ <description>OpenStack Heat Model</description>
</project>
*/
import java.util.Map;
-
import com.fasterxml.jackson.annotation.JsonProperty;
public class CreateStackParam {
@Override
public String toString() {
- return String.format("CreateStackParam{"
- + "stackName='%s',"
- + " templateUrl='%s',"
- + " template='%s',"
- + " parameters=%s,"
- + " timeoutMinutes=%d,"
- + " environment='%s',"
- + " disableRollback='%s',"
- + " files=%s"
- + "}",
- stackName,
- templateUrl,
- template,
- parameters,
- timeoutMinutes,
- environment,
- disableRollback,
- files);
+ return String.format(
+ "CreateStackParam{" + "stackName='%s'," + " templateUrl='%s'," + " template='%s'," + " parameters=%s,"
+ + " timeoutMinutes=%d," + " environment='%s'," + " disableRollback='%s'," + " files=%s" + "}",
+ stackName, templateUrl, template, parameters, timeoutMinutes, environment, disableRollback, files);
}
}
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
@JsonInclude(JsonInclude.Include.NON_NULL)
-@JsonPropertyOrder({ "event_time", "id", "links", "logical_resource_id", "physical_resource_id", "resource_name",
- "resource_status", "resource_status_reason" })
+@JsonPropertyOrder({"event_time", "id", "links", "logical_resource_id", "physical_resource_id", "resource_name",
+ "resource_status", "resource_status_reason"})
public class Event {
- @JsonProperty("event_time")
- private String eventTime;
- @JsonProperty("id")
- private String id;
- @JsonProperty("links")
- private List<Link> links = null;
- @JsonProperty("logical_resource_id")
- private String logicalResourceId;
- @JsonProperty("physical_resource_id")
- private Object physicalResourceId;
- @JsonProperty("resource_name")
- private String resourceName;
- @JsonProperty("resource_status")
- private String resourceStatus;
- @JsonProperty("resource_status_reason")
- private String resourceStatusReason;
-
- @JsonProperty("event_time")
- public String getEventTime() {
- return eventTime;
- }
-
- @JsonProperty("event_time")
- public void setEventTime(String eventTime) {
- this.eventTime = eventTime;
- }
-
- @JsonProperty("id")
- public String getId() {
- return id;
- }
-
- @JsonProperty("id")
- public void setId(String id) {
- this.id = id;
- }
-
- @JsonProperty("links")
- public List<Link> getLinks() {
- return links;
- }
-
- @JsonProperty("links")
- public void setLinks(List<Link> links) {
- this.links = links;
- }
-
- @JsonProperty("logical_resource_id")
- public String getLogicalResourceId() {
- return logicalResourceId;
- }
-
- @JsonProperty("logical_resource_id")
- public void setLogicalResourceId(String logicalResourceId) {
- this.logicalResourceId = logicalResourceId;
- }
-
- @JsonProperty("physical_resource_id")
- public Object getPhysicalResourceId() {
- return physicalResourceId;
- }
-
- @JsonProperty("physical_resource_id")
- public void setPhysicalResourceId(Object physicalResourceId) {
- this.physicalResourceId = physicalResourceId;
- }
-
- @JsonProperty("resource_name")
- public String getResourceName() {
- return resourceName;
- }
-
- @JsonProperty("resource_name")
- public void setResourceName(String resourceName) {
- this.resourceName = resourceName;
- }
-
- @JsonProperty("resource_status")
- public String getResourceStatus() {
- return resourceStatus;
- }
-
- @JsonProperty("resource_status")
- public void setResourceStatus(String resourceStatus) {
- this.resourceStatus = resourceStatus;
- }
-
- @JsonProperty("resource_status_reason")
- public String getResourceStatusReason() {
- return resourceStatusReason;
- }
-
- @JsonProperty("resource_status_reason")
- public void setResourceStatusReason(String resourceStatusReason) {
- this.resourceStatusReason = resourceStatusReason;
- }
+ @JsonProperty("event_time")
+ private String eventTime;
+ @JsonProperty("id")
+ private String id;
+ @JsonProperty("links")
+ private List<Link> links = null;
+ @JsonProperty("logical_resource_id")
+ private String logicalResourceId;
+ @JsonProperty("physical_resource_id")
+ private Object physicalResourceId;
+ @JsonProperty("resource_name")
+ private String resourceName;
+ @JsonProperty("resource_status")
+ private String resourceStatus;
+ @JsonProperty("resource_status_reason")
+ private String resourceStatusReason;
+
+ @JsonProperty("event_time")
+ public String getEventTime() {
+ return eventTime;
+ }
+
+ @JsonProperty("event_time")
+ public void setEventTime(String eventTime) {
+ this.eventTime = eventTime;
+ }
+
+ @JsonProperty("id")
+ public String getId() {
+ return id;
+ }
+
+ @JsonProperty("id")
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ @JsonProperty("links")
+ public List<Link> getLinks() {
+ return links;
+ }
+
+ @JsonProperty("links")
+ public void setLinks(List<Link> links) {
+ this.links = links;
+ }
+
+ @JsonProperty("logical_resource_id")
+ public String getLogicalResourceId() {
+ return logicalResourceId;
+ }
+
+ @JsonProperty("logical_resource_id")
+ public void setLogicalResourceId(String logicalResourceId) {
+ this.logicalResourceId = logicalResourceId;
+ }
+
+ @JsonProperty("physical_resource_id")
+ public Object getPhysicalResourceId() {
+ return physicalResourceId;
+ }
+
+ @JsonProperty("physical_resource_id")
+ public void setPhysicalResourceId(Object physicalResourceId) {
+ this.physicalResourceId = physicalResourceId;
+ }
+
+ @JsonProperty("resource_name")
+ public String getResourceName() {
+ return resourceName;
+ }
+
+ @JsonProperty("resource_name")
+ public void setResourceName(String resourceName) {
+ this.resourceName = resourceName;
+ }
+
+ @JsonProperty("resource_status")
+ public String getResourceStatus() {
+ return resourceStatus;
+ }
+
+ @JsonProperty("resource_status")
+ public void setResourceStatus(String resourceStatus) {
+ this.resourceStatus = resourceStatus;
+ }
+
+ @JsonProperty("resource_status_reason")
+ public String getResourceStatusReason() {
+ return resourceStatusReason;
+ }
+
+ @JsonProperty("resource_status_reason")
+ public void setResourceStatusReason(String resourceStatusReason) {
+ this.resourceStatusReason = resourceStatusReason;
+ }
}
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
-
import com.fasterxml.jackson.annotation.JsonProperty;
public class Events implements Iterable<Event>, Serializable {
- /**
- *
- */
- private static final long serialVersionUID = 3598543745379474704L;
-
- @JsonProperty("events")
- private List<Event> events = new ArrayList<>();
+ /**
+ *
+ */
+ private static final long serialVersionUID = 3598543745379474704L;
+
+ @JsonProperty("events")
+ private List<Event> events = new ArrayList<>();
public List<Event> getEvents() {
return events;
}
-
+
@Override
public Iterator<Event> iterator() {
return events.iterator();
*/
// There is no Root element for the Explanation return
-//@JsonRootName("error")
+// @JsonRootName("error")
public class Explanation {
@JsonProperty("explanation")
private String explanation;
@JsonProperty("title")
private String title;
-
+
@JsonRootName("error")
public static class Error {
@JsonProperty("message")
public String getMessage() {
return message;
}
-
+
public String getTraceback() {
return traceback;
}
-
+
public String getType() {
return type;
}
}
-
+
private Error error;
-
+
public String getExplanation() {
return explanation;
}
-
+
public int getCode() {
return code;
}
-
+
public String getTitle() {
return title;
}
-
+
public Error getError() {
return error;
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
- return "Explanation [ " +
- "code='" + code +
- "', title='" + title +
- "', explanation='" + explanation +
- "', Error [type='" + error.type +
- "', message='" + error.message + "' ] ]";
+ return "Explanation [ " + "code='" + code + "', title='" + title + "', explanation='" + explanation
+ + "', Error [type='" + error.type + "', message='" + error.message + "' ] ]";
}
}
@Override
public String toString() {
- return "Link{" +
- "href='" + href + '\'' +
- ", rel='" + rel + '\'' +
- '}';
+ return "Link{" + "href='" + href + '\'' + ", rel='" + rel + '\'' + '}';
}
}
import java.util.Date;
import java.util.List;
-
import com.fasterxml.jackson.annotation.JsonProperty;
public class Resource {
@JsonProperty("updated_time")
private Date updatedTime;
+ @JsonProperty("creation_time")
+ private Date creationTime;
+
@JsonProperty("resource_type")
private String type;
return statusReason;
}
+ public Date getCreationTime() {
+ return creationTime;
+ }
+
+ public void setCreationTime(Date creationTime) {
+ this.creationTime = creationTime;
+ }
+
public void setStatusReason(String statusReason) {
this.statusReason = statusReason;
}
@Override
public String toString() {
- return "Resource{" +
- "name='" + name + '\'' +
- ", links=" + links +
- ", status='" + status + '\'' +
- ", physicalResourceId='" + physicalResourceId + '\'' +
- ", logicalResourceId='" + logicalResourceId + '\'' +
- ", requiredBy=" + requiredBy +
- ", updatedTime=" + updatedTime +
- ", type='" + type + '\'' +
- ", statusReason='" + statusReason + '\'' +
- '}';
+ return "Resource{" + "name='" + name + '\'' + ", links=" + links + ", status='" + status + '\''
+ + ", physicalResourceId='" + physicalResourceId + '\'' + ", logicalResourceId='" + logicalResourceId
+ + '\'' + ", requiredBy=" + requiredBy + ", updatedTime=" + updatedTime + ", type='" + type + '\''
+ + ", statusReason='" + statusReason + '\'' + '}';
}
}
import java.io.Serializable;
import java.util.Iterator;
import java.util.List;
-
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonRootName;
@Override
public String toString() {
- return "Resources{" +
- "list=" + list +
- '}';
+ return "Resources{" + "list=" + list + '}';
}
}
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
-
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
@JsonProperty("links")
private List<Link> links;
+
@JsonProperty("stack_status_reason")
private String stackStatusReason;
@JsonProperty("id")
private String id;
-
+
+ @JsonProperty("template_description")
+ private String templateDescription;
+
+ @JsonProperty("stack_owner")
+ private String stackOwner;
+
+ @JsonProperty("disable_rollback")
+ private boolean disableRollback;
+
+ @JsonProperty("stack_user_project_id")
+ private String userProjectId;
+
+ @JsonProperty("timeout_mins")
+ private int timeouteMinutes;
+
+ public String getTemplateDescription() {
+ return templateDescription;
+ }
+
+ public void setTemplateDescription(String templateDescription) {
+ this.templateDescription = templateDescription;
+ }
+
+ public String getStackOwner() {
+ return stackOwner;
+ }
+
+ public void setStackOwner(String stackOwner) {
+ this.stackOwner = stackOwner;
+ }
+
+ public boolean isDisableRollback() {
+ return disableRollback;
+ }
+
+ public void setDisableRollback(boolean disableRollback) {
+ this.disableRollback = disableRollback;
+ }
+
+ public String getUserProjectId() {
+ return userProjectId;
+ }
+
+ public void setUserProjectId(String userProjectId) {
+ this.userProjectId = userProjectId;
+ }
+
+ public int getTimeouteMinutes() {
+ return timeouteMinutes;
+ }
+
+ public void setTimeouteMinutes(int timeouteMinutes) {
+ this.timeouteMinutes = timeouteMinutes;
+ }
+
+ public String getProject() {
+ return project;
+ }
+
+ public void setProject(String project) {
+ this.project = project;
+ }
+
+ @JsonProperty("project")
+ private String project;
+
@JsonProperty("files")
private Map<String, Object> files = null;
-
+
// ObjectMapper instance to parse Json stack outputs
@JsonIgnore
private static ObjectMapper mapper = new ObjectMapper();
public void setDescription(String description) {
this.description = description;
}
-
+
public Map<String, Object> getFiles() {
return this.files;
}
+
public void setFiles(Map<String, Object> files) {
this.files = files;
}
@Override
public String toString() {
- return "Stack{" +
- "description='" + description + '\'' +
- ", links=" + links +
- ", stackStatusReason='" + stackStatusReason + '\'' +
- ", stackName='" + stackName + '\'' +
- ", updatedTime=" + updatedTime +
- ", creationTime=" + creationTime +
- ", stackStatus='" + stackStatus + '\'' +
- ", id='" + id + '\'' +
- ", outputs='" + outputs + '\'' +
- ", parameters='" + parameters + '\'' +
- ", files='" + files + '\'' +
- '}';
- }
-
- @JsonIgnoreProperties(ignoreUnknown=true)
+ return "Stack{" + "description='" + description + '\'' + ", links=" + links + ", stackStatusReason='"
+ + stackStatusReason + '\'' + ", stackName='" + stackName + '\'' + ", updatedTime=" + updatedTime
+ + ", creationTime=" + creationTime + ", stackStatus='" + stackStatus + '\'' + ", id='" + id + '\''
+ + ", outputs='" + outputs + '\'' + ", parameters='" + parameters + '\'' + ", files='" + files + '\''
+ + '}';
+ }
+
+ @JsonIgnoreProperties(ignoreUnknown = true)
public static final class Output {
@JsonProperty("output_value")
private Object outputValue;
-
+
private String description;
-
+
@JsonProperty("output_key")
private String outputKey;
-
+
public Object getOutputValue() {
return outputValue;
}
return outputKey;
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
- return "Output [key=" + outputKey + ", value="
- + outputValue + "]";
+ return "Output [key=" + outputKey + ", value=" + outputValue + "]";
}
}
-
+
private List<Output> outputs;
public List<Output> getOutputs() {
return outputs;
}
-
- private Object _findOutputValue (String key) {
+
+ private Object _findOutputValue(String key) {
for (Output o : outputs) {
if (o.getOutputKey().equals(key)) {
return o.getOutputValue();
}
return null;
}
-
+
/*
- * Return a stack output as a String.
- * Generally speaking, most outputs will be Strings.
+ * Return a stack output as a String. Generally speaking, most outputs will be Strings.
*/
- public String getOutputValue (String key)
- {
+ public String getOutputValue(String key) {
Object value = _findOutputValue(key);
if (value != null)
return value.toString();
else
return null;
}
-
+
/*
- * Return a stack output as a Json-mapped Object of the provided type.
- * This is useful for json-object stack outputs.
+ * Return a stack output as a Json-mapped Object of the provided type. This is useful for json-object stack outputs.
*/
- public <T> T getOutputValue (String key, Class<T> type)
- {
+ public <T> T getOutputValue(String key, Class<T> type) {
try {
String s = mapper.writeValueAsString(_findOutputValue(key));
return mapper.readValue(s, type);
- }
- catch (IOException e) {
+ } catch (IOException e) {
return null;
}
}
-
+
@JsonProperty("parameters")
- private Map<String,Object> parameters = new HashMap<>();
-
- public void setParameters (Map<String,Object> params)
- {
+ private Map<String, Object> parameters = new HashMap<>();
+
+ public void setParameters(Map<String, Object> params) {
// Need to "fix" comma-delimited-list parameters for pre-Juno Heat
// (see https://bugs.launchpad.net/heat/+bug/1367393)
parameters = params;
-
- for (Entry<String,Object> param : parameters.entrySet())
- {
+
+ for (Entry<String, Object> param : parameters.entrySet()) {
// CDL params are returned as a string with format:
// "[u'<value1>',u'<value2>',...]"
String value = param.getValue().toString();
- if (value.startsWith("[") && value.endsWith("]"))
- {
- param.setValue(value.substring(1,value.length()-1).replaceAll("u'([^\']+)'","$1"));
+ if (value.startsWith("[") && value.endsWith("]")) {
+ param.setValue(value.substring(1, value.length() - 1).replaceAll("u'([^\']+)'", "$1"));
}
}
}
-
- public Map<String,Object> getParameters() {
+
+ public Map<String, Object> getParameters() {
return parameters;
}
}
import java.io.Serializable;
import java.util.Iterator;
import java.util.List;
-
import com.fasterxml.jackson.annotation.JsonProperty;
public class Stacks implements Iterable<Stack>, Serializable {
@JsonProperty("stacks")
private List<Stack> list;
+ @JsonProperty("links")
+ private List<Link> links;
+
+ public List<Link> getLinks() {
+ return links;
+ }
+
+ public void setLinks(List<Link> links) {
+ this.links = links;
+ }
+
@Override
public Iterator<Stack> iterator() {
return list.iterator();
package com.woorea.openstack.heat.model;
import java.util.Map;
-
import com.fasterxml.jackson.annotation.JsonProperty;
public class UpdateStackParam {
@JsonProperty("disable_rollback")
private boolean disableRollback = true;
-
+
@JsonProperty("files")
private Map<String, Object> files;
public String getEnvironment() {
return environment;
- }
+ }
public void setFiles(Map<String, Object> files) {
this.files = files;
}
+
public Map<String, Object> getFiles() {
return this.files;
}
@Override
public String toString() {
- return "UpdateStackParam{" +
- " templateUrl='" + templateUrl + '\'' +
- ", template='" + template + '\'' +
- ", parameters=" + parameters +
- ", timeoutMinutes=" + timeoutMinutes +
- ", environment='" + environment + '\'' +
- ", disableRollback='" + disableRollback + '\'' +
- ", files=" + files +
- '}';
+ return "UpdateStackParam{" + " templateUrl='" + templateUrl + '\'' + ", template='" + template + '\''
+ + ", parameters=" + parameters + ", timeoutMinutes=" + timeoutMinutes + ", environment='" + environment
+ + '\'' + ", disableRollback='" + disableRollback + '\'' + ", files=" + files + '}';
}
}
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
-
import java.util.Map;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"template\" : \"template\"," + EOL
- + " \"parameters\" : {" + EOL
- + " \"parameters-k1\" : \"parameters-v1\"," + EOL
- + " \"parameters-k2\" : \"parameters-v2\"" + EOL
- + " }," + EOL
- + " \"environment\" : \"environment\"," + EOL
- + " \"files\" : {" + EOL
- + " \"files-k1\" : \"files-v1\"," + EOL
- + " \"files-k2\" : \"files-v2\"" + EOL
- + " }," + EOL
- + " \"stack_name\" : \"stackname\"," + EOL
- + " \"template_url\" : \"templateurl\"," + EOL
- + " \"timeout_mins\" : 79," + EOL
- + " \"disable_rollback\" : true" + EOL
- + "}";
-
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private static final String JSON_FULL = "{" + EOL + " \"template\" : \"template\"," + EOL + " \"parameters\" : {"
+ + EOL + " \"parameters-k1\" : \"parameters-v1\"," + EOL + " \"parameters-k2\" : \"parameters-v2\""
+ + EOL + " }," + EOL + " \"environment\" : \"environment\"," + EOL + " \"files\" : {" + EOL
+ + " \"files-k1\" : \"files-v1\"," + EOL + " \"files-k2\" : \"files-v2\"" + EOL + " }," + EOL
+ + " \"stack_name\" : \"stackname\"," + EOL + " \"template_url\" : \"templateurl\"," + EOL
+ + " \"timeout_mins\" : 79," + EOL + " \"disable_rollback\" : true" + EOL + "}";
+
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
CreateStackParam createstackparam = objectMapper.readValue(JSON_FULL, CreateStackParam.class);
createstackparam.toString();
-
+
String template = createstackparam.getTemplate();
Assert.assertNotNull(template);
createstackparam.setTemplate(template);
-
+
String environment = createstackparam.getEnvironment();
Assert.assertNotNull(environment);
createstackparam.setEnvironment(environment);
-
+
int timeoutMinutes = createstackparam.getTimeoutMinutes();
Assert.assertNotNull(timeoutMinutes);
createstackparam.setTimeoutMinutes(timeoutMinutes);
-
+
boolean disableRollback = createstackparam.getDisableRollback();
Assert.assertNotNull(disableRollback);
createstackparam.setDisableRollback(disableRollback);
-
- Map<String,Object> files = createstackparam.getFiles();
+
+ Map<String, Object> files = createstackparam.getFiles();
Assert.assertNotNull(files);
Assert.assertEquals(2, files.size());
createstackparam.setFiles(files);
-
+
String stackName = createstackparam.getStackName();
Assert.assertNotNull(stackName);
createstackparam.setStackName(stackName);
-
- Map<String,Object> parameters = createstackparam.getParameters();
+
+ Map<String, Object> parameters = createstackparam.getParameters();
Assert.assertNotNull(parameters);
Assert.assertEquals(2, parameters.size());
createstackparam.setParameters(parameters);
-
+
String templateUrl = createstackparam.getTemplateUrl();
Assert.assertNotNull(templateUrl);
createstackparam.setTemplateUrl(templateUrl);
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.woorea.openstack.heat.model.Explanation.Error;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"error\" : {" + EOL
- + " \"message\" : \"message\"," + EOL
- + " \"traceback\" : \"traceback\"," + EOL
- + " \"type\" : \"type\"" + EOL
- + " }" + EOL
- + "}";
+ private static final String JSON_FULL = "{" + EOL + " \"error\" : {" + EOL + " \"message\" : \"message\"," + EOL
+ + " \"traceback\" : \"traceback\"," + EOL + " \"type\" : \"type\"" + EOL + " }" + EOL + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(SerializationFeature.WRAP_ROOT_VALUE)
- .enable(DeserializationFeature.UNWRAP_ROOT_VALUE)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE)
+ .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
Error error = objectMapper.readValue(JSON_FULL, Error.class);
error.toString();
-
+
String type = error.getType();
Assert.assertNotNull(type);
-
+
String message = error.getMessage();
Assert.assertNotNull(message);
-
+
String traceback = error.getTraceback();
Assert.assertNotNull(traceback);
}
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.woorea.openstack.heat.model.Explanation.Error;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"explanation\" : \"explanation\"," + EOL
- + " \"code\" : 42," + EOL
- + " \"title\" : \"title\"," + EOL
- + " \"error\" : {" + EOL
- + " \"message\" : \"message\"," + EOL
- + " \"traceback\" : \"traceback\"," + EOL
- + " \"type\" : \"type\"" + EOL
- + " }" + EOL
- + "}";
+ private static final String JSON_FULL = "{" + EOL + " \"explanation\" : \"explanation\"," + EOL
+ + " \"code\" : 42," + EOL + " \"title\" : \"title\"," + EOL + " \"error\" : {" + EOL
+ + " \"message\" : \"message\"," + EOL + " \"traceback\" : \"traceback\"," + EOL
+ + " \"type\" : \"type\"" + EOL + " }" + EOL + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
Explanation explanation = objectMapper.readValue(JSON_FULL, Explanation.class);
explanation.toString();
-
+
int code = explanation.getCode();
Assert.assertNotNull(code);
-
+
String explanationProperty = explanation.getExplanation();
Assert.assertNotNull(explanationProperty);
-
+
String title = explanation.getTitle();
Assert.assertNotNull(title);
-
+
Error error = explanation.getError();
Assert.assertNotNull(error);
}
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"href\" : \"href\"," + EOL
- + " \"rel\" : \"rel\"" + EOL
- + "}";
+ private static final String JSON_FULL =
+ "{" + EOL + " \"href\" : \"href\"," + EOL + " \"rel\" : \"rel\"" + EOL + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
Link link = objectMapper.readValue(JSON_FULL, Link.class);
link.toString();
-
+
String rel = link.getRel();
Assert.assertNotNull(rel);
link.setRel(rel);
-
+
String href = link.getHref();
Assert.assertNotNull(href);
link.setHref(href);
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.woorea.openstack.heat.model.Stack.Output;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"description\" : \"description\"," + EOL
- + " \"output_value\" : \"outputvalue\"," + EOL
- + " \"output_key\" : \"outputkey\"" + EOL
- + "}";
+ private static final String JSON_FULL = "{" + EOL + " \"description\" : \"description\"," + EOL
+ + " \"output_value\" : \"outputvalue\"," + EOL + " \"output_key\" : \"outputkey\"" + EOL + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
Output output = objectMapper.readValue(JSON_FULL, Output.class);
output.toString();
-
+
String outputKey = output.getOutputKey();
Assert.assertNotNull(outputKey);
-
+
Object outputValue = output.getOutputValue();
Assert.assertNotNull(outputValue);
-
+
String description = output.getDescription();
Assert.assertNotNull(description);
}
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
-
import java.util.Date;
import java.util.List;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"links\" : [ {" + EOL
- + " \"href\" : \"href\"," + EOL
- + " \"rel\" : \"rel\"" + EOL
- + " }, {" + EOL
- + " \"href\" : \"href\"," + EOL
- + " \"rel\" : \"rel\"" + EOL
- + " } ]," + EOL
- + " \"resource_name\" : \"name\"," + EOL
- + " \"resource_status\" : \"status\"," + EOL
- + " \"physical_resource_id\" : \"physicalresourceid\"," + EOL
- + " \"logical_resource_id\" : \"logicalresourceid\"," + EOL
- + " \"required_by\" : [ \"requiredby-v1\", \"requiredby-v2\" ]," + EOL
- + " \"updated_time\" : 1488110400000," + EOL
- + " \"resource_type\" : \"type\"," + EOL
- + " \"resource_status_reason\" : \"statusreason\"" + EOL
- + "}";
-
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private static final String JSON_FULL = "{" + EOL + " \"links\" : [ {" + EOL + " \"href\" : \"href\"," + EOL
+ + " \"rel\" : \"rel\"" + EOL + " }, {" + EOL + " \"href\" : \"href\"," + EOL
+ + " \"rel\" : \"rel\"" + EOL + " } ]," + EOL + " \"resource_name\" : \"name\"," + EOL
+ + " \"resource_status\" : \"status\"," + EOL + " \"physical_resource_id\" : \"physicalresourceid\"," + EOL
+ + " \"logical_resource_id\" : \"logicalresourceid\"," + EOL
+ + " \"required_by\" : [ \"requiredby-v1\", \"requiredby-v2\" ]," + EOL
+ + " \"updated_time\" : 1488110400000," + EOL + " \"resource_type\" : \"type\"," + EOL
+ + " \"resource_status_reason\" : \"statusreason\"" + EOL + "}";
+
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
Resource resource = objectMapper.readValue(JSON_FULL, Resource.class);
resource.toString();
-
+
Date updatedTime = resource.getUpdatedTime();
Assert.assertNotNull(updatedTime);
resource.setUpdatedTime(updatedTime);
-
+
String physicalResourceId = resource.getPhysicalResourceId();
Assert.assertNotNull(physicalResourceId);
resource.setPhysicalResourceId(physicalResourceId);
-
+
List<String> requiredBy = resource.getRequiredBy();
Assert.assertNotNull(requiredBy);
Assert.assertEquals(2, requiredBy.size());
resource.setRequiredBy(requiredBy);
-
+
String statusReason = resource.getStatusReason();
Assert.assertNotNull(statusReason);
resource.setStatusReason(statusReason);
-
+
String name = resource.getName();
Assert.assertNotNull(name);
resource.setName(name);
-
+
List<Link> links = resource.getLinks();
Assert.assertNotNull(links);
Assert.assertEquals(2, links.size());
resource.setLinks(links);
-
+
String logicalResourceId = resource.getLogicalResourceId();
Assert.assertNotNull(logicalResourceId);
resource.setLogicalResourceId(logicalResourceId);
-
+
String type = resource.getType();
Assert.assertNotNull(type);
resource.setType(type);
-
+
String status = resource.getStatus();
Assert.assertNotNull(status);
resource.setStatus(status);
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
-
import java.util.List;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"resources\" : [ {" + EOL
- + " \"links\" : [ {" + EOL
- + " \"href\" : \"href\"," + EOL
- + " \"rel\" : \"rel\"" + EOL
- + " }, {" + EOL
- + " \"href\" : \"href\"," + EOL
- + " \"rel\" : \"rel\"" + EOL
- + " } ]," + EOL
- + " \"resource_name\" : \"name\"," + EOL
- + " \"resource_status\" : \"status\"," + EOL
- + " \"physical_resource_id\" : \"physicalresourceid\"," + EOL
- + " \"logical_resource_id\" : \"logicalresourceid\"," + EOL
- + " \"required_by\" : [ \"requiredby-v1\", \"requiredby-v2\" ]," + EOL
- + " \"updated_time\" : 1488110400000," + EOL
- + " \"resource_type\" : \"type\"," + EOL
- + " \"resource_status_reason\" : \"statusreason\"" + EOL
- + " }, {" + EOL
- + " \"links\" : [ {" + EOL
- + " \"href\" : \"href\"," + EOL
- + " \"rel\" : \"rel\"" + EOL
- + " }, {" + EOL
- + " \"href\" : \"href\"," + EOL
- + " \"rel\" : \"rel\"" + EOL
- + " } ]," + EOL
- + " \"resource_name\" : \"name\"," + EOL
- + " \"resource_status\" : \"status\"," + EOL
- + " \"physical_resource_id\" : \"physicalresourceid\"," + EOL
- + " \"logical_resource_id\" : \"logicalresourceid\"," + EOL
- + " \"required_by\" : [ \"requiredby-v1\", \"requiredby-v2\" ]," + EOL
- + " \"updated_time\" : 1488110400000," + EOL
- + " \"resource_type\" : \"type\"," + EOL
- + " \"resource_status_reason\" : \"statusreason\"" + EOL
- + " } ]" + EOL
- + "}";
+ private static final String JSON_FULL = "{" + EOL + " \"resources\" : [ {" + EOL + " \"links\" : [ {" + EOL
+ + " \"href\" : \"href\"," + EOL + " \"rel\" : \"rel\"" + EOL + " }, {" + EOL
+ + " \"href\" : \"href\"," + EOL + " \"rel\" : \"rel\"" + EOL + " } ]," + EOL
+ + " \"resource_name\" : \"name\"," + EOL + " \"resource_status\" : \"status\"," + EOL
+ + " \"physical_resource_id\" : \"physicalresourceid\"," + EOL
+ + " \"logical_resource_id\" : \"logicalresourceid\"," + EOL
+ + " \"required_by\" : [ \"requiredby-v1\", \"requiredby-v2\" ]," + EOL
+ + " \"updated_time\" : 1488110400000," + EOL + " \"resource_type\" : \"type\"," + EOL
+ + " \"resource_status_reason\" : \"statusreason\"" + EOL + " }, {" + EOL + " \"links\" : [ {" + EOL
+ + " \"href\" : \"href\"," + EOL + " \"rel\" : \"rel\"" + EOL + " }, {" + EOL
+ + " \"href\" : \"href\"," + EOL + " \"rel\" : \"rel\"" + EOL + " } ]," + EOL
+ + " \"resource_name\" : \"name\"," + EOL + " \"resource_status\" : \"status\"," + EOL
+ + " \"physical_resource_id\" : \"physicalresourceid\"," + EOL
+ + " \"logical_resource_id\" : \"logicalresourceid\"," + EOL
+ + " \"required_by\" : [ \"requiredby-v1\", \"requiredby-v2\" ]," + EOL
+ + " \"updated_time\" : 1488110400000," + EOL + " \"resource_type\" : \"type\"," + EOL
+ + " \"resource_status_reason\" : \"statusreason\"" + EOL + " } ]" + EOL + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
Resources resources = objectMapper.readValue(JSON_FULL, Resources.class);
resources.toString();
-
+
List<Resource> list = resources.getList();
Assert.assertNotNull(list);
Assert.assertEquals(2, list.size());
-
+
int cnt = 0;
- for (@SuppressWarnings("unused") Resource x : resources) {
+ for (@SuppressWarnings("unused")
+ Resource x : resources) {
++cnt;
}
Assert.assertEquals(2, cnt);
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.woorea.openstack.heat.model.Stack.Output;
-
import java.util.Date;
import java.util.List;
import java.util.Map;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"stack\" : {" + EOL
- + " \"description\" : \"description\"," + EOL
- + " \"links\" : [ {" + EOL
- + " \"href\" : \"href\"," + EOL
- + " \"rel\" : \"rel\"" + EOL
- + " }, {" + EOL
- + " \"href\" : \"href\"," + EOL
- + " \"rel\" : \"rel\"" + EOL
- + " } ]," + EOL
- + " \"id\" : \"id\"," + EOL
- + " \"files\" : {" + EOL
- + " \"files-k1\" : \"files-v1\"," + EOL
- + " \"files-k2\" : \"files-v2\"" + EOL
- + " }," + EOL
- + " \"outputs\" : [ {" + EOL
- + " \"description\" : \"description\"," + EOL
- + " \"output_value\" : \"outputvalue\"," + EOL
- + " \"output_key\" : \"outputkey\"" + EOL
- + " }, {" + EOL
- + " \"description\" : \"description\"," + EOL
- + " \"output_value\" : \"outputvalue\"," + EOL
- + " \"output_key\" : \"outputkey\"" + EOL
- + " } ]," + EOL
- + " \"parameters\" : {" + EOL
- + " \"parameters-k1\" : \"parameters-v1\"," + EOL
- + " \"parameters-k2\" : \"parameters-v2\"" + EOL
- + " }," + EOL
- + " \"stack_status_reason\" : \"stackstatusreason\"," + EOL
- + " \"stack_name\" : \"stackname\"," + EOL
- + " \"updated_time\" : 1488110400000," + EOL
- + " \"creation_time\" : 1488974400000," + EOL
- + " \"stack_status\" : \"stackstatus\"" + EOL
- + " }" + EOL
- + "}";
-
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(SerializationFeature.WRAP_ROOT_VALUE)
- .enable(DeserializationFeature.UNWRAP_ROOT_VALUE)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private static final String JSON_FULL = "{" + EOL + " \"stack\" : {" + EOL
+ + " \"description\" : \"description\"," + EOL + " \"links\" : [ {" + EOL
+ + " \"href\" : \"href\"," + EOL + " \"rel\" : \"rel\"" + EOL + " }, {" + EOL
+ + " \"href\" : \"href\"," + EOL + " \"rel\" : \"rel\"" + EOL + " } ]," + EOL
+ + " \"id\" : \"id\"," + EOL + " \"files\" : {" + EOL + " \"files-k1\" : \"files-v1\"," + EOL
+ + " \"files-k2\" : \"files-v2\"" + EOL + " }," + EOL + " \"outputs\" : [ {" + EOL
+ + " \"description\" : \"description\"," + EOL + " \"output_value\" : \"outputvalue\"," + EOL
+ + " \"output_key\" : \"outputkey\"" + EOL + " }, {" + EOL
+ + " \"description\" : \"description\"," + EOL + " \"output_value\" : \"outputvalue\"," + EOL
+ + " \"output_key\" : \"outputkey\"" + EOL + " } ]," + EOL + " \"parameters\" : {" + EOL
+ + " \"parameters-k1\" : \"parameters-v1\"," + EOL + " \"parameters-k2\" : \"parameters-v2\"" + EOL
+ + " }," + EOL + " \"stack_status_reason\" : \"stackstatusreason\"," + EOL
+ + " \"stack_name\" : \"stackname\"," + EOL + " \"updated_time\" : 1488110400000," + EOL
+ + " \"creation_time\" : 1488974400000," + EOL + " \"stack_status\" : \"stackstatus\"" + EOL + " }"
+ + EOL + "}";
+
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE)
+ .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
Stack stack = objectMapper.readValue(JSON_FULL, Stack.class);
stack.toString();
-
+
Date updatedTime = stack.getUpdatedTime();
Assert.assertNotNull(updatedTime);
stack.setUpdatedTime(updatedTime);
-
+
List<Output> outputs = stack.getOutputs();
Assert.assertNotNull(outputs);
Assert.assertEquals(2, outputs.size());
-
+
String stackStatus = stack.getStackStatus();
Assert.assertNotNull(stackStatus);
stack.setStackStatus(stackStatus);
-
+
String description = stack.getDescription();
Assert.assertNotNull(description);
stack.setDescription(description);
-
- Map<String,Object> files = stack.getFiles();
+
+ Map<String, Object> files = stack.getFiles();
Assert.assertNotNull(files);
Assert.assertEquals(2, files.size());
stack.setFiles(files);
-
+
List<Link> links = stack.getLinks();
Assert.assertNotNull(links);
Assert.assertEquals(2, links.size());
stack.setLinks(links);
-
+
String stackName = stack.getStackName();
Assert.assertNotNull(stackName);
stack.setStackName(stackName);
-
+
String id = stack.getId();
Assert.assertNotNull(id);
stack.setId(id);
-
+
Date creationTime = stack.getCreationTime();
Assert.assertNotNull(creationTime);
stack.setCreationTime(creationTime);
-
- Map<String,Object> parameters = stack.getParameters();
+
+ Map<String, Object> parameters = stack.getParameters();
Assert.assertNotNull(parameters);
Assert.assertEquals(2, parameters.size());
stack.setParameters(parameters);
-
+
String stackStatusReason = stack.getStackStatusReason();
Assert.assertNotNull(stackStatusReason);
stack.setStackStatusReason(stackStatusReason);
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"stacks\" : [ {" + EOL
- + " \"description\" : \"description\"," + EOL
- + " \"links\" : [ {" + EOL
- + " \"href\" : \"href\"," + EOL
- + " \"rel\" : \"rel\"" + EOL
- + " }, {" + EOL
- + " \"href\" : \"href\"," + EOL
- + " \"rel\" : \"rel\"" + EOL
- + " } ]," + EOL
- + " \"id\" : \"id\"," + EOL
- + " \"files\" : {" + EOL
- + " \"files-k1\" : \"files-v1\"," + EOL
- + " \"files-k2\" : \"files-v2\"" + EOL
- + " }," + EOL
- + " \"outputs\" : [ {" + EOL
- + " \"description\" : \"description\"," + EOL
- + " \"output_value\" : \"outputvalue\"," + EOL
- + " \"output_key\" : \"outputkey\"" + EOL
- + " }, {" + EOL
- + " \"description\" : \"description\"," + EOL
- + " \"output_value\" : \"outputvalue\"," + EOL
- + " \"output_key\" : \"outputkey\"" + EOL
- + " } ]," + EOL
- + " \"parameters\" : {" + EOL
- + " \"parameters-k1\" : \"parameters-v1\"," + EOL
- + " \"parameters-k2\" : \"parameters-v2\"" + EOL
- + " }," + EOL
- + " \"stack_status_reason\" : \"stackstatusreason\"," + EOL
- + " \"stack_name\" : \"stackname\"," + EOL
- + " \"updated_time\" : 1488110400000," + EOL
- + " \"creation_time\" : 1488974400000," + EOL
- + " \"stack_status\" : \"stackstatus\"" + EOL
- + " }, {" + EOL
- + " \"description\" : \"description\"," + EOL
- + " \"links\" : [ {" + EOL
- + " \"href\" : \"href\"," + EOL
- + " \"rel\" : \"rel\"" + EOL
- + " }, {" + EOL
- + " \"href\" : \"href\"," + EOL
- + " \"rel\" : \"rel\"" + EOL
- + " } ]," + EOL
- + " \"id\" : \"id\"," + EOL
- + " \"files\" : {" + EOL
- + " \"files-k1\" : \"files-v1\"," + EOL
- + " \"files-k2\" : \"files-v2\"" + EOL
- + " }," + EOL
- + " \"outputs\" : [ {" + EOL
- + " \"description\" : \"description\"," + EOL
- + " \"output_value\" : \"outputvalue\"," + EOL
- + " \"output_key\" : \"outputkey\"" + EOL
- + " }, {" + EOL
- + " \"description\" : \"description\"," + EOL
- + " \"output_value\" : \"outputvalue\"," + EOL
- + " \"output_key\" : \"outputkey\"" + EOL
- + " } ]," + EOL
- + " \"parameters\" : {" + EOL
- + " \"parameters-k1\" : \"parameters-v1\"," + EOL
- + " \"parameters-k2\" : \"parameters-v2\"" + EOL
- + " }," + EOL
- + " \"stack_status_reason\" : \"stackstatusreason\"," + EOL
- + " \"stack_name\" : \"stackname\"," + EOL
- + " \"updated_time\" : 1488110400000," + EOL
- + " \"creation_time\" : 1488974400000," + EOL
- + " \"stack_status\" : \"stackstatus\"" + EOL
- + " } ]" + EOL
- + "}";
+ private static final String JSON_FULL = "{" + EOL + " \"stacks\" : [ {" + EOL
+ + " \"description\" : \"description\"," + EOL + " \"links\" : [ {" + EOL
+ + " \"href\" : \"href\"," + EOL + " \"rel\" : \"rel\"" + EOL + " }, {" + EOL
+ + " \"href\" : \"href\"," + EOL + " \"rel\" : \"rel\"" + EOL + " } ]," + EOL
+ + " \"id\" : \"id\"," + EOL + " \"files\" : {" + EOL + " \"files-k1\" : \"files-v1\"," + EOL
+ + " \"files-k2\" : \"files-v2\"" + EOL + " }," + EOL + " \"outputs\" : [ {" + EOL
+ + " \"description\" : \"description\"," + EOL + " \"output_value\" : \"outputvalue\"," + EOL
+ + " \"output_key\" : \"outputkey\"" + EOL + " }, {" + EOL
+ + " \"description\" : \"description\"," + EOL + " \"output_value\" : \"outputvalue\"," + EOL
+ + " \"output_key\" : \"outputkey\"" + EOL + " } ]," + EOL + " \"parameters\" : {" + EOL
+ + " \"parameters-k1\" : \"parameters-v1\"," + EOL + " \"parameters-k2\" : \"parameters-v2\"" + EOL
+ + " }," + EOL + " \"stack_status_reason\" : \"stackstatusreason\"," + EOL
+ + " \"stack_name\" : \"stackname\"," + EOL + " \"updated_time\" : 1488110400000," + EOL
+ + " \"creation_time\" : 1488974400000," + EOL + " \"stack_status\" : \"stackstatus\"" + EOL + " }, {"
+ + EOL + " \"description\" : \"description\"," + EOL + " \"links\" : [ {" + EOL
+ + " \"href\" : \"href\"," + EOL + " \"rel\" : \"rel\"" + EOL + " }, {" + EOL
+ + " \"href\" : \"href\"," + EOL + " \"rel\" : \"rel\"" + EOL + " } ]," + EOL
+ + " \"id\" : \"id\"," + EOL + " \"files\" : {" + EOL + " \"files-k1\" : \"files-v1\"," + EOL
+ + " \"files-k2\" : \"files-v2\"" + EOL + " }," + EOL + " \"outputs\" : [ {" + EOL
+ + " \"description\" : \"description\"," + EOL + " \"output_value\" : \"outputvalue\"," + EOL
+ + " \"output_key\" : \"outputkey\"" + EOL + " }, {" + EOL
+ + " \"description\" : \"description\"," + EOL + " \"output_value\" : \"outputvalue\"," + EOL
+ + " \"output_key\" : \"outputkey\"" + EOL + " } ]," + EOL + " \"parameters\" : {" + EOL
+ + " \"parameters-k1\" : \"parameters-v1\"," + EOL + " \"parameters-k2\" : \"parameters-v2\"" + EOL
+ + " }," + EOL + " \"stack_status_reason\" : \"stackstatusreason\"," + EOL
+ + " \"stack_name\" : \"stackname\"," + EOL + " \"updated_time\" : 1488110400000," + EOL
+ + " \"creation_time\" : 1488974400000," + EOL + " \"stack_status\" : \"stackstatus\"" + EOL + " } ]"
+ + EOL + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
Stacks stacks = objectMapper.readValue(JSON_FULL, Stacks.class);
stacks.toString();
-
+
int cnt = 0;
- for (@SuppressWarnings("unused") Stack x : stacks) {
+ for (@SuppressWarnings("unused")
+ Stack x : stacks) {
++cnt;
}
Assert.assertEquals(2, cnt);
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
-
import java.util.Map;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"template\" : \"template\"," + EOL
- + " \"parameters\" : {" + EOL
- + " \"parameters-k1\" : \"parameters-v1\"," + EOL
- + " \"parameters-k2\" : \"parameters-v2\"" + EOL
- + " }," + EOL
- + " \"environment\" : \"environment\"," + EOL
- + " \"files\" : {" + EOL
- + " \"files-k1\" : \"files-v1\"," + EOL
- + " \"files-k2\" : \"files-v2\"" + EOL
- + " }," + EOL
- + " \"template_url\" : \"templateurl\"," + EOL
- + " \"timeout_mins\" : 79," + EOL
- + " \"disable_rollback\" : true" + EOL
- + "}";
+ private static final String JSON_FULL = "{" + EOL + " \"template\" : \"template\"," + EOL + " \"parameters\" : {"
+ + EOL + " \"parameters-k1\" : \"parameters-v1\"," + EOL + " \"parameters-k2\" : \"parameters-v2\""
+ + EOL + " }," + EOL + " \"environment\" : \"environment\"," + EOL + " \"files\" : {" + EOL
+ + " \"files-k1\" : \"files-v1\"," + EOL + " \"files-k2\" : \"files-v2\"" + EOL + " }," + EOL
+ + " \"template_url\" : \"templateurl\"," + EOL + " \"timeout_mins\" : 79," + EOL
+ + " \"disable_rollback\" : true" + EOL + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
UpdateStackParam updatestackparam = objectMapper.readValue(JSON_FULL, UpdateStackParam.class);
updatestackparam.toString();
-
+
String template = updatestackparam.getTemplate();
Assert.assertNotNull(template);
updatestackparam.setTemplate(template);
-
+
String environment = updatestackparam.getEnvironment();
Assert.assertNotNull(environment);
updatestackparam.setEnvironment(environment);
-
+
int timeoutMinutes = updatestackparam.getTimeoutMinutes();
Assert.assertNotNull(timeoutMinutes);
updatestackparam.setTimeoutMinutes(timeoutMinutes);
-
+
boolean disableRollback = updatestackparam.getDisableRollback();
Assert.assertNotNull(disableRollback);
updatestackparam.setDisableRollback(disableRollback);
-
- Map<String,Object> files = updatestackparam.getFiles();
+
+ Map<String, Object> files = updatestackparam.getFiles();
Assert.assertNotNull(files);
Assert.assertEquals(2, files.size());
updatestackparam.setFiles(files);
-
- Map<String,Object> parameters = updatestackparam.getParameters();
+
+ Map<String, Object> parameters = updatestackparam.getParameters();
Assert.assertNotNull(parameters);
Assert.assertEquals(2, parameters.size());
updatestackparam.setParameters(parameters);
-
+
String templateUrl = updatestackparam.getTemplateUrl();
Assert.assertNotNull(templateUrl);
updatestackparam.setTemplateUrl(templateUrl);
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.onap.so.libs</groupId>
<name>OpenStack Keystone Client</name>
<description>OpenStack Keystone Client</description>
<dependencies>
- <dependency>
- <groupId>org.onap.so.libs.openstack-java-sdk</groupId>
- <artifactId>openstack-client</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.onap.so.libs.openstack-java-sdk</groupId>
- <artifactId>keystone-model</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.jmockit</groupId>
- <artifactId>jmockit</artifactId>
- <version>1.19</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.12</version>
- <scope>test</scope>
- </dependency>
+ <dependency>
+ <groupId>org.onap.so.libs.openstack-java-sdk</groupId>
+ <artifactId>openstack-client</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.so.libs.openstack-java-sdk</groupId>
+ <artifactId>keystone-model</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jmockit</groupId>
+ <artifactId>jmockit</artifactId>
+ <version>1.19</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.12</version>
+ <scope>test</scope>
+ </dependency>
</dependencies>
</project>
import com.woorea.openstack.keystone.model.Endpoints;
public class EndpointsResource {
-
+
private OpenStackClient client;
-
+
public EndpointsResource(OpenStackClient client) {
this.client = client;
}
-
+
public List list() {
return new List();
}
-
+
public Create create(Endpoint endpoint) {
return new Create(endpoint);
}
-
+
public Show show(String id) {
return new Show(id);
}
-
+
public Delete delete(String id) {
return new Delete(id);
}
public class List extends OpenStackRequest<Endpoints> {
-
+
public List() {
super(client, HttpMethod.GET, "/endpoints", null, Endpoints.class);
}
}
-
+
public class Create extends OpenStackRequest<Endpoint> {
private Endpoint endpoint;
-
+
public Create(Endpoint endpoint) {
super(client, HttpMethod.POST, "/endpoints", Entity.json(endpoint), Endpoint.class);
this.endpoint = endpoint;
}
-
+
}
-
+
public class Show extends OpenStackRequest<Endpoint> {
-
+
public Show(String id) {
super(client, HttpMethod.GET, new StringBuilder("/endpoints/").append(id).toString(), null, Endpoint.class);
}
}
-
+
public class Delete extends OpenStackRequest<Void> {
-
+
public Delete(String id) {
super(client, HttpMethod.DELETE, new StringBuilder("/endpoints/").append(id).toString(), null, Void.class);
}
-
+
}
-
+
}
import com.woorea.openstack.keystone.model.Roles;
public class RolesResource {
-
+
private OpenStackClient client;
-
+
public RolesResource(OpenStackClient client) {
this.client = client;
}
-
+
public List list() {
return new List();
}
-
+
public Create create(Role role) {
return new Create(role);
}
-
+
public Delete delete(String id) {
return new Delete(id);
}
public class List extends OpenStackRequest<Roles> {
-
+
public List() {
super(client, HttpMethod.GET, "/OS-KSADM/roles", null, Roles.class);
}
}
-
+
public class Create extends OpenStackRequest<Role> {
private Role role;
-
+
public Create(Role role) {
super(client, HttpMethod.POST, "/OS-KSADM/roles", Entity.json(role), Role.class);
this.role = role;
}
-
+
}
-
+
public class Delete extends OpenStackRequest<Void> {
-
+
public Delete(String id) {
- super(client, HttpMethod.DELETE, new StringBuilder("/OS-KSADM/roles/").append(id).toString(), null, Void.class);
+ super(client, HttpMethod.DELETE, new StringBuilder("/OS-KSADM/roles/").append(id).toString(), null,
+ Void.class);
}
-
+
}
-
+
}
import com.woorea.openstack.keystone.model.Services;
public class ServicesResource {
-
+
private OpenStackClient client;
-
+
public ServicesResource(OpenStackClient client) {
this.client = client;
}
-
+
public List list() {
return new List();
}
-
+
public Create create(Service service) {
return new Create(service);
}
-
+
public Show show(String id) {
return new Show(id);
}
-
+
public Delete delete(String id) {
return new Delete(id);
}
public class List extends OpenStackRequest<Services> {
-
+
public List() {
super(client, HttpMethod.GET, "/OS-KSADM/services", null, Services.class);
}
}
-
+
public class Create extends OpenStackRequest<Service> {
private Service service;
-
+
public Create(Service service) {
super(client, HttpMethod.POST, "/OS-KSADM/services", Entity.json(service), Service.class);
this.service = service;
}
-
+
}
-
+
public class Show extends OpenStackRequest<Service> {
-
+
public Show(String id) {
- super(client, HttpMethod.GET, new StringBuilder("/OS-KSADM/services/").append(id).toString(), null, Service.class);
+ super(client, HttpMethod.GET, new StringBuilder("/OS-KSADM/services/").append(id).toString(), null,
+ Service.class);
}
}
-
+
public class Delete extends OpenStackRequest<Void> {
-
+
public Delete(String id) {
- super(client, HttpMethod.DELETE, new StringBuilder("/OS-KSADM/services/").append(id).toString(), null, Void.class);
+ super(client, HttpMethod.DELETE, new StringBuilder("/OS-KSADM/services/").append(id).toString(), null,
+ Void.class);
}
-
+
}
-
+
}
private Tenant tenant;
public Update(String id, Tenant tenant) {
- super(client, HttpMethod.PUT, getTenantsString(id).toString(), Entity.json(tenant),
- Tenant.class);
+ super(client, HttpMethod.PUT, getTenantsString(id).toString(), Entity.json(tenant), Tenant.class);
this.tenant = tenant;
}
}
public class ListUsers extends OpenStackRequest<Users> {
public ListUsers(String tenantId) {
- super(client, HttpMethod.GET,getTenantsString(tenantId).append("/users").toString(),
- null, Users.class);
+ super(client, HttpMethod.GET, getTenantsString(tenantId).append("/users").toString(), null, Users.class);
}
}
public class AddUser extends OpenStackRequest<Void> {
public AddUser(String tenantId, String userId, String roleId) {
- super(client, HttpMethod.PUT,
- getTenantsString(tenantId).append(USERS).append(userId)
+ super(client, HttpMethod.PUT, getTenantsString(tenantId).append(USERS).append(userId)
.append("/roles/OS-KSADM/").append(roleId).toString(), null, Void.class);
}
}
public class RemoveUser extends OpenStackRequest<Void> {
public RemoveUser(String tenantId, String userId, String roleId) {
- super(client, HttpMethod.DELETE,
- getTenantsString(tenantId).append(USERS).append(userId)
+ super(client, HttpMethod.DELETE, getTenantsString(tenantId).append(USERS).append(userId)
.append("/roles/OS-KSADM/").append(roleId).toString(), null, Void.class);
}
}
public ListUserRoles(String tenantId, String userId) {
super(client, HttpMethod.GET,
- getTenantsString(tenantId).append(USERS).append(userId).append("/roles")
- .toString(), null, Roles.class);
+ getTenantsString(tenantId).append(USERS).append(userId).append("/roles").toString(), null,
+ Roles.class);
}
}
/**
- * The following APIs support Tenant-level metadata. This is a feature supported
- * by the DCP/LCP (i.e. AIC cloud), but not native Openstack. The full API as
- * documented by AIC is implemented below.
+ * The following APIs support Tenant-level metadata. This is a feature supported by the DCP/LCP (i.e. AIC cloud),
+ * but not native Openstack. The full API as documented by AIC is implemented below.
*/
public class ShowMetadata extends OpenStackRequest<Metadata> {
public CreateOrUpdateMetadata(String tenantId, Metadata metadata) {
super(client, HttpMethod.POST, getTenantsString(tenantId).append(METADATA), Entity.json(metadata),
- Metadata.class);
+ Metadata.class);
}
}
public ReplaceMetadata(String tenantId, Metadata metadata) {
super(client, HttpMethod.PUT, getTenantsString(tenantId).append(METADATA), Entity.json(metadata),
- Metadata.class);
+ Metadata.class);
}
}
public class ShowMetadataItem extends OpenStackRequest<Metadata> {
public ShowMetadataItem(String tenantId, String key) {
- super(client, HttpMethod.GET,
- getTenantsString(tenantId).append(METADATA).append(key), null, Metadata.class);
+ super(client, HttpMethod.GET, getTenantsString(tenantId).append(METADATA).append(key), null,
+ Metadata.class);
}
}
public class CreateOrUpdateMetadataItem extends OpenStackRequest<Metadata> {
public CreateOrUpdateMetadataItem(String tenantId, String key, Metadata metadata) {
- super(client, HttpMethod.POST,
- getTenantsString(tenantId).append(METADATA).append(key), Entity.json(metadata),
- Metadata.class);
+ super(client, HttpMethod.POST, getTenantsString(tenantId).append(METADATA).append(key),
+ Entity.json(metadata), Metadata.class);
}
}
public class DeleteMetadataItem extends OpenStackRequest<Void> {
public DeleteMetadataItem(String tenantId, String key) {
- super(client, HttpMethod.DELETE,
- getTenantsString(tenantId).append("/metadata/").append(key), null, Void.class);
+ super(client, HttpMethod.DELETE, getTenantsString(tenantId).append("/metadata/").append(key), null,
+ Void.class);
}
}
private User user;
public Update(String id, User user) {
- super(client, HttpMethod.PUT, getUserString(id), Entity.json(user),
- User.class);
+ super(client, HttpMethod.PUT, getUserString(id), Entity.json(user), User.class);
this.user = user;
}
}
public Access getAccessByTenant(String tenantName) {
Access access = hashTenantAccess.get(tenantName);
if (access == null) {
- access = keystone.tokens().authenticate(new UsernamePassword(username, password))
- .withTenantName(tenantName)
- .execute();
+ access = keystone.tokens().authenticate(new UsernamePassword(username, password)).withTenantName(tenantName)
+ .execute();
hashTenantAccess.put(tenantName, access);
}
return access;
return new OpenStackTokenProvider() {
@Override
public String getToken() {
- return keystoneTokenProvider.getAccessByTenant(tenantName)
- .getToken().getId();
+ return keystoneTokenProvider.getAccessByTenant(tenantName).getToken().getId();
}
@Override
public class KeystoneUtils {
- private KeystoneUtils() {
- }
+ private KeystoneUtils() {}
public static String findEndpointURL(List<Service> serviceCatalog, String type, String region, String facing) {
for (Service service : serviceCatalog) {
}
public OpenStackRequest<Void> add(String roleId) {
- return new OpenStackRequest<>(CLIENT, HttpMethod.PUT, new StringBuilder(path).append("/").append(roleId).toString(), Entity.json(""), Void.class);
+ return new OpenStackRequest<>(CLIENT, HttpMethod.PUT,
+ new StringBuilder(path).append("/").append(roleId).toString(), Entity.json(""), Void.class);
}
-
+
public OpenStackRequest<Void> remove(String roleId) {
- return new OpenStackRequest<>(CLIENT, HttpMethod.DELETE, new StringBuilder(path).append("/").append(roleId).toString(), null, Void.class);
+ return new OpenStackRequest<>(CLIENT, HttpMethod.DELETE,
+ new StringBuilder(path).append("/").append(roleId).toString(), null, Void.class);
}
}
public DomainsResource(OpenStackClient client) {
super(client, "/domains", Domain.class, Domains.class);
}
-
+
public DomainUserRolesResource userRoles(String domainId, String userId) {
- return new DomainUserRolesResource(CLIENT, new StringBuilder(path).append("/").append(domainId).append("/users/").append(userId).append("/roles").toString());
+ return new DomainUserRolesResource(CLIENT, new StringBuilder(path).append("/").append(domainId)
+ .append("/users/").append(userId).append("/roles").toString());
}
-
+
public DomainUserRolesResource groupRoles(String domainId, String groupId) {
- return new DomainUserRolesResource(CLIENT, new StringBuilder(path).append("/").append(domainId).append("/groups/").append(groupId).append("/roles").toString());
+ return new DomainUserRolesResource(CLIENT, new StringBuilder(path).append("/").append(domainId)
+ .append("/groups/").append(groupId).append("/roles").toString());
}
}
public class GenericResource<One, Many> {
protected final OpenStackClient CLIENT;
-
+
protected CharSequence path;
-
+
protected Class<One> oneClass;
protected Class<Many> manyClass;
-
+
public GenericResource(OpenStackClient client, CharSequence path, Class<One> oneClass, Class<Many> manyClass) {
CLIENT = client;
this.path = path;
this.oneClass = oneClass;
this.manyClass = manyClass;
}
-
+
public OpenStackRequest<Many> list() {
return new OpenStackRequest<>(CLIENT, HttpMethod.GET, path, null, manyClass);
}
-
+
public OpenStackRequest<One> create(One one) {
return new OpenStackRequest<>(CLIENT, HttpMethod.POST, path, Entity.json(one), oneClass);
}
-
+
public OpenStackRequest<One> show(String id) {
- return new OpenStackRequest<>(CLIENT, HttpMethod.GET, new StringBuilder(path).append("/").append(id).toString(), null, oneClass);
+ return new OpenStackRequest<>(CLIENT, HttpMethod.GET, new StringBuilder(path).append("/").append(id).toString(),
+ null, oneClass);
}
-
+
public OpenStackRequest<One> update(String id, One one) {
- return new OpenStackRequest<>(CLIENT, HttpMethod.PATCH, new StringBuilder(path).append("/").append(id).toString(), Entity.json(one), oneClass);
+ return new OpenStackRequest<>(CLIENT, HttpMethod.PATCH,
+ new StringBuilder(path).append("/").append(id).toString(), Entity.json(one), oneClass);
}
-
+
public OpenStackRequest<One> delete(String id) {
- return new OpenStackRequest<>(CLIENT, HttpMethod.DELETE, new StringBuilder(path).append("/").append(id).toString(), null, oneClass);
+ return new OpenStackRequest<>(CLIENT, HttpMethod.DELETE,
+ new StringBuilder(path).append("/").append(id).toString(), null, oneClass);
}
-
+
}
public GroupsResource(OpenStackClient client) {
super(client, "/groups", Group.class, Groups.class);
}
-
+
public DomainUserRolesResource userRoles(String domainId, String userId) {
- return new DomainUserRolesResource(CLIENT, new StringBuilder(path).append("/").append(domainId).append("/users/").append(userId).append("/roles").toString());
+ return new DomainUserRolesResource(CLIENT, new StringBuilder(path).append("/").append(domainId)
+ .append("/users/").append(userId).append("/roles").toString());
}
}
package com.woorea.openstack.keystone.v3.api;
import com.woorea.openstack.base.client.OpenStackClient;
-
import com.woorea.openstack.keystone.v3.model.Policies;
import com.woorea.openstack.keystone.v3.model.Policy;
import com.woorea.openstack.base.client.OpenStackRequest;
public class ProjectRolesResource {
-
+
private final OpenStackClient CLIENT;
-
+
private final String PATH;
public ProjectRolesResource(OpenStackClient client, String path) {
this.CLIENT = client;
this.PATH = path;
}
-
+
public OpenStackRequest<Void> add(String roleId) {
- return new OpenStackRequest<>(CLIENT, HttpMethod.PUT, new StringBuilder(PATH).append("/").append(roleId).toString(), Entity.json(""), Void.class);
+ return new OpenStackRequest<>(CLIENT, HttpMethod.PUT,
+ new StringBuilder(PATH).append("/").append(roleId).toString(), Entity.json(""), Void.class);
}
-
+
public OpenStackRequest<Void> remove(String roleId) {
- return new OpenStackRequest<>(CLIENT, HttpMethod.DELETE, new StringBuilder(PATH).append("/").append(roleId).toString(), null, Void.class);
+ return new OpenStackRequest<>(CLIENT, HttpMethod.DELETE,
+ new StringBuilder(PATH).append("/").append(roleId).toString(), null, Void.class);
}
}
public ProjectUserRolesResource(OpenStackClient client, String path) {
super(client, path, Role.class, Roles.class);
}
-
+
public OpenStackRequest<Void> add(String roleId) {
- return new OpenStackRequest<>(CLIENT, HttpMethod.PUT, new StringBuilder(path).append("/").append(roleId).toString(), Entity.json(""), Void.class);
+ return new OpenStackRequest<>(CLIENT, HttpMethod.PUT,
+ new StringBuilder(path).append("/").append(roleId).toString(), Entity.json(""), Void.class);
}
-
+
public OpenStackRequest<Void> remove(String roleId) {
- return new OpenStackRequest<>(CLIENT, HttpMethod.DELETE, new StringBuilder(path).append("/").append(roleId).toString(), null, Void.class);
+ return new OpenStackRequest<>(CLIENT, HttpMethod.DELETE,
+ new StringBuilder(path).append("/").append(roleId).toString(), null, Void.class);
}
}
public ProjectsResource(OpenStackClient client) {
super(client, "/projects", Project.class, Projects.class);
}
-
+
public OpenStackRequest<Users> users(String projectId) {
- return CLIENT.get(new StringBuilder(path).append("/").append(projectId).append("/users/").toString(), Users.class);
+ return CLIENT.get(new StringBuilder(path).append("/").append(projectId).append("/users/").toString(),
+ Users.class);
}
-
+
public ProjectUserRolesResource userRoles(String projectId, String userId) {
- return new ProjectUserRolesResource(CLIENT, new StringBuilder(path).append("/").append(projectId).append("/users/").append(userId).append("/roles").toString());
+ return new ProjectUserRolesResource(CLIENT, new StringBuilder(path).append("/").append(projectId)
+ .append("/users/").append(userId).append("/roles").toString());
}
-
+
public ProjectUserRolesResource groupRoles(String projectId, String groupId) {
- return new ProjectUserRolesResource(CLIENT, new StringBuilder(path).append("/").append(projectId).append("/groups/").append(groupId).append("/roles").toString());
+ return new ProjectUserRolesResource(CLIENT, new StringBuilder(path).append("/").append(projectId)
+ .append("/groups/").append(groupId).append("/roles").toString());
}
}
public RolesResource(OpenStackClient client) {
super(client, "/roles", Role.class, Roles.class);
}
-
+
public OpenStackRequest<Users> users(String domainId, String userId) {
- return CLIENT.get(new StringBuilder(path).append("/").append(domainId).append("/users/").append(userId).append("/roles").toString(), Users.class);
+ return CLIENT.get(new StringBuilder(path).append("/").append(domainId).append("/users/").append(userId)
+ .append("/roles").toString(), Users.class);
}
}
import com.woorea.openstack.keystone.v3.model.Token;
public class TokensResource {
-
+
private final OpenStackClient CLIENT;
-
+
public TokensResource(OpenStackClient client) {
CLIENT = client;
}
-
+
public Authenticate authenticate(Authentication authentication) {
return new Authenticate(authentication);
}
-
+
public OpenStackRequest<Token> show() {
return CLIENT.get("/auth/tokens", Token.class);
}
public class Authenticate extends OpenStackRequest<Token> {
-
+
private Authentication authentication;
-
+
public Authenticate() {
-
+
}
-
+
public Authenticate(Authentication authentication) {
super(CLIENT, HttpMethod.POST, "/auth/tokens", Entity.json(authentication), Token.class);
this.authentication = authentication;
}
}
-
+
}
public UsersResource(OpenStackClient client) {
super(client, "/users", User.class, Users.class);
}
-
+
public OpenStackRequest<Services> groups(String userId) {
- return CLIENT.get(new StringBuilder(path).append("/").append(userId).append("/groups").toString(), Services.class);
+ return CLIENT.get(new StringBuilder(path).append("/").append(userId).append("/groups").toString(),
+ Services.class);
}
-
+
public OpenStackRequest<Services> projects(String userId) {
- return CLIENT.get(new StringBuilder(path).append("/").append(userId).append("/projects").toString(), Services.class);
+ return CLIENT.get(new StringBuilder(path).append("/").append(userId).append("/projects").toString(),
+ Services.class);
}
-
+
public OpenStackRequest<Services> roles(String userId) {
- return CLIENT.get(new StringBuilder(path).append("/").append(userId).append("/roles").toString(), Services.class);
+ return CLIENT.get(new StringBuilder(path).append("/").append(userId).append("/roles").toString(),
+ Services.class);
}
}
import com.woorea.openstack.base.client.OpenStackClientConnector;
import org.junit.Test;
-
import javax.swing.table.TableStringConverter;
-
import static org.junit.Assert.*;
public class KeystoneTest {
keystone.endpoints();
}
-}
\ No newline at end of file
+}
import com.woorea.openstack.keystone.model.Endpoint;
import org.junit.Test;
-
import static org.junit.Assert.*;
public class EndpointsResourceTest {
endpointsResource.delete("123");
}
-}
\ No newline at end of file
+}
import com.woorea.openstack.keystone.model.Role;
import org.junit.Test;
-
import static org.junit.Assert.*;
public class RolesResourceTest {
rolesResource.delete("123");
}
-}
\ No newline at end of file
+}
import com.woorea.openstack.keystone.model.Service;
import org.junit.Test;
-
import static org.junit.Assert.*;
public class ServicesResourceTest {
servicesResource.delete("123");
}
-}
\ No newline at end of file
+}
import com.woorea.openstack.keystone.model.Metadata;
import com.woorea.openstack.keystone.model.Tenant;
import org.junit.Test;
-
import static org.junit.Assert.*;
public class TenantsResourceTest {
tenantsResource.deleteMetadataItem("123", "key");
}
-}
\ No newline at end of file
+}
import com.woorea.openstack.keystone.model.Authentication;
import org.junit.Test;
-
import static org.junit.Assert.*;
public class TokensResourceTest {
public void withTenantNameTest() {
authenticate.withTenantName("123");
}
-}
\ No newline at end of file
+}
import com.woorea.openstack.keystone.model.User;
import org.junit.Test;
-
import static org.junit.Assert.*;
public class UsersResourceTest {
usersResource.delete("123");
}
-}
\ No newline at end of file
+}
package com.woorea.openstack.keystone.utils;
import org.junit.Test;
-
import static org.junit.Assert.*;
public class KeystoneTokenProviderTest {
- KeystoneTokenProvider keystoneTokenProvider = new KeystoneTokenProvider("endpoint",
- "username",
- "password");
+ KeystoneTokenProvider keystoneTokenProvider = new KeystoneTokenProvider("endpoint", "username", "password");
@Test(expected = NullPointerException.class)
public void getAccessByTenant() throws Exception {
keystoneTokenProvider.getProviderByTenant("id-123");
}
-}
\ No newline at end of file
+}
import com.woorea.openstack.keystone.model.Access.Service;
import org.junit.Test;
-
import java.util.Arrays;
import java.util.List;
-
import static org.junit.Assert.*;
public class KeystoneUtilsTest {
KeystoneUtils.findEndpointURL(services, "type", "region", "facing");
}
-}
\ No newline at end of file
+}
import com.woorea.openstack.base.client.OpenStackRequest;
import com.woorea.openstack.base.client.OpenStackResponse;
import org.junit.Test;
-
import static org.junit.Assert.*;
public class KeystoneTest {
keystone.endpoints();
}
-}
\ No newline at end of file
+}
domainsResource.groupRoles("test", "test");
}
-}
\ No newline at end of file
+}
import com.woorea.openstack.keystone.v3.model.User;
import com.woorea.openstack.keystone.v3.model.Users;
import org.junit.Test;
-
import static org.junit.Assert.*;
public class GenericResourceTest {
genericResource.delete("123");
}
-}
\ No newline at end of file
+}
groupsResource.userRoles("test", "test");
}
-}
\ No newline at end of file
+}
projectGroupRolesResource.delete("test");
}
-}
\ No newline at end of file
+}
projectRolesResource.remove("test");
}
-}
\ No newline at end of file
+}
projectUserRolesResource.remove("roleid");
}
-}
\ No newline at end of file
+}
projectsResource.groupRoles("pid", "gid");
}
-}
\ No newline at end of file
+}
rolesResource.users("domainid", "userid");
}
-}
\ No newline at end of file
+}
tokensResource.show();
}
-}
\ No newline at end of file
+}
usersResource.roles("uid");
}
-}
\ No newline at end of file
+}
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.onap.so.libs</groupId>
- <artifactId>openstack-java-sdk</artifactId>
- <version>1.4.0-SNAPSHOT</version>
- </parent>
- <groupId>org.onap.so.libs.openstack-java-sdk</groupId>
- <artifactId>keystone-model</artifactId>
- <name>OpenStack Keystone Model</name>
- <description>OpenStack Keystone Model</description>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.onap.so.libs</groupId>
+ <artifactId>openstack-java-sdk</artifactId>
+ <version>1.4.0-SNAPSHOT</version>
+ </parent>
+ <groupId>org.onap.so.libs.openstack-java-sdk</groupId>
+ <artifactId>keystone-model</artifactId>
+ <name>OpenStack Keystone Model</name>
+ <description>OpenStack Keystone Model</description>
- <dependencies>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.skyscreamer</groupId>
- <artifactId>jsonassert</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.skyscreamer</groupId>
+ <artifactId>jsonassert</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
</project>
import java.io.Serializable;
import java.util.List;
import java.util.Map;
-
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonRootName;
public class Access implements Serializable {
public static final class Service {
-
- @JsonIgnoreProperties(ignoreUnknown=true)
+
+ @JsonIgnoreProperties(ignoreUnknown = true)
public static final class Endpoint {
-
+
private String region;
-
+
private String publicURL;
-
+
private String internalURL;
-
+
private String adminURL;
/**
return adminURL;
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
- return "Endpoint [region=" + region + ", publicURL="
- + publicURL + ", internalURL=" + internalURL
+ return "Endpoint [region=" + region + ", publicURL=" + publicURL + ", internalURL=" + internalURL
+ ", adminURL=" + adminURL + "]";
}
-
+
}
-
+
private String type;
-
+
private String name;
-
+
private List<Endpoint> endpoints;
-
+
@JsonProperty("endpoints_links")
private List<Link> endpointsLinks;
return endpointsLinks;
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
- return "Service [type=" + type + ", name=" + name + ", endpoints="
- + endpoints + ", endpointsLinks=" + endpointsLinks + "]";
+ return "Service [type=" + type + ", name=" + name + ", endpoints=" + endpoints + ", endpointsLinks="
+ + endpointsLinks + "]";
}
-
+
}
-
- @JsonIgnoreProperties(ignoreUnknown=true)
+
+ @JsonIgnoreProperties(ignoreUnknown = true)
public static final class User {
-
- @JsonIgnoreProperties(ignoreUnknown=true)
+
+ @JsonIgnoreProperties(ignoreUnknown = true)
public static final class Role {
-
+
private String id;
-
+
private String name;
/**
return name;
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
return "Role [id=" + id + ", name=" + name + "]";
}
-
+
}
-
+
private String id;
-
+
private String name;
-
+
private String username;
-
+
private List<Role> roles;
-
+
@JsonProperty("roles_links")
private List<Link> rolesLinks;
return rolesLinks;
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
- return "User [id=" + id + ", name=" + name + ", username="
- + username + ", roles=" + roles + ", rolesLinks="
+ return "User [id=" + id + ", name=" + name + ", username=" + username + ", roles=" + roles + ", rolesLinks="
+ rolesLinks + "]";
}
-
+
}
-
+
private Token token;
-
+
private List<Service> serviceCatalog;
-
+
private User user;
-
+
private Map<String, Object> metadata;
/**
return metadata;
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
- return "Access [token=" + token + ", serviceCatalog=" + serviceCatalog
- + ", user=" + user + ", metadata=" + metadata + "]";
+ return "Access [token=" + token + ", serviceCatalog=" + serviceCatalog + ", user=" + user + ", metadata="
+ + metadata + "]";
}
-
+
}
public abstract class Authentication implements Serializable {
private String tenantId;
-
+
private String tenantName;
/**
public void setTenantName(String tenantName) {
this.tenantName = tenantName;
}
-
+
}
package com.woorea.openstack.keystone.model;
import java.io.Serializable;
-
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonRootName;
public class Endpoint implements Serializable {
private String id;
-
+
@JsonProperty("service_id")
private String serviceId;
-
+
private String region;
-
+
@JsonProperty("publicurl")
private String publicURL;
-
+
@JsonProperty("internalurl")
private String internalURL;
-
+
@JsonProperty("adminurl")
private String adminURL;
this.adminURL = adminURL;
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
- return "Endpoint [id=" + id + ", serviceId=" + serviceId + ", region="
- + region + ", publicURL=" + publicURL + ", internalURL="
- + internalURL + ", adminURL=" + adminURL + "]";
+ return "Endpoint [id=" + id + ", serviceId=" + serviceId + ", region=" + region + ", publicURL=" + publicURL
+ + ", internalURL=" + internalURL + ", adminURL=" + adminURL + "]";
}
-
+
}
import java.io.Serializable;
import java.util.Iterator;
import java.util.List;
-
import com.fasterxml.jackson.annotation.JsonProperty;
public class Endpoints implements Iterable<Endpoint>, Serializable {
public List<Endpoint> getList() {
return list;
}
-
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see java.lang.Object#toString()
*/
@Override
public Iterator<Endpoint> iterator() {
return list.iterator();
}
-
+
}
package com.woorea.openstack.keystone.model;
import java.io.Serializable;
-
import com.fasterxml.jackson.annotation.JsonRootName;
@JsonRootName("error")
public class Error implements Serializable {
private Integer code;
-
+
private String title;
-
+
private String message;
/**
return message;
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
- return "Error [code=" + code + ", title=" + title + ", message="
- + message + "]";
+ return "Error [code=" + code + ", title=" + title + ", message=" + message + "]";
}
-
+
}
public class Link implements Serializable {
private String rel;
-
+
private String href;
-
+
private String type;
/**
return type;
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
return "Link [rel=" + rel + ", href=" + href + ", type=" + type + "]";
}
-
+
}
/**
* Set the metadata
+ *
* @param metadata
*/
public void setMetadata(Map<String, String> metadata) {
this.metadata = metadata;
}
-
-
+
+
}
package com.woorea.openstack.keystone.model;
import java.io.Serializable;
-
import com.fasterxml.jackson.annotation.JsonRootName;
@JsonRootName("role")
public class Role implements Serializable {
private String id;
-
+
private String name;
-
+
private String description;
-
+
private String enabled;
/**
import java.io.Serializable;
import java.util.Iterator;
import java.util.List;
-
import com.fasterxml.jackson.annotation.JsonProperty;
public class Roles implements Iterable<Role>, Serializable {
public List<Role> getList() {
return list;
}
-
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see java.lang.Object#toString()
*/
@Override
public Iterator<Role> iterator() {
return list.iterator();
}
-
+
}
package com.woorea.openstack.keystone.model;
import java.io.Serializable;
-
import com.fasterxml.jackson.annotation.JsonRootName;
@JsonRootName("OS-KSADM:service")
public class Service implements Serializable {
private String id;
-
+
private String type;
-
+
private String name;
-
+
private String description;
/**
this.description = description;
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
- return "Service [id=" + id + ", type=" + type + ", name=" + name
- + ", description=" + description + "]";
+ return "Service [id=" + id + ", type=" + type + ", name=" + name + ", description=" + description + "]";
}
-
+
}
import java.io.Serializable;
import java.util.Iterator;
import java.util.List;
-
import com.fasterxml.jackson.annotation.JsonProperty;
-public class Services implements Iterable<Service>, Serializable {
+public class Services implements Iterable<Service>, Serializable {
@JsonProperty("OS-KSADM:services")
private List<Service> list;
public List<Service> getList() {
return list;
}
-
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see java.lang.Object#toString()
*/
@Override
public Iterator<Service> iterator() {
return list.iterator();
}
-
+
}
package com.woorea.openstack.keystone.model;
import java.io.Serializable;
-
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonRootName;
@JsonRootName("tenant")
-@JsonIgnoreProperties(ignoreUnknown=true)
+@JsonIgnoreProperties(ignoreUnknown = true)
public class Tenant implements Serializable {
private String id;
-
+
private String name;
-
+
private String description;
-
+
private Boolean enabled;
-
+
public Tenant(String name, String description, Boolean enabled) {
this.name = name;
this.description = description;
this.enabled = enabled;
}
-
+
public Tenant(String name, String description) {
this(name, description, Boolean.TRUE);
}
-
+
public Tenant(String name) {
this(name, null);
}
-
- public Tenant() {
- }
+
+ public Tenant() {}
/**
* @return the id
this.enabled = enabled;
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
- return "Tenant [id=" + id + ", name=" + name + ", description="
- + description + ", enabled=" + enabled + "]";
+ return "Tenant [id=" + id + ", name=" + name + ", description=" + description + ", enabled=" + enabled + "]";
}
-
+
}
import java.io.Serializable;
import java.util.Iterator;
import java.util.List;
-
import com.fasterxml.jackson.annotation.JsonProperty;
public class Tenants implements Iterable<Tenant>, Serializable {
@JsonProperty("tenants")
private List<Tenant> list;
-
+
@JsonProperty("tenants_links")
private List<Link> links;
return links;
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see java.lang.Object#toString()
*/
@Override
public Iterator<Tenant> iterator() {
return list.iterator();
}
-
+
}
* @return the issued_at
*/
public Calendar getIssued_at() {
- return issued_at;
+ return issued_at;
}
/**
return tenant;
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
- return "Token [id=" + id + ", Issued_at=" + issued_at + ", expires=" + expires + ", tenant="
- + tenant + "]";
+ return "Token [id=" + id + ", Issued_at=" + issued_at + ", expires=" + expires + ", tenant=" + tenant + "]";
}
-}
\ No newline at end of file
+}
*/
import java.io.Serializable;
-
import com.fasterxml.jackson.annotation.JsonRootName;
@JsonRootName("user")
public class User implements Serializable {
private String id;
-
+
private String username;
-
-// @JsonProperty("OS-KSADM:password")
-// @JsonProperty("OS_KSADM_password")
+
+ // @JsonProperty("OS-KSADM:password")
+ // @JsonProperty("OS_KSADM_password")
private String password;
-
+
private String tenantId;
-
+
private String name;
-
+
private String email;
-
+
private Boolean enabled;
/**
this.enabled = enabled;
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
- return "User [id=" + id + ", username=" + username + ", password="
- + password + ", tenantId=" + tenantId + ", name=" + name
- + ", email=" + email + ", enabled=" + enabled + "]";
+ return "User [id=" + id + ", username=" + username + ", password=" + password + ", tenantId=" + tenantId
+ + ", name=" + name + ", email=" + email + ", enabled=" + enabled + "]";
}
-
+
}
import java.io.Serializable;
import java.util.Iterator;
import java.util.List;
-
import com.fasterxml.jackson.annotation.JsonProperty;
public class Users implements Iterable<User>, Serializable {
public List<User> getList() {
return list;
}
-
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see java.lang.Object#toString()
*/
@Override
public Iterator<User> iterator() {
return list.iterator();
}
-
+
}
@JsonRootName("auth")
public class AccessKey extends Authentication {
-
+
public static final class ApiAccessKeyCredentials {
-
+
private String accessKey;
-
+
private String secretKey;
/**
public void setSecretKey(String secretKey) {
this.secretKey = secretKey;
}
-
+
}
-
+
private ApiAccessKeyCredentials apiAccessKeyCredentials = new ApiAccessKeyCredentials();
-
+
public AccessKey() {
-
+
}
-
+
public AccessKey(String accessKey, String secretKey) {
apiAccessKeyCredentials.setAccessKey(accessKey);
apiAccessKeyCredentials.setSecretKey(secretKey);
/**
* @param apiAccessKeyCredentials the apiAccessKeyCredentials to set
*/
- public void setApiAccessKeyCredentials(
- ApiAccessKeyCredentials apiAccessKeyCredentials) {
+ public void setApiAccessKeyCredentials(ApiAccessKeyCredentials apiAccessKeyCredentials) {
this.apiAccessKeyCredentials = apiAccessKeyCredentials;
}
-
+
}
@JsonRootName("auth")
public class TokenAuthentication extends Authentication {
-
+
public static final class Token {
-
+
private String id;
/**
public void setId(String id) {
this.id = id;
}
-
+
}
-
+
private Token token = new Token();
-
+
public TokenAuthentication(String token) {
this.token.id = token;
}
public void setToken(Token token) {
this.token = token;
}
-
+
}
@JsonRootName("auth")
public class UsernamePassword extends Authentication {
-
+
public static final class PasswordCredentials {
-
+
private String username;
-
+
private String password;
/**
public void setPassword(String password) {
this.password = password;
}
-
+
}
-
+
private PasswordCredentials passwordCredentials = new PasswordCredentials();
-
+
public UsernamePassword() {
-
+
}
-
+
public UsernamePassword(String username, String password) {
passwordCredentials.setUsername(username);
passwordCredentials.setPassword(password);
public void setPasswordCredentials(PasswordCredentials passwordCredentials) {
this.passwordCredentials = passwordCredentials;
}
-
+
}
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
-
import com.fasterxml.jackson.annotation.JsonRootName;
@JsonRootName("auth")
public class Authentication implements Serializable {
-
+
public static final class Identity {
-
+
public static final Identity password(String userId, String password) {
Identity identity = new Identity();
identity.getMethods().add("password");
identity.setPassword(method);
return identity;
}
-
+
public static final Identity password(String domainName, String username, String password) {
Identity identity = new Identity();
identity.getMethods().add("password");
Password method = new Password();
- com.woorea.openstack.keystone.v3.model.Authentication.Identity.Password.User.Domain domain = new com.woorea.openstack.keystone.v3.model.Authentication.Identity.Password.User.Domain();
+ com.woorea.openstack.keystone.v3.model.Authentication.Identity.Password.User.Domain domain =
+ new com.woorea.openstack.keystone.v3.model.Authentication.Identity.Password.User.Domain();
domain.setName(domainName);
method.getUser().setDomain(domain);
method.getUser().setName(username);
identity.setPassword(method);
return identity;
}
-
+
public static final Identity token(String token) {
Identity identity = new Identity();
identity.getMethods().add("token");
identity.setToken(method);
return identity;
}
-
+
private List<String> methods = new ArrayList<>();
-
+
public static final class Password {
-
+
public static final class User {
-
+
public static final class Domain {
-
+
private String id;
-
+
private String name;
public String getId() {
this.name = name;
}
}
-
+
private Domain domain;
-
+
private String id;
-
+
private String name;
-
+
private String password;
public Domain getDomain() {
public void setPassword(String password) {
this.password = password;
}
-
+
}
-
+
private User user = new User();
public User getUser() {
public void setUser(User user) {
this.user = user;
}
-
+
}
-
+
private Password password;
-
+
public static final class Token {
-
+
private String id;
public String getId() {
public void setId(String id) {
this.id = id;
}
-
+
}
-
+
private Token token;
public List<String> getMethods() {
public void setToken(Token token) {
this.token = token;
}
-
+
}
-
+
private Identity identity;
-
+
public static final class Scope {
-
+
public static Scope project(String id) {
Scope scope = new Scope();
Project project = new Project();
scope.setProject(project);
return scope;
}
-
+
public static Scope project(String domainName, String projectName) {
Scope scope = new Scope();
- com.woorea.openstack.keystone.v3.model.Authentication.Scope.Project.Domain domain = new com.woorea.openstack.keystone.v3.model.Authentication.Scope.Project.Domain();
+ com.woorea.openstack.keystone.v3.model.Authentication.Scope.Project.Domain domain =
+ new com.woorea.openstack.keystone.v3.model.Authentication.Scope.Project.Domain();
domain.setName(domainName);
Project project = new Project();
project.setDomain(domain);
scope.setProject(project);
return scope;
}
-
+
public static final class Project {
-
+
public static final class Domain {
-
+
private String id;
-
+
private String name;
public String getId() {
this.name = name;
}
}
-
+
private String id;
-
+
private Domain domain;
-
+
private String name;
-
+
public String getId() {
return id;
public void setName(String name) {
this.name = name;
}
-
+
}
-
+
private Project project;
public Project getProject() {
public void setProject(Project project) {
this.project = project;
}
-
+
}
-
+
private Scope scope;
public Identity getIdentity() {
public void setScope(Scope scope) {
this.scope = scope;
}
-
+
}
import java.util.HashMap;
import java.util.Map;
-
import com.fasterxml.jackson.annotation.JsonRootName;
@JsonRootName("credential")
public class Credential {
-
+
private String id;
private String projectId;
-
+
private String type;
-
+
private String userId;
-
+
private Map<String, String> blob = new HashMap<>();
public String getId() {
public void setBlob(Map<String, String> blob) {
this.blob = blob;
}
-
+
}
import java.io.Serializable;
import java.util.Iterator;
import java.util.List;
-
import com.fasterxml.jackson.annotation.JsonProperty;
-public class Credentials implements Iterable<Credential>, Serializable {
+public class Credentials implements Iterable<Credential>, Serializable {
@JsonProperty("credentials")
private List<Credential> list;
public List<Credential> getList() {
return list;
}
-
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see java.lang.Object#toString()
*/
@Override
public Iterator<Credential> iterator() {
return list.iterator();
}
-
+
}
public class Domain {
private String id;
-
+
private String name;
-
+
private String description;
-
+
private Boolean enabled;
public String getId() {
public void setDescription(String description) {
this.description = description;
}
-
+
public Boolean getEnabled() {
return enabled;
}
public void setEnabled(Boolean enabled) {
this.enabled = enabled;
}
-
+
}
import java.io.Serializable;
import java.util.Iterator;
import java.util.List;
-
import com.fasterxml.jackson.annotation.JsonProperty;
-public class Domains implements Iterable<Domain>, Serializable {
+public class Domains implements Iterable<Domain>, Serializable {
@JsonProperty("domains")
private List<Domain> list;
public List<Domain> getList() {
return list;
}
-
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see java.lang.Object#toString()
*/
@Override
public Iterator<Domain> iterator() {
return list.iterator();
}
-
+
}
public class Endpoint {
private String id;
-
+
@JsonProperty("interface")
private String iface;
-
+
private String name;
-
+
@JsonProperty("service_id")
private String serviceId;
public void setServiceId(String serviceId) {
this.serviceId = serviceId;
}
-
+
}
import java.io.Serializable;
import java.util.Iterator;
import java.util.List;
-
import com.fasterxml.jackson.annotation.JsonProperty;
-public class Endpoints implements Iterable<Endpoint>, Serializable {
+public class Endpoints implements Iterable<Endpoint>, Serializable {
@JsonProperty("endpoints")
private List<Endpoint> list;
public List<Endpoint> getList() {
return list;
}
-
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see java.lang.Object#toString()
*/
@Override
public Iterator<Endpoint> iterator() {
return list.iterator();
}
-
+
}
public class Group {
private String id;
-
+
@JsonProperty("domain_id")
private String domainId;
-
+
private String name;
-
+
private String description;
public String getId() {
public void setDescription(String description) {
this.description = description;
}
-
+
}
import java.io.Serializable;
import java.util.Iterator;
import java.util.List;
-
import com.fasterxml.jackson.annotation.JsonProperty;
-public class Groups implements Iterable<Group>, Serializable {
+public class Groups implements Iterable<Group>, Serializable {
@JsonProperty("groups")
private List<Group> list;
public List<Group> getList() {
return list;
}
-
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see java.lang.Object#toString()
*/
@Override
public Iterator<Group> iterator() {
return list.iterator();
}
-
+
}
import java.io.Serializable;
import java.util.Iterator;
import java.util.List;
-
import com.fasterxml.jackson.annotation.JsonProperty;
-public class Policies implements Iterable<Policy>, Serializable {
+public class Policies implements Iterable<Policy>, Serializable {
@JsonProperty("policies")
private List<Policy> list;
public List<Policy> getList() {
return list;
}
-
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see java.lang.Object#toString()
*/
@Override
public Iterator<Policy> iterator() {
return list.iterator();
}
-
+
}
import java.util.HashMap;
import java.util.Map;
-
import com.fasterxml.jackson.annotation.JsonRootName;
@JsonRootName("policy")
public class Policy {
-
+
private String id;
private String projectId;
-
+
private String type;
-
+
private String userId;
-
+
private Map<String, String> blob = new HashMap<>();
public String getId() {
public void setBlob(Map<String, String> blob) {
this.blob = blob;
}
-
+
}
public class Project {
private String id;
-
+
@JsonProperty("domain_id")
private String domainId;
-
+
private String name;
-
+
private Boolean enabled;
public String getId() {
public void setName(String name) {
this.name = name;
}
-
+
public Boolean getEnabled() {
return enabled;
}
public void setEnabled(Boolean enabled) {
this.enabled = enabled;
}
-
+
}
import java.io.Serializable;
import java.util.Iterator;
import java.util.List;
-
import com.fasterxml.jackson.annotation.JsonProperty;
-public class Projects implements Iterable<Project>, Serializable {
+public class Projects implements Iterable<Project>, Serializable {
@JsonProperty("projects")
private List<Project> list;
public List<Project> getList() {
return list;
}
-
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see java.lang.Object#toString()
*/
@Override
public Iterator<Project> iterator() {
return list.iterator();
}
-
+
}
package com.woorea.openstack.keystone.v3.model;
import java.io.Serializable;
-
import com.fasterxml.jackson.annotation.JsonRootName;
@JsonRootName("role")
public class Role implements Serializable {
private String id;
-
+
private String name;
-
+
private String description;
-
+
private String enabled;
/**
import java.io.Serializable;
import java.util.Iterator;
import java.util.List;
-
import com.fasterxml.jackson.annotation.JsonProperty;
public class Roles implements Iterable<Role>, Serializable {
public List<Role> getList() {
return list;
}
-
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see java.lang.Object#toString()
*/
@Override
public Iterator<Role> iterator() {
return list.iterator();
}
-
+
}
public class Service {
private String id;
-
+
private String type;
-
+
private String name;
-
+
private String description;
public String getId() {
public void setDescription(String description) {
this.description = description;
}
-
+
}
import java.io.Serializable;
import java.util.Iterator;
import java.util.List;
-
import com.fasterxml.jackson.annotation.JsonProperty;
import com.woorea.openstack.keystone.model.Service;
-public class Services implements Iterable<Service>, Serializable {
+public class Services implements Iterable<Service>, Serializable {
@JsonProperty("services")
private List<Service> list;
public List<Service> getList() {
return list;
}
-
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see java.lang.Object#toString()
*/
@Override
public Iterator<Service> iterator() {
return list.iterator();
}
-
+
}
import java.io.Serializable;
import java.util.Calendar;
import java.util.List;
-
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonRootName;
@JsonRootName("token")
-@JsonIgnoreProperties(ignoreUnknown=true)
+@JsonIgnoreProperties(ignoreUnknown = true)
public class Token implements Serializable {
-
+
private String id;
-
+
@JsonProperty("expires_at")
private Calendar expiresAt;
-
+
@JsonProperty("issued_at")
private Calendar issuedAt;
-
+
private List<String> methods;
-
- @JsonIgnoreProperties(ignoreUnknown=true)
+
+ @JsonIgnoreProperties(ignoreUnknown = true)
public static final class Domain {
-
+
private String id;
-
+
private String name;
public String getId() {
public void setName(String name) {
this.name = name;
}
-
+
}
-
+
private Domain domain;
-
- @JsonIgnoreProperties(ignoreUnknown=true)
+
+ @JsonIgnoreProperties(ignoreUnknown = true)
public static final class Project {
-
+
private Domain domain;
-
+
private String id;
-
+
private String name;
public Domain getDomain() {
public void setName(String name) {
this.name = name;
}
-
+
}
-
+
private Project project;
-
- @JsonIgnoreProperties(ignoreUnknown=true)
+
+ @JsonIgnoreProperties(ignoreUnknown = true)
public static final class User {
-
- @JsonIgnoreProperties(ignoreUnknown=true)
+
+ @JsonIgnoreProperties(ignoreUnknown = true)
private static final class Domain {
-
+
private String id;
-
+
private String name;
public String getId() {
public void setName(String name) {
this.name = name;
}
-
+
}
-
+
private String id;
-
+
private String name;
public String getId() {
public void setName(String name) {
this.name = name;
}
-
+
}
-
+
private User user;
-
- @JsonIgnoreProperties(ignoreUnknown=true)
+
+ @JsonIgnoreProperties(ignoreUnknown = true)
public static final class Role {
-
+
private String id;
-
+
private String name;
-
+
}
-
+
private List<Role> roles;
-
+
public static final class Service {
-
+
public static final class Endpoint {
-
+
private String id;
-
+
private String url;
-
+
private String region;
-
+
private Boolean enabled;
-
+
@JsonProperty("legacy_endpoint_id")
private String legacyEndpointId;
-
+
@JsonProperty("interface")
private String iface;
public void setInterface(String iface) {
this.iface = iface;
}
-
+
}
-
+
private String id;
-
+
private String type;
-
+
private List<Endpoint> endpoints;
public String getId() {
public void setEndpoints(List<Endpoint> endpoints) {
this.endpoints = endpoints;
}
-
+
}
-
+
private List<Service> catalog;
this.catalog = catalog;
}
-
+
@Override
public String toString() {
- return "Token [id=" + id + ", expiresAt=" + expiresAt + ", issuedAt="
- + issuedAt + ", methods=" + methods + ", domain=" + domain
- + ", project=" + project + ", user=" + user + ", roles="
- + roles + ", catalog=" + catalog + "]";
+ return "Token [id=" + id + ", expiresAt=" + expiresAt + ", issuedAt=" + issuedAt + ", methods=" + methods
+ + ", domain=" + domain + ", project=" + project + ", user=" + user + ", roles=" + roles + ", catalog="
+ + catalog + "]";
}
}
public class User {
private String id;
-
+
@JsonProperty("domain_id")
private String domainId;
-
+
@JsonProperty("default_project_id")
private String defaultProjectId;
-
+
private String name;
-
+
private String password;
-
+
private String email;
-
+
private String description;
-
+
private Boolean enabled;
public String getId() {
public void setEnabled(Boolean enabled) {
this.enabled = enabled;
}
-
+
}
import java.io.Serializable;
import java.util.Iterator;
import java.util.List;
-
import com.fasterxml.jackson.annotation.JsonProperty;
import com.woorea.openstack.keystone.model.User;
-public class Users implements Iterable<User>, Serializable {
+public class Users implements Iterable<User>, Serializable {
@JsonProperty("users")
private List<User> list;
public List<User> getList() {
return list;
}
-
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see java.lang.Object#toString()
*/
@Override
public Iterator<User> iterator() {
return list.iterator();
}
-
+
}
import com.fasterxml.jackson.databind.SerializationFeature;
import com.woorea.openstack.keystone.model.Access.Service;
import com.woorea.openstack.keystone.model.Access.User;
-
import java.util.List;
import java.util.Map;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"access\" : {" + EOL
- + " \"token\" : {" + EOL
- + " \"id\" : \"id\"," + EOL
- + " \"issued_at\" : 1488024000000," + EOL
- + " \"expires\" : 1488628800000," + EOL
- + " \"tenant\" : {" + EOL
- + " \"id\" : \"id\"," + EOL
- + " \"name\" : \"name\"," + EOL
- + " \"description\" : \"description\"," + EOL
- + " \"enabled\" : false" + EOL
- + " }" + EOL
- + " }," + EOL
- + " \"serviceCatalog\" : [ {" + EOL
- + " \"type\" : \"type\"," + EOL
- + " \"name\" : \"name\"," + EOL
- + " \"endpoints\" : [ {" + EOL
- + " \"region\" : \"region\"," + EOL
- + " \"publicURL\" : \"publicurl\"," + EOL
- + " \"internalURL\" : \"internalurl\"," + EOL
- + " \"adminURL\" : \"adminurl\"" + EOL
- + " }, {" + EOL
- + " \"region\" : \"region\"," + EOL
- + " \"publicURL\" : \"publicurl\"," + EOL
- + " \"internalURL\" : \"internalurl\"," + EOL
- + " \"adminURL\" : \"adminurl\"" + EOL
- + " } ]," + EOL
- + " \"endpoints_links\" : [ {" + EOL
- + " \"rel\" : \"rel\"," + EOL
- + " \"href\" : \"href\"," + EOL
- + " \"type\" : \"type\"" + EOL
- + " }, {" + EOL
- + " \"rel\" : \"rel\"," + EOL
- + " \"href\" : \"href\"," + EOL
- + " \"type\" : \"type\"" + EOL
- + " } ]" + EOL
- + " }, {" + EOL
- + " \"type\" : \"type\"," + EOL
- + " \"name\" : \"name\"," + EOL
- + " \"endpoints\" : [ {" + EOL
- + " \"region\" : \"region\"," + EOL
- + " \"publicURL\" : \"publicurl\"," + EOL
- + " \"internalURL\" : \"internalurl\"," + EOL
- + " \"adminURL\" : \"adminurl\"" + EOL
- + " }, {" + EOL
- + " \"region\" : \"region\"," + EOL
- + " \"publicURL\" : \"publicurl\"," + EOL
- + " \"internalURL\" : \"internalurl\"," + EOL
- + " \"adminURL\" : \"adminurl\"" + EOL
- + " } ]," + EOL
- + " \"endpoints_links\" : [ {" + EOL
- + " \"rel\" : \"rel\"," + EOL
- + " \"href\" : \"href\"," + EOL
- + " \"type\" : \"type\"" + EOL
- + " }, {" + EOL
- + " \"rel\" : \"rel\"," + EOL
- + " \"href\" : \"href\"," + EOL
- + " \"type\" : \"type\"" + EOL
- + " } ]" + EOL
- + " } ]," + EOL
- + " \"user\" : {" + EOL
- + " \"id\" : \"id\"," + EOL
- + " \"name\" : \"name\"," + EOL
- + " \"username\" : \"username\"," + EOL
- + " \"roles\" : [ {" + EOL
- + " \"id\" : \"id\"," + EOL
- + " \"name\" : \"name\"" + EOL
- + " }, {" + EOL
- + " \"id\" : \"id\"," + EOL
- + " \"name\" : \"name\"" + EOL
- + " } ]," + EOL
- + " \"roles_links\" : [ {" + EOL
- + " \"rel\" : \"rel\"," + EOL
- + " \"href\" : \"href\"," + EOL
- + " \"type\" : \"type\"" + EOL
- + " }, {" + EOL
- + " \"rel\" : \"rel\"," + EOL
- + " \"href\" : \"href\"," + EOL
- + " \"type\" : \"type\"" + EOL
- + " } ]" + EOL
- + " }," + EOL
- + " \"metadata\" : {" + EOL
- + " \"metadata-k1\" : \"metadata-v1\"," + EOL
- + " \"metadata-k2\" : \"metadata-v2\"" + EOL
- + " }" + EOL
- + " }" + EOL
- + "}";
+ private static final String JSON_FULL = "{" + EOL + " \"access\" : {" + EOL + " \"token\" : {" + EOL
+ + " \"id\" : \"id\"," + EOL + " \"issued_at\" : 1488024000000," + EOL
+ + " \"expires\" : 1488628800000," + EOL + " \"tenant\" : {" + EOL + " \"id\" : \"id\","
+ + EOL + " \"name\" : \"name\"," + EOL + " \"description\" : \"description\"," + EOL
+ + " \"enabled\" : false" + EOL + " }" + EOL + " }," + EOL + " \"serviceCatalog\" : [ {"
+ + EOL + " \"type\" : \"type\"," + EOL + " \"name\" : \"name\"," + EOL
+ + " \"endpoints\" : [ {" + EOL + " \"region\" : \"region\"," + EOL
+ + " \"publicURL\" : \"publicurl\"," + EOL + " \"internalURL\" : \"internalurl\"," + EOL
+ + " \"adminURL\" : \"adminurl\"" + EOL + " }, {" + EOL + " \"region\" : \"region\","
+ + EOL + " \"publicURL\" : \"publicurl\"," + EOL + " \"internalURL\" : \"internalurl\"," + EOL
+ + " \"adminURL\" : \"adminurl\"" + EOL + " } ]," + EOL + " \"endpoints_links\" : [ {" + EOL
+ + " \"rel\" : \"rel\"," + EOL + " \"href\" : \"href\"," + EOL + " \"type\" : \"type\""
+ + EOL + " }, {" + EOL + " \"rel\" : \"rel\"," + EOL + " \"href\" : \"href\"," + EOL
+ + " \"type\" : \"type\"" + EOL + " } ]" + EOL + " }, {" + EOL + " \"type\" : \"type\","
+ + EOL + " \"name\" : \"name\"," + EOL + " \"endpoints\" : [ {" + EOL
+ + " \"region\" : \"region\"," + EOL + " \"publicURL\" : \"publicurl\"," + EOL
+ + " \"internalURL\" : \"internalurl\"," + EOL + " \"adminURL\" : \"adminurl\"" + EOL
+ + " }, {" + EOL + " \"region\" : \"region\"," + EOL + " \"publicURL\" : \"publicurl\","
+ + EOL + " \"internalURL\" : \"internalurl\"," + EOL + " \"adminURL\" : \"adminurl\"" + EOL
+ + " } ]," + EOL + " \"endpoints_links\" : [ {" + EOL + " \"rel\" : \"rel\"," + EOL
+ + " \"href\" : \"href\"," + EOL + " \"type\" : \"type\"" + EOL + " }, {" + EOL
+ + " \"rel\" : \"rel\"," + EOL + " \"href\" : \"href\"," + EOL + " \"type\" : \"type\""
+ + EOL + " } ]" + EOL + " } ]," + EOL + " \"user\" : {" + EOL + " \"id\" : \"id\"," + EOL
+ + " \"name\" : \"name\"," + EOL + " \"username\" : \"username\"," + EOL + " \"roles\" : [ {"
+ + EOL + " \"id\" : \"id\"," + EOL + " \"name\" : \"name\"" + EOL + " }, {" + EOL
+ + " \"id\" : \"id\"," + EOL + " \"name\" : \"name\"" + EOL + " } ]," + EOL
+ + " \"roles_links\" : [ {" + EOL + " \"rel\" : \"rel\"," + EOL + " \"href\" : \"href\","
+ + EOL + " \"type\" : \"type\"" + EOL + " }, {" + EOL + " \"rel\" : \"rel\"," + EOL
+ + " \"href\" : \"href\"," + EOL + " \"type\" : \"type\"" + EOL + " } ]" + EOL + " },"
+ + EOL + " \"metadata\" : {" + EOL + " \"metadata-k1\" : \"metadata-v1\"," + EOL
+ + " \"metadata-k2\" : \"metadata-v2\"" + EOL + " }" + EOL + " }" + EOL + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(SerializationFeature.WRAP_ROOT_VALUE)
- .enable(DeserializationFeature.UNWRAP_ROOT_VALUE)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE)
+ .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
Access access = objectMapper.readValue(JSON_FULL, Access.class);
access.toString();
-
+
List<Service> serviceCatalog = access.getServiceCatalog();
Assert.assertNotNull(serviceCatalog);
Assert.assertEquals(2, serviceCatalog.size());
-
- Map<String,Object> metadata = access.getMetadata();
+
+ Map<String, Object> metadata = access.getMetadata();
Assert.assertNotNull(metadata);
Assert.assertEquals(2, metadata.size());
-
+
User user = access.getUser();
Assert.assertNotNull(user);
-
+
Token token = access.getToken();
Assert.assertNotNull(token);
}
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"endpoint\" : {" + EOL
- + " \"id\" : \"id\"," + EOL
- + " \"region\" : \"region\"," + EOL
- + " \"service_id\" : \"serviceid\"," + EOL
- + " \"publicurl\" : \"publicurl\"," + EOL
- + " \"internalurl\" : \"internalurl\"," + EOL
- + " \"adminurl\" : \"adminurl\"" + EOL
- + " }" + EOL
- + "}";
+ private static final String JSON_FULL = "{" + EOL + " \"endpoint\" : {" + EOL + " \"id\" : \"id\"," + EOL
+ + " \"region\" : \"region\"," + EOL + " \"service_id\" : \"serviceid\"," + EOL
+ + " \"publicurl\" : \"publicurl\"," + EOL + " \"internalurl\" : \"internalurl\"," + EOL
+ + " \"adminurl\" : \"adminurl\"" + EOL + " }" + EOL + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(SerializationFeature.WRAP_ROOT_VALUE)
- .enable(DeserializationFeature.UNWRAP_ROOT_VALUE)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE)
+ .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
Endpoint endpoint = objectMapper.readValue(JSON_FULL, Endpoint.class);
endpoint.toString();
-
+
String publicURL = endpoint.getPublicURL();
Assert.assertNotNull(publicURL);
endpoint.setPublicURL(publicURL);
-
+
String internalURL = endpoint.getInternalURL();
Assert.assertNotNull(internalURL);
endpoint.setInternalURL(internalURL);
-
+
String id = endpoint.getId();
Assert.assertNotNull(id);
endpoint.setId(id);
-
+
String region = endpoint.getRegion();
Assert.assertNotNull(region);
endpoint.setRegion(region);
-
+
String serviceId = endpoint.getServiceId();
Assert.assertNotNull(serviceId);
endpoint.setServiceId(serviceId);
-
+
String adminURL = endpoint.getAdminURL();
Assert.assertNotNull(adminURL);
endpoint.setAdminURL(adminURL);
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
-
import java.util.List;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"endpoints\" : [ {" + EOL
- + " \"id\" : \"id\"," + EOL
- + " \"region\" : \"region\"," + EOL
- + " \"service_id\" : \"serviceid\"," + EOL
- + " \"publicurl\" : \"publicurl\"," + EOL
- + " \"internalurl\" : \"internalurl\"," + EOL
- + " \"adminurl\" : \"adminurl\"" + EOL
- + " }, {" + EOL
- + " \"id\" : \"id\"," + EOL
- + " \"region\" : \"region\"," + EOL
- + " \"service_id\" : \"serviceid\"," + EOL
- + " \"publicurl\" : \"publicurl\"," + EOL
- + " \"internalurl\" : \"internalurl\"," + EOL
- + " \"adminurl\" : \"adminurl\"" + EOL
- + " } ]" + EOL
- + "}";
+ private static final String JSON_FULL = "{" + EOL + " \"endpoints\" : [ {" + EOL + " \"id\" : \"id\"," + EOL
+ + " \"region\" : \"region\"," + EOL + " \"service_id\" : \"serviceid\"," + EOL
+ + " \"publicurl\" : \"publicurl\"," + EOL + " \"internalurl\" : \"internalurl\"," + EOL
+ + " \"adminurl\" : \"adminurl\"" + EOL + " }, {" + EOL + " \"id\" : \"id\"," + EOL
+ + " \"region\" : \"region\"," + EOL + " \"service_id\" : \"serviceid\"," + EOL
+ + " \"publicurl\" : \"publicurl\"," + EOL + " \"internalurl\" : \"internalurl\"," + EOL
+ + " \"adminurl\" : \"adminurl\"" + EOL + " } ]" + EOL + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
Endpoints endpoints = objectMapper.readValue(JSON_FULL, Endpoints.class);
endpoints.toString();
-
+
List<Endpoint> list = endpoints.getList();
Assert.assertNotNull(list);
Assert.assertEquals(2, list.size());
-
+
int cnt = 0;
- for (@SuppressWarnings("unused") Endpoint x : endpoints) {
+ for (@SuppressWarnings("unused")
+ Endpoint x : endpoints) {
++cnt;
}
Assert.assertEquals(2, cnt);
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"error\" : {" + EOL
- + " \"code\" : 29," + EOL
- + " \"title\" : \"title\"," + EOL
- + " \"message\" : \"message\"" + EOL
- + " }" + EOL
- + "}";
+ private static final String JSON_FULL = "{" + EOL + " \"error\" : {" + EOL + " \"code\" : 29," + EOL
+ + " \"title\" : \"title\"," + EOL + " \"message\" : \"message\"" + EOL + " }" + EOL + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(SerializationFeature.WRAP_ROOT_VALUE)
- .enable(DeserializationFeature.UNWRAP_ROOT_VALUE)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE)
+ .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
Error error = objectMapper.readValue(JSON_FULL, Error.class);
error.toString();
-
+
Integer code = error.getCode();
Assert.assertNotNull(code);
-
+
String title = error.getTitle();
Assert.assertNotNull(title);
-
+
String message = error.getMessage();
Assert.assertNotNull(message);
}
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"rel\" : \"rel\"," + EOL
- + " \"href\" : \"href\"," + EOL
- + " \"type\" : \"type\"" + EOL
- + "}";
+ private static final String JSON_FULL = "{" + EOL + " \"rel\" : \"rel\"," + EOL + " \"href\" : \"href\"," + EOL
+ + " \"type\" : \"type\"" + EOL + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
Link link = objectMapper.readValue(JSON_FULL, Link.class);
link.toString();
-
+
String rel = link.getRel();
Assert.assertNotNull(rel);
-
+
String href = link.getHref();
Assert.assertNotNull(href);
-
+
String type = link.getType();
Assert.assertNotNull(type);
}
metadata.setMetadata(null);
}
-}
\ No newline at end of file
+}
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"role\" : {" + EOL
- + " \"id\" : \"id\"," + EOL
- + " \"name\" : \"name\"," + EOL
- + " \"description\" : \"description\"," + EOL
- + " \"enabled\" : \"enabled\"" + EOL
- + " }" + EOL
- + "}";
+ private static final String JSON_FULL = "{" + EOL + " \"role\" : {" + EOL + " \"id\" : \"id\"," + EOL
+ + " \"name\" : \"name\"," + EOL + " \"description\" : \"description\"," + EOL
+ + " \"enabled\" : \"enabled\"" + EOL + " }" + EOL + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(SerializationFeature.WRAP_ROOT_VALUE)
- .enable(DeserializationFeature.UNWRAP_ROOT_VALUE)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE)
+ .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
Role role = objectMapper.readValue(JSON_FULL, Role.class);
role.toString();
-
+
String name = role.getName();
Assert.assertNotNull(name);
role.setName(name);
-
+
String description = role.getDescription();
Assert.assertNotNull(description);
role.setDescription(description);
-
+
String id = role.getId();
Assert.assertNotNull(id);
-
+
String enabled = role.getEnabled();
Assert.assertNotNull(enabled);
role.setEnabled(enabled);
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
-
import java.util.List;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"roles\" : [ {" + EOL
- + " \"id\" : \"id\"," + EOL
- + " \"name\" : \"name\"," + EOL
- + " \"description\" : \"description\"," + EOL
- + " \"enabled\" : \"enabled\"" + EOL
- + " }, {" + EOL
- + " \"id\" : \"id\"," + EOL
- + " \"name\" : \"name\"," + EOL
- + " \"description\" : \"description\"," + EOL
- + " \"enabled\" : \"enabled\"" + EOL
- + " } ]" + EOL
- + "}";
+ private static final String JSON_FULL = "{" + EOL + " \"roles\" : [ {" + EOL + " \"id\" : \"id\"," + EOL
+ + " \"name\" : \"name\"," + EOL + " \"description\" : \"description\"," + EOL
+ + " \"enabled\" : \"enabled\"" + EOL + " }, {" + EOL + " \"id\" : \"id\"," + EOL
+ + " \"name\" : \"name\"," + EOL + " \"description\" : \"description\"," + EOL
+ + " \"enabled\" : \"enabled\"" + EOL + " } ]" + EOL + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
Roles roles = objectMapper.readValue(JSON_FULL, Roles.class);
roles.toString();
-
+
List<Role> list = roles.getList();
Assert.assertNotNull(list);
Assert.assertEquals(2, list.size());
-
+
int cnt = 0;
- for (@SuppressWarnings("unused") Role x : roles) {
+ for (@SuppressWarnings("unused")
+ Role x : roles) {
++cnt;
}
Assert.assertEquals(2, cnt);
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"OS-KSADM:service\" : {" + EOL
- + " \"id\" : \"id\"," + EOL
- + " \"type\" : \"type\"," + EOL
- + " \"name\" : \"name\"," + EOL
- + " \"description\" : \"description\"" + EOL
- + " }" + EOL
- + "}";
+ private static final String JSON_FULL = "{" + EOL + " \"OS-KSADM:service\" : {" + EOL + " \"id\" : \"id\","
+ + EOL + " \"type\" : \"type\"," + EOL + " \"name\" : \"name\"," + EOL
+ + " \"description\" : \"description\"" + EOL + " }" + EOL + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(SerializationFeature.WRAP_ROOT_VALUE)
- .enable(DeserializationFeature.UNWRAP_ROOT_VALUE)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE)
+ .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
Service service = objectMapper.readValue(JSON_FULL, Service.class);
service.toString();
-
+
String name = service.getName();
Assert.assertNotNull(name);
service.setName(name);
-
+
String description = service.getDescription();
Assert.assertNotNull(description);
service.setDescription(description);
-
+
String id = service.getId();
Assert.assertNotNull(id);
-
+
String type = service.getType();
Assert.assertNotNull(type);
service.setType(type);
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
-
import java.util.List;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"OS-KSADM:services\" : [ {" + EOL
- + " \"id\" : \"id\"," + EOL
- + " \"type\" : \"type\"," + EOL
- + " \"name\" : \"name\"," + EOL
- + " \"description\" : \"description\"" + EOL
- + " }, {" + EOL
- + " \"id\" : \"id\"," + EOL
- + " \"type\" : \"type\"," + EOL
- + " \"name\" : \"name\"," + EOL
- + " \"description\" : \"description\"" + EOL
- + " } ]" + EOL
- + "}";
+ private static final String JSON_FULL = "{" + EOL + " \"OS-KSADM:services\" : [ {" + EOL + " \"id\" : \"id\","
+ + EOL + " \"type\" : \"type\"," + EOL + " \"name\" : \"name\"," + EOL
+ + " \"description\" : \"description\"" + EOL + " }, {" + EOL + " \"id\" : \"id\"," + EOL
+ + " \"type\" : \"type\"," + EOL + " \"name\" : \"name\"," + EOL
+ + " \"description\" : \"description\"" + EOL + " } ]" + EOL + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
Services services = objectMapper.readValue(JSON_FULL, Services.class);
services.toString();
-
+
List<Service> list = services.getList();
Assert.assertNotNull(list);
Assert.assertEquals(2, list.size());
-
+
int cnt = 0;
- for (@SuppressWarnings("unused") Service x : services) {
+ for (@SuppressWarnings("unused")
+ Service x : services) {
++cnt;
}
Assert.assertEquals(2, cnt);
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"tenant\" : {" + EOL
- + " \"id\" : \"id\"," + EOL
- + " \"name\" : \"name\"," + EOL
- + " \"description\" : \"description\"," + EOL
- + " \"enabled\" : false" + EOL
- + " }" + EOL
- + "}";
+ private static final String JSON_FULL = "{" + EOL + " \"tenant\" : {" + EOL + " \"id\" : \"id\"," + EOL
+ + " \"name\" : \"name\"," + EOL + " \"description\" : \"description\"," + EOL
+ + " \"enabled\" : false" + EOL + " }" + EOL + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(SerializationFeature.WRAP_ROOT_VALUE)
- .enable(DeserializationFeature.UNWRAP_ROOT_VALUE)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE)
+ .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
Tenant tenant = objectMapper.readValue(JSON_FULL, Tenant.class);
tenant.toString();
-
+
String name = tenant.getName();
Assert.assertNotNull(name);
tenant.setName(name);
-
+
String description = tenant.getDescription();
Assert.assertNotNull(description);
tenant.setDescription(description);
-
+
String id = tenant.getId();
Assert.assertNotNull(id);
tenant.setId(id);
-
+
Boolean enabled = tenant.getEnabled();
Assert.assertNotNull(enabled);
tenant.setEnabled(enabled);
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
-
import java.util.List;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"tenants\" : [ {" + EOL
- + " \"id\" : \"id\"," + EOL
- + " \"name\" : \"name\"," + EOL
- + " \"description\" : \"description\"," + EOL
- + " \"enabled\" : false" + EOL
- + " }, {" + EOL
- + " \"id\" : \"id\"," + EOL
- + " \"name\" : \"name\"," + EOL
- + " \"description\" : \"description\"," + EOL
- + " \"enabled\" : false" + EOL
- + " } ]," + EOL
- + " \"tenants_links\" : [ {" + EOL
- + " \"rel\" : \"rel\"," + EOL
- + " \"href\" : \"href\"," + EOL
- + " \"type\" : \"type\"" + EOL
- + " }, {" + EOL
- + " \"rel\" : \"rel\"," + EOL
- + " \"href\" : \"href\"," + EOL
- + " \"type\" : \"type\"" + EOL
- + " } ]" + EOL
- + "}";
+ private static final String JSON_FULL =
+ "{" + EOL + " \"tenants\" : [ {" + EOL + " \"id\" : \"id\"," + EOL + " \"name\" : \"name\"," + EOL
+ + " \"description\" : \"description\"," + EOL + " \"enabled\" : false" + EOL + " }, {" + EOL
+ + " \"id\" : \"id\"," + EOL + " \"name\" : \"name\"," + EOL
+ + " \"description\" : \"description\"," + EOL + " \"enabled\" : false" + EOL + " } ]," + EOL
+ + " \"tenants_links\" : [ {" + EOL + " \"rel\" : \"rel\"," + EOL + " \"href\" : \"href\","
+ + EOL + " \"type\" : \"type\"" + EOL + " }, {" + EOL + " \"rel\" : \"rel\"," + EOL
+ + " \"href\" : \"href\"," + EOL + " \"type\" : \"type\"" + EOL + " } ]" + EOL + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
Tenants tenants = objectMapper.readValue(JSON_FULL, Tenants.class);
tenants.toString();
-
+
List<Link> links = tenants.getLinks();
Assert.assertNotNull(links);
Assert.assertEquals(2, links.size());
-
+
List<Tenant> list = tenants.getList();
Assert.assertNotNull(list);
Assert.assertEquals(2, list.size());
-
+
int cnt = 0;
- for (@SuppressWarnings("unused") Tenant x : tenants) {
+ for (@SuppressWarnings("unused")
+ Tenant x : tenants) {
++cnt;
}
Assert.assertEquals(2, cnt);
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
-
import java.util.Calendar;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"id\" : \"id\"," + EOL
- + " \"issued_at\" : 1488024000000," + EOL
- + " \"expires\" : 1488628800000," + EOL
- + " \"tenant\" : {" + EOL
- + " \"id\" : \"id\"," + EOL
- + " \"name\" : \"name\"," + EOL
- + " \"description\" : \"description\"," + EOL
- + " \"enabled\" : false" + EOL
- + " }" + EOL
- + "}";
+ private static final String JSON_FULL = "{" + EOL + " \"id\" : \"id\"," + EOL + " \"issued_at\" : 1488024000000,"
+ + EOL + " \"expires\" : 1488628800000," + EOL + " \"tenant\" : {" + EOL + " \"id\" : \"id\"," + EOL
+ + " \"name\" : \"name\"," + EOL + " \"description\" : \"description\"," + EOL
+ + " \"enabled\" : false" + EOL + " }" + EOL + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
Token token = objectMapper.readValue(JSON_FULL, Token.class);
token.toString();
-
+
Calendar expires = token.getExpires();
Assert.assertNotNull(expires);
-
+
String id = token.getId();
Assert.assertNotNull(id);
-
+
Calendar issued_at = token.getIssued_at();
Assert.assertNotNull(issued_at);
-
+
Tenant tenant = token.getTenant();
Assert.assertNotNull(tenant);
}
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"user\" : {" + EOL
- + " \"id\" : \"id\"," + EOL
- + " \"username\" : \"username\"," + EOL
- + " \"password\" : \"password\"," + EOL
- + " \"tenantId\" : \"tenantid\"," + EOL
- + " \"name\" : \"name\"," + EOL
- + " \"email\" : \"email\"," + EOL
- + " \"enabled\" : false" + EOL
- + " }" + EOL
- + "}";
+ private static final String JSON_FULL = "{" + EOL + " \"user\" : {" + EOL + " \"id\" : \"id\"," + EOL
+ + " \"username\" : \"username\"," + EOL + " \"password\" : \"password\"," + EOL
+ + " \"tenantId\" : \"tenantid\"," + EOL + " \"name\" : \"name\"," + EOL + " \"email\" : \"email\","
+ + EOL + " \"enabled\" : false" + EOL + " }" + EOL + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(SerializationFeature.WRAP_ROOT_VALUE)
- .enable(DeserializationFeature.UNWRAP_ROOT_VALUE)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE)
+ .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
User user = objectMapper.readValue(JSON_FULL, User.class);
user.toString();
-
+
String password = user.getPassword();
Assert.assertNotNull(password);
user.setPassword(password);
-
+
String name = user.getName();
Assert.assertNotNull(name);
user.setName(name);
-
+
String tenantId = user.getTenantId();
Assert.assertNotNull(tenantId);
user.setTenantId(tenantId);
-
+
String id = user.getId();
Assert.assertNotNull(id);
user.setId(id);
-
+
String email = user.getEmail();
Assert.assertNotNull(email);
user.setEmail(email);
-
+
Boolean enabled = user.getEnabled();
Assert.assertNotNull(enabled);
user.setEnabled(enabled);
-
+
String username = user.getUsername();
Assert.assertNotNull(username);
user.setUsername(username);
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
-
import java.util.List;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"users\" : [ {" + EOL
- + " \"id\" : \"id\"," + EOL
- + " \"username\" : \"username\"," + EOL
- + " \"password\" : \"password\"," + EOL
- + " \"tenantId\" : \"tenantid\"," + EOL
- + " \"name\" : \"name\"," + EOL
- + " \"email\" : \"email\"," + EOL
- + " \"enabled\" : false" + EOL
- + " }, {" + EOL
- + " \"id\" : \"id\"," + EOL
- + " \"username\" : \"username\"," + EOL
- + " \"password\" : \"password\"," + EOL
- + " \"tenantId\" : \"tenantid\"," + EOL
- + " \"name\" : \"name\"," + EOL
- + " \"email\" : \"email\"," + EOL
- + " \"enabled\" : false" + EOL
- + " } ]" + EOL
- + "}";
+ private static final String JSON_FULL = "{" + EOL + " \"users\" : [ {" + EOL + " \"id\" : \"id\"," + EOL
+ + " \"username\" : \"username\"," + EOL + " \"password\" : \"password\"," + EOL
+ + " \"tenantId\" : \"tenantid\"," + EOL + " \"name\" : \"name\"," + EOL + " \"email\" : \"email\","
+ + EOL + " \"enabled\" : false" + EOL + " }, {" + EOL + " \"id\" : \"id\"," + EOL
+ + " \"username\" : \"username\"," + EOL + " \"password\" : \"password\"," + EOL
+ + " \"tenantId\" : \"tenantid\"," + EOL + " \"name\" : \"name\"," + EOL + " \"email\" : \"email\","
+ + EOL + " \"enabled\" : false" + EOL + " } ]" + EOL + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
Users users = objectMapper.readValue(JSON_FULL, Users.class);
users.toString();
-
+
List<User> list = users.getList();
Assert.assertNotNull(list);
Assert.assertEquals(2, list.size());
-
+
int cnt = 0;
- for (@SuppressWarnings("unused") User x : users) {
+ for (@SuppressWarnings("unused")
+ User x : users) {
++cnt;
}
Assert.assertEquals(2, cnt);
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.woorea.openstack.keystone.model.authentication.AccessKey.ApiAccessKeyCredentials;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"auth\" : {" + EOL
- + " \"tenantId\" : \"tenantid\"," + EOL
- + " \"tenantName\" : \"tenantname\"," + EOL
- + " \"apiAccessKeyCredentials\" : {" + EOL
- + " \"accessKey\" : \"accesskey\"," + EOL
- + " \"secretKey\" : \"secretkey\"" + EOL
- + " }" + EOL
- + " }" + EOL
- + "}";
+ private static final String JSON_FULL = "{" + EOL + " \"auth\" : {" + EOL + " \"tenantId\" : \"tenantid\","
+ + EOL + " \"tenantName\" : \"tenantname\"," + EOL + " \"apiAccessKeyCredentials\" : {" + EOL
+ + " \"accessKey\" : \"accesskey\"," + EOL + " \"secretKey\" : \"secretkey\"" + EOL + " }" + EOL
+ + " }" + EOL + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(SerializationFeature.WRAP_ROOT_VALUE)
- .enable(DeserializationFeature.UNWRAP_ROOT_VALUE)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE)
+ .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
AccessKey accesskey = objectMapper.readValue(JSON_FULL, AccessKey.class);
accesskey.toString();
-
+
ApiAccessKeyCredentials apiAccessKeyCredentials = accesskey.getApiAccessKeyCredentials();
Assert.assertNotNull(apiAccessKeyCredentials);
accesskey.setApiAccessKeyCredentials(apiAccessKeyCredentials);
-
+
String tenantId = accesskey.getTenantId();
Assert.assertNotNull(tenantId);
accesskey.setTenantId(tenantId);
-
+
String tenantName = accesskey.getTenantName();
Assert.assertNotNull(tenantName);
accesskey.setTenantName(tenantName);
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.woorea.openstack.keystone.model.authentication.AccessKey.ApiAccessKeyCredentials;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"accessKey\" : \"accesskey\"," + EOL
- + " \"secretKey\" : \"secretkey\"" + EOL
- + "}";
+ private static final String JSON_FULL =
+ "{" + EOL + " \"accessKey\" : \"accesskey\"," + EOL + " \"secretKey\" : \"secretkey\"" + EOL + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
System.out.println("CLASS: " + ApiAccessKeyCredentials.class.getName());
System.out.println("TEST JSON: " + JSON_FULL);
- ApiAccessKeyCredentials apiaccesskeycredentials = objectMapper.readValue(JSON_FULL, ApiAccessKeyCredentials.class);
+ ApiAccessKeyCredentials apiaccesskeycredentials =
+ objectMapper.readValue(JSON_FULL, ApiAccessKeyCredentials.class);
String json = objectMapper.writeValueAsString(apiaccesskeycredentials);
System.out.println("RE-SERIALIZED OBJECT: " + json);
JSONAssert.assertEquals(JSON_FULL, json, JSONCompareMode.LENIENT);
@Test
public void testMethods() throws Exception {
- ApiAccessKeyCredentials apiaccesskeycredentials = objectMapper.readValue(JSON_FULL, ApiAccessKeyCredentials.class);
+ ApiAccessKeyCredentials apiaccesskeycredentials =
+ objectMapper.readValue(JSON_FULL, ApiAccessKeyCredentials.class);
apiaccesskeycredentials.toString();
-
+
String secretKey = apiaccesskeycredentials.getSecretKey();
Assert.assertNotNull(secretKey);
apiaccesskeycredentials.setSecretKey(secretKey);
-
+
String accessKey = apiaccesskeycredentials.getAccessKey();
Assert.assertNotNull(accessKey);
apiaccesskeycredentials.setAccessKey(accessKey);
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.woorea.openstack.keystone.model.authentication.UsernamePassword.PasswordCredentials;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"username\" : \"username\"," + EOL
- + " \"password\" : \"password\"" + EOL
- + "}";
+ private static final String JSON_FULL =
+ "{" + EOL + " \"username\" : \"username\"," + EOL + " \"password\" : \"password\"" + EOL + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
PasswordCredentials passwordcredentials = objectMapper.readValue(JSON_FULL, PasswordCredentials.class);
passwordcredentials.toString();
-
+
String password = passwordcredentials.getPassword();
Assert.assertNotNull(password);
passwordcredentials.setPassword(password);
-
+
String username = passwordcredentials.getUsername();
Assert.assertNotNull(username);
passwordcredentials.setUsername(username);
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.woorea.openstack.keystone.model.authentication.TokenAuthentication.Token;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"id\" : \"id\"" + EOL
- + "}";
+ private static final String JSON_FULL = "{" + EOL + " \"id\" : \"id\"" + EOL + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
Token token = objectMapper.readValue(JSON_FULL, Token.class);
token.toString();
-
+
String id = token.getId();
Assert.assertNotNull(id);
token.setId(id);
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.woorea.openstack.keystone.model.authentication.UsernamePassword.PasswordCredentials;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"auth\" : {" + EOL
- + " \"tenantId\" : \"tenantid\"," + EOL
- + " \"tenantName\" : \"tenantname\"," + EOL
- + " \"passwordCredentials\" : {" + EOL
- + " \"username\" : \"username\"," + EOL
- + " \"password\" : \"password\"" + EOL
- + " }" + EOL
- + " }" + EOL
- + "}";
+ private static final String JSON_FULL = "{" + EOL + " \"auth\" : {" + EOL + " \"tenantId\" : \"tenantid\","
+ + EOL + " \"tenantName\" : \"tenantname\"," + EOL + " \"passwordCredentials\" : {" + EOL
+ + " \"username\" : \"username\"," + EOL + " \"password\" : \"password\"" + EOL + " }" + EOL
+ + " }" + EOL + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(SerializationFeature.WRAP_ROOT_VALUE)
- .enable(DeserializationFeature.UNWRAP_ROOT_VALUE)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE)
+ .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
UsernamePassword usernamepassword = objectMapper.readValue(JSON_FULL, UsernamePassword.class);
usernamepassword.toString();
-
+
PasswordCredentials passwordCredentials = usernamepassword.getPasswordCredentials();
Assert.assertNotNull(passwordCredentials);
usernamepassword.setPasswordCredentials(passwordCredentials);
-
+
String tenantId = usernamepassword.getTenantId();
Assert.assertNotNull(tenantId);
usernamepassword.setTenantId(tenantId);
-
+
String tenantName = usernamepassword.getTenantName();
Assert.assertNotNull(tenantName);
usernamepassword.setTenantName(tenantName);
import com.fasterxml.jackson.databind.SerializationFeature;
import com.woorea.openstack.keystone.v3.model.Authentication.Identity;
import com.woorea.openstack.keystone.v3.model.Authentication.Scope;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"auth\" : {" + EOL
- + " \"identity\" : {" + EOL
- + " \"methods\" : [ \"methods-v1\", \"methods-v2\" ]," + EOL
- + " \"password\" : {" + EOL
- + " \"user\" : {" + EOL
- + " \"domain\" : {" + EOL
- + " \"id\" : \"id\"," + EOL
- + " \"name\" : \"name\"" + EOL
- + " }," + EOL
- + " \"id\" : \"id\"," + EOL
- + " \"name\" : \"name\"," + EOL
- + " \"password\" : \"password\"" + EOL
- + " }" + EOL
- + " }," + EOL
- + " \"token\" : {" + EOL
- + " \"id\" : \"id\"" + EOL
- + " }" + EOL
- + " }," + EOL
- + " \"scope\" : {" + EOL
- + " \"project\" : {" + EOL
- + " \"id\" : \"id\"," + EOL
- + " \"domain\" : {" + EOL
- + " \"id\" : \"id\"," + EOL
- + " \"name\" : \"name\"" + EOL
- + " }," + EOL
- + " \"name\" : \"name\"" + EOL
- + " }" + EOL
- + " }" + EOL
- + " }" + EOL
- + "}";
+ private static final String JSON_FULL = "{" + EOL + " \"auth\" : {" + EOL + " \"identity\" : {" + EOL
+ + " \"methods\" : [ \"methods-v1\", \"methods-v2\" ]," + EOL + " \"password\" : {" + EOL
+ + " \"user\" : {" + EOL + " \"domain\" : {" + EOL + " \"id\" : \"id\"," + EOL
+ + " \"name\" : \"name\"" + EOL + " }," + EOL + " \"id\" : \"id\"," + EOL
+ + " \"name\" : \"name\"," + EOL + " \"password\" : \"password\"" + EOL + " }" + EOL
+ + " }," + EOL + " \"token\" : {" + EOL + " \"id\" : \"id\"" + EOL + " }" + EOL
+ + " }," + EOL + " \"scope\" : {" + EOL + " \"project\" : {" + EOL + " \"id\" : \"id\","
+ + EOL + " \"domain\" : {" + EOL + " \"id\" : \"id\"," + EOL
+ + " \"name\" : \"name\"" + EOL + " }," + EOL + " \"name\" : \"name\"" + EOL
+ + " }" + EOL + " }" + EOL + " }" + EOL + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(SerializationFeature.WRAP_ROOT_VALUE)
- .enable(DeserializationFeature.UNWRAP_ROOT_VALUE)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE)
+ .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
Authentication authentication = objectMapper.readValue(JSON_FULL, Authentication.class);
authentication.toString();
-
+
Identity identity = authentication.getIdentity();
Assert.assertNotNull(identity);
authentication.setIdentity(identity);
-
+
Scope scope = authentication.getScope();
Assert.assertNotNull(scope);
authentication.setScope(scope);
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
-
import java.util.Map;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"credential\" : {" + EOL
- + " \"id\" : \"id\"," + EOL
- + " \"projectId\" : \"projectid\"," + EOL
- + " \"type\" : \"type\"," + EOL
- + " \"userId\" : \"userid\"," + EOL
- + " \"blob\" : {" + EOL
- + " \"blob-k1\" : \"blob-v1\"," + EOL
- + " \"blob-k2\" : \"blob-v2\"" + EOL
- + " }" + EOL
- + " }" + EOL
- + "}";
+ private static final String JSON_FULL = "{" + EOL + " \"credential\" : {" + EOL + " \"id\" : \"id\"," + EOL
+ + " \"projectId\" : \"projectid\"," + EOL + " \"type\" : \"type\"," + EOL
+ + " \"userId\" : \"userid\"," + EOL + " \"blob\" : {" + EOL + " \"blob-k1\" : \"blob-v1\"," + EOL
+ + " \"blob-k2\" : \"blob-v2\"" + EOL + " }" + EOL + " }" + EOL + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(SerializationFeature.WRAP_ROOT_VALUE)
- .enable(DeserializationFeature.UNWRAP_ROOT_VALUE)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE)
+ .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
Credential credential = objectMapper.readValue(JSON_FULL, Credential.class);
credential.toString();
-
- Map<String,String> blob = credential.getBlob();
+
+ Map<String, String> blob = credential.getBlob();
Assert.assertNotNull(blob);
Assert.assertEquals(2, blob.size());
credential.setBlob(blob);
-
+
String id = credential.getId();
Assert.assertNotNull(id);
credential.setId(id);
-
+
String type = credential.getType();
Assert.assertNotNull(type);
credential.setType(type);
-
+
String userId = credential.getUserId();
Assert.assertNotNull(userId);
credential.setUserId(userId);
-
+
String projectId = credential.getProjectId();
Assert.assertNotNull(projectId);
credential.setProjectId(projectId);
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
-
import java.util.List;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"credentials\" : [ {" + EOL
- + " \"id\" : \"id\"," + EOL
- + " \"projectId\" : \"projectid\"," + EOL
- + " \"type\" : \"type\"," + EOL
- + " \"userId\" : \"userid\"," + EOL
- + " \"blob\" : {" + EOL
- + " \"blob-k1\" : \"blob-v1\"," + EOL
- + " \"blob-k2\" : \"blob-v2\"" + EOL
- + " }" + EOL
- + " }, {" + EOL
- + " \"id\" : \"id\"," + EOL
- + " \"projectId\" : \"projectid\"," + EOL
- + " \"type\" : \"type\"," + EOL
- + " \"userId\" : \"userid\"," + EOL
- + " \"blob\" : {" + EOL
- + " \"blob-k1\" : \"blob-v1\"," + EOL
- + " \"blob-k2\" : \"blob-v2\"" + EOL
- + " }" + EOL
- + " } ]" + EOL
- + "}";
+ private static final String JSON_FULL = "{" + EOL + " \"credentials\" : [ {" + EOL + " \"id\" : \"id\"," + EOL
+ + " \"projectId\" : \"projectid\"," + EOL + " \"type\" : \"type\"," + EOL
+ + " \"userId\" : \"userid\"," + EOL + " \"blob\" : {" + EOL + " \"blob-k1\" : \"blob-v1\"," + EOL
+ + " \"blob-k2\" : \"blob-v2\"" + EOL + " }" + EOL + " }, {" + EOL + " \"id\" : \"id\"," + EOL
+ + " \"projectId\" : \"projectid\"," + EOL + " \"type\" : \"type\"," + EOL
+ + " \"userId\" : \"userid\"," + EOL + " \"blob\" : {" + EOL + " \"blob-k1\" : \"blob-v1\"," + EOL
+ + " \"blob-k2\" : \"blob-v2\"" + EOL + " }" + EOL + " } ]" + EOL + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
Credentials credentials = objectMapper.readValue(JSON_FULL, Credentials.class);
credentials.toString();
-
+
List<Credential> list = credentials.getList();
Assert.assertNotNull(list);
Assert.assertEquals(2, list.size());
-
+
int cnt = 0;
- for (@SuppressWarnings("unused") Credential x : credentials) {
+ for (@SuppressWarnings("unused")
+ Credential x : credentials) {
++cnt;
}
Assert.assertEquals(2, cnt);
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.woorea.openstack.keystone.v3.model.Token.Domain;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"id\" : \"id\"," + EOL
- + " \"name\" : \"name\"" + EOL
- + "}";
-
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private static final String JSON_FULL =
+ "{" + EOL + " \"id\" : \"id\"," + EOL + " \"name\" : \"name\"" + EOL + "}";
+
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
Domain domain = objectMapper.readValue(JSON_FULL, Domain.class);
domain.toString();
-
+
String name = domain.getName();
Assert.assertNotNull(name);
domain.setName(name);
-
+
String id = domain.getId();
Assert.assertNotNull(id);
domain.setId(id);
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
-
import java.util.List;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"domains\" : [ {" + EOL
- + " \"id\" : \"id\"," + EOL
- + " \"name\" : \"name\"," + EOL
- + " \"description\" : \"description\"," + EOL
- + " \"enabled\" : false" + EOL
- + " }, {" + EOL
- + " \"id\" : \"id\"," + EOL
- + " \"name\" : \"name\"," + EOL
- + " \"description\" : \"description\"," + EOL
- + " \"enabled\" : false" + EOL
- + " } ]" + EOL
- + "}";
+ private static final String JSON_FULL = "{" + EOL + " \"domains\" : [ {" + EOL + " \"id\" : \"id\"," + EOL
+ + " \"name\" : \"name\"," + EOL + " \"description\" : \"description\"," + EOL
+ + " \"enabled\" : false" + EOL + " }, {" + EOL + " \"id\" : \"id\"," + EOL
+ + " \"name\" : \"name\"," + EOL + " \"description\" : \"description\"," + EOL
+ + " \"enabled\" : false" + EOL + " } ]" + EOL + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
Domains domains = objectMapper.readValue(JSON_FULL, Domains.class);
domains.toString();
-
+
List<Domain> list = domains.getList();
Assert.assertNotNull(list);
Assert.assertEquals(2, list.size());
-
+
int cnt = 0;
- for (@SuppressWarnings("unused") Domain x : domains) {
+ for (@SuppressWarnings("unused")
+ Domain x : domains) {
++cnt;
}
Assert.assertEquals(2, cnt);
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.woorea.openstack.keystone.v3.model.Token.Service.Endpoint;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"id\" : \"id\"," + EOL
- + " \"url\" : \"url\"," + EOL
- + " \"region\" : \"region\"," + EOL
- + " \"enabled\" : false," + EOL
- + " \"interface\" : \"interface\"," + EOL
- + " \"legacy_endpoint_id\" : \"legacyendpointid\"" + EOL
- + "}";
+ private static final String JSON_FULL = "{" + EOL + " \"id\" : \"id\"," + EOL + " \"url\" : \"url\"," + EOL
+ + " \"region\" : \"region\"," + EOL + " \"enabled\" : false," + EOL + " \"interface\" : \"interface\","
+ + EOL + " \"legacy_endpoint_id\" : \"legacyendpointid\"" + EOL + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
Endpoint endpoint = objectMapper.readValue(JSON_FULL, Endpoint.class);
endpoint.toString();
-
+
String legacyEndpointId = endpoint.getLegacyEndpointId();
Assert.assertNotNull(legacyEndpointId);
endpoint.setLegacyEndpointId(legacyEndpointId);
-
+
String id = endpoint.getId();
Assert.assertNotNull(id);
endpoint.setId(id);
-
+
String region = endpoint.getRegion();
Assert.assertNotNull(region);
endpoint.setRegion(region);
-
+
String interfaceProperty = endpoint.getInterface();
Assert.assertNotNull(interfaceProperty);
endpoint.setInterface(interfaceProperty);
-
+
String url = endpoint.getUrl();
Assert.assertNotNull(url);
endpoint.setUrl(url);
-
+
Boolean enabled = endpoint.getEnabled();
Assert.assertNotNull(enabled);
endpoint.setEnabled(enabled);
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
-
import java.util.List;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"endpoints\" : [ {" + EOL
- + " \"id\" : \"id\"," + EOL
- + " \"name\" : \"name\"," + EOL
- + " \"interface\" : \"interface\"," + EOL
- + " \"service_id\" : \"serviceid\"" + EOL
- + " }, {" + EOL
- + " \"id\" : \"id\"," + EOL
- + " \"name\" : \"name\"," + EOL
- + " \"interface\" : \"interface\"," + EOL
- + " \"service_id\" : \"serviceid\"" + EOL
- + " } ]" + EOL
- + "}";
+ private static final String JSON_FULL = "{" + EOL + " \"endpoints\" : [ {" + EOL + " \"id\" : \"id\"," + EOL
+ + " \"name\" : \"name\"," + EOL + " \"interface\" : \"interface\"," + EOL
+ + " \"service_id\" : \"serviceid\"" + EOL + " }, {" + EOL + " \"id\" : \"id\"," + EOL
+ + " \"name\" : \"name\"," + EOL + " \"interface\" : \"interface\"," + EOL
+ + " \"service_id\" : \"serviceid\"" + EOL + " } ]" + EOL + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
Endpoints endpoints = objectMapper.readValue(JSON_FULL, Endpoints.class);
endpoints.toString();
-
+
List<Endpoint> list = endpoints.getList();
Assert.assertNotNull(list);
Assert.assertEquals(2, list.size());
-
+
int cnt = 0;
- for (@SuppressWarnings("unused") Endpoint x : endpoints) {
+ for (@SuppressWarnings("unused")
+ Endpoint x : endpoints) {
++cnt;
}
Assert.assertEquals(2, cnt);
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"group\" : {" + EOL
- + " \"id\" : \"id\"," + EOL
- + " \"name\" : \"name\"," + EOL
- + " \"description\" : \"description\"," + EOL
- + " \"domain_id\" : \"domainid\"" + EOL
- + " }" + EOL
- + "}";
+ private static final String JSON_FULL = "{" + EOL + " \"group\" : {" + EOL + " \"id\" : \"id\"," + EOL
+ + " \"name\" : \"name\"," + EOL + " \"description\" : \"description\"," + EOL
+ + " \"domain_id\" : \"domainid\"" + EOL + " }" + EOL + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(SerializationFeature.WRAP_ROOT_VALUE)
- .enable(DeserializationFeature.UNWRAP_ROOT_VALUE)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE)
+ .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
Group group = objectMapper.readValue(JSON_FULL, Group.class);
group.toString();
-
+
String name = group.getName();
Assert.assertNotNull(name);
group.setName(name);
-
+
String description = group.getDescription();
Assert.assertNotNull(description);
group.setDescription(description);
-
+
String id = group.getId();
Assert.assertNotNull(id);
group.setId(id);
-
+
String domainId = group.getDomainId();
Assert.assertNotNull(domainId);
group.setDomainId(domainId);
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
-
import java.util.List;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"groups\" : [ {" + EOL
- + " \"id\" : \"id\"," + EOL
- + " \"name\" : \"name\"," + EOL
- + " \"description\" : \"description\"," + EOL
- + " \"domain_id\" : \"domainid\"" + EOL
- + " }, {" + EOL
- + " \"id\" : \"id\"," + EOL
- + " \"name\" : \"name\"," + EOL
- + " \"description\" : \"description\"," + EOL
- + " \"domain_id\" : \"domainid\"" + EOL
- + " } ]" + EOL
- + "}";
+ private static final String JSON_FULL = "{" + EOL + " \"groups\" : [ {" + EOL + " \"id\" : \"id\"," + EOL
+ + " \"name\" : \"name\"," + EOL + " \"description\" : \"description\"," + EOL
+ + " \"domain_id\" : \"domainid\"" + EOL + " }, {" + EOL + " \"id\" : \"id\"," + EOL
+ + " \"name\" : \"name\"," + EOL + " \"description\" : \"description\"," + EOL
+ + " \"domain_id\" : \"domainid\"" + EOL + " } ]" + EOL + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
Groups groups = objectMapper.readValue(JSON_FULL, Groups.class);
groups.toString();
-
+
List<Group> list = groups.getList();
Assert.assertNotNull(list);
Assert.assertEquals(2, list.size());
-
+
int cnt = 0;
- for (@SuppressWarnings("unused") Group x : groups) {
+ for (@SuppressWarnings("unused")
+ Group x : groups) {
++cnt;
}
Assert.assertEquals(2, cnt);
import com.woorea.openstack.keystone.v3.model.Authentication.Identity;
import com.woorea.openstack.keystone.v3.model.Authentication.Identity.Password;
import com.woorea.openstack.keystone.v3.model.Authentication.Identity.Token;
-
import java.util.List;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"methods\" : [ \"methods-v1\", \"methods-v2\" ]," + EOL
- + " \"password\" : {" + EOL
- + " \"user\" : {" + EOL
- + " \"domain\" : {" + EOL
- + " \"id\" : \"id\"," + EOL
- + " \"name\" : \"name\"" + EOL
- + " }," + EOL
- + " \"id\" : \"id\"," + EOL
- + " \"name\" : \"name\"," + EOL
- + " \"password\" : \"password\"" + EOL
- + " }" + EOL
- + " }," + EOL
- + " \"token\" : {" + EOL
- + " \"id\" : \"id\"" + EOL
- + " }" + EOL
- + "}";
+ private static final String JSON_FULL =
+ "{" + EOL + " \"methods\" : [ \"methods-v1\", \"methods-v2\" ]," + EOL + " \"password\" : {" + EOL
+ + " \"user\" : {" + EOL + " \"domain\" : {" + EOL + " \"id\" : \"id\"," + EOL
+ + " \"name\" : \"name\"" + EOL + " }," + EOL + " \"id\" : \"id\"," + EOL
+ + " \"name\" : \"name\"," + EOL + " \"password\" : \"password\"" + EOL + " }" + EOL
+ + " }," + EOL + " \"token\" : {" + EOL + " \"id\" : \"id\"" + EOL + " }" + EOL + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
Identity identity = objectMapper.readValue(JSON_FULL, Identity.class);
identity.toString();
-
+
Password password = identity.getPassword();
Assert.assertNotNull(password);
identity.setPassword(password);
-
+
List<String> methods = identity.getMethods();
Assert.assertNotNull(methods);
Assert.assertEquals(2, methods.size());
identity.setMethods(methods);
-
+
Token token = identity.getToken();
Assert.assertNotNull(token);
identity.setToken(token);
import com.fasterxml.jackson.databind.SerializationFeature;
import com.woorea.openstack.keystone.v3.model.Authentication.Identity.Password;
import com.woorea.openstack.keystone.v3.model.Authentication.Identity.Password.User;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"user\" : {" + EOL
- + " \"domain\" : {" + EOL
- + " \"id\" : \"id\"," + EOL
- + " \"name\" : \"name\"" + EOL
- + " }," + EOL
- + " \"id\" : \"id\"," + EOL
- + " \"name\" : \"name\"," + EOL
- + " \"password\" : \"password\"" + EOL
- + " }" + EOL
- + "}";
+ private static final String JSON_FULL =
+ "{" + EOL + " \"user\" : {" + EOL + " \"domain\" : {" + EOL + " \"id\" : \"id\"," + EOL
+ + " \"name\" : \"name\"" + EOL + " }," + EOL + " \"id\" : \"id\"," + EOL
+ + " \"name\" : \"name\"," + EOL + " \"password\" : \"password\"" + EOL + " }" + EOL + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
Password password = objectMapper.readValue(JSON_FULL, Password.class);
password.toString();
-
+
User user = password.getUser();
Assert.assertNotNull(user);
password.setUser(user);
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
-
import java.util.List;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"policies\" : [ {" + EOL
- + " \"id\" : \"id\"," + EOL
- + " \"projectId\" : \"projectid\"," + EOL
- + " \"type\" : \"type\"," + EOL
- + " \"userId\" : \"userid\"," + EOL
- + " \"blob\" : {" + EOL
- + " \"blob-k1\" : \"blob-v1\"," + EOL
- + " \"blob-k2\" : \"blob-v2\"" + EOL
- + " }" + EOL
- + " }, {" + EOL
- + " \"id\" : \"id\"," + EOL
- + " \"projectId\" : \"projectid\"," + EOL
- + " \"type\" : \"type\"," + EOL
- + " \"userId\" : \"userid\"," + EOL
- + " \"blob\" : {" + EOL
- + " \"blob-k1\" : \"blob-v1\"," + EOL
- + " \"blob-k2\" : \"blob-v2\"" + EOL
- + " }" + EOL
- + " } ]" + EOL
- + "}";
+ private static final String JSON_FULL = "{" + EOL + " \"policies\" : [ {" + EOL + " \"id\" : \"id\"," + EOL
+ + " \"projectId\" : \"projectid\"," + EOL + " \"type\" : \"type\"," + EOL
+ + " \"userId\" : \"userid\"," + EOL + " \"blob\" : {" + EOL + " \"blob-k1\" : \"blob-v1\"," + EOL
+ + " \"blob-k2\" : \"blob-v2\"" + EOL + " }" + EOL + " }, {" + EOL + " \"id\" : \"id\"," + EOL
+ + " \"projectId\" : \"projectid\"," + EOL + " \"type\" : \"type\"," + EOL
+ + " \"userId\" : \"userid\"," + EOL + " \"blob\" : {" + EOL + " \"blob-k1\" : \"blob-v1\"," + EOL
+ + " \"blob-k2\" : \"blob-v2\"" + EOL + " }" + EOL + " } ]" + EOL + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
Policies policies = objectMapper.readValue(JSON_FULL, Policies.class);
policies.toString();
-
+
List<Policy> list = policies.getList();
Assert.assertNotNull(list);
Assert.assertEquals(2, list.size());
-
+
int cnt = 0;
- for (@SuppressWarnings("unused") Policy x : policies) {
+ for (@SuppressWarnings("unused")
+ Policy x : policies) {
++cnt;
}
Assert.assertEquals(2, cnt);
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
-
import java.util.Map;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"policy\" : {" + EOL
- + " \"id\" : \"id\"," + EOL
- + " \"projectId\" : \"projectid\"," + EOL
- + " \"type\" : \"type\"," + EOL
- + " \"userId\" : \"userid\"," + EOL
- + " \"blob\" : {" + EOL
- + " \"blob-k1\" : \"blob-v1\"," + EOL
- + " \"blob-k2\" : \"blob-v2\"" + EOL
- + " }" + EOL
- + " }" + EOL
- + "}";
+ private static final String JSON_FULL = "{" + EOL + " \"policy\" : {" + EOL + " \"id\" : \"id\"," + EOL
+ + " \"projectId\" : \"projectid\"," + EOL + " \"type\" : \"type\"," + EOL
+ + " \"userId\" : \"userid\"," + EOL + " \"blob\" : {" + EOL + " \"blob-k1\" : \"blob-v1\"," + EOL
+ + " \"blob-k2\" : \"blob-v2\"" + EOL + " }" + EOL + " }" + EOL + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(SerializationFeature.WRAP_ROOT_VALUE)
- .enable(DeserializationFeature.UNWRAP_ROOT_VALUE)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE)
+ .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
Policy policy = objectMapper.readValue(JSON_FULL, Policy.class);
policy.toString();
-
- Map<String,String> blob = policy.getBlob();
+
+ Map<String, String> blob = policy.getBlob();
Assert.assertNotNull(blob);
Assert.assertEquals(2, blob.size());
policy.setBlob(blob);
-
+
String id = policy.getId();
Assert.assertNotNull(id);
policy.setId(id);
-
+
String type = policy.getType();
Assert.assertNotNull(type);
policy.setType(type);
-
+
String userId = policy.getUserId();
Assert.assertNotNull(userId);
policy.setUserId(userId);
-
+
String projectId = policy.getProjectId();
Assert.assertNotNull(projectId);
policy.setProjectId(projectId);
import com.fasterxml.jackson.databind.SerializationFeature;
import com.woorea.openstack.keystone.v3.model.Token.Domain;
import com.woorea.openstack.keystone.v3.model.Token.Project;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"domain\" : {" + EOL
- + " \"id\" : \"id\"," + EOL
- + " \"name\" : \"name\"" + EOL
- + " }," + EOL
- + " \"id\" : \"id\"," + EOL
- + " \"name\" : \"name\"" + EOL
- + "}";
+ private static final String JSON_FULL =
+ "{" + EOL + " \"domain\" : {" + EOL + " \"id\" : \"id\"," + EOL + " \"name\" : \"name\"" + EOL
+ + " }," + EOL + " \"id\" : \"id\"," + EOL + " \"name\" : \"name\"" + EOL + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
Project project = objectMapper.readValue(JSON_FULL, Project.class);
project.toString();
-
+
Domain domain = project.getDomain();
Assert.assertNotNull(domain);
project.setDomain(domain);
-
+
String name = project.getName();
Assert.assertNotNull(name);
project.setName(name);
-
+
String id = project.getId();
Assert.assertNotNull(id);
project.setId(id);
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
-
import java.util.List;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"projects\" : [ {" + EOL
- + " \"id\" : \"id\"," + EOL
- + " \"name\" : \"name\"," + EOL
- + " \"enabled\" : false," + EOL
- + " \"domain_id\" : \"domainid\"" + EOL
- + " }, {" + EOL
- + " \"id\" : \"id\"," + EOL
- + " \"name\" : \"name\"," + EOL
- + " \"enabled\" : false," + EOL
- + " \"domain_id\" : \"domainid\"" + EOL
- + " } ]" + EOL
- + "}";
+ private static final String JSON_FULL = "{" + EOL + " \"projects\" : [ {" + EOL + " \"id\" : \"id\"," + EOL
+ + " \"name\" : \"name\"," + EOL + " \"enabled\" : false," + EOL + " \"domain_id\" : \"domainid\""
+ + EOL + " }, {" + EOL + " \"id\" : \"id\"," + EOL + " \"name\" : \"name\"," + EOL
+ + " \"enabled\" : false," + EOL + " \"domain_id\" : \"domainid\"" + EOL + " } ]" + EOL + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
Projects projects = objectMapper.readValue(JSON_FULL, Projects.class);
projects.toString();
-
+
List<Project> list = projects.getList();
Assert.assertNotNull(list);
Assert.assertEquals(2, list.size());
-
+
int cnt = 0;
- for (@SuppressWarnings("unused") Project x : projects) {
+ for (@SuppressWarnings("unused")
+ Project x : projects) {
++cnt;
}
Assert.assertEquals(2, cnt);
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.woorea.openstack.keystone.v3.model.Token.Role;
-
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
import org.skyscreamer.jsonassert.JSONCompareMode;
private static final String JSON_FULL = "{ }";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
-
import java.util.List;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"roles\" : [ {" + EOL
- + " \"id\" : \"id\"," + EOL
- + " \"name\" : \"name\"," + EOL
- + " \"description\" : \"description\"," + EOL
- + " \"enabled\" : \"enabled\"" + EOL
- + " }, {" + EOL
- + " \"id\" : \"id\"," + EOL
- + " \"name\" : \"name\"," + EOL
- + " \"description\" : \"description\"," + EOL
- + " \"enabled\" : \"enabled\"" + EOL
- + " } ]" + EOL
- + "}";
+ private static final String JSON_FULL = "{" + EOL + " \"roles\" : [ {" + EOL + " \"id\" : \"id\"," + EOL
+ + " \"name\" : \"name\"," + EOL + " \"description\" : \"description\"," + EOL
+ + " \"enabled\" : \"enabled\"" + EOL + " }, {" + EOL + " \"id\" : \"id\"," + EOL
+ + " \"name\" : \"name\"," + EOL + " \"description\" : \"description\"," + EOL
+ + " \"enabled\" : \"enabled\"" + EOL + " } ]" + EOL + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
Roles roles = objectMapper.readValue(JSON_FULL, Roles.class);
roles.toString();
-
+
List<Role> list = roles.getList();
Assert.assertNotNull(list);
Assert.assertEquals(2, list.size());
-
+
int cnt = 0;
- for (@SuppressWarnings("unused") Role x : roles) {
+ for (@SuppressWarnings("unused")
+ Role x : roles) {
++cnt;
}
Assert.assertEquals(2, cnt);
import com.fasterxml.jackson.databind.SerializationFeature;
import com.woorea.openstack.keystone.v3.model.Authentication.Scope;
import com.woorea.openstack.keystone.v3.model.Authentication.Scope.Project;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"project\" : {" + EOL
- + " \"id\" : \"id\"," + EOL
- + " \"domain\" : {" + EOL
- + " \"id\" : \"id\"," + EOL
- + " \"name\" : \"name\"" + EOL
- + " }," + EOL
- + " \"name\" : \"name\"" + EOL
- + " }" + EOL
- + "}";
+ private static final String JSON_FULL = "{" + EOL + " \"project\" : {" + EOL + " \"id\" : \"id\"," + EOL
+ + " \"domain\" : {" + EOL + " \"id\" : \"id\"," + EOL + " \"name\" : \"name\"" + EOL + " },"
+ + EOL + " \"name\" : \"name\"" + EOL + " }" + EOL + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
Scope scope = objectMapper.readValue(JSON_FULL, Scope.class);
scope.toString();
-
+
Project project = scope.getProject();
Assert.assertNotNull(project);
scope.setProject(project);
import com.fasterxml.jackson.databind.SerializationFeature;
import com.woorea.openstack.keystone.v3.model.Token.Service;
import com.woorea.openstack.keystone.v3.model.Token.Service.Endpoint;
-
import java.util.List;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"id\" : \"id\"," + EOL
- + " \"type\" : \"type\"," + EOL
- + " \"endpoints\" : [ {" + EOL
- + " \"id\" : \"id\"," + EOL
- + " \"url\" : \"url\"," + EOL
- + " \"region\" : \"region\"," + EOL
- + " \"enabled\" : false," + EOL
- + " \"interface\" : \"interface\"," + EOL
- + " \"legacy_endpoint_id\" : \"legacyendpointid\"" + EOL
- + " }, {" + EOL
- + " \"id\" : \"id\"," + EOL
- + " \"url\" : \"url\"," + EOL
- + " \"region\" : \"region\"," + EOL
- + " \"enabled\" : false," + EOL
- + " \"interface\" : \"interface\"," + EOL
- + " \"legacy_endpoint_id\" : \"legacyendpointid\"" + EOL
- + " } ]" + EOL
- + "}";
+ private static final String JSON_FULL =
+ "{" + EOL + " \"id\" : \"id\"," + EOL + " \"type\" : \"type\"," + EOL + " \"endpoints\" : [ {" + EOL
+ + " \"id\" : \"id\"," + EOL + " \"url\" : \"url\"," + EOL + " \"region\" : \"region\","
+ + EOL + " \"enabled\" : false," + EOL + " \"interface\" : \"interface\"," + EOL
+ + " \"legacy_endpoint_id\" : \"legacyendpointid\"" + EOL + " }, {" + EOL
+ + " \"id\" : \"id\"," + EOL + " \"url\" : \"url\"," + EOL + " \"region\" : \"region\","
+ + EOL + " \"enabled\" : false," + EOL + " \"interface\" : \"interface\"," + EOL
+ + " \"legacy_endpoint_id\" : \"legacyendpointid\"" + EOL + " } ]" + EOL + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
Service service = objectMapper.readValue(JSON_FULL, Service.class);
service.toString();
-
+
List<Endpoint> endpoints = service.getEndpoints();
Assert.assertNotNull(endpoints);
Assert.assertEquals(2, endpoints.size());
service.setEndpoints(endpoints);
-
+
String id = service.getId();
Assert.assertNotNull(id);
service.setId(id);
-
+
String type = service.getType();
Assert.assertNotNull(type);
service.setType(type);
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.woorea.openstack.keystone.model.Service;
-
import java.util.List;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"services\" : [ {" + EOL
- + " \"id\" : \"id\"," + EOL
- + " \"type\" : \"type\"," + EOL
- + " \"name\" : \"name\"," + EOL
- + " \"description\" : \"description\"" + EOL
- + " }, {" + EOL
- + " \"id\" : \"id\"," + EOL
- + " \"type\" : \"type\"," + EOL
- + " \"name\" : \"name\"," + EOL
- + " \"description\" : \"description\"" + EOL
- + " } ]" + EOL
- + "}";
+ private static final String JSON_FULL =
+ "{" + EOL + " \"services\" : [ {" + EOL + " \"id\" : \"id\"," + EOL + " \"type\" : \"type\"," + EOL
+ + " \"name\" : \"name\"," + EOL + " \"description\" : \"description\"" + EOL + " }, {" + EOL
+ + " \"id\" : \"id\"," + EOL + " \"type\" : \"type\"," + EOL + " \"name\" : \"name\"," + EOL
+ + " \"description\" : \"description\"" + EOL + " } ]" + EOL + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
Services services = objectMapper.readValue(JSON_FULL, Services.class);
services.toString();
-
+
List<Service> list = services.getList();
Assert.assertNotNull(list);
Assert.assertEquals(2, list.size());
-
+
int cnt = 0;
- for (@SuppressWarnings("unused") Service x : services) {
+ for (@SuppressWarnings("unused")
+ Service x : services) {
++cnt;
}
Assert.assertEquals(2, cnt);
import com.woorea.openstack.keystone.v3.model.Token.Role;
import com.woorea.openstack.keystone.v3.model.Token.Service;
import com.woorea.openstack.keystone.v3.model.Token.User;
-
import java.util.Calendar;
import java.util.List;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"token\" : {" + EOL
- + " \"id\" : \"id\"," + EOL
- + " \"methods\" : [ \"methods-v1\", \"methods-v2\" ]," + EOL
- + " \"domain\" : {" + EOL
- + " \"id\" : \"id\"," + EOL
- + " \"name\" : \"name\"" + EOL
- + " }," + EOL
- + " \"project\" : {" + EOL
- + " \"domain\" : {" + EOL
- + " \"id\" : \"id\"," + EOL
- + " \"name\" : \"name\"" + EOL
- + " }," + EOL
- + " \"id\" : \"id\"," + EOL
- + " \"name\" : \"name\"" + EOL
- + " }," + EOL
- + " \"user\" : {" + EOL
- + " \"id\" : \"id\"," + EOL
- + " \"name\" : \"name\"" + EOL
- + " }," + EOL
- + " \"roles\" : [ { }, { } ]," + EOL
- + " \"catalog\" : [ {" + EOL
- + " \"id\" : \"id\"," + EOL
- + " \"type\" : \"type\"," + EOL
- + " \"endpoints\" : [ {" + EOL
- + " \"id\" : \"id\"," + EOL
- + " \"url\" : \"url\"," + EOL
- + " \"region\" : \"region\"," + EOL
- + " \"enabled\" : false," + EOL
- + " \"interface\" : \"interface\"," + EOL
- + " \"legacy_endpoint_id\" : \"legacyendpointid\"" + EOL
- + " }, {" + EOL
- + " \"id\" : \"id\"," + EOL
- + " \"url\" : \"url\"," + EOL
- + " \"region\" : \"region\"," + EOL
- + " \"enabled\" : false," + EOL
- + " \"interface\" : \"interface\"," + EOL
- + " \"legacy_endpoint_id\" : \"legacyendpointid\"" + EOL
- + " } ]" + EOL
- + " }, {" + EOL
- + " \"id\" : \"id\"," + EOL
- + " \"type\" : \"type\"," + EOL
- + " \"endpoints\" : [ {" + EOL
- + " \"id\" : \"id\"," + EOL
- + " \"url\" : \"url\"," + EOL
- + " \"region\" : \"region\"," + EOL
- + " \"enabled\" : false," + EOL
- + " \"interface\" : \"interface\"," + EOL
- + " \"legacy_endpoint_id\" : \"legacyendpointid\"" + EOL
- + " }, {" + EOL
- + " \"id\" : \"id\"," + EOL
- + " \"url\" : \"url\"," + EOL
- + " \"region\" : \"region\"," + EOL
- + " \"enabled\" : false," + EOL
- + " \"interface\" : \"interface\"," + EOL
- + " \"legacy_endpoint_id\" : \"legacyendpointid\"" + EOL
- + " } ]" + EOL
- + " } ]," + EOL
- + " \"expires_at\" : 1489752000000," + EOL
- + " \"issued_at\" : 1488456000000" + EOL
- + " }" + EOL
- + "}";
-
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(SerializationFeature.WRAP_ROOT_VALUE)
- .enable(DeserializationFeature.UNWRAP_ROOT_VALUE)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private static final String JSON_FULL = "{" + EOL + " \"token\" : {" + EOL + " \"id\" : \"id\"," + EOL
+ + " \"methods\" : [ \"methods-v1\", \"methods-v2\" ]," + EOL + " \"domain\" : {" + EOL
+ + " \"id\" : \"id\"," + EOL + " \"name\" : \"name\"" + EOL + " }," + EOL
+ + " \"project\" : {" + EOL + " \"domain\" : {" + EOL + " \"id\" : \"id\"," + EOL
+ + " \"name\" : \"name\"" + EOL + " }," + EOL + " \"id\" : \"id\"," + EOL
+ + " \"name\" : \"name\"" + EOL + " }," + EOL + " \"user\" : {" + EOL + " \"id\" : \"id\","
+ + EOL + " \"name\" : \"name\"" + EOL + " }," + EOL + " \"roles\" : [ { }, { } ]," + EOL
+ + " \"catalog\" : [ {" + EOL + " \"id\" : \"id\"," + EOL + " \"type\" : \"type\"," + EOL
+ + " \"endpoints\" : [ {" + EOL + " \"id\" : \"id\"," + EOL + " \"url\" : \"url\"," + EOL
+ + " \"region\" : \"region\"," + EOL + " \"enabled\" : false," + EOL
+ + " \"interface\" : \"interface\"," + EOL + " \"legacy_endpoint_id\" : \"legacyendpointid\""
+ + EOL + " }, {" + EOL + " \"id\" : \"id\"," + EOL + " \"url\" : \"url\"," + EOL
+ + " \"region\" : \"region\"," + EOL + " \"enabled\" : false," + EOL
+ + " \"interface\" : \"interface\"," + EOL + " \"legacy_endpoint_id\" : \"legacyendpointid\""
+ + EOL + " } ]" + EOL + " }, {" + EOL + " \"id\" : \"id\"," + EOL + " \"type\" : \"type\","
+ + EOL + " \"endpoints\" : [ {" + EOL + " \"id\" : \"id\"," + EOL + " \"url\" : \"url\","
+ + EOL + " \"region\" : \"region\"," + EOL + " \"enabled\" : false," + EOL
+ + " \"interface\" : \"interface\"," + EOL + " \"legacy_endpoint_id\" : \"legacyendpointid\""
+ + EOL + " }, {" + EOL + " \"id\" : \"id\"," + EOL + " \"url\" : \"url\"," + EOL
+ + " \"region\" : \"region\"," + EOL + " \"enabled\" : false," + EOL
+ + " \"interface\" : \"interface\"," + EOL + " \"legacy_endpoint_id\" : \"legacyendpointid\""
+ + EOL + " } ]" + EOL + " } ]," + EOL + " \"expires_at\" : 1489752000000," + EOL
+ + " \"issued_at\" : 1488456000000" + EOL + " }" + EOL + "}";
+
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE)
+ .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
Token token = objectMapper.readValue(JSON_FULL, Token.class);
token.toString();
-
+
List<String> methods = token.getMethods();
Assert.assertNotNull(methods);
Assert.assertEquals(2, methods.size());
token.setMethods(methods);
-
+
List<Service> catalog = token.getCatalog();
Assert.assertNotNull(catalog);
Assert.assertEquals(2, catalog.size());
token.setCatalog(catalog);
-
+
Domain domain = token.getDomain();
Assert.assertNotNull(domain);
token.setDomain(domain);
-
+
List<Role> roles = token.getRoles();
Assert.assertNotNull(roles);
Assert.assertEquals(2, roles.size());
token.setRoles(roles);
-
+
Project project = token.getProject();
Assert.assertNotNull(project);
token.setProject(project);
-
+
Calendar issuedAt = token.getIssuedAt();
Assert.assertNotNull(issuedAt);
token.setIssuedAt(issuedAt);
-
+
String id = token.getId();
Assert.assertNotNull(id);
token.setId(id);
-
+
User user = token.getUser();
Assert.assertNotNull(user);
token.setUser(user);
-
+
Calendar expiresAt = token.getExpiresAt();
Assert.assertNotNull(expiresAt);
token.setExpiresAt(expiresAt);
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"user\" : {" + EOL
- + " \"id\" : \"id\"," + EOL
- + " \"name\" : \"name\"," + EOL
- + " \"password\" : \"password\"," + EOL
- + " \"email\" : \"email\"," + EOL
- + " \"description\" : \"description\"," + EOL
- + " \"enabled\" : false," + EOL
- + " \"domain_id\" : \"domainid\"," + EOL
- + " \"default_project_id\" : \"defaultprojectid\"" + EOL
- + " }" + EOL
- + "}";
-
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(SerializationFeature.WRAP_ROOT_VALUE)
- .enable(DeserializationFeature.UNWRAP_ROOT_VALUE)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private static final String JSON_FULL = "{" + EOL + " \"user\" : {" + EOL + " \"id\" : \"id\"," + EOL
+ + " \"name\" : \"name\"," + EOL + " \"password\" : \"password\"," + EOL + " \"email\" : \"email\","
+ + EOL + " \"description\" : \"description\"," + EOL + " \"enabled\" : false," + EOL
+ + " \"domain_id\" : \"domainid\"," + EOL + " \"default_project_id\" : \"defaultprojectid\"" + EOL
+ + " }" + EOL + "}";
+
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE)
+ .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
User user = objectMapper.readValue(JSON_FULL, User.class);
user.toString();
-
+
String password = user.getPassword();
Assert.assertNotNull(password);
user.setPassword(password);
-
+
String name = user.getName();
Assert.assertNotNull(name);
user.setName(name);
-
+
String description = user.getDescription();
Assert.assertNotNull(description);
user.setDescription(description);
-
+
String id = user.getId();
Assert.assertNotNull(id);
user.setId(id);
-
+
String email = user.getEmail();
Assert.assertNotNull(email);
user.setEmail(email);
-
+
String domainId = user.getDomainId();
Assert.assertNotNull(domainId);
user.setDomainId(domainId);
-
+
Boolean enabled = user.getEnabled();
Assert.assertNotNull(enabled);
user.setEnabled(enabled);
-
+
String defaultProjectId = user.getDefaultProjectId();
Assert.assertNotNull(defaultProjectId);
user.setDefaultProjectId(defaultProjectId);
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.woorea.openstack.keystone.model.User;
-
import java.util.List;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"users\" : [ {" + EOL
- + " \"id\" : \"id\"," + EOL
- + " \"username\" : \"username\"," + EOL
- + " \"password\" : \"password\"," + EOL
- + " \"tenantId\" : \"tenantid\"," + EOL
- + " \"name\" : \"name\"," + EOL
- + " \"email\" : \"email\"," + EOL
- + " \"enabled\" : false" + EOL
- + " }, {" + EOL
- + " \"id\" : \"id\"," + EOL
- + " \"username\" : \"username\"," + EOL
- + " \"password\" : \"password\"," + EOL
- + " \"tenantId\" : \"tenantid\"," + EOL
- + " \"name\" : \"name\"," + EOL
- + " \"email\" : \"email\"," + EOL
- + " \"enabled\" : false" + EOL
- + " } ]" + EOL
- + "}";
+ private static final String JSON_FULL = "{" + EOL + " \"users\" : [ {" + EOL + " \"id\" : \"id\"," + EOL
+ + " \"username\" : \"username\"," + EOL + " \"password\" : \"password\"," + EOL
+ + " \"tenantId\" : \"tenantid\"," + EOL + " \"name\" : \"name\"," + EOL + " \"email\" : \"email\","
+ + EOL + " \"enabled\" : false" + EOL + " }, {" + EOL + " \"id\" : \"id\"," + EOL
+ + " \"username\" : \"username\"," + EOL + " \"password\" : \"password\"," + EOL
+ + " \"tenantId\" : \"tenantid\"," + EOL + " \"name\" : \"name\"," + EOL + " \"email\" : \"email\","
+ + EOL + " \"enabled\" : false" + EOL + " } ]" + EOL + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
Users users = objectMapper.readValue(JSON_FULL, Users.class);
users.toString();
-
+
List<User> list = users.getList();
Assert.assertNotNull(list);
Assert.assertEquals(2, list.size());
-
+
int cnt = 0;
- for (@SuppressWarnings("unused") User x : users) {
+ for (@SuppressWarnings("unused")
+ User x : users) {
++cnt;
}
Assert.assertEquals(2, cnt);
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.onap.so.libs</groupId>
- <artifactId>openstack-java-sdk</artifactId>
- <version>1.4.0-SNAPSHOT</version>
- </parent>
- <groupId>org.onap.so.libs.openstack-java-sdk</groupId>
- <artifactId>nova-client</artifactId>
- <name>OpenStack Nova Client</name>
- <description>OpenStack Nova Client</description>
- <dependencies>
- <dependency>
- <groupId>org.onap.so.libs.openstack-java-sdk</groupId>
- <artifactId>openstack-client</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.onap.so.libs.openstack-java-sdk</groupId>
- <artifactId>nova-model</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.jmockit</groupId>
- <artifactId>jmockit</artifactId>
- <version>1.19</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.onap.so.libs.openstack-java-sdk</groupId>
- <artifactId>openstack-client</artifactId>
- <type>test-jar</type>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.mockito</groupId>
- <artifactId>mockito-all</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.powermock</groupId>
- <artifactId>powermock-module-junit4</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.onap.so.libs</groupId>
+ <artifactId>openstack-java-sdk</artifactId>
+ <version>1.4.0-SNAPSHOT</version>
+ </parent>
+ <groupId>org.onap.so.libs.openstack-java-sdk</groupId>
+ <artifactId>nova-client</artifactId>
+ <name>OpenStack Nova Client</name>
+ <description>OpenStack Nova Client</description>
+ <dependencies>
+ <dependency>
+ <groupId>org.onap.so.libs.openstack-java-sdk</groupId>
+ <artifactId>openstack-client</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.so.libs.openstack-java-sdk</groupId>
+ <artifactId>nova-model</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jmockit</groupId>
+ <artifactId>jmockit</artifactId>
+ <version>1.19</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.so.libs.openstack-java-sdk</groupId>
+ <artifactId>openstack-client</artifactId>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-all</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.powermock</groupId>
+ <artifactId>powermock-module-junit4</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
</project>
public class ShowMetadata extends OpenStackRequest<Metadata> {
public ShowMetadata(String id) {
- super(client, HttpMethod.GET, "/images/" + id + "/metadata", null,
- Metadata.class);
+ super(client, HttpMethod.GET, "/images/" + id + "/metadata", null, Metadata.class);
}
}
public ShowMetadata(String id) {
super(client, HttpMethod.GET, new StringBuilder(SERVERS).append(id).append("/metadata"), null,
- Metadata.class);
+ Metadata.class);
}
}
public CreateOrUpdateMetadata(String id, Metadata metadata) {
super(client, HttpMethod.POST, new StringBuilder(SERVERS).append(id).append("/metadata"),
- Entity.json(metadata), Metadata.class);
+ Entity.json(metadata), Metadata.class);
}
}
public ReplaceMetadata(String id, Metadata metadata) {
super(client, HttpMethod.PUT, new StringBuilder(SERVERS).append(id).append("/metadata"),
- Entity.json(metadata), Metadata.class);
+ Entity.json(metadata), Metadata.class);
}
}
public DeleteMetadata(String id, String key) {
super(client, HttpMethod.DELETE, new StringBuilder(SERVERS).append(id).append("/metadata/").append(key),
- null, Void.class);
+ null, Void.class);
}
}
public class ShowServerAddresses extends OpenStackRequest<Addresses> {
public ShowServerAddresses(String id) {
- super(client, HttpMethod.GET, new StringBuilder(SERVERS).append(id).append("/ips"), null,
- Addresses.class);
+ super(client, HttpMethod.GET, new StringBuilder(SERVERS).append(id).append("/ips"), null, Addresses.class);
}
}
public abstract class Action<T> extends OpenStackRequest<T> {
public Action(String id, Entity<?> entity, Class<T> returnType) {
- super(client, HttpMethod.POST, new StringBuilder(SERVERS).append(id).append(ACTION), entity,
- returnType);
+ super(client, HttpMethod.POST, new StringBuilder(SERVERS).append(id).append(ACTION), entity, returnType);
}
}
public StartServer(String id) {
super(client, HttpMethod.POST, new StringBuilder(SERVERS).append(id).append(ACTION),
- Entity.json(new Start()), Void.class);
+ Entity.json(new Start()), Void.class);
}
}
public StopServer(String id) {
super(client, HttpMethod.POST, new StringBuilder(SERVERS).append(id).append(ACTION),
- Entity.json(new Stop()), Void.class);
+ Entity.json(new Stop()), Void.class);
}
}
private String id;
public GetVncConsoleServer(String id, GetVncConsole action) {
- super(client, HttpMethod.POST, new StringBuilder(SERVERS).append(id).append(ACTION),
- Entity.json(action), VncConsole.class);
+ super(client, HttpMethod.POST, new StringBuilder(SERVERS).append(id).append(ACTION), Entity.json(action),
+ VncConsole.class);
}
}
public class GetConsoleOutputServer extends OpenStackRequest<ConsoleOutput> {
public GetConsoleOutputServer(String id, GetConsoleOutput action) {
- super(client, HttpMethod.POST, new StringBuilder(SERVERS).append(id).append(ACTION),
- Entity.json(action), ConsoleOutput.class);
+ super(client, HttpMethod.POST, new StringBuilder(SERVERS).append(id).append(ACTION), Entity.json(action),
+ ConsoleOutput.class);
}
}
public PauseServer(String id) {
super(client, HttpMethod.POST, new StringBuilder(SERVERS).append(id).append(ACTION),
- Entity.json(new Pause()), Void.class);
+ Entity.json(new Pause()), Void.class);
}
}
public UnpauseServer(String id) {
super(client, HttpMethod.POST, new StringBuilder(SERVERS).append(id).append(ACTION),
- Entity.json(new Unpause()), Void.class);
+ Entity.json(new Unpause()), Void.class);
}
}
public LockServer(String id) {
super(client, HttpMethod.POST, new StringBuilder(SERVERS).append(id).append(ACTION),
- Entity.json(new Lock()), Void.class);
+ Entity.json(new Lock()), Void.class);
}
}
public UnlockServer(String id) {
super(client, HttpMethod.POST, new StringBuilder(SERVERS).append(id).append(ACTION),
- Entity.json(new Unlock()), Void.class);
+ Entity.json(new Unlock()), Void.class);
}
}
public SuspendServer(String id) {
super(client, HttpMethod.POST, new StringBuilder(SERVERS).append(id).append(ACTION),
- Entity.json(new Suspend()), Void.class);
+ Entity.json(new Suspend()), Void.class);
}
}
public ResumeServer(String id) {
super(client, HttpMethod.POST, new StringBuilder(SERVERS).append(id).append(ACTION),
- Entity.json(new Resume()), Void.class);
+ Entity.json(new Resume()), Void.class);
}
}
public class CreateBackupServer extends OpenStackRequest<Void> {
public CreateBackupServer(String id, CreateBackup action) {
- super(client, HttpMethod.POST, new StringBuilder(SERVERS).append(id).append(ACTION),
- Entity.json(action), Void.class);
+ super(client, HttpMethod.POST, new StringBuilder(SERVERS).append(id).append(ACTION), Entity.json(action),
+ Void.class);
}
}
public class RescueServer extends OpenStackRequest<Void> {
public RescueServer(String id, Rescue action) {
- super(client, HttpMethod.POST, new StringBuilder(SERVERS).append(id).append(ACTION),
- Entity.json(action), Void.class);
+ super(client, HttpMethod.POST, new StringBuilder(SERVERS).append(id).append(ACTION), Entity.json(action),
+ Void.class);
}
}
public UnrescueServer(String id) {
super(client, HttpMethod.POST, new StringBuilder(SERVERS).append(id).append(ACTION),
- Entity.json(new Unrescue()), Void.class);
+ Entity.json(new Unrescue()), Void.class);
}
}
public class AssociateFloatingIp extends OpenStackRequest<Void> {
public AssociateFloatingIp(String id, com.woorea.openstack.nova.model.ServerAction.AssociateFloatingIp action) {
- super(client, HttpMethod.POST, new StringBuilder(SERVERS).append(id).append(ACTION),
- Entity.json(action), Void.class);
+ super(client, HttpMethod.POST, new StringBuilder(SERVERS).append(id).append(ACTION), Entity.json(action),
+ Void.class);
}
}
public class DisassociateFloatingIp extends OpenStackRequest<Void> {
public DisassociateFloatingIp(String id,
- com.woorea.openstack.nova.model.ServerAction.DisassociateFloatingIp action) {
- super(client, HttpMethod.POST, new StringBuilder(SERVERS).append(id).append(ACTION),
- Entity.json(action), Void.class);
+ com.woorea.openstack.nova.model.ServerAction.DisassociateFloatingIp action) {
+ super(client, HttpMethod.POST, new StringBuilder(SERVERS).append(id).append(ACTION), Entity.json(action),
+ Void.class);
}
}
public AssociateFloatingIp associateFloatingIp(String serverId, String floatingIpAddress) {
- com.woorea.openstack.nova.model.ServerAction.AssociateFloatingIp action = new com.woorea.openstack.nova.model.ServerAction.AssociateFloatingIp(
- floatingIpAddress);
+ com.woorea.openstack.nova.model.ServerAction.AssociateFloatingIp action =
+ new com.woorea.openstack.nova.model.ServerAction.AssociateFloatingIp(floatingIpAddress);
return new AssociateFloatingIp(serverId, action);
}
public DisassociateFloatingIp disassociateFloatingIp(String serverId, String floatingIpAddress) {
- com.woorea.openstack.nova.model.ServerAction.DisassociateFloatingIp action = new com.woorea.openstack.nova.model.ServerAction.DisassociateFloatingIp(
- floatingIpAddress);
+ com.woorea.openstack.nova.model.ServerAction.DisassociateFloatingIp action =
+ new com.woorea.openstack.nova.model.ServerAction.DisassociateFloatingIp(floatingIpAddress);
return new DisassociateFloatingIp(serverId, action);
}
public class AttachVolume extends OpenStackRequest<Void> {
public AttachVolume(String serverId, final VolumeAttachment volumeAttachment) {
- super(client, HttpMethod.POST,
- new StringBuilder(SERVERS).append(serverId).append("/os-volume_attachments"),
- Entity.json(volumeAttachment), Void.class);
+ super(client, HttpMethod.POST, new StringBuilder(SERVERS).append(serverId).append("/os-volume_attachments"),
+ Entity.json(volumeAttachment), Void.class);
}
}
public DetachVolume(String serverId, String volumeId) {
super(client, HttpMethod.DELETE,
- new StringBuilder(SERVERS).append(serverId).append("/os-volume_attachments/").append(volumeId),
- null, Void.class);
+ new StringBuilder(SERVERS).append(serverId).append("/os-volume_attachments/").append(volumeId),
+ null, Void.class);
}
}
public class ListVolumeAttachments extends OpenStackRequest<VolumeAttachments> {
public ListVolumeAttachments(String serverId) {
- super(client, HttpMethod.GET,
- new StringBuilder(SERVERS).append(serverId).append("/os-volume_attachments"), null,
- VolumeAttachments.class);
+ super(client, HttpMethod.GET, new StringBuilder(SERVERS).append(serverId).append("/os-volume_attachments"),
+ null, VolumeAttachments.class);
}
}
public class ShowVolumeAttachment extends OpenStackRequest<VolumeAttachment> {
public ShowVolumeAttachment(String serverId, String volumeAttachmentId) {
- super(client, HttpMethod.GET,
- new StringBuilder(SERVERS).append(serverId).append("/os-volume_attachments/")
+ super(client, HttpMethod.GET, new StringBuilder(SERVERS).append(serverId).append("/os-volume_attachments/")
.append(volumeAttachmentId), null, VolumeAttachment.class);
}
}
return new ShowAggregate(id);
}
- public UpdateAggregateMetadata updateAggregateMetadata(String id,
- String name, String availabilityZone) {
+ public UpdateAggregateMetadata updateAggregateMetadata(String id, String name, String availabilityZone) {
return new UpdateAggregateMetadata(id, name, availabilityZone);
}
- public CreateAggregate createAggregate(String aggregateName,
- String availabilityZoneName) {
+ public CreateAggregate createAggregate(String aggregateName, String availabilityZoneName) {
return new CreateAggregate(aggregateName, availabilityZoneName);
}
return new RemoveHost(hostId, aggregateId);
}
- public SetMetadata setMetadata(String aggregateId,
- String key, String value) {
+ public SetMetadata setMetadata(String aggregateId, String key, String value) {
return new SetMetadata(aggregateId, key, value);
}
public class List extends OpenStackRequest<HostAggregates> {
public List() {
- super(CLIENT, HttpMethod.GET, "/os-aggregates",
- null,
- HostAggregates.class);
+ super(CLIENT, HttpMethod.GET, "/os-aggregates", null, HostAggregates.class);
}
}
public class ShowAggregate extends OpenStackRequest<HostAggregate> {
public ShowAggregate(String id) {
- super(CLIENT, HttpMethod.GET,
- new StringBuffer("/os-aggregates/").append(id),
- null,
- HostAggregate.class);
+ super(CLIENT, HttpMethod.GET, new StringBuffer("/os-aggregates/").append(id), null, HostAggregate.class);
}
}
public class UpdateAggregateMetadata extends OpenStackRequest<HostAggregate> {
- public UpdateAggregateMetadata(String id,
- String name, String availabilityZone) {
- super(CLIENT, HttpMethod.PUT,
- new StringBuffer("/os-aggregates/").append(id),
- availabilityZone == null ?
- Entity.json("{\"aggregate\": {\"name\": \"" + name + "\" }}")
- :
- Entity.json("{\"aggregate\": {\"name\": \"" +
- name +
- "\", \"availability_zone\": \"" +
- availabilityZone +
- "\" }}"),
+ public UpdateAggregateMetadata(String id, String name, String availabilityZone) {
+ super(CLIENT, HttpMethod.PUT, new StringBuffer("/os-aggregates/").append(id),
+ availabilityZone == null ? Entity.json("{\"aggregate\": {\"name\": \"" + name + "\" }}")
+ : Entity.json("{\"aggregate\": {\"name\": \"" + name + "\", \"availability_zone\": \""
+ + availabilityZone + "\" }}"),
HostAggregate.class);
}
public class CreateAggregate extends OpenStackRequest<HostAggregate> {
public CreateAggregate(String name, String availabilityZone) {
- super(CLIENT, HttpMethod.POST,
- new StringBuffer("/os-aggregates"),
- availabilityZone == null ?
- Entity.json("{\"aggregate\": {\"name\": \"" +
- name +
- "\", \"availability_zone\": null }}")
- :
- Entity.json("{\"aggregate\": {\"name\": \"" +
- name +
- "\", \"availability_zone\": \"" +
- availabilityZone +
- "\" }}"),
+ super(CLIENT, HttpMethod.POST, new StringBuffer("/os-aggregates"),
+ availabilityZone == null
+ ? Entity.json("{\"aggregate\": {\"name\": \"" + name + "\", \"availability_zone\": null }}")
+ : Entity.json("{\"aggregate\": {\"name\": \"" + name + "\", \"availability_zone\": \""
+ + availabilityZone + "\" }}"),
HostAggregate.class);
}
public class DeleteAggregate extends OpenStackRequest<Void> {
public DeleteAggregate(String id) {
- super(CLIENT, HttpMethod.DELETE,
- new StringBuffer("/os-aggregates/").append(id),
- null,
- null);
+ super(CLIENT, HttpMethod.DELETE, new StringBuffer("/os-aggregates/").append(id), null, null);
}
}
public class AddHost extends OpenStackRequest<HostAggregate> {
public AddHost(String aggregateId, String hostId) {
- super(CLIENT, HttpMethod.POST,
- new StringBuffer("/os-aggregates/")
- .append(aggregateId).append("/action"),
- Entity.json("{\"add_host\": {\"host\": \"" +
- hostId + "\" }}"),
- HostAggregate.class);
+ super(CLIENT, HttpMethod.POST, new StringBuffer("/os-aggregates/").append(aggregateId).append("/action"),
+ Entity.json("{\"add_host\": {\"host\": \"" + hostId + "\" }}"), HostAggregate.class);
}
}
public class RemoveHost extends OpenStackRequest<HostAggregate> {
public RemoveHost(String hostId, String aggregateId) {
- super(CLIENT, HttpMethod.POST,
- new StringBuffer("/os-aggregates/")
- .append(aggregateId).append("/action"),
- Entity.json("{\"remove_host\": {\"host\": \"" +
- hostId + "\" }}"),
- HostAggregate.class);
+ super(CLIENT, HttpMethod.POST, new StringBuffer("/os-aggregates/").append(aggregateId).append("/action"),
+ Entity.json("{\"remove_host\": {\"host\": \"" + hostId + "\" }}"), HostAggregate.class);
}
}
public class SetMetadata extends OpenStackRequest<HostAggregate> {
public SetMetadata(String aggregateId, String key, String value) {
- super(CLIENT, HttpMethod.POST,
- new StringBuffer("/os-aggregates/")
- .append(aggregateId).append("/action"),
- Entity.json("{\"set_metadata\": {\"metadata\": { \"" +
- key + "\": \"" + value + "\" }}}"),
+ super(CLIENT, HttpMethod.POST, new StringBuffer("/os-aggregates/").append(aggregateId).append("/action"),
+ Entity.json("{\"set_metadata\": {\"metadata\": { \"" + key + "\": \"" + value + "\" }}}"),
HostAggregate.class);
}
}
-}
\ No newline at end of file
+}
import com.woorea.openstack.nova.model.Certificate;
public class CredentialsExtension {
-
+
private final OpenStackClient CLIENT;
-
+
public CredentialsExtension(OpenStackClient client) {
CLIENT = client;
}
-
+
public Create createCertificate(String id) {
return new Create(id);
}
public class Create extends OpenStackRequest<Certificate> {
public Create(String id) {
- super(CLIENT, HttpMethod.GET, new StringBuffer("/os-certificates").append(id).toString(), null, Certificate.class);
+ super(CLIENT, HttpMethod.GET, new StringBuffer("/os-certificates").append(id).toString(), null,
+ Certificate.class);
}
}
}
-
+
}
public CreateDomain(FloatingIpDomain floatingIpDomain) {
- super(CLIENT, HttpMethod.POST, "/os-floating-ip-dns", Entity.json(floatingIpDomain), FloatingIpDomain.class);
+ super(CLIENT, HttpMethod.POST, "/os-floating-ip-dns", Entity.json(floatingIpDomain),
+ FloatingIpDomain.class);
}
public class ShowDomain extends OpenStackRequest<FloatingIpDomain> {
public ShowDomain(String id) {
- super(CLIENT, HttpMethod.GET, new StringBuffer("/os-floating-ip-dns/").append(id).toString(), null, FloatingIpDomain.class);
+ super(CLIENT, HttpMethod.GET, new StringBuffer("/os-floating-ip-dns/").append(id).toString(), null,
+ FloatingIpDomain.class);
}
}
public class DeleteDomain extends OpenStackRequest<Void> {
public DeleteDomain(String id) {
- super(CLIENT, HttpMethod.DELETE, new StringBuffer("/os-floating-ip-dns/").append(id).toString(), null, Void.class);
+ super(CLIENT, HttpMethod.DELETE, new StringBuffer("/os-floating-ip-dns/").append(id).toString(), null,
+ Void.class);
}
}
-}
\ No newline at end of file
+}
-}
\ No newline at end of file
+}
import java.util.HashMap;
import java.util.Map;
-
-
import com.woorea.openstack.base.client.Entity;
import com.woorea.openstack.base.client.HttpMethod;
import com.woorea.openstack.base.client.OpenStackClient;
public class Deallocate extends OpenStackRequest<Void> {
public Deallocate(String id) {
- super(CLIENT, HttpMethod.DELETE, new StringBuffer("/os-floating-ips/").append(id).toString(), null, Void.class);
+ super(CLIENT, HttpMethod.DELETE, new StringBuffer("/os-floating-ips/").append(id).toString(), null,
+ Void.class);
}
}
}
public Allocate allocate(String pool) {
- Entity<?> entity=null;
- if(pool!=null) {
+ Entity<?> entity = null;
+ if (pool != null) {
Map<String, String> body = new HashMap<>();
body.put("pool", pool);
- entity=Entity.json(body);
+ entity = Entity.json(body);
}
return new Allocate(entity);
}
-}
\ No newline at end of file
+}
public interface HypervisorsExtension {
-}
\ No newline at end of file
+}
public Delete(String name) {
- super(CLIENT, HttpMethod.DELETE, new StringBuilder("/os-keypairs/").append(name).toString(), null, Void.class);
+ super(CLIENT, HttpMethod.DELETE, new StringBuilder("/os-keypairs/").append(name).toString(), null,
+ Void.class);
}
}
}
-}
\ No newline at end of file
+}
public class Show extends OpenStackRequest<Network> {
public Show(String id) {
- super(CLIENT, HttpMethod.GET, new StringBuilder("/os-networks/").append(id).toString(), null, Network.class);
+ super(CLIENT, HttpMethod.GET, new StringBuilder("/os-networks/").append(id).toString(), null,
+ Network.class);
}
}
public class Disassociate extends OpenStackRequest<Void> {
public Disassociate(String id) {
- super(CLIENT, HttpMethod.POST, new StringBuilder("/os-networks/").append(id).toString(), Entity.json("{\"action\":\"disassociate\"}"), Void.class);
- ;
+ super(CLIENT, HttpMethod.POST, new StringBuilder("/os-networks/").append(id).toString(),
+ Entity.json("{\"action\":\"disassociate\"}"), Void.class);;
}
}
public class Delete extends OpenStackRequest<Void> {
public Delete(String id) {
- super(CLIENT, HttpMethod.DELETE, new StringBuilder("/os-networks/").append(id).toString(), null, Void.class);
+ super(CLIENT, HttpMethod.DELETE, new StringBuilder("/os-networks/").append(id).toString(), null,
+ Void.class);
}
}
-}
\ No newline at end of file
+}
private SecurityGroupForCreate securityGroupForCreate;
public Create(SecurityGroupForCreate securityGroupForCreate) {
- super(CLIENT, HttpMethod.POST, "/os-security-groups", Entity.json(securityGroupForCreate), SecurityGroup.class);
+ super(CLIENT, HttpMethod.POST, "/os-security-groups", Entity.json(securityGroupForCreate),
+ SecurityGroup.class);
this.securityGroupForCreate = securityGroupForCreate;
}
*/
@Deprecated
public Show(Integer id) {
- super(CLIENT, HttpMethod.GET, new StringBuilder("/os-security-groups/").append(id).toString(), null, SecurityGroup.class);
+ super(CLIENT, HttpMethod.GET, new StringBuilder("/os-security-groups/").append(id).toString(), null,
+ SecurityGroup.class);
}
+
public Show(String id) {
- super(CLIENT, HttpMethod.GET, new StringBuilder("/os-security-groups/").append(id).toString(), null, SecurityGroup.class);
+ super(CLIENT, HttpMethod.GET, new StringBuilder("/os-security-groups/").append(id).toString(), null,
+ SecurityGroup.class);
}
}
*/
@Deprecated
public Delete(Integer id) {
- super(CLIENT, HttpMethod.DELETE, new StringBuilder("/os-security-groups/").append(String.valueOf(id)).toString(), null, Void.class);
+ super(CLIENT, HttpMethod.DELETE,
+ new StringBuilder("/os-security-groups/").append(String.valueOf(id)).toString(), null, Void.class);
}
+
public Delete(String id) {
- super(CLIENT, HttpMethod.DELETE, new StringBuilder("/os-security-groups/").append(id).toString(), null, Void.class);
+ super(CLIENT, HttpMethod.DELETE, new StringBuilder("/os-security-groups/").append(id).toString(), null,
+ Void.class);
}
}
private SecurityGroupRuleForCreate securityGroupRuleForCreate;
public CreateRule(SecurityGroupRuleForCreate securityGroupRuleForCreate) {
- super(CLIENT, HttpMethod.POST, "/os-security-group-rules", Entity.json(securityGroupRuleForCreate), SecurityGroup.Rule.class);
+ super(CLIENT, HttpMethod.POST, "/os-security-group-rules", Entity.json(securityGroupRuleForCreate),
+ SecurityGroup.Rule.class);
this.securityGroupRuleForCreate = securityGroupRuleForCreate;
}
}
*/
@Deprecated
public DeleteRule(Integer id) {
- super(CLIENT, HttpMethod.DELETE, new StringBuilder("/os-security-group-rules/").append(String.valueOf(id)).toString(), null, Void.class);
+ super(CLIENT, HttpMethod.DELETE,
+ new StringBuilder("/os-security-group-rules/").append(String.valueOf(id)).toString(), null,
+ Void.class);
}
public DeleteRule(String id) {
- super(CLIENT, HttpMethod.DELETE, new StringBuilder("/os-security-group-rules/").append(String.valueOf(id)).toString(), null, Void.class);
+ super(CLIENT, HttpMethod.DELETE,
+ new StringBuilder("/os-security-group-rules/").append(String.valueOf(id)).toString(), null,
+ Void.class);
}
}
return new List();
}
- public Create createSecurityGroup(String name,
- String description) {
+ public Create createSecurityGroup(String name, String description) {
return new Create(new SecurityGroupForCreate(name, description));
}
public Show showSecurityGroup(String id) {
return new Show(id);
}
+
public Delete deleteSecurityGroup(Integer id) {
return new Delete(String.valueOf(id));
}
* @deprecated Use {@link #createSecurityGroupRule(String, String, Integer, Integer, String)}
*/
@Deprecated
- public CreateRule createSecurityGroupRule(
- Integer parentSecurityGroupId, String ipProtocol, Integer fromPort,
+ public CreateRule createSecurityGroupRule(Integer parentSecurityGroupId, String ipProtocol, Integer fromPort,
Integer toPort, String cidr) {
- SecurityGroupRuleForCreate securityGroupRuleForCreate = new SecurityGroupRuleForCreate(
- parentSecurityGroupId, ipProtocol, fromPort, toPort, cidr);
+ SecurityGroupRuleForCreate securityGroupRuleForCreate =
+ new SecurityGroupRuleForCreate(parentSecurityGroupId, ipProtocol, fromPort, toPort, cidr);
return new CreateRule(securityGroupRuleForCreate);
}
+
/**
*
* @param parentSecurityGroupId
* @deprecated Use {@link #createSecurityGroupRule(String, String, String, Integer, Integer)}
*/
@Deprecated
- public CreateRule createSecurityGroupRule(
- Integer parentSecurityGroupId, String ipProtocol, Integer fromPort,
+ public CreateRule createSecurityGroupRule(Integer parentSecurityGroupId, String ipProtocol, Integer fromPort,
Integer toPort, Integer sourceGroupId) {
- SecurityGroupRuleForCreate securityGroupRuleForCreate = new SecurityGroupRuleForCreate(
- parentSecurityGroupId, ipProtocol, fromPort, toPort,
- sourceGroupId);
+ SecurityGroupRuleForCreate securityGroupRuleForCreate =
+ new SecurityGroupRuleForCreate(parentSecurityGroupId, ipProtocol, fromPort, toPort, sourceGroupId);
return new CreateRule(securityGroupRuleForCreate);
}
- public CreateRule createSecurityGroupRule(
- String parentSecurityGroupId, String ipProtocol, Integer fromPort,
+ public CreateRule createSecurityGroupRule(String parentSecurityGroupId, String ipProtocol, Integer fromPort,
Integer toPort, String cidr) {
- SecurityGroupRuleForCreate securityGroupRuleForCreate = new SecurityGroupRuleForCreate(
- parentSecurityGroupId, ipProtocol, fromPort, toPort, cidr);
+ SecurityGroupRuleForCreate securityGroupRuleForCreate =
+ new SecurityGroupRuleForCreate(parentSecurityGroupId, ipProtocol, fromPort, toPort, cidr);
return new CreateRule(securityGroupRuleForCreate);
}
- public CreateRule createSecurityGroupRule(
- String parentSecurityGroupId,String sourceGroupId,String ipProtocol, Integer fromPort,
- Integer toPort) {
- SecurityGroupRuleForCreate securityGroupRuleForCreate = new SecurityGroupRuleForCreate(
- parentSecurityGroupId, sourceGroupId,ipProtocol, fromPort, toPort
- );
+ public CreateRule createSecurityGroupRule(String parentSecurityGroupId, String sourceGroupId, String ipProtocol,
+ Integer fromPort, Integer toPort) {
+ SecurityGroupRuleForCreate securityGroupRuleForCreate =
+ new SecurityGroupRuleForCreate(parentSecurityGroupId, sourceGroupId, ipProtocol, fromPort, toPort);
return new CreateRule(securityGroupRuleForCreate);
}
+
public DeleteRule deleteSecurityGroupRule(String id) {
return new DeleteRule(id);
}
+
public DeleteRule deleteSecurityGroupRule(Integer id) {
return new DeleteRule(String.valueOf(id));
}
-}
\ No newline at end of file
+}
public class Show extends OpenStackRequest<Snapshot> {
public Show(String id) {
- super(CLIENT, HttpMethod.GET, new StringBuilder("/os-snapshots/").append(id).toString(), null, Snapshot.class);
+ super(CLIENT, HttpMethod.GET, new StringBuilder("/os-snapshots/").append(id).toString(), null,
+ Snapshot.class);
}
}
public class ShowMetadata extends OpenStackRequest<Metadata> {
public ShowMetadata(String id) {
- super(CLIENT, HttpMethod.GET, new StringBuilder("/os-snapshots/").append(id).append("/metadata").toString(), null, Metadata.class);
+ super(CLIENT, HttpMethod.GET, new StringBuilder("/os-snapshots/").append(id).append("/metadata").toString(),
+ null, Metadata.class);
}
}
public class Delete extends OpenStackRequest<Void> {
public Delete(String id) {
- super(CLIENT, HttpMethod.DELETE, new StringBuilder("/os-snapshots/").append(id).toString(), null, Void.class);
+ super(CLIENT, HttpMethod.DELETE, new StringBuilder("/os-snapshots/").append(id).toString(), null,
+ Void.class);
}
}
public class List extends OpenStackRequest<Volumes> {
public List(boolean detail) {
- super(CLIENT, HttpMethod.GET, detail ? "/os-volumes/detail"
- : "/os-volumes", null, Volumes.class);
+ super(CLIENT, HttpMethod.GET, detail ? "/os-volumes/detail" : "/os-volumes", null, Volumes.class);
}
}
public Create(VolumeForCreate volume) {
- super(CLIENT, HttpMethod.POST, "/os-volumes", Entity.json(volume),
- Volume.class);
+ super(CLIENT, HttpMethod.POST, "/os-volumes", Entity.json(volume), Volume.class);
}
public class UploadToImage extends OpenStackRequest<Void> {
public UploadToImage(VolumeForImageCreate volumeForImageCreate) {
- super(CLIENT, HttpMethod.POST, new StringBuilder("/volumes/")
- .append(volumeForImageCreate.getVolumeId() + "/action"),
+ super(CLIENT, HttpMethod.POST,
+ new StringBuilder("/volumes/").append(volumeForImageCreate.getVolumeId() + "/action"),
Entity.json(volumeForImageCreate), Void.class);
}
public class Show extends OpenStackRequest<Volume> {
public Show(String id) {
- super(CLIENT, HttpMethod.GET, new StringBuilder("/os-volumes/")
- .append(id).toString(), null, Volume.class);
+ super(CLIENT, HttpMethod.GET, new StringBuilder("/os-volumes/").append(id).toString(), null, Volume.class);
}
}
public class ShowMetadata extends OpenStackRequest<Metadata> {
public ShowMetadata(String id) {
- super(CLIENT, HttpMethod.GET, new StringBuilder("/os-volumes/")
- .append(id).append("/metadata").toString(), null,
- Metadata.class);
+ super(CLIENT, HttpMethod.GET, new StringBuilder("/os-volumes/").append(id).append("/metadata").toString(),
+ null, Metadata.class);
}
}
public class Delete extends OpenStackRequest<Void> {
public Delete(String id) {
- super(CLIENT, HttpMethod.DELETE, new StringBuilder("/os-volumes/")
- .append(id).toString(), null, Void.class);
+ super(CLIENT, HttpMethod.DELETE, new StringBuilder("/os-volumes/").append(id).toString(), null, Void.class);
}
}
-}
\ No newline at end of file
+}
-/*-\r
- * ONAP-SO\r
- * ============LICENSE_START=======================================================\r
- * Copyright 2018 Huawei Intellectual Property. All rights reserved.\r
- * =================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-package com.woorea.openstack.nova;\r
-\r
-\r
-\r
-import static org.junit.Assert.fail;\r
-\r
-import org.junit.Test;\r
-public class NovaTest {\r
-\r
- @Test\r
- public void test() {\r
- try\r
- {\r
- Nova nova = new Nova(null); \r
- }\r
- catch(Exception ex)\r
- {\r
- fail("Exception while creating Nova");\r
- }\r
- \r
- \r
- }\r
-\r
-}\r
+/*-
+ * ONAP-SO
+ * ============LICENSE_START=======================================================
+ * Copyright 2018 Huawei Intellectual Property. All rights reserved.
+ * =================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package com.woorea.openstack.nova;
+
+
+
+import static org.junit.Assert.fail;
+import org.junit.Test;
+
+public class NovaTest {
+
+ @Test
+ public void test() {
+ try {
+ Nova nova = new Nova(null);
+ } catch (Exception ex) {
+ fail("Exception while creating Nova");
+ }
+
+
+ }
+
+}
public class ShowMetadata extends OpenStackRequest<Metadata> {
public ShowMetadata(String id) {
- super(client, HttpMethod.GET, "/images/" + id + "/metadata", null,
- Metadata.class);
+ super(client, HttpMethod.GET, "/images/" + id + "/metadata", null, Metadata.class);
}
}
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mockito;
-
import java.util.Collections;
public class ServersResourceTest {
final Metadata expectedServer = Mockito.mock(Metadata.class);
OpenStackClientMockUtils.getInstance().mockRequestResponse(Metadata.class, expectedServer);
Metadata metadata = Mockito.mock(Metadata.class);
- final ServersResource.CreateOrUpdateMetadata metadataCreateUpdate = serversResource.createOrUpdateMetadata(SERVER_KEY, metadata);
+ final ServersResource.CreateOrUpdateMetadata metadataCreateUpdate =
+ serversResource.createOrUpdateMetadata(SERVER_KEY, metadata);
final Metadata actualServer = metadataCreateUpdate.execute();
Assert.assertEquals(expectedServer, actualServer);
}
final Metadata expectedServer = Mockito.mock(Metadata.class);
OpenStackClientMockUtils.getInstance().mockRequestResponse(Metadata.class, expectedServer);
Metadata metadata = Mockito.mock(Metadata.class);
- final ServersResource.ReplaceMetadata metadataCreateUpdate = serversResource.replaceMetadata(SERVER_KEY, metadata);
+ final ServersResource.ReplaceMetadata metadataCreateUpdate =
+ serversResource.replaceMetadata(SERVER_KEY, metadata);
final Metadata actualServer = metadataCreateUpdate.execute();
Assert.assertEquals(expectedServer, actualServer);
}
@Test
public void deleteMetadata() {
- final ServersResource.DeleteMetadata metadataCreateUpdate = serversResource.deleteMetadata(SERVER_NAME, SERVER_KEY);
+ final ServersResource.DeleteMetadata metadataCreateUpdate =
+ serversResource.deleteMetadata(SERVER_NAME, SERVER_KEY);
metadataCreateUpdate.execute();
}
public void update() {
final Server expectedServer = Mockito.mock(Server.class);
OpenStackClientMockUtils.getInstance().mockRequestResponse(Server.class, expectedServer);
- final ServersResource.UpdateServer metadataCreateUpdate = serversResource.update(SERVER_NAME, SERVER_KEY, I_PV_4, "");
+ final ServersResource.UpdateServer metadataCreateUpdate =
+ serversResource.update(SERVER_NAME, SERVER_KEY, I_PV_4, "");
final Server actualServer = metadataCreateUpdate.execute();
Assert.assertEquals(expectedServer, actualServer);
}
public void changePassword() {
final Server expectedServer = Mockito.mock(Server.class);
OpenStackClientMockUtils.getInstance().mockRequestResponse(Server.class, expectedServer);
- final ServersResource.ChangePasswordAction metadataCreateUpdate = serversResource.changePassword(SERVER_NAME, SERVER_NAME);
+ final ServersResource.ChangePasswordAction metadataCreateUpdate =
+ serversResource.changePassword(SERVER_NAME, SERVER_NAME);
final Server actualServer = metadataCreateUpdate.execute();
Assert.assertEquals(expectedServer, actualServer);
}
public void resize() {
final Server expectedServer = Mockito.mock(Server.class);
OpenStackClientMockUtils.getInstance().mockRequestResponse(Server.class, expectedServer);
- final ServersResource.ResizeAction metadataCreateUpdate = serversResource.resize(SERVER_NAME, SERVER_FLAVOR, DISK_CONFIG);
+ final ServersResource.ResizeAction metadataCreateUpdate =
+ serversResource.resize(SERVER_NAME, SERVER_FLAVOR, DISK_CONFIG);
final Server actualServer = metadataCreateUpdate.execute();
Assert.assertEquals(expectedServer, actualServer);
}
@Test
public void createImage() {
- final ServersResource.CreateImageAction metadataCreateUpdate = serversResource.createImage(SERVER_NAME, SERVER_KEY, Collections.<String, String>emptyMap());
+ final ServersResource.CreateImageAction metadataCreateUpdate =
+ serversResource.createImage(SERVER_NAME, SERVER_KEY, Collections.<String, String>emptyMap());
metadataCreateUpdate.execute();
}
public void getVncConsole() {
final ServerAction.VncConsole console = new ServerAction.VncConsole();
OpenStackClientMockUtils.getInstance().mockRequestResponse(ServerAction.VncConsole.class, console);
- final ServersResource.GetVncConsoleServer metadataCreateUpdate = serversResource.getVncConsole(SERVER_NAME, CONSOLE_TYPE);
+ final ServersResource.GetVncConsoleServer metadataCreateUpdate =
+ serversResource.getVncConsole(SERVER_NAME, CONSOLE_TYPE);
final ServerAction.VncConsole actualConsole = metadataCreateUpdate.execute();
Assert.assertEquals(console, actualConsole);
}
public void getConsoleOutput() {
final ServerAction.ConsoleOutput console = new ServerAction.ConsoleOutput();
OpenStackClientMockUtils.getInstance().mockRequestResponse(ServerAction.ConsoleOutput.class, console);
- final ServersResource.GetConsoleOutputServer metadataCreateUpdate = serversResource.getConsoleOutput(SERVER_NAME, Integer.MAX_VALUE);
+ final ServersResource.GetConsoleOutputServer metadataCreateUpdate =
+ serversResource.getConsoleOutput(SERVER_NAME, Integer.MAX_VALUE);
final ServerAction.ConsoleOutput actualConsole = metadataCreateUpdate.execute();
Assert.assertEquals(console, actualConsole);
}
@Test
public void createBackup() {
ServerAction.CreateBackup backup = new ServerAction.CreateBackup();
- final ServersResource.CreateBackupServer metadataCreateUpdate = serversResource.createBackup(SERVER_NAME, backup);
+ final ServersResource.CreateBackupServer metadataCreateUpdate =
+ serversResource.createBackup(SERVER_NAME, backup);
metadataCreateUpdate.execute();
}
@Test
public void rescue() {
final ServerAction.CreateBackup console = new ServerAction.CreateBackup();
- final ServersResource.CreateBackupServer metadataCreateUpdate = serversResource.createBackup(SERVER_NAME, console);
+ final ServersResource.CreateBackupServer metadataCreateUpdate =
+ serversResource.createBackup(SERVER_NAME, console);
metadataCreateUpdate.execute();
}
@Test
public void associateFloatingIp() {
- final ServersResource.AssociateFloatingIp metadataCreateUpdate = serversResource.associateFloatingIp(SERVER_NAME, I_PV_4);
+ final ServersResource.AssociateFloatingIp metadataCreateUpdate =
+ serversResource.associateFloatingIp(SERVER_NAME, I_PV_4);
metadataCreateUpdate.execute();
}
@Test
public void disassociateFloatingIp() {
- final ServersResource.DisassociateFloatingIp metadataCreateUpdate = serversResource.disassociateFloatingIp(SERVER_NAME, I_PV_4);
+ final ServersResource.DisassociateFloatingIp metadataCreateUpdate =
+ serversResource.disassociateFloatingIp(SERVER_NAME, I_PV_4);
metadataCreateUpdate.execute();
}
@Test
public void attachVolume() {
- final ServersResource.AttachVolume metadataCreateUpdate = serversResource.attachVolume(SERVER_NAME, "volume_id", "device");
+ final ServersResource.AttachVolume metadataCreateUpdate =
+ serversResource.attachVolume(SERVER_NAME, "volume_id", "device");
metadataCreateUpdate.execute();
}
@Test
public void detachVolume() {
- final ServersResource.DetachVolume metadataCreateUpdate = serversResource.detachVolume(SERVER_NAME, "volume_id");
+ final ServersResource.DetachVolume metadataCreateUpdate =
+ serversResource.detachVolume(SERVER_NAME, "volume_id");
metadataCreateUpdate.execute();
}
public void listVolumeAttachments() {
final VolumeAttachments volumeAttachments = new VolumeAttachments();
OpenStackClientMockUtils.getInstance().mockRequestResponse(VolumeAttachments.class, volumeAttachments);
- final ServersResource.ListVolumeAttachments metadataCreateUpdate = serversResource.listVolumeAttachments(SERVER_NAME);
+ final ServersResource.ListVolumeAttachments metadataCreateUpdate =
+ serversResource.listVolumeAttachments(SERVER_NAME);
final VolumeAttachments actualVolumeAttachments = metadataCreateUpdate.execute();
Assert.assertEquals(volumeAttachments, actualVolumeAttachments);
}
public void showVolumeAttachment() {
final VolumeAttachment volumeAttachment = new VolumeAttachment();
OpenStackClientMockUtils.getInstance().mockRequestResponse(VolumeAttachment.class, volumeAttachment);
- final ServersResource.ShowVolumeAttachment metadataCreateUpdate = serversResource.showVolumeAttachment(SERVER_NAME, "volume_id");
+ final ServersResource.ShowVolumeAttachment metadataCreateUpdate =
+ serversResource.showVolumeAttachment(SERVER_NAME, "volume_id");
final VolumeAttachment actualVolumeAttachment = metadataCreateUpdate.execute();
Assert.assertEquals(volumeAttachment, actualVolumeAttachment);
}
server.setUserData(SERVER_USER_DATA);
return server;
}
-}
\ No newline at end of file
+}
aggregatesExtension.setMetadata("test", "test", "test");
}
-}
\ No newline at end of file
+}
cloudpipesExtension.create(new Cloudpipe());
}
-}
\ No newline at end of file
+}
credentialsExtension.showCertificate("id");
}
-}
\ No newline at end of file
+}
floatingIpDnsExtension.delete("id");
}
-}
\ No newline at end of file
+}
floatingIpPoolsExtension.list();
}
-}
\ No newline at end of file
+}
floatingIpPoolsExtension.deallocate("test");
}
-}
\ No newline at end of file
+}
hostsExtension.show("test");
}
-}
\ No newline at end of file
+}
keyPairsExtension.delete("test");
}
-}
\ No newline at end of file
+}
networksExtension.disassociate("test");
}
-}
\ No newline at end of file
+}
@Test
public void createSecurityGroupRule2() throws Exception {
- securityGroupsExtension.createSecurityGroupRule(12,
- "test",
- 1,
- 1,
- "test");
+ securityGroupsExtension.createSecurityGroupRule(12, "test", 1, 1, "test");
}
@Test
public void createSecurityGroupRule3() throws Exception {
- securityGroupsExtension.createSecurityGroupRule(1,
- "test",
- 1,
- 1,
- 1);
+ securityGroupsExtension.createSecurityGroupRule(1, "test", 1, 1, 1);
}
@Test
securityGroupsExtension.deleteSecurityGroup(1);
}
-}
\ No newline at end of file
+}
snapshotsExtension.delete("test");
}
-}
\ No newline at end of file
+}
volumesExtension.delete("test");
}
-}
\ No newline at end of file
+}
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.onap.so.libs</groupId>
- <artifactId>openstack-java-sdk</artifactId>
- <version>1.4.0-SNAPSHOT</version>
- </parent>
- <groupId>org.onap.so.libs.openstack-java-sdk</groupId>
- <artifactId>nova-model</artifactId>
- <name>OpenStack Nova Model</name>
- <description>OpenStack Nova Model</description>
- <dependencies>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.skyscreamer</groupId>
- <artifactId>jsonassert</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.onap.so.libs</groupId>
+ <artifactId>openstack-java-sdk</artifactId>
+ <version>1.4.0-SNAPSHOT</version>
+ </parent>
+ <groupId>org.onap.so.libs.openstack-java-sdk</groupId>
+ <artifactId>nova-model</artifactId>
+ <name>OpenStack Nova Model</name>
+ <description>OpenStack Nova Model</description>
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.skyscreamer</groupId>
+ <artifactId>jsonassert</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
</project>
public class Certificate {
private String data;
-
+
@JsonProperty("private_key")
private String privateKey;
return privateKey;
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
return "Certificate [data=" + data + ", privateKey=" + privateKey + "]";
}
-
+
}
import java.io.Serializable;
import java.util.Calendar;
-
import com.fasterxml.jackson.annotation.JsonRootName;
@JsonRootName("cloudpipe")
public class Cloudpipe implements Serializable {
-
+
private String projectId;
-
+
private String internalIp;
-
+
private String publicIp;
-
+
private String publicPort;
-
+
private String state;
-
+
private String instanceId;
-
+
private Calendar createdAt;
/**
this.createdAt = createdAt;
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
- return "CloudPipe [projectId=" + projectId + ", internalIp="
- + internalIp + ", publicIp=" + publicIp + ", publicPort="
- + publicPort + ", state=" + state + ", instanceId="
- + instanceId + ", createdAt=" + createdAt + "]";
+ return "CloudPipe [projectId=" + projectId + ", internalIp=" + internalIp + ", publicIp=" + publicIp
+ + ", publicPort=" + publicPort + ", state=" + state + ", instanceId=" + instanceId + ", createdAt="
+ + createdAt + "]";
}
-
+
}
import java.io.Serializable;
import java.util.List;
-
import com.fasterxml.jackson.annotation.JsonProperty;
public class Cloudpipes implements Serializable {
public List<Cloudpipe> getList() {
return list;
}
-
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
return "Flavors [list=" + list + "]";
}
-
+
}
import java.io.Serializable;
import java.util.Calendar;
import java.util.List;
-
import com.fasterxml.jackson.annotation.JsonRootName;
@JsonRootName("extension")
public class Extension implements Serializable {
private String alias;
-
+
private String description;
-
+
private String name;
-
+
private String namespace;
-
+
private Calendar updated;
-
+
private List<Link> links;
/**
return links;
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
- return "Extension [alias=" + alias + ", description=" + description
- + ", name=" + name + ", namespace=" + namespace + "]";
+ return "Extension [alias=" + alias + ", description=" + description + ", name=" + name + ", namespace="
+ + namespace + "]";
}
-
+
}
import java.io.Serializable;
import java.util.Iterator;
import java.util.List;
-
import com.fasterxml.jackson.annotation.JsonProperty;
public class Extensions implements Iterable<Extension>, Serializable {
public List<Extension> getList() {
return list;
}
-
+
@Override
public Iterator<Extension> iterator() {
return list.iterator();
}
-
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see java.lang.Object#toString()
*/
@Override
import java.io.Serializable;
import java.util.List;
-
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonRootName;
@JsonRootName("flavor")
public class Flavor implements Serializable {
+ @JsonProperty("id")
private String id;
-
+
+ @JsonProperty("name")
private String name;
-
+
+ @JsonProperty("vcpus")
private Integer vcpus;
-
+
+ @JsonProperty("ram")
private Integer ram;
-
+
+ @JsonProperty("disk")
private Integer disk;
-
+
@JsonProperty("OS-FLV-EXT-DATA:ephemeral")
private Integer ephemeral;
-
+
+ @JsonProperty("swap")
private String swap;
-
+
@JsonProperty("rxtx_factor")
private Float rxtxFactor;
-
+
@JsonProperty("OS-FLV-DISABLED:disabled")
private Boolean disabled;
-
+
@JsonProperty("rxtx_quota")
private Integer rxtxQuota;
-
+
@JsonProperty("rxtx_cap")
private Integer rxtxCap;
-
+
private List<Link> links;
-
+
@JsonProperty("os-flavor-access:is_public")
private Boolean isPublic;
public void setDisabled(Boolean disabled) {
this.disabled = disabled;
}
-
+
/**
* @return the isPublic
*/
this.links = links;
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
- return "Flavor [id=" + id + ", name=" + name + ", vcpus=" + vcpus
- + ", ram=" + ram + ", disk=" + disk + ", ephemeral="
- + ephemeral + ", swap=" + swap + ", rxtxFactor=" + rxtxFactor
- + ", disabled=" + disabled + ", rxtxQuota=" + rxtxQuota
- + ", rxtxCap=" + rxtxCap + ", links=" + links + ", isPublic="
+ return "Flavor [id=" + id + ", name=" + name + ", vcpus=" + vcpus + ", ram=" + ram + ", disk=" + disk
+ + ", ephemeral=" + ephemeral + ", swap=" + swap + ", rxtxFactor=" + rxtxFactor + ", disabled="
+ + disabled + ", rxtxQuota=" + rxtxQuota + ", rxtxCap=" + rxtxCap + ", links=" + links + ", isPublic="
+ isPublic + "]";
}
-
+
}
@JsonRootName("flavor")
public class FlavorForCreate implements Serializable {
-
+
private String id;
-
+
private String name;
-
+
private String vcpus;
-
+
private Integer ram;
-
+
private String disk;
-
+
@JsonProperty("OS-FLV-EXT-DATA:ephemeral")
private Integer ephemeral;
-
+
private String swap;
-
+
@JsonProperty("rxtx_factor")
private Float rxtxFactor;
public void setRxtxFactor(Float rxtxFactor) {
this.rxtxFactor = rxtxFactor;
}
-
+
}
import java.io.Serializable;
import java.util.Iterator;
import java.util.List;
-
import com.fasterxml.jackson.annotation.JsonProperty;
+
public class Flavors implements Iterable<Flavor>, Serializable {
@JsonProperty("flavors")
private List<Flavor> list;
+ @JsonProperty("flavors_links")
+ private List<Link> links;
+
/**
* @return the list
*/
public List<Flavor> getList() {
return list;
}
-
+
@Override
public Iterator<Flavor> iterator() {
return list.iterator();
}
-
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see java.lang.Object#toString()
*/
@Override
package com.woorea.openstack.nova.model;
import java.io.Serializable;
-
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonRootName;
public class FloatingIp implements Serializable {
private String id;
-
+
private String pool;
-
+
private String ip;
-
+
@JsonProperty("fixed_ip")
private String fixedIp;
-
+
@JsonProperty("instance_id")
private String instanceId;
return instanceId;
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
- return "FloatingIp [id=" + id + ", pool=" + pool + ", ip=" + ip
- + ", fixedIp=" + fixedIp + ", instanceId=" + instanceId + "]";
+ return "FloatingIp [id=" + id + ", pool=" + pool + ", ip=" + ip + ", fixedIp=" + fixedIp + ", instanceId="
+ + instanceId + "]";
}
-
+
}
package com.woorea.openstack.nova.model;
import java.io.Serializable;
-
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonRootName;
public class FloatingIpDomain implements Serializable {
private String domain;
-
+
private String scope;
-
+
private String project;
-
+
@JsonProperty("availabilityZone")
private String availabilityZone;
return availabilityZone;
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
- return "FloatingIpDomain [domain=" + domain + ", scope=" + scope
- + ", project=" + project + ", availabilityZone="
- + availabilityZone + "]";
+ return "FloatingIpDomain [domain=" + domain + ", scope=" + scope + ", project=" + project
+ + ", availabilityZone=" + availabilityZone + "]";
}
-
+
}
import java.io.Serializable;
import java.util.Iterator;
import java.util.List;
-
import com.fasterxml.jackson.annotation.JsonProperty;
public class FloatingIpDomains implements Iterable<FloatingIpDomain>, Serializable {
return list.iterator();
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
return "FloatingIpDomains [list=" + list + "]";
}
-
+
}
import java.io.Serializable;
import java.util.Iterator;
import java.util.List;
-
import com.fasterxml.jackson.annotation.JsonProperty;
import com.woorea.openstack.nova.model.FloatingIpPools.FloatingIpPool;
public class FloatingIpPools implements Iterable<FloatingIpPool>, Serializable {
-
+
public static class FloatingIpPool implements Serializable {
private String name;
return name;
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
return "FloatingIpPool [name=" + name + "]";
}
-
+
}
@JsonProperty("floating_ip_pools")
public List<FloatingIpPool> getList() {
return list;
}
-
+
@Override
public Iterator<FloatingIpPool> iterator() {
return list.iterator();
}
-
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see java.lang.Object#toString()
*/
@Override
import java.io.Serializable;
import java.util.Iterator;
import java.util.List;
-
import com.fasterxml.jackson.annotation.JsonProperty;
public class FloatingIps implements Iterable<FloatingIp>, Serializable {
public List<FloatingIp> getList() {
return list;
}
-
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see java.lang.Object#toString()
*/
@Override
public Iterator<FloatingIp> iterator() {
return list.iterator();
}
-
+
}
import java.io.Serializable;
import java.util.List;
-
import com.fasterxml.jackson.annotation.JsonProperty;
public class Host implements Serializable {
-
+
public static final class ResourceWrapper implements Serializable {
-
+
public static final class Resource implements Serializable {
-
+
private String project;
-
+
@JsonProperty("memory_mb")
private Integer memoryMb;
-
+
private String host;
-
+
private Integer cpu;
-
+
@JsonProperty("disk_gb")
private Integer diskGb;
return diskGb;
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
- return "Resource [project=" + project + ", memoryMb="
- + memoryMb + ", host=" + host + ", cpu=" + cpu
+ return "Resource [project=" + project + ", memoryMb=" + memoryMb + ", host=" + host + ", cpu=" + cpu
+ ", diskGb=" + diskGb + "]";
}
-
+
}
-
+
private Resource resource;
/**
return resource;
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
return "ResourceWrapper [resource=" + resource + "]";
}
-
+
}
private List<ResourceWrapper> host;
return host;
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
return "Host [host=" + host + "]";
}
-
+
}
import java.io.Serializable;
import java.util.List;
import java.util.Map;
-
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonRootName;
@JsonRootName("aggregate")
public class HostAggregate implements Serializable {
-
- private String id;
+ @JsonProperty("id")
+ private Integer id;
+
+ @JsonProperty("name")
private String name;
-
+
@JsonProperty("availability_zone")
private String availabilityZone;
-
+
@JsonProperty("created_at")
private String createdAt;
-
+
@JsonProperty("updated_at")
private String updatedAt;
-
+
@JsonProperty("deleted_at")
private String deletedAt;
-
+
private Boolean deleted;
-
+
private List<String> hosts;
-
+
private Map<String, String> metadata;
/**
* @return the id
*/
- public String getId() {
+ public Integer getId() {
return id;
}
return metadata;
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
- return "HostAggregate [id=" + id + ", name=" + name
- + ", availabilityZone=" + availabilityZone + ", createdAt="
- + createdAt + ", updatedAt=" + updatedAt + ", deletedAt="
- + deletedAt + ", deleted=" + deleted + ", hosts=" + hosts
- + ", metadata=" + metadata + "]";
+ return "HostAggregate [id=" + id + ", name=" + name + ", availabilityZone=" + availabilityZone + ", createdAt="
+ + createdAt + ", updatedAt=" + updatedAt + ", deletedAt=" + deletedAt + ", deleted=" + deleted
+ + ", hosts=" + hosts + ", metadata=" + metadata + "]";
}
-
+
}
import java.io.Serializable;
import java.util.Iterator;
import java.util.List;
-
import com.fasterxml.jackson.annotation.JsonProperty;
public class HostAggregates implements Iterable<HostAggregate>, Serializable {
public List<HostAggregate> getList() {
return list;
}
-
+
@Override
public Iterator<HostAggregate> iterator() {
return list.iterator();
}
-
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see java.lang.Object#toString()
*/
@Override
import java.io.Serializable;
import java.util.Iterator;
import java.util.List;
-
import com.fasterxml.jackson.annotation.JsonProperty;
public class Hosts implements Iterable<Hosts.Host>, Serializable {
-
+
public static final class Host {
-
+
private String zone;
-
+
@JsonProperty("host_name")
private String hostName;
-
+
private String service;
/**
public String getService() {
return service;
}
-
+
public String getZone() {
return zone;
}
this.zone = zone;
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
return "Host [hostName=" + hostName + ", service=" + service + "]";
}
-
+
}
@JsonProperty("hosts")
public List<Host> getList() {
return list;
}
-
+
@Override
public Iterator<Hosts.Host> iterator() {
return list.iterator();
}
-
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see java.lang.Object#toString()
*/
@Override
return "Hosts [list=" + list + "]";
}
-
-
+
+
}
import java.util.Calendar;
import java.util.List;
import java.util.Map;
-
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonRootName;
@JsonRootName("image")
public class Image implements Serializable {
-
+
public static final class Server implements Serializable {
-
+
private String id;
-
+
private List<Link> links;
-
+
/**
* @return the id
*/
public String getId() {
return id;
}
-
+
/**
* @return the links
*/
public List<Link> getLinks() {
return links;
}
-
+
@Override
public String toString() {
return "Server [id=" + id + ", links=" + links + "]";
}
-
+
}
private String id;
-
+
private String status;
-
+
private String name;
-
+
private Integer progress;
-
+
private Integer minRam;
-
+
private Integer minDisk;
-
+
private Calendar created;
-
+
private Calendar updated;
-
+
@JsonProperty("OS-EXT-IMG-SIZE:size")
private Long size;
-
+
private Map<String, String> metadata;
-
+
private Server server;
-
+
private List<Link> links;
/**
public void setMetadata(Map<String, String> metadata) {
this.metadata = metadata;
}
-
+
/**
* @return the server
*/
this.links = links;
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
- return "Image [id=" + id + ", status=" + status + ", name=" + name
- + ", progress=" + progress + ", minRam=" + minRam
- + ", minDisk=" + minDisk + ", created=" + (created != null ? created.getTime() : null)
+ return "Image [id=" + id + ", status=" + status + ", name=" + name + ", progress=" + progress + ", minRam="
+ + minRam + ", minDisk=" + minDisk + ", created=" + (created != null ? created.getTime() : null)
+ ", updated=" + (updated != null ? updated.getTime() : null) + ", size=" + size + ", metadata="
- + metadata + ", server="+server+", links=" + links + "]";
+ + metadata + ", server=" + server + ", links=" + links + "]";
}
-
+
}
package com.woorea.openstack.nova.model;
import java.io.Serializable;
-
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonRootName;
import java.io.Serializable;
import java.util.Iterator;
import java.util.List;
-
import com.fasterxml.jackson.annotation.JsonProperty;
public class Images implements Iterable<Image>, Serializable {
public List<Image> getList() {
return list;
}
-
+
@Override
public Iterator<Image> iterator() {
return list.iterator();
}
-
-
- /* (non-Javadoc)
+
+
+ /*
+ * (non-Javadoc)
+ *
* @see java.lang.Object#toString()
*/
@Override
package com.woorea.openstack.nova.model;
import java.io.Serializable;
-
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonRootName;
public class KeyPair implements Serializable {
private String name;
-
+
@JsonProperty("user_id")
private String userId;
-
+
@JsonProperty("public_key")
private String publicKey;
-
+
@JsonProperty("private_key")
private String privateKey;
-
+
private String fingerprint;
public KeyPair() {
super();
}
-
+
public KeyPair(String name) {
this.name = name;
}
-
+
public KeyPair(String name, String publicKey) {
this(name);
this.publicKey = publicKey;
return fingerprint;
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
- return "KeyPair [name=" + name + ", userId=" + userId + ", publicKey="
- + publicKey + ", privateKey=" + privateKey + ", fingerprint="
- + fingerprint + "]";
+ return "KeyPair [name=" + name + ", userId=" + userId + ", publicKey=" + publicKey + ", privateKey="
+ + privateKey + ", fingerprint=" + fingerprint + "]";
}
-
-
+
+
}
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
-
import com.fasterxml.jackson.annotation.JsonProperty;
public class KeyPairs implements Iterable<KeyPair>, Serializable {
-
+
public static final class KeyPairWrapper implements Serializable {
-
+
@JsonProperty
private KeyPair keypair;
-
+
}
@JsonProperty("keypairs")
*/
public List<KeyPair> getList() {
List<KeyPair> keyPairList = new ArrayList<>();
- for(KeyPairWrapper wrapper : this.list) {
+ for (KeyPairWrapper wrapper : this.list) {
keyPairList.add(wrapper.keypair);
}
return keyPairList;
}
-
+
@Override
public Iterator<KeyPair> iterator() {
return getList().iterator();
}
-
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see java.lang.Object#toString()
*/
@Override
import java.io.Serializable;
import java.util.Calendar;
import java.util.List;
-
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonRootName;
*/
@Override
public String toString() {
- return "LimitEntry [nextAvailable=" + nextAvailable + ", unit="
- + unit + ", verb=" + verb + ", remaining=" + remaining
- + ", available=" + available + ", value=" + value + "]";
+ return "LimitEntry [nextAvailable=" + nextAvailable + ", unit=" + unit + ", verb=" + verb
+ + ", remaining=" + remaining + ", available=" + available + ", value=" + value + "]";
}
}
*/
@Override
public String toString() {
- return "RateLimit [regex=" + regex + ", uri=" + uri + ", limit="
- + limit + "]";
+ return "RateLimit [regex=" + regex + ", uri=" + uri + ", limit=" + limit + "]";
}
}
public Integer getMaxSecurityGroupRules() {
return maxSecurityGroupRules;
}
-
+
/**
* @return the maxTotalKeypairs
*/
public Integer getMaxSecurityGroups() {
return maxSecurityGroups;
}
-
+
/**
* @return the totalVolumeGigabytesUsed
*/
*/
@Override
public String toString() {
- return "AbsoluteLimit [maxServerMeta=" + maxServerMeta
- + ", maxPersonality=" + maxPersonality + ", maxImageMeta="
- + maxImageMeta + ", maxPersonalitySize="
- + maxPersonalitySize + ", maxTotalCores=" + maxTotalCores
- + ", maxTotalInstances=" + maxTotalInstances
+ return "AbsoluteLimit [maxServerMeta=" + maxServerMeta + ", maxPersonality=" + maxPersonality
+ + ", maxImageMeta=" + maxImageMeta + ", maxPersonalitySize=" + maxPersonalitySize
+ + ", maxTotalCores=" + maxTotalCores + ", maxTotalInstances=" + maxTotalInstances
+ ", maxTotalRAMSize=" + maxTotalRAMSize + "]";
}
public class Link implements Serializable {
private String rel;
-
+
private String href;
-
+
private String type;
/**
return type;
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
return "Link [rel=" + rel + ", href=" + href + ", type=" + type + "]";
}
-
+
}
/**
* Set the metadata
+ *
* @param metadata
*/
public void setMetadata(Map<String, String> metadata) {
this.metadata = metadata;
}
-
-
+
+
}
package com.woorea.openstack.nova.model;
import java.io.Serializable;
-
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonRootName;
public class Network implements Serializable {
private String id;
-
+
@JsonProperty("vpn_public_address")
private String vpnPublicAddress;
-
+
@JsonProperty("vpn_private_address")
private String vpnPrivateAddress;
-
+
@JsonProperty("vpn_public_port")
private String vpnPublicPort;
-
+
@JsonProperty("dhcp_start")
private String dhcpStart;
-
+
private String bridge;
-
+
@JsonProperty("bridge_interface")
private String bridgeInterface;
-
+
@JsonProperty("updated_at")
private String updatedAt;
private Boolean deleted;
-
+
private String vlan;
-
+
private String broadcast;
-
+
private String netmask;
-
+
private Boolean injected;
-
+
private String host;
-
+
@JsonProperty("multi_host")
private Boolean multiHost;
-
+
@JsonProperty("created_at")
private String createdAt;
-
+
@JsonProperty("deleted_at")
private String deletedAt;
-
+
private String cidr;
-
+
@JsonProperty("cidr_v6")
private String cidrV6;
-
+
private String gateway;
-
+
@JsonProperty("gateway_v6")
private String gatewayV6;
-
+
@JsonProperty("netmask_v6")
private String netmaskV6;
-
+
@JsonProperty("project_id")
private String projectId;
-
+
@JsonProperty("rxtx_base")
private String rxtxBase;
-
+
private String dns1;
-
+
private String dns2;
-
+
private String label;
-
+
private String priority;
/**
return priority;
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
- return "Network [id=" + id + ", vpnPublicAddress=" + vpnPublicAddress
- + ", vpnPublicPort=" + vpnPublicPort + ", dhcpStart="
- + dhcpStart + ", bridge=" + bridge + ", bridgeInterface="
- + bridgeInterface + ", updatedAt=" + updatedAt + ", deleted="
- + deleted + ", vlan=" + vlan + ", broadcast=" + broadcast
- + ", netmask=" + netmask + ", injected=" + injected + ", host="
- + host + ", multiHost=" + multiHost + ", createdAt="
- + createdAt + ", deletedAt=" + deletedAt + ", cidr=" + cidr
- + ", cidrV6=" + cidrV6 + ", gateway=" + gateway
- + ", gatewayV6=" + gatewayV6 + ", netmaskV6=" + netmaskV6
- + ", projectId=" + projectId + ", rxtxBase=" + rxtxBase
- + ", dns1=" + dns1 + ", dns2=" + dns2 + ", label=" + label
+ return "Network [id=" + id + ", vpnPublicAddress=" + vpnPublicAddress + ", vpnPublicPort=" + vpnPublicPort
+ + ", dhcpStart=" + dhcpStart + ", bridge=" + bridge + ", bridgeInterface=" + bridgeInterface
+ + ", updatedAt=" + updatedAt + ", deleted=" + deleted + ", vlan=" + vlan + ", broadcast=" + broadcast
+ + ", netmask=" + netmask + ", injected=" + injected + ", host=" + host + ", multiHost=" + multiHost
+ + ", createdAt=" + createdAt + ", deletedAt=" + deletedAt + ", cidr=" + cidr + ", cidrV6=" + cidrV6
+ + ", gateway=" + gateway + ", gatewayV6=" + gatewayV6 + ", netmaskV6=" + netmaskV6 + ", projectId="
+ + projectId + ", rxtxBase=" + rxtxBase + ", dns1=" + dns1 + ", dns2=" + dns2 + ", label=" + label
+ ", priority=" + priority + "]";
}
-
+
}
import java.io.Serializable;
import java.util.Iterator;
import java.util.List;
-
import com.fasterxml.jackson.annotation.JsonProperty;
public class Networks implements Iterable<Network>, Serializable {
public List<Network> getList() {
return list;
}
-
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see java.lang.Object#toString()
*/
@Override
public Iterator<Network> iterator() {
return list.iterator();
}
-
+
}
import java.io.Serializable;
public final class PersonalityFile implements Serializable {
-
+
private String path;
-
+
private String contents;
/**
public void setContents(String contents) {
this.contents = contents;
}
-
+
}
public class QuotaSet {
private String id;
-
+
@JsonProperty("metadata_items")
private Integer metadataItems;
-
+
@JsonProperty("injected_file_content_bytes")
private Integer injectedFileContentBytes;
-
+
@JsonProperty("injected_files")
private Integer injectedFiles;
-
+
private Integer gigabytes;
-
+
private Integer ram;
-
+
@JsonProperty("floating_ips")
private Integer floatingIps;
-
+
private Integer instances;
-
+
private Integer volumes;
-
+
private Integer cores;
-
+
@JsonProperty("security_groups")
private Integer securityGroups;
-
+
@JsonProperty("security_group_rules")
private Integer securityGroupRules;
@JsonProperty("key_pairs")
private Integer keyPairs;
+ @JsonProperty("fixed_ips")
+ private Integer fixedIps;
+
+ @JsonProperty("server_group_members")
+ private Integer serverGroupMembers;
+
+ @JsonProperty("server_groups")
+ private Integer serverGroups;
+
public String getId() {
return id;
}
this.id = id;
}
+ public Integer getFixedIps() {
+ return fixedIps;
+ }
+
+ public void setFixedIps(Integer fixedIps) {
+ this.fixedIps = fixedIps;
+ }
+
+ public Integer getServerGroupMembers() {
+ return serverGroupMembers;
+ }
+
+ public void setServerGroupMembers(Integer serverGroupMembers) {
+ this.serverGroupMembers = serverGroupMembers;
+ }
+
+ public Integer getServerGroups() {
+ return serverGroups;
+ }
+
+ public void setServerGroups(Integer serverGroups) {
+ this.serverGroups = serverGroups;
+ }
+
public Integer getMetadataItems() {
return metadataItems;
}
import java.io.Serializable;
import java.util.List;
-
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonRootName;
@JsonRootName("security_group")
public class SecurityGroup implements Serializable {
-
+
@JsonRootName("security_group_rule")
public static final class Rule implements Serializable {
-
+
public static final class Group implements Serializable {
private String name;
public String getName() {
return name;
}
-
+
public String getTenantId() {
return tenantId;
}
return group;
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
- return "Rule [id=" + id + ", name=" + name + ", parentGroupId="
- + parentGroupId + ", fromPort=" + fromPort + ", toPort="
- + toPort + ", ipProtocol=" + ipProtocol + ", ipRange="
- + ipRange + ", group=" + group + "]";
+ return "Rule [id=" + id + ", name=" + name + ", parentGroupId=" + parentGroupId + ", fromPort=" + fromPort
+ + ", toPort=" + toPort + ", ipProtocol=" + ipProtocol + ", ipRange=" + ipRange + ", group=" + group
+ + "]";
}
-
+
}
private String id;
-
+
private String name;
-
+
private String description;
-
+
@JsonProperty("tenant_id")
private String tenantId;
-
+
private List<Rule> rules;
-
+
private List<Link> links;
/**
return links;
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
- return "SecurityGroup [id=" + id + ", name=" + name + ", description="
- + description + ", tenantId=" + tenantId + ", rules=" + rules
- + ", links=" + links + "]";
+ return "SecurityGroup [id=" + id + ", name=" + name + ", description=" + description + ", tenantId=" + tenantId
+ + ", rules=" + rules + ", links=" + links + "]";
}
-
+
}
package com.woorea.openstack.nova.model;
import java.io.Serializable;
-
import com.fasterxml.jackson.annotation.JsonRootName;
@JsonRootName("security_group")
public class SecurityGroupForCreate implements Serializable {
-
+
private String name;
-
+
private String description;
public SecurityGroupForCreate() {
super();
}
-
+
public SecurityGroupForCreate(String name) {
this.name = name;
}
this.description = description;
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
- return "SecurityGroupForCreate [name=" + name + ", description="
- + description + "]";
+ return "SecurityGroupForCreate [name=" + name + ", description=" + description + "]";
}
-
+
}
package com.woorea.openstack.nova.model;
import java.io.Serializable;
-
import javax.xml.bind.annotation.XmlElement;
-
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonRootName;
@JsonProperty("parent_group_id")
private String parentGroupId;
-
+
@JsonProperty("ip_protocol")
private String ipProtocol;
@JsonProperty("to_port")
private Integer toPort;
-
+
@XmlElement
private String cidr;
@JsonProperty("group_id")
private String groupId;
-
+
public SecurityGroupRuleForCreate() {
-
+
}
-
+
/**
*
* @param parentSecurityGroupId
* @param fromPort
* @param toPort
* @param cidr
- * @deprecated Ids in some installs have shown to use strings .Use {@link #SecurityGroupRuleForCreate(String, String, Integer, Integer, String)}
+ * @deprecated Ids in some installs have shown to use strings .Use
+ * {@link #SecurityGroupRuleForCreate(String, String, Integer, Integer, String)}
*/
@Deprecated
- public SecurityGroupRuleForCreate(Integer parentSecurityGroupId, String ipProtocol, Integer fromPort,Integer toPort, String cidr) {
+ public SecurityGroupRuleForCreate(Integer parentSecurityGroupId, String ipProtocol, Integer fromPort,
+ Integer toPort, String cidr) {
this.parentGroupId = String.valueOf(parentSecurityGroupId);
this.ipProtocol = ipProtocol;
this.fromPort = fromPort;
this.toPort = toPort;
this.cidr = cidr;
}
+
/**
*
* @param parentSecurityGroupId
* @param fromPort
* @param toPort
* @param cidr
- * @deprecated Ids in some installs have shown to use strings .Use {@link #SecurityGroupRuleForCreate(String, String, String, Integer, Integer)}
+ * @deprecated Ids in some installs have shown to use strings .Use
+ * {@link #SecurityGroupRuleForCreate(String, String, String, Integer, Integer)}
*/
@Deprecated
- public SecurityGroupRuleForCreate(Integer parentGroupId, String ipProtocol, Integer fromPort,Integer toPort, Integer sourceGroupId) {
+ public SecurityGroupRuleForCreate(Integer parentGroupId, String ipProtocol, Integer fromPort, Integer toPort,
+ Integer sourceGroupId) {
this.parentGroupId = String.valueOf(parentGroupId);
this.ipProtocol = ipProtocol;
this.fromPort = fromPort;
this.toPort = toPort;
this.groupId = String.valueOf(sourceGroupId);
}
-
- public SecurityGroupRuleForCreate(String parentSecurityGroupId, String ipProtocol, Integer fromPort,Integer toPort, String cidr) {
+
+ public SecurityGroupRuleForCreate(String parentSecurityGroupId, String ipProtocol, Integer fromPort, Integer toPort,
+ String cidr) {
this.parentGroupId = parentSecurityGroupId;
this.ipProtocol = ipProtocol;
this.fromPort = fromPort;
this.toPort = toPort;
this.cidr = cidr;
}
-
- public SecurityGroupRuleForCreate(String parentGroupId, String sourceGroupId, String ipProtocol, Integer fromPort,Integer toPort) {
+
+ public SecurityGroupRuleForCreate(String parentGroupId, String sourceGroupId, String ipProtocol, Integer fromPort,
+ Integer toPort) {
this.parentGroupId = parentGroupId;
this.ipProtocol = ipProtocol;
this.fromPort = fromPort;
public String getParentGroupId() {
return parentGroupId;
}
-
-
+
+
/**
* @param parentGroupId the parentGroupId to set
* @deprecated Use {@link #setParentGroupId(String)}
public void setParentGroupId(Integer parentGroupId) {
this.parentGroupId = String.valueOf(parentGroupId);
}
-
+
/**
* @param parentGroupId the parentGroupId to set
*/
public void setGroupId(Integer groupId) {
this.groupId = String.valueOf(groupId);
}
-
+
/**
* @param groupId the groupId to set
*/
this.groupId = groupId;
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
- return "SecurityGroupRuleForCreate [parentGroupId=" + parentGroupId
- + ", fromPort=" + fromPort + ", toPort=" + toPort
- + ", ipProtocol=" + ipProtocol + ", cidr=" + cidr
- + ", groupId=" + groupId + "]";
+ return "SecurityGroupRuleForCreate [parentGroupId=" + parentGroupId + ", fromPort=" + fromPort + ", toPort="
+ + toPort + ", ipProtocol=" + ipProtocol + ", cidr=" + cidr + ", groupId=" + groupId + "]";
}
}
import java.io.Serializable;
import java.util.Iterator;
import java.util.List;
-
import com.fasterxml.jackson.annotation.JsonProperty;
public class SecurityGroups implements Iterable<SecurityGroup>, Serializable {
public List<SecurityGroup> getList() {
return list;
}
-
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see java.lang.Object#toString()
*/
@Override
public Iterator<SecurityGroup> iterator() {
return list.iterator();
}
-
+
}
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonRootName;
@JsonRootName("server")
public class Server implements Serializable {
-
+
public static final class Addresses implements Serializable {
-
+
public static final class Address implements Serializable {
-
+
@JsonProperty("OS-EXT-IPS-MAC:mac_addr")
private String macAddr;
private String version;
-
+
private String addr;
-
+
@JsonProperty("OS-EXT-IPS:type")
private String type;
- /**
- * @return the macAddr
- */
+ /**
+ * @return the macAddr
+ */
public String getMacAddr() {
return macAddr;
}
public String getAddr() {
return addr;
}
-
+
/**
* @return the type
* @param macAddr the mac addr to set
*/
public void setMacAddr(String macAddr) {
- this.macAddr= macAddr;
+ this.macAddr = macAddr;
}
}
public void add(String key, List<Address> value) {
addresses.put(key, value);
}
+
/**
* @return the ip address List Map
*/
return addresses;
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
return "Addresses List Map [" + addresses + "]";
}
-
+
}
-
+
public static final class Fault {
-
+
private Integer code;
-
+
private String message;
-
+
private String details;
-
+
private Calendar created;
/**
return created;
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
- return "Fault [code=" + code + ", message=" + message
- + ", details=" + details + ", created=" + created + "]";
+ return "Fault [code=" + code + ", message=" + message + ", details=" + details + ", created=" + created
+ + "]";
}
-
-
+
+
}
-
+
private String id;
-
+
private String name;
-
+
private Addresses addresses;
-
+
private List<Link> links;
-
+
private Image image;
-
+
private Flavor flavor;
-
+
private String accessIPv4;
-
+
private String accessIPv6;
-
+
@JsonProperty("config_drive")
private String configDrive;
-
+
private String status;
-
+
private Integer progress;
-
+
private Fault fault;
-
+
@JsonProperty("tenant_id")
private String tenantId;
-
+
@JsonProperty("user_id")
private String userId;
-
+
@JsonProperty("key_name")
private String keyName;
-
+
private String hostId;
-
+
private String updated;
-
+
private String created;
-
+
private Map<String, String> metadata;
-
+
@JsonProperty("security_groups")
private List<SecurityGroup> securityGroups;
-
+
@JsonProperty("OS-EXT-STS:task_state")
private String taskState;
-
+
@JsonProperty("OS-EXT-STS:power_state")
private String powerState;
-
+
@JsonProperty("OS-EXT-STS:vm_state")
private String vmState;
-
+
@JsonProperty("OS-EXT-SRV-ATTR:host")
private String host;
-
+
@JsonProperty("OS-EXT-SRV-ATTR:instance_name")
private String instanceName;
-
+
@JsonProperty("OS-EXT-SRV-ATTR:hypervisor_hostname")
private String hypervisorHostname;
-
+
@JsonProperty("OS-DCF:diskConfig")
private String diskConfig;
-
+
@JsonProperty("OS-EXT-AZ:availability_zone")
private String availabilityZone;
@JsonProperty("os-extended-volumes:volumes_attached")
private List<String> osExtendedVolumesAttached;
-
+
private String uuid;
-
+
private String adminPass;
/**
public Flavor getFlavor() {
return flavor;
}
-
+
/**
* @param flavor the flavor to set
*/
return adminPass;
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
- return "Server [id=" + id + ", name=" + name + ", addresses="
- + addresses + ", links=" + links + ", image=" + image
- + ", flavor=" + flavor + ", accessIPv4=" + accessIPv4
- + ", accessIPv6=" + accessIPv6 + ", configDrive=" + configDrive
- + ", status=" + status + ", progress=" + progress + ", fault="
- + fault + ", tenantId=" + tenantId + ", userId=" + userId
- + ", keyName=" + keyName + ", hostId=" + hostId + ", updated="
- + updated + ", created=" + created + ", metadata=" + metadata
- + ", securityGroups=" + securityGroups + ", taskState="
- + taskState + ", powerState=" + powerState + ", vmState="
- + vmState + ", host=" + host + ", instanceName=" + instanceName
- + ", hypervisorHostname=" + hypervisorHostname
- + ", diskConfig=" + diskConfig + ", availabilityZone="
- + availabilityZone + ", launchedAt=" + launchedAt + ", terminatedAt="
- + ", " + "osExtendedVolumesAttached=" + osExtendedVolumesAttached
- + ", uuid=" + uuid + ", adminPass="
- + adminPass + "]";
+ return "Server [id=" + id + ", name=" + name + ", addresses=" + addresses + ", links=" + links + ", image="
+ + image + ", flavor=" + flavor + ", accessIPv4=" + accessIPv4 + ", accessIPv6=" + accessIPv6
+ + ", configDrive=" + configDrive + ", status=" + status + ", progress=" + progress + ", fault=" + fault
+ + ", tenantId=" + tenantId + ", userId=" + userId + ", keyName=" + keyName + ", hostId=" + hostId
+ + ", updated=" + updated + ", created=" + created + ", metadata=" + metadata + ", securityGroups="
+ + securityGroups + ", taskState=" + taskState + ", powerState=" + powerState + ", vmState=" + vmState
+ + ", host=" + host + ", instanceName=" + instanceName + ", hypervisorHostname=" + hypervisorHostname
+ + ", diskConfig=" + diskConfig + ", availabilityZone=" + availabilityZone + ", launchedAt=" + launchedAt
+ + ", terminatedAt=" + ", " + "osExtendedVolumesAttached=" + osExtendedVolumesAttached + ", uuid=" + uuid
+ + ", adminPass=" + adminPass + "]";
}
}
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonRootName;
public interface ServerAction extends Serializable {
-
+
@JsonRootName("changePassword")
public static final class ChangePassword implements ServerAction {
-
+
private String adminPass;
public ChangePassword() {
public void setAdminPass(String adminPass) {
this.adminPass = adminPass;
}
-
+
}
-
+
@JsonRootName("reboot")
public static final class Reboot implements ServerAction {
-
+
private String type;
/**
public void setType(String type) {
this.type = type;
}
-
+
}
-
+
@JsonRootName("rebuild")
public static final class Rebuild implements ServerAction {
-
+
private String imageRef;
-
+
private String name;
-
+
private String adminPass;
-
+
private String accessIPv4;
-
+
private String accessIPv6;
-
+
private Map<String, String> metadata = new HashMap<>();
-
+
private List<PersonalityFile> personality = new ArrayList<>();
-
+
@JsonProperty("OS-DCF:diskConfig")
private String diskConfig;
public void setDiskConfig(String diskConfig) {
this.diskConfig = diskConfig;
}
-
+
}
-
+
@JsonRootName("resize")
public static final class Resize implements ServerAction {
-
+
private String flavorRef;
-
+
@JsonProperty("OS-DCF:diskConfig")
private String diskConfig;
public void setDiskConfig(String diskConfig) {
this.diskConfig = diskConfig;
}
-
+
}
-
+
@JsonRootName("confirmResize")
public static final class ConfirmResize implements ServerAction {
-
+
}
-
+
@JsonRootName("revertResize")
public static final class RevertResize implements ServerAction {
-
+
}
-
+
@JsonRootName("createImage")
public static final class CreateImage implements ServerAction {
-
+
private String name;
-
+
private Map<String, String> metadata;
/**
public void setMetadata(Map<String, String> metadata) {
this.metadata = metadata;
}
-
+
}
-
+
@JsonRootName("rescue")
public static final class Rescue implements ServerAction {
-
+
private String adminPass;
public Rescue() {
-
+
}
-
+
public Rescue(String adminPass) {
this.adminPass = adminPass;
}
public void setAdminPass(String adminPass) {
this.adminPass = adminPass;
}
-
+
}
-
+
public static final class RescueResponse implements ServerAction {
-
+
private String adminPass;
/**
public String getAdminPass() {
return adminPass;
}
-
+
}
@JsonRootName("unrescue")
public static final class Unrescue implements ServerAction {
-
+
}
-
+
@JsonRootName("unpause")
public static final class Unpause implements ServerAction {
-
+
}
@JsonRootName("pause")
public static final class Pause implements ServerAction {
-
+
}
-
+
@JsonRootName("suspend")
public static final class Suspend implements ServerAction {
-
+
}
@JsonRootName("resume")
public static final class Resume implements ServerAction {
-
+
}
-
+
@JsonRootName("lock")
public static final class Lock implements ServerAction {
-
+
}
@JsonRootName("unlock")
public static final class Unlock implements ServerAction {
-
+
}
-
+
@JsonRootName("os-getConsoleOutput")
public static final class GetConsoleOutput implements ServerAction {
-
+
private Integer length;
-
+
public GetConsoleOutput() {
-
+
}
public GetConsoleOutput(Integer length) {
public void setLength(Integer length) {
this.length = length;
}
-
+
}
-
+
public static final class ConsoleOutput implements ServerAction {
-
+
private String output;
/**
public String getOutput() {
return output;
}
-
+
}
-
+
@JsonRootName("os-getVNCConsole")
public static final class GetVncConsole implements ServerAction {
-
+
private String type;
public GetVncConsole() {
super();
}
-
+
public GetVncConsole(String type) {
super();
public void setType(String type) {
this.type = type;
}
-
+
}
-
+
@JsonRootName("console")
public static final class VncConsole implements ServerAction {
-
+
private String type;
-
+
private String url;
/**
public String getUrl() {
return url;
}
-
+
}
-
+
@JsonRootName("os-start")
public static final class Start implements ServerAction {
-
+
}
@JsonRootName("os-stop")
public static final class Stop implements ServerAction {
-
+
}
-
+
@JsonRootName("forceDelete")
public static final class ForceDelete implements ServerAction {
-
+
}
@JsonRootName("restore")
public static final class Restore implements ServerAction {
-
+
}
-
+
@JsonRootName("addFloatingIp")
public static final class AssociateFloatingIp implements ServerAction {
-
+
private String address;
public AssociateFloatingIp() {
public void setAddress(String address) {
this.address = address;
}
-
+
}
-
+
@JsonRootName("removeFloatingIp")
public static final class DisassociateFloatingIp implements ServerAction {
-
+
private String address;
-
+
public DisassociateFloatingIp() {
super();
}
public void setAddress(String address) {
this.address = address;
}
-
+
}
-
+
@JsonRootName("createBackup")
public static final class CreateBackup implements ServerAction {
-
+
private String name;
@JsonProperty("backup_type")
public void setMetadata(Map<String, String> metadata) {
this.metadata = metadata;
}
-
+
}
-
+
}
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonRootName;
private String name;
- public SecurityGroup() {
- }
+ public SecurityGroup() {}
public SecurityGroup(String name) {
this.name = name;
}
/**
- * @param name
- * the name to set
+ * @param name the name to set
*/
public void setName(String name) {
this.name = name;
}
/**
- * @param name
- * the name to set
+ * @param name the name to set
*/
public void setName(String name) {
this.name = name;
}
/**
- * @param adminPass
- * the adminPass to set
+ * @param adminPass the adminPass to set
*/
public void setAdminPass(String adminPass) {
this.adminPass = adminPass;
}
/**
- * @param imageRef
- * the imageRef to set
+ * @param imageRef the imageRef to set
*/
public void setImageRef(String imageRef) {
this.imageRef = imageRef;
}
/**
- * @param flavorRef
- * the flavorRef to set
+ * @param flavorRef the flavorRef to set
*/
public void setFlavorRef(String flavorRef) {
this.flavorRef = flavorRef;
}
/**
- * @param accessIPv4
- * the accessIPv4 to set
+ * @param accessIPv4 the accessIPv4 to set
*/
public void setAccessIPv4(String accessIPv4) {
this.accessIPv4 = accessIPv4;
}
/**
- * @param accessIPv6
- * the accessIPv6 to set
+ * @param accessIPv6 the accessIPv6 to set
*/
public void setAccessIPv6(String accessIPv6) {
this.accessIPv6 = accessIPv6;
}
/**
- * @param min
- * the min to set
+ * @param min the min to set
*/
public void setMin(Integer min) {
this.min = min;
}
/**
- * @param max
- * the max to set
+ * @param max the max to set
*/
public void setMax(Integer max) {
this.max = max;
}
/**
- * @param diskConfig
- * the diskConfig to set
+ * @param diskConfig the diskConfig to set
*/
public void setDiskConfig(String diskConfig) {
this.diskConfig = diskConfig;
}
/**
- * @param keyName
- * the keyName to set
+ * @param keyName the keyName to set
*/
public void setKeyName(String keyName) {
this.keyName = keyName;
}
/**
- * @param personality
- * the personality to set
+ * @param personality the personality to set
*/
public void setPersonality(List<PersonalityFile> personality) {
this.personality = personality;
}
/**
- * @param metadata
- * the metadata to set
+ * @param metadata the metadata to set
*/
public void setMetadata(Map<String, String> metadata) {
this.metadata = metadata;
}
/**
- * @param userData
- * the userData to set
+ * @param userData the userData to set
*/
public void setUserData(String userData) {
this.userData = userData;
}
/**
- * @param availabilityZone
- * the availabilityZone to set
+ * @param availabilityZone the availabilityZone to set
*/
public void setAvailabilityZone(String availabilityZone) {
this.availabilityZone = availabilityZone;
import java.io.Serializable;
import java.util.Iterator;
import java.util.List;
-
import com.fasterxml.jackson.annotation.JsonProperty;
public class Servers implements Iterable<Server>, Serializable {
public List<Server> getList() {
return list;
}
-
+
@Override
public Iterator<Server> iterator() {
return list.iterator();
}
-
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see java.lang.Object#toString()
*/
@Override
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;
-
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonRootName;
@JsonRootName("tenant_usage")
public class SimpleTenantUsage implements Serializable {
-
+
@JsonProperty("total_memory_mb_usage")
private BigDecimal totalMemoryMbUsage;
-
+
@JsonProperty("total_vcpus_usage")
private BigDecimal totalVcpusUsage;
-
+
@JsonProperty("total_local_gb_usage")
private BigDecimal totalLocalGbUsage;
private String start;
-
+
private String stop;
-
+
@JsonProperty("tenant_id")
private String tenantId;
-
+
@JsonProperty("total_hours")
private String totalHours;
this.serverUsages = serverUsages;
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
- return "SimpleTenantUsage [totalMemoryMbUsage=" + totalMemoryMbUsage
- + ", totalVcpusUsage=" + totalVcpusUsage
- + ", totalLocalGbUsage=" + totalLocalGbUsage + ", start="
- + start + ", stop=" + stop + ", tenantId=" + tenantId
- + ", totalHours=" + totalHours + "]";
+ return "SimpleTenantUsage [totalMemoryMbUsage=" + totalMemoryMbUsage + ", totalVcpusUsage=" + totalVcpusUsage
+ + ", totalLocalGbUsage=" + totalLocalGbUsage + ", start=" + start + ", stop=" + stop + ", tenantId="
+ + tenantId + ", totalHours=" + totalHours + "]";
}
public static final class ServerUsage implements Serializable {
@JsonProperty("started_at")
private String startedAt;
-
+
@JsonProperty("ended_at")
private String endedAt;
import java.io.Serializable;
import java.util.Iterator;
import java.util.List;
-
import com.fasterxml.jackson.annotation.JsonProperty;
public class SimpleTenantUsages implements Iterable<SimpleTenantUsage>, Serializable {
return list;
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see java.lang.Object#toString()
*/
@Override
public Iterator<SimpleTenantUsage> iterator() {
return list.iterator();
}
-
+
}
package com.woorea.openstack.nova.model;
import java.io.Serializable;
-
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonRootName;
public class Snapshot implements Serializable {
private String id;
-
+
private String status;
-
+
@JsonProperty("displayName")
private String name;
-
+
@JsonProperty("displayDescription")
private String description;
-
+
private String volumeId;
-
+
private Integer size;
-
+
private String createdAt;
/**
return createdAt;
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
- return "Snapshot [id=" + id + ", status=" + status + ", displayName="
- + name + ", displayDescription=" + description
- + ", volumeId=" + volumeId + ", size=" + size + ", createdAt="
- + createdAt + "]";
+ return "Snapshot [id=" + id + ", status=" + status + ", displayName=" + name + ", displayDescription="
+ + description + ", volumeId=" + volumeId + ", size=" + size + ", createdAt=" + createdAt + "]";
}
-
+
}
package com.woorea.openstack.nova.model;
import java.io.Serializable;
-
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonRootName;
@JsonRootName("snapshot")
public class SnapshotForCreate implements Serializable {
-
+
@JsonProperty("volume_id")
private String volumeId;
-
+
private Boolean force;
-
+
@JsonProperty("display_name")
private String name;
this.description = description;
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
- return "SnapshotForCreate [volumeId=" + volumeId + ", force=" + force
- + ", name=" + name + ", description=" + description + "]";
+ return "SnapshotForCreate [volumeId=" + volumeId + ", force=" + force + ", name=" + name + ", description="
+ + description + "]";
}
}
import java.io.Serializable;
import java.util.Iterator;
import java.util.List;
-
import com.fasterxml.jackson.annotation.JsonProperty;
public class Snapshots implements Iterable<Snapshot>, Serializable {
public List<Snapshot> getList() {
return list;
}
-
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see java.lang.Object#toString()
*/
@Override
public Iterator<Snapshot> iterator() {
return list.iterator();
}
-
+
}
import java.io.Serializable;
import java.util.List;
import java.util.Map;
-
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonRootName;
public class Volume implements Serializable {
private String id;
-
+
private String status;
-
+
@JsonProperty("displayName")
private String name;
-
+
@JsonProperty("displayDescription")
private String description;
-
+
private String availabilityZone;
private String volumeType;
-
+
private String snapshotId;
-
+
private List<Map<String, Object>> attachments;
-
+
private Map<String, String> metadata;
-
+
private String createdAt;
-
+
private Integer size;
/**
return size;
}
-
-
+
+
}
package com.woorea.openstack.nova.model;
import java.io.Serializable;
-
import com.fasterxml.jackson.annotation.JsonRootName;
@JsonRootName("volumeAttachment")
this.device = device;
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
- return "VolumeAttachment [id=" + id + ", volumeId=" + volumeId
- + ", serverId=" + serverId + ", device=" + device + "]";
+ return "VolumeAttachment [id=" + id + ", volumeId=" + volumeId + ", serverId=" + serverId + ", device=" + device
+ + "]";
}
}
import java.io.Serializable;
import java.util.Iterator;
import java.util.List;
-
import com.fasterxml.jackson.annotation.JsonProperty;
public class VolumeAttachments implements Iterable<VolumeAttachment>, Serializable {
public Iterator<VolumeAttachment> iterator() {
return list.iterator();
}
-
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see java.lang.Object#toString()
*/
@Override
import java.io.Serializable;
import java.util.Map;
-
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonRootName;
this.metadata = metadata;
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
- return "VolumeForCreate [size=" + size + ", availabilityZone="
- + availabilityZone + ", name=" + name + ", description="
- + description + ", snapshotId=" + snapshotId + ", metadata="
- + metadata + "]";
+ return "VolumeForCreate [size=" + size + ", availabilityZone=" + availabilityZone + ", name=" + name
+ + ", description=" + description + ", snapshotId=" + snapshotId + ", metadata=" + metadata + "]";
}
}
package com.woorea.openstack.nova.model;
import java.io.Serializable;
-
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonRootName;
package com.woorea.openstack.nova.model;
import java.io.Serializable;
-
import com.fasterxml.jackson.annotation.JsonRootName;
@JsonRootName("volume-type")
import java.io.Serializable;
import java.util.Iterator;
import java.util.List;
-
import com.fasterxml.jackson.annotation.JsonProperty;
public class VolumeTypes implements Iterable<VolumeType>, Serializable {
public Iterator<VolumeType> iterator() {
return list.iterator();
}
-
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
return "VolumeTypes [list=" + list + "]";
}
-
+
}
import java.io.Serializable;
import java.util.Iterator;
import java.util.List;
-
import com.fasterxml.jackson.annotation.JsonProperty;
public class Volumes implements Iterable<Volume>, Serializable {
public List<Volume> getList() {
return list;
}
-
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see java.lang.Object#toString()
*/
@Override
public Iterator<Volume> iterator() {
return list.iterator();
}
-
+
}
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.woorea.openstack.nova.model.Limits.AbsoluteLimit;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"maxServerMeta\" : 30," + EOL
- + " \"serverMetaUsed\" : 37," + EOL
- + " \"maxPersonality\" : 54," + EOL
- + " \"personalityUsed\" : 61," + EOL
- + " \"maxImageMeta\" : 82," + EOL
- + " \"imageMetaUsed\" : 89," + EOL
- + " \"maxPersonalitySize\" : 97," + EOL
- + " \"personalitySizeUsed\" : 4," + EOL
- + " \"maxTotalCores\" : 32," + EOL
- + " \"totalCoresUsed\" : 39," + EOL
- + " \"maxTotalInstances\" : 60," + EOL
- + " \"totalInstancesUsed\" : 67," + EOL
- + " \"maxTotalRAMSize\" : 55," + EOL
- + " \"totalRAMUsed\" : 19," + EOL
- + " \"maxSecurityGroupRules\" : 44," + EOL
- + " \"securityGroupRulesUsed\" : 51," + EOL
- + " \"maxTotalKeypairs\" : 64," + EOL
- + " \"totalKeyPairsUsed\" : 71," + EOL
- + " \"maxTotalVolumes\" : 71," + EOL
- + " \"totalVolumesUsed\" : 78," + EOL
- + " \"maxSecurityGroups\" : 4," + EOL
- + " \"totalSecurityGroupsUsed\" : 59," + EOL
- + " \"maxTotalFloatingIps\" : 76," + EOL
- + " \"totalFloatingIpsUsed\" : 83," + EOL
- + " \"maxTotalVolumeGigabytes\" : 15," + EOL
- + " \"totalVolumeGigabytesUsed\" : 22" + EOL
- + "}";
-
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private static final String JSON_FULL = "{" + EOL + " \"maxServerMeta\" : 30," + EOL + " \"serverMetaUsed\" : 37,"
+ + EOL + " \"maxPersonality\" : 54," + EOL + " \"personalityUsed\" : 61," + EOL
+ + " \"maxImageMeta\" : 82," + EOL + " \"imageMetaUsed\" : 89," + EOL + " \"maxPersonalitySize\" : 97,"
+ + EOL + " \"personalitySizeUsed\" : 4," + EOL + " \"maxTotalCores\" : 32," + EOL
+ + " \"totalCoresUsed\" : 39," + EOL + " \"maxTotalInstances\" : 60," + EOL
+ + " \"totalInstancesUsed\" : 67," + EOL + " \"maxTotalRAMSize\" : 55," + EOL + " \"totalRAMUsed\" : 19,"
+ + EOL + " \"maxSecurityGroupRules\" : 44," + EOL + " \"securityGroupRulesUsed\" : 51," + EOL
+ + " \"maxTotalKeypairs\" : 64," + EOL + " \"totalKeyPairsUsed\" : 71," + EOL
+ + " \"maxTotalVolumes\" : 71," + EOL + " \"totalVolumesUsed\" : 78," + EOL
+ + " \"maxSecurityGroups\" : 4," + EOL + " \"totalSecurityGroupsUsed\" : 59," + EOL
+ + " \"maxTotalFloatingIps\" : 76," + EOL + " \"totalFloatingIpsUsed\" : 83," + EOL
+ + " \"maxTotalVolumeGigabytes\" : 15," + EOL + " \"totalVolumeGigabytesUsed\" : 22" + EOL + "}";
+
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
AbsoluteLimit absolutelimit = objectMapper.readValue(JSON_FULL, AbsoluteLimit.class);
absolutelimit.toString();
-
+
Integer maxTotalRAMSize = absolutelimit.getMaxTotalRAMSize();
Assert.assertNotNull(maxTotalRAMSize);
-
+
Integer maxTotalInstances = absolutelimit.getMaxTotalInstances();
Assert.assertNotNull(maxTotalInstances);
-
+
Integer serverMetaUsed = absolutelimit.getServerMetaUsed();
Assert.assertNotNull(serverMetaUsed);
-
+
Integer maxTotalKeypairs = absolutelimit.getMaxTotalKeypairs();
Assert.assertNotNull(maxTotalKeypairs);
-
+
Integer maxTotalVolumeGigabytes = absolutelimit.getMaxTotalVolumeGigabytes();
Assert.assertNotNull(maxTotalVolumeGigabytes);
-
+
Integer totalSecurityGroupsUsed = absolutelimit.getTotalSecurityGroupsUsed();
Assert.assertNotNull(totalSecurityGroupsUsed);
-
+
Integer maxTotalVolumes = absolutelimit.getMaxTotalVolumes();
Assert.assertNotNull(maxTotalVolumes);
-
+
Integer maxImageMeta = absolutelimit.getMaxImageMeta();
Assert.assertNotNull(maxImageMeta);
-
+
Integer imageMetaUsed = absolutelimit.getImageMetaUsed();
Assert.assertNotNull(imageMetaUsed);
-
+
Integer totalVolumeGigabytesUsed = absolutelimit.getTotalVolumeGigabytesUsed();
Assert.assertNotNull(totalVolumeGigabytesUsed);
-
+
Integer maxSecurityGroupRules = absolutelimit.getMaxSecurityGroupRules();
Assert.assertNotNull(maxSecurityGroupRules);
-
+
Integer totalCoresUsed = absolutelimit.getTotalCoresUsed();
Assert.assertNotNull(totalCoresUsed);
-
+
Integer totalVolumesUsed = absolutelimit.getTotalVolumesUsed();
Assert.assertNotNull(totalVolumesUsed);
-
+
Integer maxTotalFloatingIps = absolutelimit.getMaxTotalFloatingIps();
Assert.assertNotNull(maxTotalFloatingIps);
-
+
Integer maxPersonality = absolutelimit.getMaxPersonality();
Assert.assertNotNull(maxPersonality);
-
+
Integer personalityUsed = absolutelimit.getPersonalityUsed();
Assert.assertNotNull(personalityUsed);
-
+
Integer maxSecurityGroups = absolutelimit.getMaxSecurityGroups();
Assert.assertNotNull(maxSecurityGroups);
-
+
Integer securityGroupRulesUsed = absolutelimit.getSecurityGroupRulesUsed();
Assert.assertNotNull(securityGroupRulesUsed);
-
+
Integer maxTotalCores = absolutelimit.getMaxTotalCores();
Assert.assertNotNull(maxTotalCores);
-
+
Integer maxServerMeta = absolutelimit.getMaxServerMeta();
Assert.assertNotNull(maxServerMeta);
-
+
Integer maxPersonalitySize = absolutelimit.getMaxPersonalitySize();
Assert.assertNotNull(maxPersonalitySize);
-
+
Integer personalitySizeUsed = absolutelimit.getPersonalitySizeUsed();
Assert.assertNotNull(personalitySizeUsed);
-
+
Integer totalKeyPairsUsed = absolutelimit.getTotalKeyPairsUsed();
Assert.assertNotNull(totalKeyPairsUsed);
-
+
Integer totalFloatingIpsUsed = absolutelimit.getTotalFloatingIpsUsed();
Assert.assertNotNull(totalFloatingIpsUsed);
-
+
Integer totalInstancesUsed = absolutelimit.getTotalInstancesUsed();
Assert.assertNotNull(totalInstancesUsed);
-
+
Integer totalRAMUsed = absolutelimit.getTotalRAMUsed();
Assert.assertNotNull(totalRAMUsed);
}
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.woorea.openstack.nova.model.Server.Addresses.Address;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"version\" : \"version\"," + EOL
- + " \"addr\" : \"addr\"," + EOL
- + " \"OS-EXT-IPS-MAC:mac_addr\" : \"macaddr\"," + EOL
- + " \"OS-EXT-IPS:type\" : \"type\"" + EOL
- + "}";
+ private static final String JSON_FULL = "{" + EOL + " \"version\" : \"version\"," + EOL + " \"addr\" : \"addr\","
+ + EOL + " \"OS-EXT-IPS-MAC:mac_addr\" : \"macaddr\"," + EOL + " \"OS-EXT-IPS:type\" : \"type\"" + EOL
+ + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
Address address = objectMapper.readValue(JSON_FULL, Address.class);
address.toString();
-
+
String type = address.getType();
Assert.assertNotNull(type);
address.setType(type);
-
+
String addr = address.getAddr();
Assert.assertNotNull(addr);
address.setAddr(addr);
-
+
String version = address.getVersion();
Assert.assertNotNull(version);
address.setVersion(version);
-
+
String macAddr = address.getMacAddr();
Assert.assertNotNull(macAddr);
address.setMacAddr(macAddr);
import com.fasterxml.jackson.databind.SerializationFeature;
import com.woorea.openstack.nova.model.Server.Addresses;
import com.woorea.openstack.nova.model.Server.Addresses.Address;
-
import java.util.List;
import java.util.Map;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"addresses\" : {" + EOL
- + " \"addresses-k1\" : [ {" + EOL
- + " \"version\" : \"version\"," + EOL
- + " \"addr\" : \"addr\"," + EOL
- + " \"OS-EXT-IPS-MAC:mac_addr\" : \"macaddr\"," + EOL
- + " \"OS-EXT-IPS:type\" : \"type\"" + EOL
- + " }, {" + EOL
- + " \"version\" : \"version\"," + EOL
- + " \"addr\" : \"addr\"," + EOL
- + " \"OS-EXT-IPS-MAC:mac_addr\" : \"macaddr\"," + EOL
- + " \"OS-EXT-IPS:type\" : \"type\"" + EOL
- + " } ]," + EOL
- + " \"addresses-k2\" : [ {" + EOL
- + " \"version\" : \"version\"," + EOL
- + " \"addr\" : \"addr\"," + EOL
- + " \"OS-EXT-IPS-MAC:mac_addr\" : \"macaddr\"," + EOL
- + " \"OS-EXT-IPS:type\" : \"type\"" + EOL
- + " }, {" + EOL
- + " \"version\" : \"version\"," + EOL
- + " \"addr\" : \"addr\"," + EOL
- + " \"OS-EXT-IPS-MAC:mac_addr\" : \"macaddr\"," + EOL
- + " \"OS-EXT-IPS:type\" : \"type\"" + EOL
- + " } ]" + EOL
- + " }" + EOL
- + "}";
+ private static final String JSON_FULL = "{" + EOL + " \"addresses\" : {" + EOL + " \"addresses-k1\" : [ {" + EOL
+ + " \"version\" : \"version\"," + EOL + " \"addr\" : \"addr\"," + EOL
+ + " \"OS-EXT-IPS-MAC:mac_addr\" : \"macaddr\"," + EOL + " \"OS-EXT-IPS:type\" : \"type\"" + EOL
+ + " }, {" + EOL + " \"version\" : \"version\"," + EOL + " \"addr\" : \"addr\"," + EOL
+ + " \"OS-EXT-IPS-MAC:mac_addr\" : \"macaddr\"," + EOL + " \"OS-EXT-IPS:type\" : \"type\"" + EOL
+ + " } ]," + EOL + " \"addresses-k2\" : [ {" + EOL + " \"version\" : \"version\"," + EOL
+ + " \"addr\" : \"addr\"," + EOL + " \"OS-EXT-IPS-MAC:mac_addr\" : \"macaddr\"," + EOL
+ + " \"OS-EXT-IPS:type\" : \"type\"" + EOL + " }, {" + EOL + " \"version\" : \"version\"," + EOL
+ + " \"addr\" : \"addr\"," + EOL + " \"OS-EXT-IPS-MAC:mac_addr\" : \"macaddr\"," + EOL
+ + " \"OS-EXT-IPS:type\" : \"type\"" + EOL + " } ]" + EOL + " }" + EOL + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
Addresses addresses = objectMapper.readValue(JSON_FULL, Addresses.class);
addresses.toString();
-
- Map<String,List<Address>> addressesProperty = addresses.getAddresses();
+
+ Map<String, List<Address>> addressesProperty = addresses.getAddresses();
Assert.assertNotNull(addressesProperty);
Assert.assertEquals(2, addressesProperty.size());
}
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.woorea.openstack.nova.model.ServerAction.AssociateFloatingIp;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"addFloatingIp\" : {" + EOL
- + " \"address\" : \"address\"" + EOL
- + " }" + EOL
- + "}";
+ private static final String JSON_FULL =
+ "{" + EOL + " \"addFloatingIp\" : {" + EOL + " \"address\" : \"address\"" + EOL + " }" + EOL + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(SerializationFeature.WRAP_ROOT_VALUE)
- .enable(DeserializationFeature.UNWRAP_ROOT_VALUE)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE)
+ .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
AssociateFloatingIp associatefloatingip = objectMapper.readValue(JSON_FULL, AssociateFloatingIp.class);
associatefloatingip.toString();
-
+
String address = associatefloatingip.getAddress();
Assert.assertNotNull(address);
associatefloatingip.setAddress(address);
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"certificate\" : {" + EOL
- + " \"data\" : \"data\"," + EOL
- + " \"private_key\" : \"privatekey\"" + EOL
- + " }" + EOL
- + "}";
+ private static final String JSON_FULL = "{" + EOL + " \"certificate\" : {" + EOL + " \"data\" : \"data\"," + EOL
+ + " \"private_key\" : \"privatekey\"" + EOL + " }" + EOL + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(SerializationFeature.WRAP_ROOT_VALUE)
- .enable(DeserializationFeature.UNWRAP_ROOT_VALUE)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE)
+ .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
Certificate certificate = objectMapper.readValue(JSON_FULL, Certificate.class);
certificate.toString();
-
+
String privateKey = certificate.getPrivateKey();
Assert.assertNotNull(privateKey);
-
+
String data = certificate.getData();
Assert.assertNotNull(data);
}
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.woorea.openstack.nova.model.ServerAction.ChangePassword;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"changePassword\" : {" + EOL
- + " \"adminPass\" : \"adminpass\"" + EOL
- + " }" + EOL
- + "}";
+ private static final String JSON_FULL = "{" + EOL + " \"changePassword\" : {" + EOL
+ + " \"adminPass\" : \"adminpass\"" + EOL + " }" + EOL + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(SerializationFeature.WRAP_ROOT_VALUE)
- .enable(DeserializationFeature.UNWRAP_ROOT_VALUE)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE)
+ .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
ChangePassword changepassword = objectMapper.readValue(JSON_FULL, ChangePassword.class);
changepassword.toString();
-
+
String adminPass = changepassword.getAdminPass();
Assert.assertNotNull(adminPass);
changepassword.setAdminPass(adminPass);
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
-
import java.util.Calendar;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"cloudpipe\" : {" + EOL
- + " \"projectId\" : \"projectid\"," + EOL
- + " \"internalIp\" : \"internalip\"," + EOL
- + " \"publicIp\" : \"publicip\"," + EOL
- + " \"publicPort\" : \"publicport\"," + EOL
- + " \"state\" : \"state\"," + EOL
- + " \"instanceId\" : \"instanceid\"," + EOL
- + " \"createdAt\" : 1486296000000" + EOL
- + " }" + EOL
- + "}";
+ private static final String JSON_FULL = "{" + EOL + " \"cloudpipe\" : {" + EOL
+ + " \"projectId\" : \"projectid\"," + EOL + " \"internalIp\" : \"internalip\"," + EOL
+ + " \"publicIp\" : \"publicip\"," + EOL + " \"publicPort\" : \"publicport\"," + EOL
+ + " \"state\" : \"state\"," + EOL + " \"instanceId\" : \"instanceid\"," + EOL
+ + " \"createdAt\" : 1486296000000" + EOL + " }" + EOL + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(SerializationFeature.WRAP_ROOT_VALUE)
- .enable(DeserializationFeature.UNWRAP_ROOT_VALUE)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE)
+ .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
Cloudpipe cloudpipe = objectMapper.readValue(JSON_FULL, Cloudpipe.class);
cloudpipe.toString();
-
+
Calendar createdAt = cloudpipe.getCreatedAt();
Assert.assertNotNull(createdAt);
cloudpipe.setCreatedAt(createdAt);
-
+
String instanceId = cloudpipe.getInstanceId();
Assert.assertNotNull(instanceId);
cloudpipe.setInstanceId(instanceId);
-
+
String publicIp = cloudpipe.getPublicIp();
Assert.assertNotNull(publicIp);
cloudpipe.setPublicIp(publicIp);
-
+
String publicPort = cloudpipe.getPublicPort();
Assert.assertNotNull(publicPort);
cloudpipe.setPublicPort(publicPort);
-
+
String state = cloudpipe.getState();
Assert.assertNotNull(state);
cloudpipe.setState(state);
-
+
String projectId = cloudpipe.getProjectId();
Assert.assertNotNull(projectId);
cloudpipe.setProjectId(projectId);
-
+
String internalIp = cloudpipe.getInternalIp();
Assert.assertNotNull(internalIp);
cloudpipe.setInternalIp(internalIp);
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
-
import java.util.List;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"cloudpipes\" : [ {" + EOL
- + " \"projectId\" : \"projectid\"," + EOL
- + " \"internalIp\" : \"internalip\"," + EOL
- + " \"publicIp\" : \"publicip\"," + EOL
- + " \"publicPort\" : \"publicport\"," + EOL
- + " \"state\" : \"state\"," + EOL
- + " \"instanceId\" : \"instanceid\"," + EOL
- + " \"createdAt\" : 1486296000000" + EOL
- + " }, {" + EOL
- + " \"projectId\" : \"projectid\"," + EOL
- + " \"internalIp\" : \"internalip\"," + EOL
- + " \"publicIp\" : \"publicip\"," + EOL
- + " \"publicPort\" : \"publicport\"," + EOL
- + " \"state\" : \"state\"," + EOL
- + " \"instanceId\" : \"instanceid\"," + EOL
- + " \"createdAt\" : 1486296000000" + EOL
- + " } ]" + EOL
- + "}";
+ private static final String JSON_FULL = "{" + EOL + " \"cloudpipes\" : [ {" + EOL
+ + " \"projectId\" : \"projectid\"," + EOL + " \"internalIp\" : \"internalip\"," + EOL
+ + " \"publicIp\" : \"publicip\"," + EOL + " \"publicPort\" : \"publicport\"," + EOL
+ + " \"state\" : \"state\"," + EOL + " \"instanceId\" : \"instanceid\"," + EOL
+ + " \"createdAt\" : 1486296000000" + EOL + " }, {" + EOL + " \"projectId\" : \"projectid\"," + EOL
+ + " \"internalIp\" : \"internalip\"," + EOL + " \"publicIp\" : \"publicip\"," + EOL
+ + " \"publicPort\" : \"publicport\"," + EOL + " \"state\" : \"state\"," + EOL
+ + " \"instanceId\" : \"instanceid\"," + EOL + " \"createdAt\" : 1486296000000" + EOL + " } ]" + EOL
+ + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
Cloudpipes cloudpipes = objectMapper.readValue(JSON_FULL, Cloudpipes.class);
cloudpipes.toString();
-
+
List<Cloudpipe> list = cloudpipes.getList();
Assert.assertNotNull(list);
Assert.assertEquals(2, list.size());
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.woorea.openstack.nova.model.ServerAction.ConfirmResize;
-
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
import org.skyscreamer.jsonassert.JSONCompareMode;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"confirmResize\" : { }" + EOL
- + "}";
+ private static final String JSON_FULL = "{" + EOL + " \"confirmResize\" : { }" + EOL + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(SerializationFeature.WRAP_ROOT_VALUE)
- .enable(DeserializationFeature.UNWRAP_ROOT_VALUE)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE)
+ .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.woorea.openstack.nova.model.ServerAction.ConsoleOutput;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"output\" : \"output\"" + EOL
- + "}";
+ private static final String JSON_FULL = "{" + EOL + " \"output\" : \"output\"" + EOL + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
ConsoleOutput consoleoutput = objectMapper.readValue(JSON_FULL, ConsoleOutput.class);
consoleoutput.toString();
-
+
String output = consoleoutput.getOutput();
Assert.assertNotNull(output);
}
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.woorea.openstack.nova.model.ServerAction.CreateBackup;
-
import java.util.Map;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"createBackup\" : {" + EOL
- + " \"name\" : \"name\"," + EOL
- + " \"rotation\" : \"rotation\"," + EOL
- + " \"metadata\" : {" + EOL
- + " \"metadata-k1\" : \"metadata-v1\"," + EOL
- + " \"metadata-k2\" : \"metadata-v2\"" + EOL
- + " }," + EOL
- + " \"backup_type\" : \"type\"" + EOL
- + " }" + EOL
- + "}";
+ private static final String JSON_FULL = "{" + EOL + " \"createBackup\" : {" + EOL + " \"name\" : \"name\","
+ + EOL + " \"rotation\" : \"rotation\"," + EOL + " \"metadata\" : {" + EOL
+ + " \"metadata-k1\" : \"metadata-v1\"," + EOL + " \"metadata-k2\" : \"metadata-v2\"" + EOL
+ + " }," + EOL + " \"backup_type\" : \"type\"" + EOL + " }" + EOL + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(SerializationFeature.WRAP_ROOT_VALUE)
- .enable(DeserializationFeature.UNWRAP_ROOT_VALUE)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE)
+ .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
CreateBackup createbackup = objectMapper.readValue(JSON_FULL, CreateBackup.class);
createbackup.toString();
-
- Map<String,String> metadata = createbackup.getMetadata();
+
+ Map<String, String> metadata = createbackup.getMetadata();
Assert.assertNotNull(metadata);
Assert.assertEquals(2, metadata.size());
createbackup.setMetadata(metadata);
-
+
String rotation = createbackup.getRotation();
Assert.assertNotNull(rotation);
createbackup.setRotation(rotation);
-
+
String name = createbackup.getName();
Assert.assertNotNull(name);
createbackup.setName(name);
-
+
String type = createbackup.getType();
Assert.assertNotNull(type);
createbackup.setType(type);
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.woorea.openstack.nova.model.ServerAction.CreateImage;
-
import java.util.Map;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"createImage\" : {" + EOL
- + " \"name\" : \"name\"," + EOL
- + " \"metadata\" : {" + EOL
- + " \"metadata-k1\" : \"metadata-v1\"," + EOL
- + " \"metadata-k2\" : \"metadata-v2\"" + EOL
- + " }" + EOL
- + " }" + EOL
- + "}";
+ private static final String JSON_FULL = "{" + EOL + " \"createImage\" : {" + EOL + " \"name\" : \"name\"," + EOL
+ + " \"metadata\" : {" + EOL + " \"metadata-k1\" : \"metadata-v1\"," + EOL
+ + " \"metadata-k2\" : \"metadata-v2\"" + EOL + " }" + EOL + " }" + EOL + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(SerializationFeature.WRAP_ROOT_VALUE)
- .enable(DeserializationFeature.UNWRAP_ROOT_VALUE)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE)
+ .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
CreateImage createimage = objectMapper.readValue(JSON_FULL, CreateImage.class);
createimage.toString();
-
- Map<String,String> metadata = createimage.getMetadata();
+
+ Map<String, String> metadata = createimage.getMetadata();
Assert.assertNotNull(metadata);
Assert.assertEquals(2, metadata.size());
createimage.setMetadata(metadata);
-
+
String name = createimage.getName();
Assert.assertNotNull(name);
createimage.setName(name);
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.woorea.openstack.nova.model.ServerAction.DisassociateFloatingIp;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"removeFloatingIp\" : {" + EOL
- + " \"address\" : \"address\"" + EOL
- + " }" + EOL
- + "}";
+ private static final String JSON_FULL =
+ "{" + EOL + " \"removeFloatingIp\" : {" + EOL + " \"address\" : \"address\"" + EOL + " }" + EOL + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(SerializationFeature.WRAP_ROOT_VALUE)
- .enable(DeserializationFeature.UNWRAP_ROOT_VALUE)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE)
+ .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
DisassociateFloatingIp disassociatefloatingip = objectMapper.readValue(JSON_FULL, DisassociateFloatingIp.class);
disassociatefloatingip.toString();
-
+
String address = disassociatefloatingip.getAddress();
Assert.assertNotNull(address);
disassociatefloatingip.setAddress(address);
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
-
import java.util.Calendar;
import java.util.List;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"extension\" : {" + EOL
- + " \"alias\" : \"alias\"," + EOL
- + " \"description\" : \"description\"," + EOL
- + " \"name\" : \"name\"," + EOL
- + " \"namespace\" : \"namespace\"," + EOL
- + " \"updated\" : 1486468800000," + EOL
- + " \"links\" : [ {" + EOL
- + " \"rel\" : \"rel\"," + EOL
- + " \"href\" : \"href\"," + EOL
- + " \"type\" : \"type\"" + EOL
- + " }, {" + EOL
- + " \"rel\" : \"rel\"," + EOL
- + " \"href\" : \"href\"," + EOL
- + " \"type\" : \"type\"" + EOL
- + " } ]" + EOL
- + " }" + EOL
- + "}";
+ private static final String JSON_FULL = "{" + EOL + " \"extension\" : {" + EOL + " \"alias\" : \"alias\"," + EOL
+ + " \"description\" : \"description\"," + EOL + " \"name\" : \"name\"," + EOL
+ + " \"namespace\" : \"namespace\"," + EOL + " \"updated\" : 1486468800000," + EOL
+ + " \"links\" : [ {" + EOL + " \"rel\" : \"rel\"," + EOL + " \"href\" : \"href\"," + EOL
+ + " \"type\" : \"type\"" + EOL + " }, {" + EOL + " \"rel\" : \"rel\"," + EOL
+ + " \"href\" : \"href\"," + EOL + " \"type\" : \"type\"" + EOL + " } ]" + EOL + " }" + EOL
+ + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(SerializationFeature.WRAP_ROOT_VALUE)
- .enable(DeserializationFeature.UNWRAP_ROOT_VALUE)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE)
+ .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
Extension extension = objectMapper.readValue(JSON_FULL, Extension.class);
extension.toString();
-
+
String name = extension.getName();
Assert.assertNotNull(name);
-
+
String namespace = extension.getNamespace();
Assert.assertNotNull(namespace);
-
+
String alias = extension.getAlias();
Assert.assertNotNull(alias);
-
+
String description = extension.getDescription();
Assert.assertNotNull(description);
-
+
List<Link> links = extension.getLinks();
Assert.assertNotNull(links);
Assert.assertEquals(2, links.size());
-
+
Calendar updated = extension.getUpdated();
Assert.assertNotNull(updated);
}
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
-
import java.util.List;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"extensions\" : [ {" + EOL
- + " \"alias\" : \"alias\"," + EOL
- + " \"description\" : \"description\"," + EOL
- + " \"name\" : \"name\"," + EOL
- + " \"namespace\" : \"namespace\"," + EOL
- + " \"updated\" : 1486468800000," + EOL
- + " \"links\" : [ {" + EOL
- + " \"rel\" : \"rel\"," + EOL
- + " \"href\" : \"href\"," + EOL
- + " \"type\" : \"type\"" + EOL
- + " }, {" + EOL
- + " \"rel\" : \"rel\"," + EOL
- + " \"href\" : \"href\"," + EOL
- + " \"type\" : \"type\"" + EOL
- + " } ]" + EOL
- + " }, {" + EOL
- + " \"alias\" : \"alias\"," + EOL
- + " \"description\" : \"description\"," + EOL
- + " \"name\" : \"name\"," + EOL
- + " \"namespace\" : \"namespace\"," + EOL
- + " \"updated\" : 1486468800000," + EOL
- + " \"links\" : [ {" + EOL
- + " \"rel\" : \"rel\"," + EOL
- + " \"href\" : \"href\"," + EOL
- + " \"type\" : \"type\"" + EOL
- + " }, {" + EOL
- + " \"rel\" : \"rel\"," + EOL
- + " \"href\" : \"href\"," + EOL
- + " \"type\" : \"type\"" + EOL
- + " } ]" + EOL
- + " } ]" + EOL
- + "}";
+ private static final String JSON_FULL = "{" + EOL + " \"extensions\" : [ {" + EOL + " \"alias\" : \"alias\","
+ + EOL + " \"description\" : \"description\"," + EOL + " \"name\" : \"name\"," + EOL
+ + " \"namespace\" : \"namespace\"," + EOL + " \"updated\" : 1486468800000," + EOL
+ + " \"links\" : [ {" + EOL + " \"rel\" : \"rel\"," + EOL + " \"href\" : \"href\"," + EOL
+ + " \"type\" : \"type\"" + EOL + " }, {" + EOL + " \"rel\" : \"rel\"," + EOL
+ + " \"href\" : \"href\"," + EOL + " \"type\" : \"type\"" + EOL + " } ]" + EOL + " }, {" + EOL
+ + " \"alias\" : \"alias\"," + EOL + " \"description\" : \"description\"," + EOL
+ + " \"name\" : \"name\"," + EOL + " \"namespace\" : \"namespace\"," + EOL
+ + " \"updated\" : 1486468800000," + EOL + " \"links\" : [ {" + EOL + " \"rel\" : \"rel\"," + EOL
+ + " \"href\" : \"href\"," + EOL + " \"type\" : \"type\"" + EOL + " }, {" + EOL
+ + " \"rel\" : \"rel\"," + EOL + " \"href\" : \"href\"," + EOL + " \"type\" : \"type\"" + EOL
+ + " } ]" + EOL + " } ]" + EOL + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
Extensions extensions = objectMapper.readValue(JSON_FULL, Extensions.class);
extensions.toString();
-
+
List<Extension> list = extensions.getList();
Assert.assertNotNull(list);
Assert.assertEquals(2, list.size());
-
+
int cnt = 0;
- for (@SuppressWarnings("unused") Extension x : extensions) {
+ for (@SuppressWarnings("unused")
+ Extension x : extensions) {
++cnt;
}
Assert.assertEquals(2, cnt);
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.woorea.openstack.nova.model.Server.Fault;
-
import java.util.Calendar;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"code\" : 29," + EOL
- + " \"message\" : \"message\"," + EOL
- + " \"details\" : \"details\"," + EOL
- + " \"created\" : 1485172800000" + EOL
- + "}";
+ private static final String JSON_FULL = "{" + EOL + " \"code\" : 29," + EOL + " \"message\" : \"message\"," + EOL
+ + " \"details\" : \"details\"," + EOL + " \"created\" : 1485172800000" + EOL + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
Fault fault = objectMapper.readValue(JSON_FULL, Fault.class);
fault.toString();
-
+
Integer code = fault.getCode();
Assert.assertNotNull(code);
-
+
Calendar created = fault.getCreated();
Assert.assertNotNull(created);
-
+
String details = fault.getDetails();
Assert.assertNotNull(details);
-
+
String message = fault.getMessage();
Assert.assertNotNull(message);
}
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"flavor\" : {" + EOL
- + " \"id\" : \"id\"," + EOL
- + " \"name\" : \"name\"," + EOL
- + " \"vcpus\" : \"vcpus\"," + EOL
- + " \"ram\" : 38," + EOL
- + " \"disk\" : \"disk\"," + EOL
- + " \"swap\" : \"swap\"," + EOL
- + " \"OS-FLV-EXT-DATA:ephemeral\" : 65," + EOL
- + " \"rxtx_factor\" : 11.0" + EOL
- + " }" + EOL
- + "}";
-
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(SerializationFeature.WRAP_ROOT_VALUE)
- .enable(DeserializationFeature.UNWRAP_ROOT_VALUE)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private static final String JSON_FULL = "{" + EOL + " \"flavor\" : {" + EOL + " \"id\" : \"id\"," + EOL
+ + " \"name\" : \"name\"," + EOL + " \"vcpus\" : \"vcpus\"," + EOL + " \"ram\" : 38," + EOL
+ + " \"disk\" : \"disk\"," + EOL + " \"swap\" : \"swap\"," + EOL
+ + " \"OS-FLV-EXT-DATA:ephemeral\" : 65," + EOL + " \"rxtx_factor\" : 11.0" + EOL + " }" + EOL + "}";
+
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE)
+ .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
FlavorForCreate flavorforcreate = objectMapper.readValue(JSON_FULL, FlavorForCreate.class);
flavorforcreate.toString();
-
+
String disk = flavorforcreate.getDisk();
Assert.assertNotNull(disk);
flavorforcreate.setDisk(disk);
-
+
String swap = flavorforcreate.getSwap();
Assert.assertNotNull(swap);
flavorforcreate.setSwap(swap);
-
+
String name = flavorforcreate.getName();
Assert.assertNotNull(name);
flavorforcreate.setName(name);
-
+
Float rxtxFactor = flavorforcreate.getRxtxFactor();
Assert.assertNotNull(rxtxFactor);
flavorforcreate.setRxtxFactor(rxtxFactor);
-
+
Integer ephemeral = flavorforcreate.getEphemeral();
Assert.assertNotNull(ephemeral);
flavorforcreate.setEphemeral(ephemeral);
-
+
String id = flavorforcreate.getId();
Assert.assertNotNull(id);
flavorforcreate.setId(id);
-
+
String vcpus = flavorforcreate.getVcpus();
Assert.assertNotNull(vcpus);
flavorforcreate.setVcpus(vcpus);
-
+
Integer ram = flavorforcreate.getRam();
Assert.assertNotNull(ram);
flavorforcreate.setRam(ram);
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
-
import java.util.List;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"flavor\" : {" + EOL
- + " \"id\" : \"id\"," + EOL
- + " \"name\" : \"name\"," + EOL
- + " \"vcpus\" : 79," + EOL
- + " \"ram\" : 38," + EOL
- + " \"disk\" : 45," + EOL
- + " \"swap\" : \"swap\"," + EOL
- + " \"links\" : [ {" + EOL
- + " \"rel\" : \"rel\"," + EOL
- + " \"href\" : \"href\"," + EOL
- + " \"type\" : \"type\"" + EOL
- + " }, {" + EOL
- + " \"rel\" : \"rel\"," + EOL
- + " \"href\" : \"href\"," + EOL
- + " \"type\" : \"type\"" + EOL
- + " } ]," + EOL
- + " \"public\" : false," + EOL
- + " \"OS-FLV-EXT-DATA:ephemeral\" : 65," + EOL
- + " \"rxtx_factor\" : 11.0," + EOL
- + " \"OS-FLV-DISABLED:disabled\" : true," + EOL
- + " \"rxtx_quota\" : 42," + EOL
- + " \"rxtx_cap\" : 96," + EOL
- + " \"os-flavor-access:is_public\" : false" + EOL
- + " }" + EOL
- + "}";
-
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(SerializationFeature.WRAP_ROOT_VALUE)
- .enable(DeserializationFeature.UNWRAP_ROOT_VALUE)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private static final String JSON_FULL = "{" + EOL + " \"flavor\" : {" + EOL + " \"id\" : \"id\"," + EOL
+ + " \"name\" : \"name\"," + EOL + " \"vcpus\" : 79," + EOL + " \"ram\" : 38," + EOL
+ + " \"disk\" : 45," + EOL + " \"swap\" : \"swap\"," + EOL + " \"links\" : [ {" + EOL
+ + " \"rel\" : \"rel\"," + EOL + " \"href\" : \"href\"," + EOL + " \"type\" : \"type\"" + EOL
+ + " }, {" + EOL + " \"rel\" : \"rel\"," + EOL + " \"href\" : \"href\"," + EOL
+ + " \"type\" : \"type\"" + EOL + " } ]," + EOL + " \"public\" : false," + EOL
+ + " \"OS-FLV-EXT-DATA:ephemeral\" : 65," + EOL + " \"rxtx_factor\" : 11.0," + EOL
+ + " \"OS-FLV-DISABLED:disabled\" : true," + EOL + " \"rxtx_quota\" : 42," + EOL
+ + " \"rxtx_cap\" : 96," + EOL + " \"os-flavor-access:is_public\" : false" + EOL + " }" + EOL + "}";
+
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE)
+ .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
Flavor flavor = objectMapper.readValue(JSON_FULL, Flavor.class);
flavor.toString();
-
+
Integer rxtxQuota = flavor.getRxtxQuota();
Assert.assertNotNull(rxtxQuota);
flavor.setRxtxQuota(rxtxQuota);
-
+
String swap = flavor.getSwap();
Assert.assertNotNull(swap);
flavor.setSwap(swap);
-
+
Float rxtxFactor = flavor.getRxtxFactor();
Assert.assertNotNull(rxtxFactor);
flavor.setRxtxFactor(rxtxFactor);
-
+
Integer ephemeral = flavor.getEphemeral();
Assert.assertNotNull(ephemeral);
flavor.setEphemeral(ephemeral);
-
+
Integer vcpus = flavor.getVcpus();
Assert.assertNotNull(vcpus);
flavor.setVcpus(vcpus);
-
+
Integer rxtxCap = flavor.getRxtxCap();
Assert.assertNotNull(rxtxCap);
flavor.setRxtxCap(rxtxCap);
-
+
Integer disk = flavor.getDisk();
Assert.assertNotNull(disk);
flavor.setDisk(disk);
-
+
String name = flavor.getName();
Assert.assertNotNull(name);
flavor.setName(name);
-
+
List<Link> links = flavor.getLinks();
Assert.assertNotNull(links);
Assert.assertEquals(2, links.size());
flavor.setLinks(links);
-
+
Boolean disabled = flavor.getDisabled();
Assert.assertNotNull(disabled);
flavor.setDisabled(disabled);
-
+
String id = flavor.getId();
Assert.assertNotNull(id);
flavor.setId(id);
-
+
Integer ram = flavor.getRam();
Assert.assertNotNull(ram);
flavor.setRam(ram);
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
-
import java.util.List;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"flavors\" : [ {" + EOL
- + " \"id\" : \"id\"," + EOL
- + " \"name\" : \"name\"," + EOL
- + " \"vcpus\" : 79," + EOL
- + " \"ram\" : 38," + EOL
- + " \"disk\" : 45," + EOL
- + " \"swap\" : \"swap\"," + EOL
- + " \"links\" : [ {" + EOL
- + " \"rel\" : \"rel\"," + EOL
- + " \"href\" : \"href\"," + EOL
- + " \"type\" : \"type\"" + EOL
- + " }, {" + EOL
- + " \"rel\" : \"rel\"," + EOL
- + " \"href\" : \"href\"," + EOL
- + " \"type\" : \"type\"" + EOL
- + " } ]," + EOL
- + " \"public\" : false," + EOL
- + " \"OS-FLV-EXT-DATA:ephemeral\" : 65," + EOL
- + " \"rxtx_factor\" : 11.0," + EOL
- + " \"OS-FLV-DISABLED:disabled\" : true," + EOL
- + " \"rxtx_quota\" : 42," + EOL
- + " \"rxtx_cap\" : 96," + EOL
- + " \"os-flavor-access:is_public\" : false" + EOL
- + " }, {" + EOL
- + " \"id\" : \"id\"," + EOL
- + " \"name\" : \"name\"," + EOL
- + " \"vcpus\" : 79," + EOL
- + " \"ram\" : 38," + EOL
- + " \"disk\" : 45," + EOL
- + " \"swap\" : \"swap\"," + EOL
- + " \"links\" : [ {" + EOL
- + " \"rel\" : \"rel\"," + EOL
- + " \"href\" : \"href\"," + EOL
- + " \"type\" : \"type\"" + EOL
- + " }, {" + EOL
- + " \"rel\" : \"rel\"," + EOL
- + " \"href\" : \"href\"," + EOL
- + " \"type\" : \"type\"" + EOL
- + " } ]," + EOL
- + " \"public\" : false," + EOL
- + " \"OS-FLV-EXT-DATA:ephemeral\" : 65," + EOL
- + " \"rxtx_factor\" : 11.0," + EOL
- + " \"OS-FLV-DISABLED:disabled\" : true," + EOL
- + " \"rxtx_quota\" : 42," + EOL
- + " \"rxtx_cap\" : 96," + EOL
- + " \"os-flavor-access:is_public\" : false" + EOL
- + " } ]" + EOL
- + "}";
+ private static final String JSON_FULL = "{" + EOL + " \"flavors\" : [ {" + EOL + " \"id\" : \"id\"," + EOL
+ + " \"name\" : \"name\"," + EOL + " \"vcpus\" : 79," + EOL + " \"ram\" : 38," + EOL
+ + " \"disk\" : 45," + EOL + " \"swap\" : \"swap\"," + EOL + " \"links\" : [ {" + EOL
+ + " \"rel\" : \"rel\"," + EOL + " \"href\" : \"href\"," + EOL + " \"type\" : \"type\"" + EOL
+ + " }, {" + EOL + " \"rel\" : \"rel\"," + EOL + " \"href\" : \"href\"," + EOL
+ + " \"type\" : \"type\"" + EOL + " } ]," + EOL + " \"public\" : false," + EOL
+ + " \"OS-FLV-EXT-DATA:ephemeral\" : 65," + EOL + " \"rxtx_factor\" : 11.0," + EOL
+ + " \"OS-FLV-DISABLED:disabled\" : true," + EOL + " \"rxtx_quota\" : 42," + EOL
+ + " \"rxtx_cap\" : 96," + EOL + " \"os-flavor-access:is_public\" : false" + EOL + " }, {" + EOL
+ + " \"id\" : \"id\"," + EOL + " \"name\" : \"name\"," + EOL + " \"vcpus\" : 79," + EOL
+ + " \"ram\" : 38," + EOL + " \"disk\" : 45," + EOL + " \"swap\" : \"swap\"," + EOL
+ + " \"links\" : [ {" + EOL + " \"rel\" : \"rel\"," + EOL + " \"href\" : \"href\"," + EOL
+ + " \"type\" : \"type\"" + EOL + " }, {" + EOL + " \"rel\" : \"rel\"," + EOL
+ + " \"href\" : \"href\"," + EOL + " \"type\" : \"type\"" + EOL + " } ]," + EOL
+ + " \"public\" : false," + EOL + " \"OS-FLV-EXT-DATA:ephemeral\" : 65," + EOL
+ + " \"rxtx_factor\" : 11.0," + EOL + " \"OS-FLV-DISABLED:disabled\" : true," + EOL
+ + " \"rxtx_quota\" : 42," + EOL + " \"rxtx_cap\" : 96," + EOL
+ + " \"os-flavor-access:is_public\" : false" + EOL + " } ]" + EOL + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
Flavors flavors = objectMapper.readValue(JSON_FULL, Flavors.class);
flavors.toString();
-
+
List<Flavor> list = flavors.getList();
Assert.assertNotNull(list);
Assert.assertEquals(2, list.size());
-
+
int cnt = 0;
- for (@SuppressWarnings("unused") Flavor x : flavors) {
+ for (@SuppressWarnings("unused")
+ Flavor x : flavors) {
++cnt;
}
Assert.assertEquals(2, cnt);
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"floating-ip-pool\" : {" + EOL
- + " \"domain\" : \"domain\"," + EOL
- + " \"scope\" : \"scope\"," + EOL
- + " \"project\" : \"project\"," + EOL
- + " \"availabilityZone\" : \"availabilityzone\"" + EOL
- + " }" + EOL
- + "}";
+ private static final String JSON_FULL =
+ "{" + EOL + " \"floating-ip-pool\" : {" + EOL + " \"domain\" : \"domain\"," + EOL
+ + " \"scope\" : \"scope\"," + EOL + " \"project\" : \"project\"," + EOL
+ + " \"availabilityZone\" : \"availabilityzone\"" + EOL + " }" + EOL + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(SerializationFeature.WRAP_ROOT_VALUE)
- .enable(DeserializationFeature.UNWRAP_ROOT_VALUE)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE)
+ .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
FloatingIpDomain floatingipdomain = objectMapper.readValue(JSON_FULL, FloatingIpDomain.class);
floatingipdomain.toString();
-
+
String domain = floatingipdomain.getDomain();
Assert.assertNotNull(domain);
-
+
String scope = floatingipdomain.getScope();
Assert.assertNotNull(scope);
-
+
String project = floatingipdomain.getProject();
Assert.assertNotNull(project);
-
+
String availabilityZone = floatingipdomain.getAvailabilityZone();
Assert.assertNotNull(availabilityZone);
}
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
-
import java.util.List;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"domain_entries\" : [ {" + EOL
- + " \"domain\" : \"domain\"," + EOL
- + " \"scope\" : \"scope\"," + EOL
- + " \"project\" : \"project\"," + EOL
- + " \"availabilityZone\" : \"availabilityzone\"" + EOL
- + " }, {" + EOL
- + " \"domain\" : \"domain\"," + EOL
- + " \"scope\" : \"scope\"," + EOL
- + " \"project\" : \"project\"," + EOL
- + " \"availabilityZone\" : \"availabilityzone\"" + EOL
- + " } ]" + EOL
- + "}";
+ private static final String JSON_FULL = "{" + EOL + " \"domain_entries\" : [ {" + EOL
+ + " \"domain\" : \"domain\"," + EOL + " \"scope\" : \"scope\"," + EOL
+ + " \"project\" : \"project\"," + EOL + " \"availabilityZone\" : \"availabilityzone\"" + EOL
+ + " }, {" + EOL + " \"domain\" : \"domain\"," + EOL + " \"scope\" : \"scope\"," + EOL
+ + " \"project\" : \"project\"," + EOL + " \"availabilityZone\" : \"availabilityzone\"" + EOL + " } ]"
+ + EOL + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
FloatingIpDomains floatingipdomains = objectMapper.readValue(JSON_FULL, FloatingIpDomains.class);
floatingipdomains.toString();
-
+
List<FloatingIpDomain> list = floatingipdomains.getList();
Assert.assertNotNull(list);
Assert.assertEquals(2, list.size());
-
+
int cnt = 0;
- for (@SuppressWarnings("unused") FloatingIpDomain x : floatingipdomains) {
+ for (@SuppressWarnings("unused")
+ FloatingIpDomain x : floatingipdomains) {
++cnt;
}
Assert.assertEquals(2, cnt);
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.woorea.openstack.nova.model.FloatingIpPools.FloatingIpPool;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"name\" : \"name\"" + EOL
- + "}";
+ private static final String JSON_FULL = "{" + EOL + " \"name\" : \"name\"" + EOL + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
FloatingIpPool floatingippool = objectMapper.readValue(JSON_FULL, FloatingIpPool.class);
floatingippool.toString();
-
+
String name = floatingippool.getName();
Assert.assertNotNull(name);
}
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.woorea.openstack.nova.model.FloatingIpPools.FloatingIpPool;
-
import java.util.List;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"floating_ip_pools\" : [ {" + EOL
- + " \"name\" : \"name\"" + EOL
- + " }, {" + EOL
- + " \"name\" : \"name\"" + EOL
- + " } ]" + EOL
- + "}";
+ private static final String JSON_FULL = "{" + EOL + " \"floating_ip_pools\" : [ {" + EOL
+ + " \"name\" : \"name\"" + EOL + " }, {" + EOL + " \"name\" : \"name\"" + EOL + " } ]" + EOL + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
FloatingIpPools floatingippools = objectMapper.readValue(JSON_FULL, FloatingIpPools.class);
floatingippools.toString();
-
+
List<FloatingIpPool> list = floatingippools.getList();
Assert.assertNotNull(list);
Assert.assertEquals(2, list.size());
-
+
int cnt = 0;
- for (@SuppressWarnings("unused") FloatingIpPool x : floatingippools) {
+ for (@SuppressWarnings("unused")
+ FloatingIpPool x : floatingippools) {
++cnt;
}
Assert.assertEquals(2, cnt);
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"floating_ip\" : {" + EOL
- + " \"id\" : \"id\"," + EOL
- + " \"pool\" : \"pool\"," + EOL
- + " \"ip\" : \"ip\"," + EOL
- + " \"fixed_ip\" : \"fixedip\"," + EOL
- + " \"instance_id\" : \"instanceid\"" + EOL
- + " }" + EOL
- + "}";
+ private static final String JSON_FULL = "{" + EOL + " \"floating_ip\" : {" + EOL + " \"id\" : \"id\"," + EOL
+ + " \"pool\" : \"pool\"," + EOL + " \"ip\" : \"ip\"," + EOL + " \"fixed_ip\" : \"fixedip\"," + EOL
+ + " \"instance_id\" : \"instanceid\"" + EOL + " }" + EOL + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(SerializationFeature.WRAP_ROOT_VALUE)
- .enable(DeserializationFeature.UNWRAP_ROOT_VALUE)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE)
+ .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
FloatingIp floatingip = objectMapper.readValue(JSON_FULL, FloatingIp.class);
floatingip.toString();
-
+
String instanceId = floatingip.getInstanceId();
Assert.assertNotNull(instanceId);
-
+
String ip = floatingip.getIp();
Assert.assertNotNull(ip);
-
+
String pool = floatingip.getPool();
Assert.assertNotNull(pool);
-
+
String fixedIp = floatingip.getFixedIp();
Assert.assertNotNull(fixedIp);
-
+
String id = floatingip.getId();
Assert.assertNotNull(id);
}
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
-
import java.util.List;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"floating_ips\" : [ {" + EOL
- + " \"id\" : \"id\"," + EOL
- + " \"pool\" : \"pool\"," + EOL
- + " \"ip\" : \"ip\"," + EOL
- + " \"fixed_ip\" : \"fixedip\"," + EOL
- + " \"instance_id\" : \"instanceid\"" + EOL
- + " }, {" + EOL
- + " \"id\" : \"id\"," + EOL
- + " \"pool\" : \"pool\"," + EOL
- + " \"ip\" : \"ip\"," + EOL
- + " \"fixed_ip\" : \"fixedip\"," + EOL
- + " \"instance_id\" : \"instanceid\"" + EOL
- + " } ]" + EOL
- + "}";
+ private static final String JSON_FULL = "{" + EOL + " \"floating_ips\" : [ {" + EOL + " \"id\" : \"id\"," + EOL
+ + " \"pool\" : \"pool\"," + EOL + " \"ip\" : \"ip\"," + EOL + " \"fixed_ip\" : \"fixedip\"," + EOL
+ + " \"instance_id\" : \"instanceid\"" + EOL + " }, {" + EOL + " \"id\" : \"id\"," + EOL
+ + " \"pool\" : \"pool\"," + EOL + " \"ip\" : \"ip\"," + EOL + " \"fixed_ip\" : \"fixedip\"," + EOL
+ + " \"instance_id\" : \"instanceid\"" + EOL + " } ]" + EOL + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
FloatingIps floatingips = objectMapper.readValue(JSON_FULL, FloatingIps.class);
floatingips.toString();
-
+
List<FloatingIp> list = floatingips.getList();
Assert.assertNotNull(list);
Assert.assertEquals(2, list.size());
-
+
int cnt = 0;
- for (@SuppressWarnings("unused") FloatingIp x : floatingips) {
+ for (@SuppressWarnings("unused")
+ FloatingIp x : floatingips) {
++cnt;
}
Assert.assertEquals(2, cnt);
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.woorea.openstack.nova.model.ServerAction.ForceDelete;
-
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
import org.skyscreamer.jsonassert.JSONCompareMode;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"forceDelete\" : { }" + EOL
- + "}";
+ private static final String JSON_FULL = "{" + EOL + " \"forceDelete\" : { }" + EOL + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(SerializationFeature.WRAP_ROOT_VALUE)
- .enable(DeserializationFeature.UNWRAP_ROOT_VALUE)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE)
+ .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.woorea.openstack.nova.model.ServerAction.GetConsoleOutput;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"os-getConsoleOutput\" : {" + EOL
- + " \"length\" : 60" + EOL
- + " }" + EOL
- + "}";
+ private static final String JSON_FULL =
+ "{" + EOL + " \"os-getConsoleOutput\" : {" + EOL + " \"length\" : 60" + EOL + " }" + EOL + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(SerializationFeature.WRAP_ROOT_VALUE)
- .enable(DeserializationFeature.UNWRAP_ROOT_VALUE)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE)
+ .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
GetConsoleOutput getconsoleoutput = objectMapper.readValue(JSON_FULL, GetConsoleOutput.class);
getconsoleoutput.toString();
-
+
Integer length = getconsoleoutput.getLength();
Assert.assertNotNull(length);
getconsoleoutput.setLength(length);
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.woorea.openstack.nova.model.ServerAction.GetVncConsole;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"os-getVNCConsole\" : {" + EOL
- + " \"type\" : \"type\"" + EOL
- + " }" + EOL
- + "}";
+ private static final String JSON_FULL =
+ "{" + EOL + " \"os-getVNCConsole\" : {" + EOL + " \"type\" : \"type\"" + EOL + " }" + EOL + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(SerializationFeature.WRAP_ROOT_VALUE)
- .enable(DeserializationFeature.UNWRAP_ROOT_VALUE)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE)
+ .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
GetVncConsole getvncconsole = objectMapper.readValue(JSON_FULL, GetVncConsole.class);
getvncconsole.toString();
-
+
String type = getvncconsole.getType();
Assert.assertNotNull(type);
getvncconsole.setType(type);
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.woorea.openstack.nova.model.SecurityGroup.Rule.Group;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"name\" : \"name\"," + EOL
- + " \"tenant_id\" : \"tenantid\"" + EOL
- + "}";
+ private static final String JSON_FULL =
+ "{" + EOL + " \"name\" : \"name\"," + EOL + " \"tenant_id\" : \"tenantid\"" + EOL + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
Group group = objectMapper.readValue(JSON_FULL, Group.class);
group.toString();
-
+
String name = group.getName();
Assert.assertNotNull(name);
-
+
String tenantId = group.getTenantId();
Assert.assertNotNull(tenantId);
}
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
-
import java.util.List;
import java.util.Map;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"aggregate\" : {" + EOL
- + " \"id\" : \"id\"," + EOL
- + " \"name\" : \"name\"," + EOL
- + " \"deleted\" : false," + EOL
- + " \"hosts\" : [ \"hosts-v1\", \"hosts-v2\" ]," + EOL
- + " \"metadata\" : {" + EOL
- + " \"metadata-k1\" : \"metadata-v1\"," + EOL
- + " \"metadata-k2\" : \"metadata-v2\"" + EOL
- + " }," + EOL
- + " \"availability_zone\" : \"availabilityzone\"," + EOL
- + " \"created_at\" : \"createdat\"," + EOL
- + " \"updated_at\" : \"updatedat\"," + EOL
- + " \"deleted_at\" : \"deletedat\"" + EOL
- + " }" + EOL
- + "}";
-
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(SerializationFeature.WRAP_ROOT_VALUE)
- .enable(DeserializationFeature.UNWRAP_ROOT_VALUE)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private static final String JSON_FULL = "{" + EOL + " \"aggregate\" : {" + EOL + " \"id\" : 1," + EOL
+ + " \"name\" : \"name\"," + EOL + " \"deleted\" : false," + EOL
+ + " \"hosts\" : [ \"hosts-v1\", \"hosts-v2\" ]," + EOL + " \"metadata\" : {" + EOL
+ + " \"metadata-k1\" : \"metadata-v1\"," + EOL + " \"metadata-k2\" : \"metadata-v2\"" + EOL
+ + " }," + EOL + " \"availability_zone\" : \"availabilityzone\"," + EOL
+ + " \"created_at\" : \"2013-02-25T02:40:21Z\"," + EOL + " \"updated_at\" : \"2013-02-25T02:40:21Z\","
+ + EOL + " \"deleted_at\" : \"2013-02-25T02:40:21Z\"" + EOL + " }" + EOL + "}";
+
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE)
+ .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
HostAggregate hostaggregate = objectMapper.readValue(JSON_FULL, HostAggregate.class);
hostaggregate.toString();
-
+
String createdAt = hostaggregate.getCreatedAt();
Assert.assertNotNull(createdAt);
-
- Map<String,String> metadata = hostaggregate.getMetadata();
+
+ Map<String, String> metadata = hostaggregate.getMetadata();
Assert.assertNotNull(metadata);
Assert.assertEquals(2, metadata.size());
-
+
String deletedAt = hostaggregate.getDeletedAt();
Assert.assertNotNull(deletedAt);
-
+
Boolean deleted = hostaggregate.getDeleted();
Assert.assertNotNull(deleted);
-
+
List<String> hosts = hostaggregate.getHosts();
Assert.assertNotNull(hosts);
Assert.assertEquals(2, hosts.size());
-
+
String name = hostaggregate.getName();
Assert.assertNotNull(name);
-
- String id = hostaggregate.getId();
+
+ Integer id = hostaggregate.getId();
Assert.assertNotNull(id);
-
+
String availabilityZone = hostaggregate.getAvailabilityZone();
Assert.assertNotNull(availabilityZone);
-
+
String updatedAt = hostaggregate.getUpdatedAt();
Assert.assertNotNull(updatedAt);
}
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
-
import java.util.List;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"aggregates\" : [ {" + EOL
- + " \"id\" : \"id\"," + EOL
- + " \"name\" : \"name\"," + EOL
- + " \"deleted\" : false," + EOL
- + " \"hosts\" : [ \"hosts-v1\", \"hosts-v2\" ]," + EOL
- + " \"metadata\" : {" + EOL
- + " \"metadata-k1\" : \"metadata-v1\"," + EOL
- + " \"metadata-k2\" : \"metadata-v2\"" + EOL
- + " }," + EOL
- + " \"availability_zone\" : \"availabilityzone\"," + EOL
- + " \"created_at\" : \"createdat\"," + EOL
- + " \"updated_at\" : \"updatedat\"," + EOL
- + " \"deleted_at\" : \"deletedat\"" + EOL
- + " }, {" + EOL
- + " \"id\" : \"id\"," + EOL
- + " \"name\" : \"name\"," + EOL
- + " \"deleted\" : false," + EOL
- + " \"hosts\" : [ \"hosts-v1\", \"hosts-v2\" ]," + EOL
- + " \"metadata\" : {" + EOL
- + " \"metadata-k1\" : \"metadata-v1\"," + EOL
- + " \"metadata-k2\" : \"metadata-v2\"" + EOL
- + " }," + EOL
- + " \"availability_zone\" : \"availabilityzone\"," + EOL
- + " \"created_at\" : \"createdat\"," + EOL
- + " \"updated_at\" : \"updatedat\"," + EOL
- + " \"deleted_at\" : \"deletedat\"" + EOL
- + " } ]" + EOL
- + "}";
+ private static final String JSON_FULL = "{" + EOL + " \"aggregates\" : [ {" + EOL + " \"id\" : 1," + EOL
+ + " \"name\" : \"name\"," + EOL + " \"deleted\" : false," + EOL
+ + " \"hosts\" : [ \"hosts-v1\", \"hosts-v2\" ]," + EOL + " \"metadata\" : {" + EOL
+ + " \"metadata-k1\" : \"metadata-v1\"," + EOL + " \"metadata-k2\" : \"metadata-v2\"" + EOL
+ + " }," + EOL + " \"availability_zone\" : \"availabilityzone\"," + EOL
+ + " \"created_at\" : \"createdat\"," + EOL + " \"updated_at\" : \"updatedat\"," + EOL
+ + " \"deleted_at\" : \"deletedat\"" + EOL + " }, {" + EOL + " \"id\" : 2," + EOL
+ + " \"name\" : \"name\"," + EOL + " \"deleted\" : false," + EOL
+ + " \"hosts\" : [ \"hosts-v1\", \"hosts-v2\" ]," + EOL + " \"metadata\" : {" + EOL
+ + " \"metadata-k1\" : \"metadata-v1\"," + EOL + " \"metadata-k2\" : \"metadata-v2\"" + EOL
+ + " }," + EOL + " \"availability_zone\" : \"availabilityzone\"," + EOL
+ + " \"created_at\" : \"createdat\"," + EOL + " \"updated_at\" : \"updatedat\"," + EOL
+ + " \"deleted_at\" : \"deletedat\"" + EOL + " } ]" + EOL + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
HostAggregates hostaggregates = objectMapper.readValue(JSON_FULL, HostAggregates.class);
hostaggregates.toString();
-
+
List<HostAggregate> list = hostaggregates.getList();
Assert.assertNotNull(list);
Assert.assertEquals(2, list.size());
-
+
int cnt = 0;
- for (@SuppressWarnings("unused") HostAggregate x : hostaggregates) {
+ for (@SuppressWarnings("unused")
+ HostAggregate x : hostaggregates) {
++cnt;
}
Assert.assertEquals(2, cnt);
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.woorea.openstack.nova.model.Hosts.Host;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"zone\" : \"zone\"," + EOL
- + " \"service\" : \"service\"," + EOL
- + " \"host_name\" : \"hostname\"" + EOL
- + "}";
+ private static final String JSON_FULL = "{" + EOL + " \"zone\" : \"zone\"," + EOL + " \"service\" : \"service\","
+ + EOL + " \"host_name\" : \"hostname\"" + EOL + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
Host host = objectMapper.readValue(JSON_FULL, Host.class);
host.toString();
-
+
String hostName = host.getHostName();
Assert.assertNotNull(hostName);
-
+
String zone = host.getZone();
Assert.assertNotNull(zone);
host.setZone(zone);
-
+
String service = host.getService();
Assert.assertNotNull(service);
}
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.woorea.openstack.nova.model.Hosts.Host;
-
import java.util.List;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"hosts\" : [ {" + EOL
- + " \"zone\" : \"zone\"," + EOL
- + " \"service\" : \"service\"," + EOL
- + " \"host_name\" : \"hostname\"" + EOL
- + " }, {" + EOL
- + " \"zone\" : \"zone\"," + EOL
- + " \"service\" : \"service\"," + EOL
- + " \"host_name\" : \"hostname\"" + EOL
- + " } ]" + EOL
- + "}";
+ private static final String JSON_FULL = "{" + EOL + " \"hosts\" : [ {" + EOL + " \"zone\" : \"zone\"," + EOL
+ + " \"service\" : \"service\"," + EOL + " \"host_name\" : \"hostname\"" + EOL + " }, {" + EOL
+ + " \"zone\" : \"zone\"," + EOL + " \"service\" : \"service\"," + EOL
+ + " \"host_name\" : \"hostname\"" + EOL + " } ]" + EOL + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
Hosts hosts = objectMapper.readValue(JSON_FULL, Hosts.class);
hosts.toString();
-
+
List<Host> list = hosts.getList();
Assert.assertNotNull(list);
Assert.assertEquals(2, list.size());
-
+
int cnt = 0;
- for (@SuppressWarnings("unused") Host x : hosts) {
+ for (@SuppressWarnings("unused")
+ Host x : hosts) {
++cnt;
}
Assert.assertEquals(2, cnt);
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"os-volume_upload_image\" : {" + EOL
- + " \"id\" : \"id\"," + EOL
- + " \"updates_at\" : \"updates_at\"," + EOL
- + " \"status\" : \"status\"," + EOL
- + " \"display_description\" : \"display_description\"," + EOL
- + " \"size\" : \"size\"," + EOL
- + " \"volume_type\" : \"volume_type\"," + EOL
- + " \"image_id\" : \"image_id\"," + EOL
- + " \"container_format\" : \"container_format\"," + EOL
- + " \"disk_format\" : \"disk_format\"," + EOL
- + " \"image_name\" : \"image_name\"" + EOL
- + " }" + EOL
- + "}";
-
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(SerializationFeature.WRAP_ROOT_VALUE)
- .enable(DeserializationFeature.UNWRAP_ROOT_VALUE)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private static final String JSON_FULL = "{" + EOL + " \"os-volume_upload_image\" : {" + EOL
+ + " \"id\" : \"id\"," + EOL + " \"updates_at\" : \"updates_at\"," + EOL
+ + " \"status\" : \"status\"," + EOL + " \"display_description\" : \"display_description\"," + EOL
+ + " \"size\" : \"size\"," + EOL + " \"volume_type\" : \"volume_type\"," + EOL
+ + " \"image_id\" : \"image_id\"," + EOL + " \"container_format\" : \"container_format\"," + EOL
+ + " \"disk_format\" : \"disk_format\"," + EOL + " \"image_name\" : \"image_name\"" + EOL + " }" + EOL
+ + "}";
+
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE)
+ .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
ImageFromVolume imagefromvolume = objectMapper.readValue(JSON_FULL, ImageFromVolume.class);
imagefromvolume.toString();
-
+
String image_name = imagefromvolume.getImage_name();
Assert.assertNotNull(image_name);
imagefromvolume.setImage_name(image_name);
-
+
String display_description = imagefromvolume.getDisplay_description();
Assert.assertNotNull(display_description);
imagefromvolume.setDisplay_description(display_description);
-
+
String updates_at = imagefromvolume.getUpdates_at();
Assert.assertNotNull(updates_at);
imagefromvolume.setUpdates_at(updates_at);
-
+
String volume_type = imagefromvolume.getVolume_type();
Assert.assertNotNull(volume_type);
imagefromvolume.setVolume_type(volume_type);
-
+
String size = imagefromvolume.getSize();
Assert.assertNotNull(size);
imagefromvolume.setSize(size);
-
+
String disk_format = imagefromvolume.getDisk_format();
Assert.assertNotNull(disk_format);
imagefromvolume.setDisk_format(disk_format);
-
+
String id = imagefromvolume.getId();
Assert.assertNotNull(id);
imagefromvolume.setId(id);
-
+
String image_id = imagefromvolume.getImage_id();
Assert.assertNotNull(image_id);
imagefromvolume.setImage_id(image_id);
-
+
String container_format = imagefromvolume.getContainer_format();
Assert.assertNotNull(container_format);
imagefromvolume.setContainer_format(container_format);
-
+
String status = imagefromvolume.getStatus();
Assert.assertNotNull(status);
imagefromvolume.setStatus(status);
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.woorea.openstack.nova.model.Image.Server;
-
import java.util.Calendar;
import java.util.List;
import java.util.Map;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"image\" : {" + EOL
- + " \"id\" : \"id\"," + EOL
- + " \"status\" : \"status\"," + EOL
- + " \"name\" : \"name\"," + EOL
- + " \"progress\" : 3," + EOL
- + " \"minRam\" : 62," + EOL
- + " \"minDisk\" : 69," + EOL
- + " \"created\" : 1485172800000," + EOL
- + " \"updated\" : 1486468800000," + EOL
- + " \"metadata\" : {" + EOL
- + " \"metadata-k1\" : \"metadata-v1\"," + EOL
- + " \"metadata-k2\" : \"metadata-v2\"" + EOL
- + " }," + EOL
- + " \"server\" : {" + EOL
- + " \"id\" : \"id\"," + EOL
- + " \"links\" : [ {" + EOL
- + " \"rel\" : \"rel\"," + EOL
- + " \"href\" : \"href\"," + EOL
- + " \"type\" : \"type\"" + EOL
- + " }, {" + EOL
- + " \"rel\" : \"rel\"," + EOL
- + " \"href\" : \"href\"," + EOL
- + " \"type\" : \"type\"" + EOL
- + " } ]" + EOL
- + " }," + EOL
- + " \"links\" : [ {" + EOL
- + " \"rel\" : \"rel\"," + EOL
- + " \"href\" : \"href\"," + EOL
- + " \"type\" : \"type\"" + EOL
- + " }, {" + EOL
- + " \"rel\" : \"rel\"," + EOL
- + " \"href\" : \"href\"," + EOL
- + " \"type\" : \"type\"" + EOL
- + " } ]," + EOL
- + " \"OS-EXT-IMG-SIZE:size\" : 43" + EOL
- + " }" + EOL
- + "}";
-
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(SerializationFeature.WRAP_ROOT_VALUE)
- .enable(DeserializationFeature.UNWRAP_ROOT_VALUE)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private static final String JSON_FULL = "{" + EOL + " \"image\" : {" + EOL + " \"id\" : \"id\"," + EOL
+ + " \"status\" : \"status\"," + EOL + " \"name\" : \"name\"," + EOL + " \"progress\" : 3," + EOL
+ + " \"minRam\" : 62," + EOL + " \"minDisk\" : 69," + EOL + " \"created\" : 1485172800000," + EOL
+ + " \"updated\" : 1486468800000," + EOL + " \"metadata\" : {" + EOL
+ + " \"metadata-k1\" : \"metadata-v1\"," + EOL + " \"metadata-k2\" : \"metadata-v2\"" + EOL
+ + " }," + EOL + " \"server\" : {" + EOL + " \"id\" : \"id\"," + EOL + " \"links\" : [ {"
+ + EOL + " \"rel\" : \"rel\"," + EOL + " \"href\" : \"href\"," + EOL
+ + " \"type\" : \"type\"" + EOL + " }, {" + EOL + " \"rel\" : \"rel\"," + EOL
+ + " \"href\" : \"href\"," + EOL + " \"type\" : \"type\"" + EOL + " } ]" + EOL + " },"
+ + EOL + " \"links\" : [ {" + EOL + " \"rel\" : \"rel\"," + EOL + " \"href\" : \"href\"," + EOL
+ + " \"type\" : \"type\"" + EOL + " }, {" + EOL + " \"rel\" : \"rel\"," + EOL
+ + " \"href\" : \"href\"," + EOL + " \"type\" : \"type\"" + EOL + " } ]," + EOL
+ + " \"OS-EXT-IMG-SIZE:size\" : 43" + EOL + " }" + EOL + "}";
+
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE)
+ .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
Image image = objectMapper.readValue(JSON_FULL, Image.class);
image.toString();
-
+
Server server = image.getServer();
Assert.assertNotNull(server);
-
- Map<String,String> metadata = image.getMetadata();
+
+ Map<String, String> metadata = image.getMetadata();
Assert.assertNotNull(metadata);
Assert.assertEquals(2, metadata.size());
image.setMetadata(metadata);
-
+
Long size = image.getSize();
Assert.assertNotNull(size);
-
+
Calendar created = image.getCreated();
Assert.assertNotNull(created);
image.setCreated(created);
-
+
Integer minRam = image.getMinRam();
Assert.assertNotNull(minRam);
image.setMinRam(minRam);
-
+
String name = image.getName();
Assert.assertNotNull(name);
image.setName(name);
-
+
Integer progress = image.getProgress();
Assert.assertNotNull(progress);
image.setProgress(progress);
-
+
List<Link> links = image.getLinks();
Assert.assertNotNull(links);
Assert.assertEquals(2, links.size());
image.setLinks(links);
-
+
String id = image.getId();
Assert.assertNotNull(id);
image.setId(id);
-
+
Calendar updated = image.getUpdated();
Assert.assertNotNull(updated);
image.setUpdated(updated);
-
+
Integer minDisk = image.getMinDisk();
Assert.assertNotNull(minDisk);
image.setMinDisk(minDisk);
-
+
String status = image.getStatus();
Assert.assertNotNull(status);
image.setStatus(status);
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
-
import java.util.List;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"images\" : [ {" + EOL
- + " \"id\" : \"id\"," + EOL
- + " \"status\" : \"status\"," + EOL
- + " \"name\" : \"name\"," + EOL
- + " \"progress\" : 3," + EOL
- + " \"minRam\" : 62," + EOL
- + " \"minDisk\" : 69," + EOL
- + " \"created\" : 1485172800000," + EOL
- + " \"updated\" : 1486468800000," + EOL
- + " \"metadata\" : {" + EOL
- + " \"metadata-k1\" : \"metadata-v1\"," + EOL
- + " \"metadata-k2\" : \"metadata-v2\"" + EOL
- + " }," + EOL
- + " \"server\" : {" + EOL
- + " \"id\" : \"id\"," + EOL
- + " \"links\" : [ {" + EOL
- + " \"rel\" : \"rel\"," + EOL
- + " \"href\" : \"href\"," + EOL
- + " \"type\" : \"type\"" + EOL
- + " }, {" + EOL
- + " \"rel\" : \"rel\"," + EOL
- + " \"href\" : \"href\"," + EOL
- + " \"type\" : \"type\"" + EOL
- + " } ]" + EOL
- + " }," + EOL
- + " \"links\" : [ {" + EOL
- + " \"rel\" : \"rel\"," + EOL
- + " \"href\" : \"href\"," + EOL
- + " \"type\" : \"type\"" + EOL
- + " }, {" + EOL
- + " \"rel\" : \"rel\"," + EOL
- + " \"href\" : \"href\"," + EOL
- + " \"type\" : \"type\"" + EOL
- + " } ]," + EOL
- + " \"OS-EXT-IMG-SIZE:size\" : 43" + EOL
- + " }, {" + EOL
- + " \"id\" : \"id\"," + EOL
- + " \"status\" : \"status\"," + EOL
- + " \"name\" : \"name\"," + EOL
- + " \"progress\" : 3," + EOL
- + " \"minRam\" : 62," + EOL
- + " \"minDisk\" : 69," + EOL
- + " \"created\" : 1485172800000," + EOL
- + " \"updated\" : 1486468800000," + EOL
- + " \"metadata\" : {" + EOL
- + " \"metadata-k1\" : \"metadata-v1\"," + EOL
- + " \"metadata-k2\" : \"metadata-v2\"" + EOL
- + " }," + EOL
- + " \"server\" : {" + EOL
- + " \"id\" : \"id\"," + EOL
- + " \"links\" : [ {" + EOL
- + " \"rel\" : \"rel\"," + EOL
- + " \"href\" : \"href\"," + EOL
- + " \"type\" : \"type\"" + EOL
- + " }, {" + EOL
- + " \"rel\" : \"rel\"," + EOL
- + " \"href\" : \"href\"," + EOL
- + " \"type\" : \"type\"" + EOL
- + " } ]" + EOL
- + " }," + EOL
- + " \"links\" : [ {" + EOL
- + " \"rel\" : \"rel\"," + EOL
- + " \"href\" : \"href\"," + EOL
- + " \"type\" : \"type\"" + EOL
- + " }, {" + EOL
- + " \"rel\" : \"rel\"," + EOL
- + " \"href\" : \"href\"," + EOL
- + " \"type\" : \"type\"" + EOL
- + " } ]," + EOL
- + " \"OS-EXT-IMG-SIZE:size\" : 43" + EOL
- + " } ]" + EOL
- + "}";
+ private static final String JSON_FULL = "{" + EOL + " \"images\" : [ {" + EOL + " \"id\" : \"id\"," + EOL
+ + " \"status\" : \"status\"," + EOL + " \"name\" : \"name\"," + EOL + " \"progress\" : 3," + EOL
+ + " \"minRam\" : 62," + EOL + " \"minDisk\" : 69," + EOL + " \"created\" : 1485172800000," + EOL
+ + " \"updated\" : 1486468800000," + EOL + " \"metadata\" : {" + EOL
+ + " \"metadata-k1\" : \"metadata-v1\"," + EOL + " \"metadata-k2\" : \"metadata-v2\"" + EOL
+ + " }," + EOL + " \"server\" : {" + EOL + " \"id\" : \"id\"," + EOL + " \"links\" : [ {"
+ + EOL + " \"rel\" : \"rel\"," + EOL + " \"href\" : \"href\"," + EOL
+ + " \"type\" : \"type\"" + EOL + " }, {" + EOL + " \"rel\" : \"rel\"," + EOL
+ + " \"href\" : \"href\"," + EOL + " \"type\" : \"type\"" + EOL + " } ]" + EOL + " },"
+ + EOL + " \"links\" : [ {" + EOL + " \"rel\" : \"rel\"," + EOL + " \"href\" : \"href\"," + EOL
+ + " \"type\" : \"type\"" + EOL + " }, {" + EOL + " \"rel\" : \"rel\"," + EOL
+ + " \"href\" : \"href\"," + EOL + " \"type\" : \"type\"" + EOL + " } ]," + EOL
+ + " \"OS-EXT-IMG-SIZE:size\" : 43" + EOL + " }, {" + EOL + " \"id\" : \"id\"," + EOL
+ + " \"status\" : \"status\"," + EOL + " \"name\" : \"name\"," + EOL + " \"progress\" : 3," + EOL
+ + " \"minRam\" : 62," + EOL + " \"minDisk\" : 69," + EOL + " \"created\" : 1485172800000," + EOL
+ + " \"updated\" : 1486468800000," + EOL + " \"metadata\" : {" + EOL
+ + " \"metadata-k1\" : \"metadata-v1\"," + EOL + " \"metadata-k2\" : \"metadata-v2\"" + EOL
+ + " }," + EOL + " \"server\" : {" + EOL + " \"id\" : \"id\"," + EOL + " \"links\" : [ {"
+ + EOL + " \"rel\" : \"rel\"," + EOL + " \"href\" : \"href\"," + EOL
+ + " \"type\" : \"type\"" + EOL + " }, {" + EOL + " \"rel\" : \"rel\"," + EOL
+ + " \"href\" : \"href\"," + EOL + " \"type\" : \"type\"" + EOL + " } ]" + EOL + " },"
+ + EOL + " \"links\" : [ {" + EOL + " \"rel\" : \"rel\"," + EOL + " \"href\" : \"href\"," + EOL
+ + " \"type\" : \"type\"" + EOL + " }, {" + EOL + " \"rel\" : \"rel\"," + EOL
+ + " \"href\" : \"href\"," + EOL + " \"type\" : \"type\"" + EOL + " } ]," + EOL
+ + " \"OS-EXT-IMG-SIZE:size\" : 43" + EOL + " } ]" + EOL + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
Images images = objectMapper.readValue(JSON_FULL, Images.class);
images.toString();
-
+
List<Image> list = images.getList();
Assert.assertNotNull(list);
Assert.assertEquals(2, list.size());
-
+
int cnt = 0;
- for (@SuppressWarnings("unused") Image x : images) {
+ for (@SuppressWarnings("unused")
+ Image x : images) {
++cnt;
}
Assert.assertEquals(2, cnt);
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.woorea.openstack.nova.model.SecurityGroup.Rule.IpRange;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"cidr\" : \"cidr\"" + EOL
- + "}";
+ private static final String JSON_FULL = "{" + EOL + " \"cidr\" : \"cidr\"" + EOL + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
IpRange iprange = objectMapper.readValue(JSON_FULL, IpRange.class);
iprange.toString();
-
+
String cidr = iprange.getCidr();
Assert.assertNotNull(cidr);
}
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"keypair\" : {" + EOL
- + " \"name\" : \"name\"," + EOL
- + " \"fingerprint\" : \"fingerprint\"," + EOL
- + " \"user_id\" : \"userid\"," + EOL
- + " \"public_key\" : \"publickey\"," + EOL
- + " \"private_key\" : \"privatekey\"" + EOL
- + " }" + EOL
- + "}";
+ private static final String JSON_FULL = "{" + EOL + " \"keypair\" : {" + EOL + " \"name\" : \"name\"," + EOL
+ + " \"fingerprint\" : \"fingerprint\"," + EOL + " \"user_id\" : \"userid\"," + EOL
+ + " \"public_key\" : \"publickey\"," + EOL + " \"private_key\" : \"privatekey\"" + EOL + " }" + EOL
+ + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(SerializationFeature.WRAP_ROOT_VALUE)
- .enable(DeserializationFeature.UNWRAP_ROOT_VALUE)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE)
+ .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
KeyPair keypair = objectMapper.readValue(JSON_FULL, KeyPair.class);
keypair.toString();
-
+
String privateKey = keypair.getPrivateKey();
Assert.assertNotNull(privateKey);
-
+
String name = keypair.getName();
Assert.assertNotNull(name);
keypair.setName(name);
-
+
String fingerprint = keypair.getFingerprint();
Assert.assertNotNull(fingerprint);
-
+
String publicKey = keypair.getPublicKey();
Assert.assertNotNull(publicKey);
keypair.setPublicKey(publicKey);
-
+
String userId = keypair.getUserId();
Assert.assertNotNull(userId);
}
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.woorea.openstack.nova.model.KeyPairs.KeyPairWrapper;
-
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
import org.skyscreamer.jsonassert.JSONCompareMode;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"keypair\" : {" + EOL
- + " \"name\" : \"name\"," + EOL
- + " \"fingerprint\" : \"fingerprint\"," + EOL
- + " \"user_id\" : \"userid\"," + EOL
- + " \"public_key\" : \"publickey\"," + EOL
- + " \"private_key\" : \"privatekey\"" + EOL
- + " }" + EOL
- + "}";
+ private static final String JSON_FULL = "{" + EOL + " \"keypair\" : {" + EOL + " \"name\" : \"name\"," + EOL
+ + " \"fingerprint\" : \"fingerprint\"," + EOL + " \"user_id\" : \"userid\"," + EOL
+ + " \"public_key\" : \"publickey\"," + EOL + " \"private_key\" : \"privatekey\"" + EOL + " }" + EOL
+ + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
-
import java.util.List;
-
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"keypairs\" : [ {" + EOL
- + " \"keypair\" : {" + EOL
- + " \"name\" : \"name\"," + EOL
- + " \"fingerprint\" : \"fingerprint\"," + EOL
- + " \"user_id\" : \"userid\"," + EOL
- + " \"public_key\" : \"publickey\"," + EOL
- + " \"private_key\" : \"privatekey\"" + EOL
- + " }" + EOL
- + " }, {" + EOL
- + " \"keypair\" : { " + EOL
- + " \"name\" : \"name\"," + EOL
- + " \"fingerprint\" : \"fingerprint\"," + EOL
- + " \"user_id\" : \"userid\"," + EOL
- + " \"public_key\" : \"publickey\"," + EOL
- + " \"private_key\" : \"privatekey\"" + EOL
- + " }" + EOL
- + " } ]" + EOL
- + "}";
+ private static final String JSON_FULL = "{" + EOL + " \"keypairs\" : [ {" + EOL + " \"keypair\" : {" + EOL
+ + " \"name\" : \"name\"," + EOL + " \"fingerprint\" : \"fingerprint\"," + EOL
+ + " \"user_id\" : \"userid\"," + EOL + " \"public_key\" : \"publickey\"," + EOL
+ + " \"private_key\" : \"privatekey\"" + EOL + " }" + EOL + " }, {" + EOL + " \"keypair\" : { "
+ + EOL + " \"name\" : \"name\"," + EOL + " \"fingerprint\" : \"fingerprint\"," + EOL
+ + " \"user_id\" : \"userid\"," + EOL + " \"public_key\" : \"publickey\"," + EOL
+ + " \"private_key\" : \"privatekey\"" + EOL + " }" + EOL + " } ]" + EOL + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
// This is test is ignored because The KeyPairs class does not
- // serialize into JSON correctly. It is probably not an operational
+ // serialize into JSON correctly. It is probably not an operational
// issue because KeyPairs is only used to represent the response to
// the GET os-keypairs request.
@Ignore
Assert.assertNotNull(list);
int cnt = 0;
- for (@SuppressWarnings("unused") KeyPair x : keypairs) {
+ for (@SuppressWarnings("unused")
+ KeyPair x : keypairs) {
++cnt;
}
Assert.assertEquals(2, cnt);
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.woorea.openstack.nova.model.Limits.RateLimit.LimitEntry;
-
import java.util.Calendar;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"unit\" : \"unit\"," + EOL
- + " \"verb\" : \"verb\"," + EOL
- + " \"remaining\" : 72," + EOL
- + " \"available\" : 47," + EOL
- + " \"value\" : 59," + EOL
- + " \"next-available\" : 1489320000000" + EOL
- + "}";
+ private static final String JSON_FULL = "{" + EOL + " \"unit\" : \"unit\"," + EOL + " \"verb\" : \"verb\"," + EOL
+ + " \"remaining\" : 72," + EOL + " \"available\" : 47," + EOL + " \"value\" : 59," + EOL
+ + " \"next-available\" : 1489320000000" + EOL + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
LimitEntry limitentry = objectMapper.readValue(JSON_FULL, LimitEntry.class);
limitentry.toString();
-
+
String unit = limitentry.getUnit();
Assert.assertNotNull(unit);
-
+
String verb = limitentry.getVerb();
Assert.assertNotNull(verb);
-
+
Integer available = limitentry.getAvailable();
Assert.assertNotNull(available);
-
+
Calendar nextAvailable = limitentry.getNextAvailable();
Assert.assertNotNull(nextAvailable);
-
+
Integer value = limitentry.getValue();
Assert.assertNotNull(value);
-
+
Integer remaining = limitentry.getRemaining();
Assert.assertNotNull(remaining);
}
import com.fasterxml.jackson.databind.SerializationFeature;
import com.woorea.openstack.nova.model.Limits.AbsoluteLimit;
import com.woorea.openstack.nova.model.Limits.RateLimit;
-
import java.util.List;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"limits\" : {" + EOL
- + " \"rate\" : [ {" + EOL
- + " \"regex\" : \"regex\"," + EOL
- + " \"uri\" : \"uri\"," + EOL
- + " \"limit\" : [ {" + EOL
- + " \"unit\" : \"unit\"," + EOL
- + " \"verb\" : \"verb\"," + EOL
- + " \"remaining\" : 72," + EOL
- + " \"available\" : 47," + EOL
- + " \"value\" : 59," + EOL
- + " \"next-available\" : 1489320000000" + EOL
- + " }, {" + EOL
- + " \"unit\" : \"unit\"," + EOL
- + " \"verb\" : \"verb\"," + EOL
- + " \"remaining\" : 72," + EOL
- + " \"available\" : 47," + EOL
- + " \"value\" : 59," + EOL
- + " \"next-available\" : 1489320000000" + EOL
- + " } ]" + EOL
- + " }, {" + EOL
- + " \"regex\" : \"regex\"," + EOL
- + " \"uri\" : \"uri\"," + EOL
- + " \"limit\" : [ {" + EOL
- + " \"unit\" : \"unit\"," + EOL
- + " \"verb\" : \"verb\"," + EOL
- + " \"remaining\" : 72," + EOL
- + " \"available\" : 47," + EOL
- + " \"value\" : 59," + EOL
- + " \"next-available\" : 1489320000000" + EOL
- + " }, {" + EOL
- + " \"unit\" : \"unit\"," + EOL
- + " \"verb\" : \"verb\"," + EOL
- + " \"remaining\" : 72," + EOL
- + " \"available\" : 47," + EOL
- + " \"value\" : 59," + EOL
- + " \"next-available\" : 1489320000000" + EOL
- + " } ]" + EOL
- + " } ]," + EOL
- + " \"absolute\" : {" + EOL
- + " \"maxServerMeta\" : 30," + EOL
- + " \"serverMetaUsed\" : 37," + EOL
- + " \"maxPersonality\" : 54," + EOL
- + " \"personalityUsed\" : 61," + EOL
- + " \"maxImageMeta\" : 82," + EOL
- + " \"imageMetaUsed\" : 89," + EOL
- + " \"maxPersonalitySize\" : 97," + EOL
- + " \"personalitySizeUsed\" : 4," + EOL
- + " \"maxTotalCores\" : 32," + EOL
- + " \"totalCoresUsed\" : 39," + EOL
- + " \"maxTotalInstances\" : 60," + EOL
- + " \"totalInstancesUsed\" : 67," + EOL
- + " \"maxTotalRAMSize\" : 55," + EOL
- + " \"totalRAMUsed\" : 19," + EOL
- + " \"maxSecurityGroupRules\" : 44," + EOL
- + " \"securityGroupRulesUsed\" : 51," + EOL
- + " \"maxTotalKeypairs\" : 64," + EOL
- + " \"totalKeyPairsUsed\" : 71," + EOL
- + " \"maxTotalVolumes\" : 71," + EOL
- + " \"totalVolumesUsed\" : 78," + EOL
- + " \"maxSecurityGroups\" : 4," + EOL
- + " \"totalSecurityGroupsUsed\" : 59," + EOL
- + " \"maxTotalFloatingIps\" : 76," + EOL
- + " \"totalFloatingIpsUsed\" : 83," + EOL
- + " \"maxTotalVolumeGigabytes\" : 15," + EOL
- + " \"totalVolumeGigabytesUsed\" : 22" + EOL
- + " }" + EOL
- + " }" + EOL
- + "}";
+ private static final String JSON_FULL = "{" + EOL + " \"limits\" : {" + EOL + " \"rate\" : [ {" + EOL
+ + " \"regex\" : \"regex\"," + EOL + " \"uri\" : \"uri\"," + EOL + " \"limit\" : [ {" + EOL
+ + " \"unit\" : \"unit\"," + EOL + " \"verb\" : \"verb\"," + EOL
+ + " \"remaining\" : 72," + EOL + " \"available\" : 47," + EOL + " \"value\" : 59,"
+ + EOL + " \"next-available\" : 1489320000000" + EOL + " }, {" + EOL
+ + " \"unit\" : \"unit\"," + EOL + " \"verb\" : \"verb\"," + EOL
+ + " \"remaining\" : 72," + EOL + " \"available\" : 47," + EOL + " \"value\" : 59,"
+ + EOL + " \"next-available\" : 1489320000000" + EOL + " } ]" + EOL + " }, {" + EOL
+ + " \"regex\" : \"regex\"," + EOL + " \"uri\" : \"uri\"," + EOL + " \"limit\" : [ {" + EOL
+ + " \"unit\" : \"unit\"," + EOL + " \"verb\" : \"verb\"," + EOL
+ + " \"remaining\" : 72," + EOL + " \"available\" : 47," + EOL + " \"value\" : 59,"
+ + EOL + " \"next-available\" : 1489320000000" + EOL + " }, {" + EOL
+ + " \"unit\" : \"unit\"," + EOL + " \"verb\" : \"verb\"," + EOL
+ + " \"remaining\" : 72," + EOL + " \"available\" : 47," + EOL + " \"value\" : 59,"
+ + EOL + " \"next-available\" : 1489320000000" + EOL + " } ]" + EOL + " } ]," + EOL
+ + " \"absolute\" : {" + EOL + " \"maxServerMeta\" : 30," + EOL + " \"serverMetaUsed\" : 37,"
+ + EOL + " \"maxPersonality\" : 54," + EOL + " \"personalityUsed\" : 61," + EOL
+ + " \"maxImageMeta\" : 82," + EOL + " \"imageMetaUsed\" : 89," + EOL
+ + " \"maxPersonalitySize\" : 97," + EOL + " \"personalitySizeUsed\" : 4," + EOL
+ + " \"maxTotalCores\" : 32," + EOL + " \"totalCoresUsed\" : 39," + EOL
+ + " \"maxTotalInstances\" : 60," + EOL + " \"totalInstancesUsed\" : 67," + EOL
+ + " \"maxTotalRAMSize\" : 55," + EOL + " \"totalRAMUsed\" : 19," + EOL
+ + " \"maxSecurityGroupRules\" : 44," + EOL + " \"securityGroupRulesUsed\" : 51," + EOL
+ + " \"maxTotalKeypairs\" : 64," + EOL + " \"totalKeyPairsUsed\" : 71," + EOL
+ + " \"maxTotalVolumes\" : 71," + EOL + " \"totalVolumesUsed\" : 78," + EOL
+ + " \"maxSecurityGroups\" : 4," + EOL + " \"totalSecurityGroupsUsed\" : 59," + EOL
+ + " \"maxTotalFloatingIps\" : 76," + EOL + " \"totalFloatingIpsUsed\" : 83," + EOL
+ + " \"maxTotalVolumeGigabytes\" : 15," + EOL + " \"totalVolumeGigabytesUsed\" : 22" + EOL
+ + " }" + EOL + " }" + EOL + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(SerializationFeature.WRAP_ROOT_VALUE)
- .enable(DeserializationFeature.UNWRAP_ROOT_VALUE)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE)
+ .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
Limits limits = objectMapper.readValue(JSON_FULL, Limits.class);
limits.toString();
-
+
List<RateLimit> rate = limits.getRate();
Assert.assertNotNull(rate);
Assert.assertEquals(2, rate.size());
-
+
AbsoluteLimit absolute = limits.getAbsolute();
Assert.assertNotNull(absolute);
}
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"rel\" : \"rel\"," + EOL
- + " \"href\" : \"href\"," + EOL
- + " \"type\" : \"type\"" + EOL
- + "}";
+ private static final String JSON_FULL = "{" + EOL + " \"rel\" : \"rel\"," + EOL + " \"href\" : \"href\"," + EOL
+ + " \"type\" : \"type\"" + EOL + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
Link link = objectMapper.readValue(JSON_FULL, Link.class);
link.toString();
-
+
String rel = link.getRel();
Assert.assertNotNull(rel);
-
+
String href = link.getHref();
Assert.assertNotNull(href);
-
+
String type = link.getType();
Assert.assertNotNull(type);
}
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.woorea.openstack.nova.model.ServerAction.Lock;
-
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
import org.skyscreamer.jsonassert.JSONCompareMode;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"lock\" : { }" + EOL
- + "}";
+ private static final String JSON_FULL = "{" + EOL + " \"lock\" : { }" + EOL + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(SerializationFeature.WRAP_ROOT_VALUE)
- .enable(DeserializationFeature.UNWRAP_ROOT_VALUE)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE)
+ .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
package com.woorea.openstack.nova.model;
import org.junit.Test;
-
import java.util.Collections;
-
import static org.junit.Assert.*;
public class MetadataTest {
public void setMetadata() {
metadata.setMetadata(Collections.<String, String>emptyMap());
}
-}
\ No newline at end of file
+}
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"uuid\" : \"id\"," + EOL
- + " \"fixed_ip\" : \"fixedip\"" + EOL
- + "}";
+ private static final String JSON_FULL =
+ "{" + EOL + " \"uuid\" : \"id\"," + EOL + " \"fixed_ip\" : \"fixedip\"" + EOL + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
NetworkForCreate networkforcreate = objectMapper.readValue(JSON_FULL, NetworkForCreate.class);
networkforcreate.toString();
-
+
String fixedIp = networkforcreate.getFixedIp();
Assert.assertNotNull(fixedIp);
networkforcreate.setFixedIp(fixedIp);
-
+
String id = networkforcreate.getId();
Assert.assertNotNull(id);
networkforcreate.setId(id);
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"network\" : {" + EOL
- + " \"id\" : \"id\"," + EOL
- + " \"bridge\" : \"bridge\"," + EOL
- + " \"deleted\" : false," + EOL
- + " \"vlan\" : \"vlan\"," + EOL
- + " \"broadcast\" : \"broadcast\"," + EOL
- + " \"netmask\" : \"netmask\"," + EOL
- + " \"injected\" : true," + EOL
- + " \"host\" : \"host\"," + EOL
- + " \"cidr\" : \"cidr\"," + EOL
- + " \"gateway\" : \"gateway\"," + EOL
- + " \"dns1\" : \"dns1\"," + EOL
- + " \"dns2\" : \"dns2\"," + EOL
- + " \"label\" : \"label\"," + EOL
- + " \"priority\" : \"priority\"," + EOL
- + " \"vpn_public_address\" : \"vpnpublicaddress\"," + EOL
- + " \"vpn_private_address\" : \"vpnprivateaddress\"," + EOL
- + " \"vpn_public_port\" : \"vpnpublicport\"," + EOL
- + " \"dhcp_start\" : \"dhcpstart\"," + EOL
- + " \"bridge_interface\" : \"bridgeinterface\"," + EOL
- + " \"updated_at\" : \"updatedat\"," + EOL
- + " \"multi_host\" : false," + EOL
- + " \"created_at\" : \"createdat\"," + EOL
- + " \"deleted_at\" : \"deletedat\"," + EOL
- + " \"cidr_v6\" : \"cidrv6\"," + EOL
- + " \"gateway_v6\" : \"gatewayv6\"," + EOL
- + " \"netmask_v6\" : \"netmaskv6\"," + EOL
- + " \"project_id\" : \"projectid\"," + EOL
- + " \"rxtx_base\" : \"rxtxbase\"" + EOL
- + " }" + EOL
- + "}";
-
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(SerializationFeature.WRAP_ROOT_VALUE)
- .enable(DeserializationFeature.UNWRAP_ROOT_VALUE)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private static final String JSON_FULL = "{" + EOL + " \"network\" : {" + EOL + " \"id\" : \"id\"," + EOL
+ + " \"bridge\" : \"bridge\"," + EOL + " \"deleted\" : false," + EOL + " \"vlan\" : \"vlan\"," + EOL
+ + " \"broadcast\" : \"broadcast\"," + EOL + " \"netmask\" : \"netmask\"," + EOL
+ + " \"injected\" : true," + EOL + " \"host\" : \"host\"," + EOL + " \"cidr\" : \"cidr\"," + EOL
+ + " \"gateway\" : \"gateway\"," + EOL + " \"dns1\" : \"dns1\"," + EOL + " \"dns2\" : \"dns2\","
+ + EOL + " \"label\" : \"label\"," + EOL + " \"priority\" : \"priority\"," + EOL
+ + " \"vpn_public_address\" : \"vpnpublicaddress\"," + EOL
+ + " \"vpn_private_address\" : \"vpnprivateaddress\"," + EOL
+ + " \"vpn_public_port\" : \"vpnpublicport\"," + EOL + " \"dhcp_start\" : \"dhcpstart\"," + EOL
+ + " \"bridge_interface\" : \"bridgeinterface\"," + EOL + " \"updated_at\" : \"updatedat\"," + EOL
+ + " \"multi_host\" : false," + EOL + " \"created_at\" : \"createdat\"," + EOL
+ + " \"deleted_at\" : \"deletedat\"," + EOL + " \"cidr_v6\" : \"cidrv6\"," + EOL
+ + " \"gateway_v6\" : \"gatewayv6\"," + EOL + " \"netmask_v6\" : \"netmaskv6\"," + EOL
+ + " \"project_id\" : \"projectid\"," + EOL + " \"rxtx_base\" : \"rxtxbase\"" + EOL + " }" + EOL
+ + "}";
+
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE)
+ .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
Network network = objectMapper.readValue(JSON_FULL, Network.class);
network.toString();
-
+
String broadcast = network.getBroadcast();
Assert.assertNotNull(broadcast);
-
+
String gatewayV6 = network.getGatewayV6();
Assert.assertNotNull(gatewayV6);
-
+
String dns2 = network.getDns2();
Assert.assertNotNull(dns2);
-
+
String bridgeInterface = network.getBridgeInterface();
Assert.assertNotNull(bridgeInterface);
-
+
String dns1 = network.getDns1();
Assert.assertNotNull(dns1);
-
+
String cidrV6 = network.getCidrV6();
Assert.assertNotNull(cidrV6);
-
+
String deletedAt = network.getDeletedAt();
Assert.assertNotNull(deletedAt);
-
+
String vlan = network.getVlan();
Assert.assertNotNull(vlan);
-
+
String netmask = network.getNetmask();
Assert.assertNotNull(netmask);
-
+
String netmaskV6 = network.getNetmaskV6();
Assert.assertNotNull(netmaskV6);
-
+
Boolean injected = network.getInjected();
Assert.assertNotNull(injected);
-
+
String host = network.getHost();
Assert.assertNotNull(host);
-
+
String cidr = network.getCidr();
Assert.assertNotNull(cidr);
-
+
String id = network.getId();
Assert.assertNotNull(id);
-
+
String projectId = network.getProjectId();
Assert.assertNotNull(projectId);
-
+
String vpnPublicAddress = network.getVpnPublicAddress();
Assert.assertNotNull(vpnPublicAddress);
-
+
String label = network.getLabel();
Assert.assertNotNull(label);
-
+
String priority = network.getPriority();
Assert.assertNotNull(priority);
-
+
String vpnPublicPort = network.getVpnPublicPort();
Assert.assertNotNull(vpnPublicPort);
-
+
String createdAt = network.getCreatedAt();
Assert.assertNotNull(createdAt);
-
+
Boolean deleted = network.getDeleted();
Assert.assertNotNull(deleted);
-
+
String rxtxBase = network.getRxtxBase();
Assert.assertNotNull(rxtxBase);
-
+
String dhcpStart = network.getDhcpStart();
Assert.assertNotNull(dhcpStart);
-
+
Boolean multiHost = network.getMultiHost();
Assert.assertNotNull(multiHost);
-
+
String bridge = network.getBridge();
Assert.assertNotNull(bridge);
-
+
String gateway = network.getGateway();
Assert.assertNotNull(gateway);
-
+
String updatedAt = network.getUpdatedAt();
Assert.assertNotNull(updatedAt);
}
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
-
import java.util.List;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"networks\" : [ {" + EOL
- + " \"id\" : \"id\"," + EOL
- + " \"bridge\" : \"bridge\"," + EOL
- + " \"deleted\" : false," + EOL
- + " \"vlan\" : \"vlan\"," + EOL
- + " \"broadcast\" : \"broadcast\"," + EOL
- + " \"netmask\" : \"netmask\"," + EOL
- + " \"injected\" : true," + EOL
- + " \"host\" : \"host\"," + EOL
- + " \"cidr\" : \"cidr\"," + EOL
- + " \"gateway\" : \"gateway\"," + EOL
- + " \"dns1\" : \"dns1\"," + EOL
- + " \"dns2\" : \"dns2\"," + EOL
- + " \"label\" : \"label\"," + EOL
- + " \"priority\" : \"priority\"," + EOL
- + " \"vpn_public_address\" : \"vpnpublicaddress\"," + EOL
- + " \"vpn_private_address\" : \"vpnprivateaddress\"," + EOL
- + " \"vpn_public_port\" : \"vpnpublicport\"," + EOL
- + " \"dhcp_start\" : \"dhcpstart\"," + EOL
- + " \"bridge_interface\" : \"bridgeinterface\"," + EOL
- + " \"updated_at\" : \"updatedat\"," + EOL
- + " \"multi_host\" : false," + EOL
- + " \"created_at\" : \"createdat\"," + EOL
- + " \"deleted_at\" : \"deletedat\"," + EOL
- + " \"cidr_v6\" : \"cidrv6\"," + EOL
- + " \"gateway_v6\" : \"gatewayv6\"," + EOL
- + " \"netmask_v6\" : \"netmaskv6\"," + EOL
- + " \"project_id\" : \"projectid\"," + EOL
- + " \"rxtx_base\" : \"rxtxbase\"" + EOL
- + " }, {" + EOL
- + " \"id\" : \"id\"," + EOL
- + " \"bridge\" : \"bridge\"," + EOL
- + " \"deleted\" : false," + EOL
- + " \"vlan\" : \"vlan\"," + EOL
- + " \"broadcast\" : \"broadcast\"," + EOL
- + " \"netmask\" : \"netmask\"," + EOL
- + " \"injected\" : true," + EOL
- + " \"host\" : \"host\"," + EOL
- + " \"cidr\" : \"cidr\"," + EOL
- + " \"gateway\" : \"gateway\"," + EOL
- + " \"dns1\" : \"dns1\"," + EOL
- + " \"dns2\" : \"dns2\"," + EOL
- + " \"label\" : \"label\"," + EOL
- + " \"priority\" : \"priority\"," + EOL
- + " \"vpn_public_address\" : \"vpnpublicaddress\"," + EOL
- + " \"vpn_private_address\" : \"vpnprivateaddress\"," + EOL
- + " \"vpn_public_port\" : \"vpnpublicport\"," + EOL
- + " \"dhcp_start\" : \"dhcpstart\"," + EOL
- + " \"bridge_interface\" : \"bridgeinterface\"," + EOL
- + " \"updated_at\" : \"updatedat\"," + EOL
- + " \"multi_host\" : false," + EOL
- + " \"created_at\" : \"createdat\"," + EOL
- + " \"deleted_at\" : \"deletedat\"," + EOL
- + " \"cidr_v6\" : \"cidrv6\"," + EOL
- + " \"gateway_v6\" : \"gatewayv6\"," + EOL
- + " \"netmask_v6\" : \"netmaskv6\"," + EOL
- + " \"project_id\" : \"projectid\"," + EOL
- + " \"rxtx_base\" : \"rxtxbase\"" + EOL
- + " } ]" + EOL
- + "}";
+ private static final String JSON_FULL = "{" + EOL + " \"networks\" : [ {" + EOL + " \"id\" : \"id\"," + EOL
+ + " \"bridge\" : \"bridge\"," + EOL + " \"deleted\" : false," + EOL + " \"vlan\" : \"vlan\"," + EOL
+ + " \"broadcast\" : \"broadcast\"," + EOL + " \"netmask\" : \"netmask\"," + EOL
+ + " \"injected\" : true," + EOL + " \"host\" : \"host\"," + EOL + " \"cidr\" : \"cidr\"," + EOL
+ + " \"gateway\" : \"gateway\"," + EOL + " \"dns1\" : \"dns1\"," + EOL + " \"dns2\" : \"dns2\","
+ + EOL + " \"label\" : \"label\"," + EOL + " \"priority\" : \"priority\"," + EOL
+ + " \"vpn_public_address\" : \"vpnpublicaddress\"," + EOL
+ + " \"vpn_private_address\" : \"vpnprivateaddress\"," + EOL
+ + " \"vpn_public_port\" : \"vpnpublicport\"," + EOL + " \"dhcp_start\" : \"dhcpstart\"," + EOL
+ + " \"bridge_interface\" : \"bridgeinterface\"," + EOL + " \"updated_at\" : \"updatedat\"," + EOL
+ + " \"multi_host\" : false," + EOL + " \"created_at\" : \"createdat\"," + EOL
+ + " \"deleted_at\" : \"deletedat\"," + EOL + " \"cidr_v6\" : \"cidrv6\"," + EOL
+ + " \"gateway_v6\" : \"gatewayv6\"," + EOL + " \"netmask_v6\" : \"netmaskv6\"," + EOL
+ + " \"project_id\" : \"projectid\"," + EOL + " \"rxtx_base\" : \"rxtxbase\"" + EOL + " }, {" + EOL
+ + " \"id\" : \"id\"," + EOL + " \"bridge\" : \"bridge\"," + EOL + " \"deleted\" : false," + EOL
+ + " \"vlan\" : \"vlan\"," + EOL + " \"broadcast\" : \"broadcast\"," + EOL
+ + " \"netmask\" : \"netmask\"," + EOL + " \"injected\" : true," + EOL + " \"host\" : \"host\","
+ + EOL + " \"cidr\" : \"cidr\"," + EOL + " \"gateway\" : \"gateway\"," + EOL
+ + " \"dns1\" : \"dns1\"," + EOL + " \"dns2\" : \"dns2\"," + EOL + " \"label\" : \"label\"," + EOL
+ + " \"priority\" : \"priority\"," + EOL + " \"vpn_public_address\" : \"vpnpublicaddress\"," + EOL
+ + " \"vpn_private_address\" : \"vpnprivateaddress\"," + EOL
+ + " \"vpn_public_port\" : \"vpnpublicport\"," + EOL + " \"dhcp_start\" : \"dhcpstart\"," + EOL
+ + " \"bridge_interface\" : \"bridgeinterface\"," + EOL + " \"updated_at\" : \"updatedat\"," + EOL
+ + " \"multi_host\" : false," + EOL + " \"created_at\" : \"createdat\"," + EOL
+ + " \"deleted_at\" : \"deletedat\"," + EOL + " \"cidr_v6\" : \"cidrv6\"," + EOL
+ + " \"gateway_v6\" : \"gatewayv6\"," + EOL + " \"netmask_v6\" : \"netmaskv6\"," + EOL
+ + " \"project_id\" : \"projectid\"," + EOL + " \"rxtx_base\" : \"rxtxbase\"" + EOL + " } ]" + EOL
+ + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
Networks networks = objectMapper.readValue(JSON_FULL, Networks.class);
networks.toString();
-
+
List<Network> list = networks.getList();
Assert.assertNotNull(list);
Assert.assertEquals(2, list.size());
-
+
int cnt = 0;
- for (@SuppressWarnings("unused") Network x : networks) {
+ for (@SuppressWarnings("unused")
+ Network x : networks) {
++cnt;
}
Assert.assertEquals(2, cnt);
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.woorea.openstack.nova.model.ServerAction.Pause;
-
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
import org.skyscreamer.jsonassert.JSONCompareMode;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"pause\" : { }" + EOL
- + "}";
+ private static final String JSON_FULL = "{" + EOL + " \"pause\" : { }" + EOL + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(SerializationFeature.WRAP_ROOT_VALUE)
- .enable(DeserializationFeature.UNWRAP_ROOT_VALUE)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE)
+ .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"path\" : \"path\"," + EOL
- + " \"contents\" : \"contents\"" + EOL
- + "}";
+ private static final String JSON_FULL =
+ "{" + EOL + " \"path\" : \"path\"," + EOL + " \"contents\" : \"contents\"" + EOL + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
PersonalityFile personalityfile = objectMapper.readValue(JSON_FULL, PersonalityFile.class);
personalityfile.toString();
-
+
String path = personalityfile.getPath();
Assert.assertNotNull(path);
personalityfile.setPath(path);
-
+
String contents = personalityfile.getContents();
Assert.assertNotNull(contents);
personalityfile.setContents(contents);
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"quota_set\" : {" + EOL
- + " \"id\" : \"id\"," + EOL
- + " \"gigabytes\" : 77," + EOL
- + " \"ram\" : 38," + EOL
- + " \"instances\" : 86," + EOL
- + " \"volumes\" : 97," + EOL
- + " \"cores\" : 58," + EOL
- + " \"metadata_items\" : 97," + EOL
- + " \"injected_file_content_bytes\" : 86," + EOL
- + " \"injected_files\" : 87," + EOL
- + " \"floating_ips\" : 2," + EOL
- + " \"security_groups\" : 78," + EOL
- + " \"security_group_rules\" : 18," + EOL
- + " \"injected_file_path_bytes\" : 52," + EOL
- + " \"key_pairs\" : 90" + EOL
- + " }" + EOL
- + "}";
-
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(SerializationFeature.WRAP_ROOT_VALUE)
- .enable(DeserializationFeature.UNWRAP_ROOT_VALUE)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private static final String JSON_FULL = "{" + EOL + " \"quota_set\" : {" + EOL + " \"id\" : \"id\"," + EOL
+ + " \"gigabytes\" : 77," + EOL + " \"ram\" : 38," + EOL + " \"instances\" : 86," + EOL
+ + " \"volumes\" : 97," + EOL + " \"cores\" : 58," + EOL + " \"metadata_items\" : 97," + EOL
+ + " \"injected_file_content_bytes\" : 86," + EOL + " \"injected_files\" : 87," + EOL
+ + " \"floating_ips\" : 2," + EOL + " \"security_groups\" : 78," + EOL
+ + " \"security_group_rules\" : 18," + EOL + " \"injected_file_path_bytes\" : 52," + EOL
+ + " \"key_pairs\" : 90" + EOL + " }" + EOL + "}";
+
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE)
+ .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
QuotaSet quotaset = objectMapper.readValue(JSON_FULL, QuotaSet.class);
quotaset.toString();
-
+
Integer injectedFileContentBytes = quotaset.getInjectedFileContentBytes();
Assert.assertNotNull(injectedFileContentBytes);
quotaset.setInjectedFileContentBytes(injectedFileContentBytes);
-
+
Integer injectedFiles = quotaset.getInjectedFiles();
Assert.assertNotNull(injectedFiles);
quotaset.setInjectedFiles(injectedFiles);
-
+
Integer instances = quotaset.getInstances();
Assert.assertNotNull(instances);
quotaset.setInstances(instances);
-
+
Integer gigabytes = quotaset.getGigabytes();
Assert.assertNotNull(gigabytes);
quotaset.setGigabytes(gigabytes);
-
+
Integer metadataItems = quotaset.getMetadataItems();
Assert.assertNotNull(metadataItems);
quotaset.setMetadataItems(metadataItems);
-
+
Integer volumes = quotaset.getVolumes();
Assert.assertNotNull(volumes);
quotaset.setVolumes(volumes);
-
+
Integer injectedFilePathBytes = quotaset.getInjectedFilePathBytes();
Assert.assertNotNull(injectedFilePathBytes);
quotaset.setInjectedFilePathBytes(injectedFilePathBytes);
-
+
Integer securityGroupRules = quotaset.getSecurityGroupRules();
Assert.assertNotNull(securityGroupRules);
quotaset.setSecurityGroupRules(securityGroupRules);
-
+
Integer floatingIps = quotaset.getFloatingIps();
Assert.assertNotNull(floatingIps);
quotaset.setFloatingIps(floatingIps);
-
+
Integer cores = quotaset.getCores();
Assert.assertNotNull(cores);
quotaset.setCores(cores);
-
+
String id = quotaset.getId();
Assert.assertNotNull(id);
quotaset.setId(id);
-
+
Integer securityGroups = quotaset.getSecurityGroups();
Assert.assertNotNull(securityGroups);
quotaset.setSecurityGroups(securityGroups);
-
+
Integer ram = quotaset.getRam();
Assert.assertNotNull(ram);
quotaset.setRam(ram);
-
+
Integer keyPairs = quotaset.getKeyPairs();
Assert.assertNotNull(keyPairs);
quotaset.setKeyPairs(keyPairs);
import com.fasterxml.jackson.databind.SerializationFeature;
import com.woorea.openstack.nova.model.Limits.RateLimit;
import com.woorea.openstack.nova.model.Limits.RateLimit.LimitEntry;
-
import java.util.List;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"regex\" : \"regex\"," + EOL
- + " \"uri\" : \"uri\"," + EOL
- + " \"limit\" : [ {" + EOL
- + " \"unit\" : \"unit\"," + EOL
- + " \"verb\" : \"verb\"," + EOL
- + " \"remaining\" : 72," + EOL
- + " \"available\" : 47," + EOL
- + " \"value\" : 59," + EOL
- + " \"next-available\" : 1489320000000" + EOL
- + " }, {" + EOL
- + " \"unit\" : \"unit\"," + EOL
- + " \"verb\" : \"verb\"," + EOL
- + " \"remaining\" : 72," + EOL
- + " \"available\" : 47," + EOL
- + " \"value\" : 59," + EOL
- + " \"next-available\" : 1489320000000" + EOL
- + " } ]" + EOL
- + "}";
+ private static final String JSON_FULL = "{" + EOL + " \"regex\" : \"regex\"," + EOL + " \"uri\" : \"uri\"," + EOL
+ + " \"limit\" : [ {" + EOL + " \"unit\" : \"unit\"," + EOL + " \"verb\" : \"verb\"," + EOL
+ + " \"remaining\" : 72," + EOL + " \"available\" : 47," + EOL + " \"value\" : 59," + EOL
+ + " \"next-available\" : 1489320000000" + EOL + " }, {" + EOL + " \"unit\" : \"unit\"," + EOL
+ + " \"verb\" : \"verb\"," + EOL + " \"remaining\" : 72," + EOL + " \"available\" : 47," + EOL
+ + " \"value\" : 59," + EOL + " \"next-available\" : 1489320000000" + EOL + " } ]" + EOL + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
RateLimit ratelimit = objectMapper.readValue(JSON_FULL, RateLimit.class);
ratelimit.toString();
-
+
String regex = ratelimit.getRegex();
Assert.assertNotNull(regex);
-
+
List<LimitEntry> limit = ratelimit.getLimit();
Assert.assertNotNull(limit);
Assert.assertEquals(2, limit.size());
-
+
String uri = ratelimit.getUri();
Assert.assertNotNull(uri);
}
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.woorea.openstack.nova.model.ServerAction.Reboot;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"reboot\" : {" + EOL
- + " \"type\" : \"type\"" + EOL
- + " }" + EOL
- + "}";
+ private static final String JSON_FULL =
+ "{" + EOL + " \"reboot\" : {" + EOL + " \"type\" : \"type\"" + EOL + " }" + EOL + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(SerializationFeature.WRAP_ROOT_VALUE)
- .enable(DeserializationFeature.UNWRAP_ROOT_VALUE)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE)
+ .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
Reboot reboot = objectMapper.readValue(JSON_FULL, Reboot.class);
reboot.toString();
-
+
String type = reboot.getType();
Assert.assertNotNull(type);
reboot.setType(type);
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.woorea.openstack.nova.model.ServerAction.Rebuild;
-
import java.util.List;
import java.util.Map;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"rebuild\" : {" + EOL
- + " \"imageRef\" : \"imageref\"," + EOL
- + " \"name\" : \"name\"," + EOL
- + " \"adminPass\" : \"adminpass\"," + EOL
- + " \"accessIPv4\" : \"accessipv4\"," + EOL
- + " \"accessIPv6\" : \"accessipv6\"," + EOL
- + " \"metadata\" : {" + EOL
- + " \"metadata-k1\" : \"metadata-v1\"," + EOL
- + " \"metadata-k2\" : \"metadata-v2\"" + EOL
- + " }," + EOL
- + " \"personality\" : [ {" + EOL
- + " \"path\" : \"path\"," + EOL
- + " \"contents\" : \"contents\"" + EOL
- + " }, {" + EOL
- + " \"path\" : \"path\"," + EOL
- + " \"contents\" : \"contents\"" + EOL
- + " } ]," + EOL
- + " \"OS-DCF:diskConfig\" : \"diskconfig\"" + EOL
- + " }" + EOL
- + "}";
-
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(SerializationFeature.WRAP_ROOT_VALUE)
- .enable(DeserializationFeature.UNWRAP_ROOT_VALUE)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private static final String JSON_FULL = "{" + EOL + " \"rebuild\" : {" + EOL + " \"imageRef\" : \"imageref\","
+ + EOL + " \"name\" : \"name\"," + EOL + " \"adminPass\" : \"adminpass\"," + EOL
+ + " \"accessIPv4\" : \"accessipv4\"," + EOL + " \"accessIPv6\" : \"accessipv6\"," + EOL
+ + " \"metadata\" : {" + EOL + " \"metadata-k1\" : \"metadata-v1\"," + EOL
+ + " \"metadata-k2\" : \"metadata-v2\"" + EOL + " }," + EOL + " \"personality\" : [ {" + EOL
+ + " \"path\" : \"path\"," + EOL + " \"contents\" : \"contents\"" + EOL + " }, {" + EOL
+ + " \"path\" : \"path\"," + EOL + " \"contents\" : \"contents\"" + EOL + " } ]," + EOL
+ + " \"OS-DCF:diskConfig\" : \"diskconfig\"" + EOL + " }" + EOL + "}";
+
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE)
+ .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
Rebuild rebuild = objectMapper.readValue(JSON_FULL, Rebuild.class);
rebuild.toString();
-
- Map<String,String> metadata = rebuild.getMetadata();
+
+ Map<String, String> metadata = rebuild.getMetadata();
Assert.assertNotNull(metadata);
Assert.assertEquals(2, metadata.size());
rebuild.setMetadata(metadata);
-
+
List<PersonalityFile> personality = rebuild.getPersonality();
Assert.assertNotNull(personality);
Assert.assertEquals(2, personality.size());
rebuild.setPersonality(personality);
-
+
String name = rebuild.getName();
Assert.assertNotNull(name);
rebuild.setName(name);
-
+
String adminPass = rebuild.getAdminPass();
Assert.assertNotNull(adminPass);
rebuild.setAdminPass(adminPass);
-
+
String imageRef = rebuild.getImageRef();
Assert.assertNotNull(imageRef);
rebuild.setImageRef(imageRef);
-
+
String accessIPv6 = rebuild.getAccessIPv6();
Assert.assertNotNull(accessIPv6);
rebuild.setAccessIPv6(accessIPv6);
-
+
String diskConfig = rebuild.getDiskConfig();
Assert.assertNotNull(diskConfig);
rebuild.setDiskConfig(diskConfig);
-
+
String accessIPv4 = rebuild.getAccessIPv4();
Assert.assertNotNull(accessIPv4);
rebuild.setAccessIPv4(accessIPv4);
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.woorea.openstack.nova.model.ServerAction.RescueResponse;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"adminPass\" : \"adminpass\"" + EOL
- + "}";
+ private static final String JSON_FULL = "{" + EOL + " \"adminPass\" : \"adminpass\"" + EOL + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
RescueResponse rescueresponse = objectMapper.readValue(JSON_FULL, RescueResponse.class);
rescueresponse.toString();
-
+
String adminPass = rescueresponse.getAdminPass();
Assert.assertNotNull(adminPass);
}
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.woorea.openstack.nova.model.ServerAction.Rescue;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"rescue\" : {" + EOL
- + " \"adminPass\" : \"adminpass\"" + EOL
- + " }" + EOL
- + "}";
+ private static final String JSON_FULL =
+ "{" + EOL + " \"rescue\" : {" + EOL + " \"adminPass\" : \"adminpass\"" + EOL + " }" + EOL + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(SerializationFeature.WRAP_ROOT_VALUE)
- .enable(DeserializationFeature.UNWRAP_ROOT_VALUE)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE)
+ .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
Rescue rescue = objectMapper.readValue(JSON_FULL, Rescue.class);
rescue.toString();
-
+
String adminPass = rescue.getAdminPass();
Assert.assertNotNull(adminPass);
rescue.setAdminPass(adminPass);
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.woorea.openstack.nova.model.ServerAction.Resize;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"resize\" : {" + EOL
- + " \"flavorRef\" : \"flavorref\"," + EOL
- + " \"OS-DCF:diskConfig\" : \"diskconfig\"" + EOL
- + " }" + EOL
- + "}";
+ private static final String JSON_FULL = "{" + EOL + " \"resize\" : {" + EOL + " \"flavorRef\" : \"flavorref\","
+ + EOL + " \"OS-DCF:diskConfig\" : \"diskconfig\"" + EOL + " }" + EOL + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(SerializationFeature.WRAP_ROOT_VALUE)
- .enable(DeserializationFeature.UNWRAP_ROOT_VALUE)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE)
+ .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
Resize resize = objectMapper.readValue(JSON_FULL, Resize.class);
resize.toString();
-
+
String flavorRef = resize.getFlavorRef();
Assert.assertNotNull(flavorRef);
resize.setFlavorRef(flavorRef);
-
+
String diskConfig = resize.getDiskConfig();
Assert.assertNotNull(diskConfig);
resize.setDiskConfig(diskConfig);
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.woorea.openstack.nova.model.Host.ResourceWrapper.Resource;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"project\" : \"project\"," + EOL
- + " \"host\" : \"host\"," + EOL
- + " \"cpu\" : 46," + EOL
- + " \"memory_mb\" : 90," + EOL
- + " \"disk_gb\" : 46" + EOL
- + "}";
+ private static final String JSON_FULL = "{" + EOL + " \"project\" : \"project\"," + EOL + " \"host\" : \"host\","
+ + EOL + " \"cpu\" : 46," + EOL + " \"memory_mb\" : 90," + EOL + " \"disk_gb\" : 46" + EOL + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
Resource resource = objectMapper.readValue(JSON_FULL, Resource.class);
resource.toString();
-
+
Integer memoryMb = resource.getMemoryMb();
Assert.assertNotNull(memoryMb);
-
+
String host = resource.getHost();
Assert.assertNotNull(host);
-
+
String project = resource.getProject();
Assert.assertNotNull(project);
-
+
Integer cpu = resource.getCpu();
Assert.assertNotNull(cpu);
-
+
Integer diskGb = resource.getDiskGb();
Assert.assertNotNull(diskGb);
}
import com.fasterxml.jackson.databind.SerializationFeature;
import com.woorea.openstack.nova.model.Host.ResourceWrapper;
import com.woorea.openstack.nova.model.Host.ResourceWrapper.Resource;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"resource\" : {" + EOL
- + " \"project\" : \"project\"," + EOL
- + " \"host\" : \"host\"," + EOL
- + " \"cpu\" : 46," + EOL
- + " \"memory_mb\" : 90," + EOL
- + " \"disk_gb\" : 46" + EOL
- + " }" + EOL
- + "}";
+ private static final String JSON_FULL = "{" + EOL + " \"resource\" : {" + EOL + " \"project\" : \"project\","
+ + EOL + " \"host\" : \"host\"," + EOL + " \"cpu\" : 46," + EOL + " \"memory_mb\" : 90," + EOL
+ + " \"disk_gb\" : 46" + EOL + " }" + EOL + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
ResourceWrapper resourcewrapper = objectMapper.readValue(JSON_FULL, ResourceWrapper.class);
resourcewrapper.toString();
-
+
Resource resource = resourcewrapper.getResource();
Assert.assertNotNull(resource);
}
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.woorea.openstack.nova.model.ServerAction.Restore;
-
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
import org.skyscreamer.jsonassert.JSONCompareMode;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"restore\" : { }" + EOL
- + "}";
+ private static final String JSON_FULL = "{" + EOL + " \"restore\" : { }" + EOL + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(SerializationFeature.WRAP_ROOT_VALUE)
- .enable(DeserializationFeature.UNWRAP_ROOT_VALUE)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE)
+ .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.woorea.openstack.nova.model.ServerAction.Resume;
-
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
import org.skyscreamer.jsonassert.JSONCompareMode;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"resume\" : { }" + EOL
- + "}";
+ private static final String JSON_FULL = "{" + EOL + " \"resume\" : { }" + EOL + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(SerializationFeature.WRAP_ROOT_VALUE)
- .enable(DeserializationFeature.UNWRAP_ROOT_VALUE)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE)
+ .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.woorea.openstack.nova.model.ServerAction.RevertResize;
-
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
import org.skyscreamer.jsonassert.JSONCompareMode;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"revertResize\" : { }" + EOL
- + "}";
+ private static final String JSON_FULL = "{" + EOL + " \"revertResize\" : { }" + EOL + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(SerializationFeature.WRAP_ROOT_VALUE)
- .enable(DeserializationFeature.UNWRAP_ROOT_VALUE)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE)
+ .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
import com.woorea.openstack.nova.model.SecurityGroup.Rule;
import com.woorea.openstack.nova.model.SecurityGroup.Rule.Group;
import com.woorea.openstack.nova.model.SecurityGroup.Rule.IpRange;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"security_group_rule\" : {" + EOL
- + " \"id\" : \"id\"," + EOL
- + " \"name\" : \"name\"," + EOL
- + " \"group\" : {" + EOL
- + " \"name\" : \"name\"," + EOL
- + " \"tenant_id\" : \"tenantid\"" + EOL
- + " }," + EOL
- + " \"parent_group_id\" : \"parentgroupid\"," + EOL
- + " \"from_port\" : 7," + EOL
- + " \"to_port\" : 98," + EOL
- + " \"ip_protocol\" : \"ipprotocol\"," + EOL
- + " \"ip_range\" : {" + EOL
- + " \"cidr\" : \"cidr\"" + EOL
- + " }" + EOL
- + " }" + EOL
- + "}";
-
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(SerializationFeature.WRAP_ROOT_VALUE)
- .enable(DeserializationFeature.UNWRAP_ROOT_VALUE)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private static final String JSON_FULL = "{" + EOL + " \"security_group_rule\" : {" + EOL + " \"id\" : \"id\","
+ + EOL + " \"name\" : \"name\"," + EOL + " \"group\" : {" + EOL + " \"name\" : \"name\"," + EOL
+ + " \"tenant_id\" : \"tenantid\"" + EOL + " }," + EOL
+ + " \"parent_group_id\" : \"parentgroupid\"," + EOL + " \"from_port\" : 7," + EOL
+ + " \"to_port\" : 98," + EOL + " \"ip_protocol\" : \"ipprotocol\"," + EOL + " \"ip_range\" : {"
+ + EOL + " \"cidr\" : \"cidr\"" + EOL + " }" + EOL + " }" + EOL + "}";
+
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE)
+ .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
Rule rule = objectMapper.readValue(JSON_FULL, Rule.class);
rule.toString();
-
+
String parentGroupId = rule.getParentGroupId();
Assert.assertNotNull(parentGroupId);
-
+
String ipProtocol = rule.getIpProtocol();
Assert.assertNotNull(ipProtocol);
-
+
IpRange ipRange = rule.getIpRange();
Assert.assertNotNull(ipRange);
-
+
Integer fromPort = rule.getFromPort();
Assert.assertNotNull(fromPort);
-
+
String name = rule.getName();
Assert.assertNotNull(name);
-
+
String id = rule.getId();
Assert.assertNotNull(id);
-
+
Integer toPort = rule.getToPort();
Assert.assertNotNull(toPort);
-
+
Group group = rule.getGroup();
Assert.assertNotNull(group);
}
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"security_group\" : {" + EOL
- + " \"name\" : \"name\"," + EOL
- + " \"description\" : \"description\"" + EOL
- + " }" + EOL
- + "}";
+ private static final String JSON_FULL = "{" + EOL + " \"security_group\" : {" + EOL + " \"name\" : \"name\","
+ + EOL + " \"description\" : \"description\"" + EOL + " }" + EOL + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(SerializationFeature.WRAP_ROOT_VALUE)
- .enable(DeserializationFeature.UNWRAP_ROOT_VALUE)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE)
+ .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
SecurityGroupForCreate securitygroupforcreate = objectMapper.readValue(JSON_FULL, SecurityGroupForCreate.class);
securitygroupforcreate.toString();
-
+
String name = securitygroupforcreate.getName();
Assert.assertNotNull(name);
securitygroupforcreate.setName(name);
-
+
String description = securitygroupforcreate.getDescription();
Assert.assertNotNull(description);
securitygroupforcreate.setDescription(description);
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"security_group_rule\" : {" + EOL
- + " \"cidr\" : \"cidr\"," + EOL
- + " \"parent_group_id\" : \"parentgroupid\"," + EOL
- + " \"ip_protocol\" : \"ipprotocol\"," + EOL
- + " \"from_port\" : 7," + EOL
- + " \"to_port\" : 98," + EOL
- + " \"group_id\" : \"groupid\"" + EOL
- + " }" + EOL
- + "}";
+ private static final String JSON_FULL = "{" + EOL + " \"security_group_rule\" : {" + EOL
+ + " \"cidr\" : \"cidr\"," + EOL + " \"parent_group_id\" : \"parentgroupid\"," + EOL
+ + " \"ip_protocol\" : \"ipprotocol\"," + EOL + " \"from_port\" : 7," + EOL + " \"to_port\" : 98,"
+ + EOL + " \"group_id\" : \"groupid\"" + EOL + " }" + EOL + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(SerializationFeature.WRAP_ROOT_VALUE)
- .enable(DeserializationFeature.UNWRAP_ROOT_VALUE)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE)
+ .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
System.out.println("CLASS: " + SecurityGroupRuleForCreate.class.getName());
System.out.println("TEST JSON: " + JSON_FULL);
- SecurityGroupRuleForCreate securitygroupruleforcreate = objectMapper.readValue(JSON_FULL, SecurityGroupRuleForCreate.class);
+ SecurityGroupRuleForCreate securitygroupruleforcreate =
+ objectMapper.readValue(JSON_FULL, SecurityGroupRuleForCreate.class);
String json = objectMapper.writeValueAsString(securitygroupruleforcreate);
System.out.println("RE-SERIALIZED OBJECT: " + json);
JSONAssert.assertEquals(JSON_FULL, json, JSONCompareMode.LENIENT);
@Test
public void testMethods() throws Exception {
- SecurityGroupRuleForCreate securitygroupruleforcreate = objectMapper.readValue(JSON_FULL, SecurityGroupRuleForCreate.class);
+ SecurityGroupRuleForCreate securitygroupruleforcreate =
+ objectMapper.readValue(JSON_FULL, SecurityGroupRuleForCreate.class);
securitygroupruleforcreate.toString();
-
+
String parentGroupId = securitygroupruleforcreate.getParentGroupId();
Assert.assertNotNull(parentGroupId);
securitygroupruleforcreate.setParentGroupId(parentGroupId);
-
+
String ipProtocol = securitygroupruleforcreate.getIpProtocol();
Assert.assertNotNull(ipProtocol);
securitygroupruleforcreate.setIpProtocol(ipProtocol);
-
+
String groupId = securitygroupruleforcreate.getGroupId();
Assert.assertNotNull(groupId);
securitygroupruleforcreate.setGroupId(groupId);
-
+
Integer fromPort = securitygroupruleforcreate.getFromPort();
Assert.assertNotNull(fromPort);
securitygroupruleforcreate.setFromPort(fromPort);
-
+
String cidr = securitygroupruleforcreate.getCidr();
Assert.assertNotNull(cidr);
securitygroupruleforcreate.setCidr(cidr);
-
+
Integer toPort = securitygroupruleforcreate.getToPort();
Assert.assertNotNull(toPort);
securitygroupruleforcreate.setToPort(toPort);
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.woorea.openstack.nova.model.ServerForCreate.SecurityGroup;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"name\" : \"name\"" + EOL
- + "}";
+ private static final String JSON_FULL = "{" + EOL + " \"name\" : \"name\"" + EOL + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
SecurityGroup securitygroup = objectMapper.readValue(JSON_FULL, SecurityGroup.class);
securitygroup.toString();
-
+
String name = securitygroup.getName();
Assert.assertNotNull(name);
securitygroup.setName(name);
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
-
import java.util.List;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"security_groups\" : [ {" + EOL
- + " \"id\" : \"id\"," + EOL
- + " \"name\" : \"name\"," + EOL
- + " \"description\" : \"description\"," + EOL
- + " \"rules\" : [ {" + EOL
- + " \"id\" : \"id\"," + EOL
- + " \"name\" : \"name\"," + EOL
- + " \"group\" : {" + EOL
- + " \"name\" : \"name\"," + EOL
- + " \"tenant_id\" : \"tenantid\"" + EOL
- + " }," + EOL
- + " \"parent_group_id\" : \"parentgroupid\"," + EOL
- + " \"from_port\" : 7," + EOL
- + " \"to_port\" : 98," + EOL
- + " \"ip_protocol\" : \"ipprotocol\"," + EOL
- + " \"ip_range\" : {" + EOL
- + " \"cidr\" : \"cidr\"" + EOL
- + " }" + EOL
- + " }, {" + EOL
- + " \"id\" : \"id\"," + EOL
- + " \"name\" : \"name\"," + EOL
- + " \"group\" : {" + EOL
- + " \"name\" : \"name\"," + EOL
- + " \"tenant_id\" : \"tenantid\"" + EOL
- + " }," + EOL
- + " \"parent_group_id\" : \"parentgroupid\"," + EOL
- + " \"from_port\" : 7," + EOL
- + " \"to_port\" : 98," + EOL
- + " \"ip_protocol\" : \"ipprotocol\"," + EOL
- + " \"ip_range\" : {" + EOL
- + " \"cidr\" : \"cidr\"" + EOL
- + " }" + EOL
- + " } ]," + EOL
- + " \"links\" : [ {" + EOL
- + " \"rel\" : \"rel\"," + EOL
- + " \"href\" : \"href\"," + EOL
- + " \"type\" : \"type\"" + EOL
- + " }, {" + EOL
- + " \"rel\" : \"rel\"," + EOL
- + " \"href\" : \"href\"," + EOL
- + " \"type\" : \"type\"" + EOL
- + " } ]," + EOL
- + " \"tenant_id\" : \"tenantid\"" + EOL
- + " }, {" + EOL
- + " \"id\" : \"id\"," + EOL
- + " \"name\" : \"name\"," + EOL
- + " \"description\" : \"description\"," + EOL
- + " \"rules\" : [ {" + EOL
- + " \"id\" : \"id\"," + EOL
- + " \"name\" : \"name\"," + EOL
- + " \"group\" : {" + EOL
- + " \"name\" : \"name\"," + EOL
- + " \"tenant_id\" : \"tenantid\"" + EOL
- + " }," + EOL
- + " \"parent_group_id\" : \"parentgroupid\"," + EOL
- + " \"from_port\" : 7," + EOL
- + " \"to_port\" : 98," + EOL
- + " \"ip_protocol\" : \"ipprotocol\"," + EOL
- + " \"ip_range\" : {" + EOL
- + " \"cidr\" : \"cidr\"" + EOL
- + " }" + EOL
- + " }, {" + EOL
- + " \"id\" : \"id\"," + EOL
- + " \"name\" : \"name\"," + EOL
- + " \"group\" : {" + EOL
- + " \"name\" : \"name\"," + EOL
- + " \"tenant_id\" : \"tenantid\"" + EOL
- + " }," + EOL
- + " \"parent_group_id\" : \"parentgroupid\"," + EOL
- + " \"from_port\" : 7," + EOL
- + " \"to_port\" : 98," + EOL
- + " \"ip_protocol\" : \"ipprotocol\"," + EOL
- + " \"ip_range\" : {" + EOL
- + " \"cidr\" : \"cidr\"" + EOL
- + " }" + EOL
- + " } ]," + EOL
- + " \"links\" : [ {" + EOL
- + " \"rel\" : \"rel\"," + EOL
- + " \"href\" : \"href\"," + EOL
- + " \"type\" : \"type\"" + EOL
- + " }, {" + EOL
- + " \"rel\" : \"rel\"," + EOL
- + " \"href\" : \"href\"," + EOL
- + " \"type\" : \"type\"" + EOL
- + " } ]," + EOL
- + " \"tenant_id\" : \"tenantid\"" + EOL
- + " } ]" + EOL
- + "}";
+ private static final String JSON_FULL = "{" + EOL + " \"security_groups\" : [ {" + EOL + " \"id\" : \"id\","
+ + EOL + " \"name\" : \"name\"," + EOL + " \"description\" : \"description\"," + EOL
+ + " \"rules\" : [ {" + EOL + " \"id\" : \"id\"," + EOL + " \"name\" : \"name\"," + EOL
+ + " \"group\" : {" + EOL + " \"name\" : \"name\"," + EOL
+ + " \"tenant_id\" : \"tenantid\"" + EOL + " }," + EOL
+ + " \"parent_group_id\" : \"parentgroupid\"," + EOL + " \"from_port\" : 7," + EOL
+ + " \"to_port\" : 98," + EOL + " \"ip_protocol\" : \"ipprotocol\"," + EOL
+ + " \"ip_range\" : {" + EOL + " \"cidr\" : \"cidr\"" + EOL + " }" + EOL + " }, {" + EOL
+ + " \"id\" : \"id\"," + EOL + " \"name\" : \"name\"," + EOL + " \"group\" : {" + EOL
+ + " \"name\" : \"name\"," + EOL + " \"tenant_id\" : \"tenantid\"" + EOL + " }," + EOL
+ + " \"parent_group_id\" : \"parentgroupid\"," + EOL + " \"from_port\" : 7," + EOL
+ + " \"to_port\" : 98," + EOL + " \"ip_protocol\" : \"ipprotocol\"," + EOL
+ + " \"ip_range\" : {" + EOL + " \"cidr\" : \"cidr\"" + EOL + " }" + EOL + " } ]," + EOL
+ + " \"links\" : [ {" + EOL + " \"rel\" : \"rel\"," + EOL + " \"href\" : \"href\"," + EOL
+ + " \"type\" : \"type\"" + EOL + " }, {" + EOL + " \"rel\" : \"rel\"," + EOL
+ + " \"href\" : \"href\"," + EOL + " \"type\" : \"type\"" + EOL + " } ]," + EOL
+ + " \"tenant_id\" : \"tenantid\"" + EOL + " }, {" + EOL + " \"id\" : \"id\"," + EOL
+ + " \"name\" : \"name\"," + EOL + " \"description\" : \"description\"," + EOL + " \"rules\" : [ {"
+ + EOL + " \"id\" : \"id\"," + EOL + " \"name\" : \"name\"," + EOL + " \"group\" : {" + EOL
+ + " \"name\" : \"name\"," + EOL + " \"tenant_id\" : \"tenantid\"" + EOL + " }," + EOL
+ + " \"parent_group_id\" : \"parentgroupid\"," + EOL + " \"from_port\" : 7," + EOL
+ + " \"to_port\" : 98," + EOL + " \"ip_protocol\" : \"ipprotocol\"," + EOL
+ + " \"ip_range\" : {" + EOL + " \"cidr\" : \"cidr\"" + EOL + " }" + EOL + " }, {" + EOL
+ + " \"id\" : \"id\"," + EOL + " \"name\" : \"name\"," + EOL + " \"group\" : {" + EOL
+ + " \"name\" : \"name\"," + EOL + " \"tenant_id\" : \"tenantid\"" + EOL + " }," + EOL
+ + " \"parent_group_id\" : \"parentgroupid\"," + EOL + " \"from_port\" : 7," + EOL
+ + " \"to_port\" : 98," + EOL + " \"ip_protocol\" : \"ipprotocol\"," + EOL
+ + " \"ip_range\" : {" + EOL + " \"cidr\" : \"cidr\"" + EOL + " }" + EOL + " } ]," + EOL
+ + " \"links\" : [ {" + EOL + " \"rel\" : \"rel\"," + EOL + " \"href\" : \"href\"," + EOL
+ + " \"type\" : \"type\"" + EOL + " }, {" + EOL + " \"rel\" : \"rel\"," + EOL
+ + " \"href\" : \"href\"," + EOL + " \"type\" : \"type\"" + EOL + " } ]," + EOL
+ + " \"tenant_id\" : \"tenantid\"" + EOL + " } ]" + EOL + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
SecurityGroups securitygroups = objectMapper.readValue(JSON_FULL, SecurityGroups.class);
securitygroups.toString();
-
+
List<SecurityGroup> list = securitygroups.getList();
Assert.assertNotNull(list);
Assert.assertEquals(2, list.size());
-
+
int cnt = 0;
- for (@SuppressWarnings("unused") SecurityGroup x : securitygroups) {
+ for (@SuppressWarnings("unused")
+ SecurityGroup x : securitygroups) {
++cnt;
}
Assert.assertEquals(2, cnt);
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP - SO\r
- * ================================================================================\r
- * Copyright (C) 2018 Huawei Intellectual Property. All rights reserved.\r
- * ================================================================================ \r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package com.woorea.openstack.nova.model;\r
-\r
-import com.woorea.openstack.nova.model.ServerAction.ChangePassword;\r
-import org.junit.Test;\r
-\r
-import static org.junit.Assert.assertEquals;\r
-import static org.junit.Assert.fail; \r
-\r
-\r
-public class ServerActionTest {\r
- private ChangePassword testObj = new ServerAction.ChangePassword();\r
-\r
- @Test\r
- public void testSetAdminPass(){\r
-\r
- try {\r
-\r
- testObj.setAdminPass("sai");\r
- assertEquals( testObj.getAdminPass(), "sai");\r
-\r
- } catch (Exception e) {\r
-\r
- fail("Exception in test obj");\r
- }\r
-\r
- }\r
-\r
- @Test\r
- public void testChangePasswdConstructor(){\r
-\r
- try {\r
- ServerAction.ChangePassword test = new ServerAction.ChangePassword("sai");\r
- assertEquals( test.getAdminPass(), "sai");\r
-\r
- } catch (Exception e) {\r
-\r
- fail("Exception in test obj");\r
- }\r
-\r
- }\r
-\r
- private ServerAction.Reboot testObj1 = new ServerAction.Reboot();\r
-\r
- @Test\r
- public void testSetType(){\r
- testObj1.setType("sai");\r
- assertEquals("sai", testObj1.getType());\r
- }\r
-\r
- private ServerAction.Rebuild testRebuild = new ServerAction.Rebuild();\r
- \r
- @Test\r
- public void testRebuild()\r
- {\r
- testRebuild.setAccessIPv4("1.1.1.1");\r
- assertEquals(testRebuild.getAccessIPv4(),"1.1.1.1");\r
- }\r
-}\r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2018 Huawei Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package com.woorea.openstack.nova.model;
+
+import com.woorea.openstack.nova.model.ServerAction.ChangePassword;
+import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+
+public class ServerActionTest {
+ private ChangePassword testObj = new ServerAction.ChangePassword();
+
+ @Test
+ public void testSetAdminPass() {
+
+ try {
+
+ testObj.setAdminPass("sai");
+ assertEquals(testObj.getAdminPass(), "sai");
+
+ } catch (Exception e) {
+
+ fail("Exception in test obj");
+ }
+
+ }
+
+ @Test
+ public void testChangePasswdConstructor() {
+
+ try {
+ ServerAction.ChangePassword test = new ServerAction.ChangePassword("sai");
+ assertEquals(test.getAdminPass(), "sai");
+
+ } catch (Exception e) {
+
+ fail("Exception in test obj");
+ }
+
+ }
+
+ private ServerAction.Reboot testObj1 = new ServerAction.Reboot();
+
+ @Test
+ public void testSetType() {
+ testObj1.setType("sai");
+ assertEquals("sai", testObj1.getType());
+ }
+
+ private ServerAction.Rebuild testRebuild = new ServerAction.Rebuild();
+
+ @Test
+ public void testRebuild() {
+ testRebuild.setAccessIPv4("1.1.1.1");
+ assertEquals(testRebuild.getAccessIPv4(), "1.1.1.1");
+ }
+}
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.woorea.openstack.nova.model.ServerForCreate.SecurityGroup;
-
import java.util.List;
import java.util.Map;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"server\" : {" + EOL
- + " \"name\" : \"name\"," + EOL
- + " \"adminPass\" : \"adminpass\"," + EOL
- + " \"imageRef\" : \"imageref\"," + EOL
- + " \"flavorRef\" : \"flavorref\"," + EOL
- + " \"accessIPv4\" : \"accessipv4\"," + EOL
- + " \"accessIPv6\" : \"accessipv6\"," + EOL
- + " \"min\" : 42," + EOL
- + " \"max\" : 44," + EOL
- + " \"diskConfig\" : \"diskconfig\"," + EOL
- + " \"personality\" : [ {" + EOL
- + " \"path\" : \"path\"," + EOL
- + " \"contents\" : \"contents\"" + EOL
- + " }, {" + EOL
- + " \"path\" : \"path\"," + EOL
- + " \"contents\" : \"contents\"" + EOL
- + " } ]," + EOL
- + " \"metadata\" : {" + EOL
- + " \"metadata-k1\" : \"metadata-v1\"," + EOL
- + " \"metadata-k2\" : \"metadata-v2\"" + EOL
- + " }," + EOL
- + " \"networks\" : [ {" + EOL
- + " \"uuid\" : \"id\"," + EOL
- + " \"fixed_ip\" : \"fixedip\"" + EOL
- + " }, {" + EOL
- + " \"uuid\" : \"id\"," + EOL
- + " \"fixed_ip\" : \"fixedip\"" + EOL
- + " } ]," + EOL
- + " \"key_name\" : \"keyname\"," + EOL
- + " \"security_groups\" : [ {" + EOL
- + " \"name\" : \"name\"" + EOL
- + " }, {" + EOL
- + " \"name\" : \"name\"" + EOL
- + " } ]," + EOL
- + " \"user_data\" : \"userdata\"," + EOL
- + " \"availability_zone\" : \"availabilityzone\"," + EOL
- + " \"config_drive\" : true" + EOL
- + " }" + EOL
- + "}";
-
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(SerializationFeature.WRAP_ROOT_VALUE)
- .enable(DeserializationFeature.UNWRAP_ROOT_VALUE)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private static final String JSON_FULL = "{" + EOL + " \"server\" : {" + EOL + " \"name\" : \"name\"," + EOL
+ + " \"adminPass\" : \"adminpass\"," + EOL + " \"imageRef\" : \"imageref\"," + EOL
+ + " \"flavorRef\" : \"flavorref\"," + EOL + " \"accessIPv4\" : \"accessipv4\"," + EOL
+ + " \"accessIPv6\" : \"accessipv6\"," + EOL + " \"min\" : 42," + EOL + " \"max\" : 44," + EOL
+ + " \"diskConfig\" : \"diskconfig\"," + EOL + " \"personality\" : [ {" + EOL
+ + " \"path\" : \"path\"," + EOL + " \"contents\" : \"contents\"" + EOL + " }, {" + EOL
+ + " \"path\" : \"path\"," + EOL + " \"contents\" : \"contents\"" + EOL + " } ]," + EOL
+ + " \"metadata\" : {" + EOL + " \"metadata-k1\" : \"metadata-v1\"," + EOL
+ + " \"metadata-k2\" : \"metadata-v2\"" + EOL + " }," + EOL + " \"networks\" : [ {" + EOL
+ + " \"uuid\" : \"id\"," + EOL + " \"fixed_ip\" : \"fixedip\"" + EOL + " }, {" + EOL
+ + " \"uuid\" : \"id\"," + EOL + " \"fixed_ip\" : \"fixedip\"" + EOL + " } ]," + EOL
+ + " \"key_name\" : \"keyname\"," + EOL + " \"security_groups\" : [ {" + EOL
+ + " \"name\" : \"name\"" + EOL + " }, {" + EOL + " \"name\" : \"name\"" + EOL + " } ],"
+ + EOL + " \"user_data\" : \"userdata\"," + EOL + " \"availability_zone\" : \"availabilityzone\","
+ + EOL + " \"config_drive\" : true" + EOL + " }" + EOL + "}";
+
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE)
+ .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
ServerForCreate serverforcreate = objectMapper.readValue(JSON_FULL, ServerForCreate.class);
serverforcreate.toString();
-
- Map<String,String> metadata = serverforcreate.getMetadata();
+
+ Map<String, String> metadata = serverforcreate.getMetadata();
Assert.assertNotNull(metadata);
Assert.assertEquals(2, metadata.size());
serverforcreate.setMetadata(metadata);
-
+
Integer max = serverforcreate.getMax();
Assert.assertNotNull(max);
serverforcreate.setMax(max);
-
+
List<NetworkForCreate> networks = serverforcreate.getNetworks();
Assert.assertNotNull(networks);
Assert.assertEquals(2, networks.size());
serverforcreate.setNetworks(networks);
-
+
String userData = serverforcreate.getUserData();
Assert.assertNotNull(userData);
serverforcreate.setUserData(userData);
-
+
Integer min = serverforcreate.getMin();
Assert.assertNotNull(min);
serverforcreate.setMin(min);
-
+
List<PersonalityFile> personality = serverforcreate.getPersonality();
Assert.assertNotNull(personality);
Assert.assertEquals(2, personality.size());
serverforcreate.setPersonality(personality);
-
+
String name = serverforcreate.getName();
Assert.assertNotNull(name);
serverforcreate.setName(name);
-
+
String flavorRef = serverforcreate.getFlavorRef();
Assert.assertNotNull(flavorRef);
serverforcreate.setFlavorRef(flavorRef);
-
+
String keyName = serverforcreate.getKeyName();
Assert.assertNotNull(keyName);
serverforcreate.setKeyName(keyName);
-
+
String adminPass = serverforcreate.getAdminPass();
Assert.assertNotNull(adminPass);
serverforcreate.setAdminPass(adminPass);
-
+
String imageRef = serverforcreate.getImageRef();
Assert.assertNotNull(imageRef);
serverforcreate.setImageRef(imageRef);
-
+
String accessIPv6 = serverforcreate.getAccessIPv6();
Assert.assertNotNull(accessIPv6);
serverforcreate.setAccessIPv6(accessIPv6);
-
+
String diskConfig = serverforcreate.getDiskConfig();
Assert.assertNotNull(diskConfig);
serverforcreate.setDiskConfig(diskConfig);
-
+
List<SecurityGroup> securityGroups = serverforcreate.getSecurityGroups();
Assert.assertNotNull(securityGroups);
Assert.assertEquals(2, securityGroups.size());
-
+
String availabilityZone = serverforcreate.getAvailabilityZone();
Assert.assertNotNull(availabilityZone);
serverforcreate.setAvailabilityZone(availabilityZone);
-
+
String accessIPv4 = serverforcreate.getAccessIPv4();
Assert.assertNotNull(accessIPv4);
serverforcreate.setAccessIPv4(accessIPv4);
import com.fasterxml.jackson.databind.SerializationFeature;
import com.woorea.openstack.nova.model.Server.Addresses;
import com.woorea.openstack.nova.model.Server.Fault;
-
import java.util.List;
import java.util.Map;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"server\" : {" + EOL
- + " \"id\" : \"id\"," + EOL
- + " \"name\" : \"name\"," + EOL
- + " \"addresses\" : {" + EOL
- + " \"addresses\" : {" + EOL
- + " \"addresses-k1\" : [ {" + EOL
- + " \"version\" : \"version\"," + EOL
- + " \"addr\" : \"addr\"," + EOL
- + " \"OS-EXT-IPS-MAC:mac_addr\" : \"macaddr\"," + EOL
- + " \"OS-EXT-IPS:type\" : \"type\"" + EOL
- + " }, {" + EOL
- + " \"version\" : \"version\"," + EOL
- + " \"addr\" : \"addr\"," + EOL
- + " \"OS-EXT-IPS-MAC:mac_addr\" : \"macaddr\"," + EOL
- + " \"OS-EXT-IPS:type\" : \"type\"" + EOL
- + " } ]," + EOL
- + " \"addresses-k2\" : [ {" + EOL
- + " \"version\" : \"version\"," + EOL
- + " \"addr\" : \"addr\"," + EOL
- + " \"OS-EXT-IPS-MAC:mac_addr\" : \"macaddr\"," + EOL
- + " \"OS-EXT-IPS:type\" : \"type\"" + EOL
- + " }, {" + EOL
- + " \"version\" : \"version\"," + EOL
- + " \"addr\" : \"addr\"," + EOL
- + " \"OS-EXT-IPS-MAC:mac_addr\" : \"macaddr\"," + EOL
- + " \"OS-EXT-IPS:type\" : \"type\"" + EOL
- + " } ]" + EOL
- + " }" + EOL
- + " }," + EOL
- + " \"links\" : [ {" + EOL
- + " \"rel\" : \"rel\"," + EOL
- + " \"href\" : \"href\"," + EOL
- + " \"type\" : \"type\"" + EOL
- + " }, {" + EOL
- + " \"rel\" : \"rel\"," + EOL
- + " \"href\" : \"href\"," + EOL
- + " \"type\" : \"type\"" + EOL
- + " } ]," + EOL
- + " \"image\" : {" + EOL
- + " \"id\" : \"id\"," + EOL
- + " \"status\" : \"status\"," + EOL
- + " \"name\" : \"name\"," + EOL
- + " \"progress\" : 3," + EOL
- + " \"minRam\" : 62," + EOL
- + " \"minDisk\" : 69," + EOL
- + " \"created\" : 1485172800000," + EOL
- + " \"updated\" : 1486468800000," + EOL
- + " \"metadata\" : {" + EOL
- + " \"metadata-k1\" : \"metadata-v1\"," + EOL
- + " \"metadata-k2\" : \"metadata-v2\"" + EOL
- + " }," + EOL
- + " \"server\" : {" + EOL
- + " \"id\" : \"id\"," + EOL
- + " \"links\" : [ {" + EOL
- + " \"rel\" : \"rel\"," + EOL
- + " \"href\" : \"href\"," + EOL
- + " \"type\" : \"type\"" + EOL
- + " }, {" + EOL
- + " \"rel\" : \"rel\"," + EOL
- + " \"href\" : \"href\"," + EOL
- + " \"type\" : \"type\"" + EOL
- + " } ]" + EOL
- + " }," + EOL
- + " \"links\" : [ {" + EOL
- + " \"rel\" : \"rel\"," + EOL
- + " \"href\" : \"href\"," + EOL
- + " \"type\" : \"type\"" + EOL
- + " }, {" + EOL
- + " \"rel\" : \"rel\"," + EOL
- + " \"href\" : \"href\"," + EOL
- + " \"type\" : \"type\"" + EOL
- + " } ]," + EOL
- + " \"OS-EXT-IMG-SIZE:size\" : 43" + EOL
- + " }," + EOL
- + " \"flavor\" : {" + EOL
- + " \"id\" : \"id\"," + EOL
- + " \"name\" : \"name\"," + EOL
- + " \"vcpus\" : 79," + EOL
- + " \"ram\" : 38," + EOL
- + " \"disk\" : 45," + EOL
- + " \"swap\" : \"swap\"," + EOL
- + " \"links\" : [ {" + EOL
- + " \"rel\" : \"rel\"," + EOL
- + " \"href\" : \"href\"," + EOL
- + " \"type\" : \"type\"" + EOL
- + " }, {" + EOL
- + " \"rel\" : \"rel\"," + EOL
- + " \"href\" : \"href\"," + EOL
- + " \"type\" : \"type\"" + EOL
- + " } ]," + EOL
- + " \"public\" : false," + EOL
- + " \"OS-FLV-EXT-DATA:ephemeral\" : 65," + EOL
- + " \"rxtx_factor\" : 11.0," + EOL
- + " \"OS-FLV-DISABLED:disabled\" : true," + EOL
- + " \"rxtx_quota\" : 42," + EOL
- + " \"rxtx_cap\" : 96," + EOL
- + " \"os-flavor-access:is_public\" : false" + EOL
- + " }," + EOL
- + " \"accessIPv4\" : \"accessipv4\"," + EOL
- + " \"accessIPv6\" : \"accessipv6\"," + EOL
- + " \"status\" : \"status\"," + EOL
- + " \"progress\" : 3," + EOL
- + " \"fault\" : {" + EOL
- + " \"code\" : 29," + EOL
- + " \"message\" : \"message\"," + EOL
- + " \"details\" : \"details\"," + EOL
- + " \"created\" : 1485172800000" + EOL
- + " }," + EOL
- + " \"hostId\" : \"hostid\"," + EOL
- + " \"updated\" : \"updated\"," + EOL
- + " \"created\" : \"created\"," + EOL
- + " \"metadata\" : {" + EOL
- + " \"metadata-k1\" : \"metadata-v1\"," + EOL
- + " \"metadata-k2\" : \"metadata-v2\"" + EOL
- + " }," + EOL
- + " \"uuid\" : \"uuid\"," + EOL
- + " \"adminPass\" : \"adminpass\"," + EOL
- + " \"config_drive\" : \"configdrive\"," + EOL
- + " \"tenant_id\" : \"tenantid\"," + EOL
- + " \"user_id\" : \"userid\"," + EOL
- + " \"key_name\" : \"keyname\"," + EOL
- + " \"security_groups\" : [ {" + EOL
- + " \"id\" : \"id\"," + EOL
- + " \"name\" : \"name\"," + EOL
- + " \"description\" : \"description\"," + EOL
- + " \"rules\" : [ {" + EOL
- + " \"id\" : \"id\"," + EOL
- + " \"name\" : \"name\"," + EOL
- + " \"group\" : {" + EOL
- + " \"name\" : \"name\"," + EOL
- + " \"tenant_id\" : \"tenantid\"" + EOL
- + " }," + EOL
- + " \"parent_group_id\" : \"parentgroupid\"," + EOL
- + " \"from_port\" : 7," + EOL
- + " \"to_port\" : 98," + EOL
- + " \"ip_protocol\" : \"ipprotocol\"," + EOL
- + " \"ip_range\" : {" + EOL
- + " \"cidr\" : \"cidr\"" + EOL
- + " }" + EOL
- + " }, {" + EOL
- + " \"id\" : \"id\"," + EOL
- + " \"name\" : \"name\"," + EOL
- + " \"group\" : {" + EOL
- + " \"name\" : \"name\"," + EOL
- + " \"tenant_id\" : \"tenantid\"" + EOL
- + " }," + EOL
- + " \"parent_group_id\" : \"parentgroupid\"," + EOL
- + " \"from_port\" : 7," + EOL
- + " \"to_port\" : 98," + EOL
- + " \"ip_protocol\" : \"ipprotocol\"," + EOL
- + " \"ip_range\" : {" + EOL
- + " \"cidr\" : \"cidr\"" + EOL
- + " }" + EOL
- + " } ]," + EOL
- + " \"links\" : [ {" + EOL
- + " \"rel\" : \"rel\"," + EOL
- + " \"href\" : \"href\"," + EOL
- + " \"type\" : \"type\"" + EOL
- + " }, {" + EOL
- + " \"rel\" : \"rel\"," + EOL
- + " \"href\" : \"href\"," + EOL
- + " \"type\" : \"type\"" + EOL
- + " } ]," + EOL
- + " \"tenant_id\" : \"tenantid\"" + EOL
- + " }, {" + EOL
- + " \"id\" : \"id\"," + EOL
- + " \"name\" : \"name\"," + EOL
- + " \"description\" : \"description\"," + EOL
- + " \"rules\" : [ {" + EOL
- + " \"id\" : \"id\"," + EOL
- + " \"name\" : \"name\"," + EOL
- + " \"group\" : {" + EOL
- + " \"name\" : \"name\"," + EOL
- + " \"tenant_id\" : \"tenantid\"" + EOL
- + " }," + EOL
- + " \"parent_group_id\" : \"parentgroupid\"," + EOL
- + " \"from_port\" : 7," + EOL
- + " \"to_port\" : 98," + EOL
- + " \"ip_protocol\" : \"ipprotocol\"," + EOL
- + " \"ip_range\" : {" + EOL
- + " \"cidr\" : \"cidr\"" + EOL
- + " }" + EOL
- + " }, {" + EOL
- + " \"id\" : \"id\"," + EOL
- + " \"name\" : \"name\"," + EOL
- + " \"group\" : {" + EOL
- + " \"name\" : \"name\"," + EOL
- + " \"tenant_id\" : \"tenantid\"" + EOL
- + " }," + EOL
- + " \"parent_group_id\" : \"parentgroupid\"," + EOL
- + " \"from_port\" : 7," + EOL
- + " \"to_port\" : 98," + EOL
- + " \"ip_protocol\" : \"ipprotocol\"," + EOL
- + " \"ip_range\" : {" + EOL
- + " \"cidr\" : \"cidr\"" + EOL
- + " }" + EOL
- + " } ]," + EOL
- + " \"links\" : [ {" + EOL
- + " \"rel\" : \"rel\"," + EOL
- + " \"href\" : \"href\"," + EOL
- + " \"type\" : \"type\"" + EOL
- + " }, {" + EOL
- + " \"rel\" : \"rel\"," + EOL
- + " \"href\" : \"href\"," + EOL
- + " \"type\" : \"type\"" + EOL
- + " } ]," + EOL
- + " \"tenant_id\" : \"tenantid\"" + EOL
- + " } ]," + EOL
- + " \"OS-EXT-STS:task_state\" : \"taskstate\"," + EOL
- + " \"OS-EXT-STS:power_state\" : \"powerstate\"," + EOL
- + " \"OS-EXT-STS:vm_state\" : \"vmstate\"," + EOL
- + " \"OS-EXT-SRV-ATTR:host\" : \"host\"," + EOL
- + " \"OS-EXT-SRV-ATTR:instance_name\" : \"instancename\"," + EOL
- + " \"OS-EXT-SRV-ATTR:hypervisor_hostname\" : \"hypervisorhostname\"," + EOL
- + " \"OS-DCF:diskConfig\" : \"diskconfig\"," + EOL
- + " \"OS-EXT-AZ:availability_zone\" : \"availabilityzone\"," + EOL
- + " \"OS-SRV-USG:launched_at\" : \"launchedat\"," + EOL
- + " \"OS-SRV-USG:terminated_at\" : \"terminatedat\"," + EOL
- + " \"os-extended-volumes:volumes_attached\" : [ \"osextendedvolumesattached-v1\", \"osextendedvolumesattached-v2\" ]" + EOL
- + " }" + EOL
- + "}";
-
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(SerializationFeature.WRAP_ROOT_VALUE)
- .enable(DeserializationFeature.UNWRAP_ROOT_VALUE)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private static final String JSON_FULL = "{" + EOL + " \"server\" : {" + EOL + " \"id\" : \"id\"," + EOL
+ + " \"name\" : \"name\"," + EOL + " \"addresses\" : {" + EOL + " \"addresses\" : {" + EOL
+ + " \"addresses-k1\" : [ {" + EOL + " \"version\" : \"version\"," + EOL
+ + " \"addr\" : \"addr\"," + EOL + " \"OS-EXT-IPS-MAC:mac_addr\" : \"macaddr\"," + EOL
+ + " \"OS-EXT-IPS:type\" : \"type\"" + EOL + " }, {" + EOL
+ + " \"version\" : \"version\"," + EOL + " \"addr\" : \"addr\"," + EOL
+ + " \"OS-EXT-IPS-MAC:mac_addr\" : \"macaddr\"," + EOL + " \"OS-EXT-IPS:type\" : \"type\""
+ + EOL + " } ]," + EOL + " \"addresses-k2\" : [ {" + EOL
+ + " \"version\" : \"version\"," + EOL + " \"addr\" : \"addr\"," + EOL
+ + " \"OS-EXT-IPS-MAC:mac_addr\" : \"macaddr\"," + EOL + " \"OS-EXT-IPS:type\" : \"type\""
+ + EOL + " }, {" + EOL + " \"version\" : \"version\"," + EOL
+ + " \"addr\" : \"addr\"," + EOL + " \"OS-EXT-IPS-MAC:mac_addr\" : \"macaddr\"," + EOL
+ + " \"OS-EXT-IPS:type\" : \"type\"" + EOL + " } ]" + EOL + " }" + EOL + " }," + EOL
+ + " \"links\" : [ {" + EOL + " \"rel\" : \"rel\"," + EOL + " \"href\" : \"href\"," + EOL
+ + " \"type\" : \"type\"" + EOL + " }, {" + EOL + " \"rel\" : \"rel\"," + EOL
+ + " \"href\" : \"href\"," + EOL + " \"type\" : \"type\"" + EOL + " } ]," + EOL
+ + " \"image\" : {" + EOL + " \"id\" : \"id\"," + EOL + " \"status\" : \"status\"," + EOL
+ + " \"name\" : \"name\"," + EOL + " \"progress\" : 3," + EOL + " \"minRam\" : 62," + EOL
+ + " \"minDisk\" : 69," + EOL + " \"created\" : 1485172800000," + EOL
+ + " \"updated\" : 1486468800000," + EOL + " \"metadata\" : {" + EOL
+ + " \"metadata-k1\" : \"metadata-v1\"," + EOL + " \"metadata-k2\" : \"metadata-v2\"" + EOL
+ + " }," + EOL + " \"server\" : {" + EOL + " \"id\" : \"id\"," + EOL
+ + " \"links\" : [ {" + EOL + " \"rel\" : \"rel\"," + EOL + " \"href\" : \"href\","
+ + EOL + " \"type\" : \"type\"" + EOL + " }, {" + EOL + " \"rel\" : \"rel\"," + EOL
+ + " \"href\" : \"href\"," + EOL + " \"type\" : \"type\"" + EOL + " } ]" + EOL
+ + " }," + EOL + " \"links\" : [ {" + EOL + " \"rel\" : \"rel\"," + EOL
+ + " \"href\" : \"href\"," + EOL + " \"type\" : \"type\"" + EOL + " }, {" + EOL
+ + " \"rel\" : \"rel\"," + EOL + " \"href\" : \"href\"," + EOL + " \"type\" : \"type\""
+ + EOL + " } ]," + EOL + " \"OS-EXT-IMG-SIZE:size\" : 43" + EOL + " }," + EOL
+ + " \"flavor\" : {" + EOL + " \"id\" : \"id\"," + EOL + " \"name\" : \"name\"," + EOL
+ + " \"vcpus\" : 79," + EOL + " \"ram\" : 38," + EOL + " \"disk\" : 45," + EOL
+ + " \"swap\" : \"swap\"," + EOL + " \"links\" : [ {" + EOL + " \"rel\" : \"rel\"," + EOL
+ + " \"href\" : \"href\"," + EOL + " \"type\" : \"type\"" + EOL + " }, {" + EOL
+ + " \"rel\" : \"rel\"," + EOL + " \"href\" : \"href\"," + EOL + " \"type\" : \"type\""
+ + EOL + " } ]," + EOL + " \"public\" : false," + EOL + " \"OS-FLV-EXT-DATA:ephemeral\" : 65,"
+ + EOL + " \"rxtx_factor\" : 11.0," + EOL + " \"OS-FLV-DISABLED:disabled\" : true," + EOL
+ + " \"rxtx_quota\" : 42," + EOL + " \"rxtx_cap\" : 96," + EOL
+ + " \"os-flavor-access:is_public\" : false" + EOL + " }," + EOL
+ + " \"accessIPv4\" : \"accessipv4\"," + EOL + " \"accessIPv6\" : \"accessipv6\"," + EOL
+ + " \"status\" : \"status\"," + EOL + " \"progress\" : 3," + EOL + " \"fault\" : {" + EOL
+ + " \"code\" : 29," + EOL + " \"message\" : \"message\"," + EOL
+ + " \"details\" : \"details\"," + EOL + " \"created\" : 1485172800000" + EOL + " }," + EOL
+ + " \"hostId\" : \"hostid\"," + EOL + " \"updated\" : \"updated\"," + EOL
+ + " \"created\" : \"created\"," + EOL + " \"metadata\" : {" + EOL
+ + " \"metadata-k1\" : \"metadata-v1\"," + EOL + " \"metadata-k2\" : \"metadata-v2\"" + EOL
+ + " }," + EOL + " \"uuid\" : \"uuid\"," + EOL + " \"adminPass\" : \"adminpass\"," + EOL
+ + " \"config_drive\" : \"configdrive\"," + EOL + " \"tenant_id\" : \"tenantid\"," + EOL
+ + " \"user_id\" : \"userid\"," + EOL + " \"key_name\" : \"keyname\"," + EOL
+ + " \"security_groups\" : [ {" + EOL + " \"id\" : \"id\"," + EOL + " \"name\" : \"name\","
+ + EOL + " \"description\" : \"description\"," + EOL + " \"rules\" : [ {" + EOL
+ + " \"id\" : \"id\"," + EOL + " \"name\" : \"name\"," + EOL + " \"group\" : {" + EOL
+ + " \"name\" : \"name\"," + EOL + " \"tenant_id\" : \"tenantid\"" + EOL + " },"
+ + EOL + " \"parent_group_id\" : \"parentgroupid\"," + EOL + " \"from_port\" : 7," + EOL
+ + " \"to_port\" : 98," + EOL + " \"ip_protocol\" : \"ipprotocol\"," + EOL
+ + " \"ip_range\" : {" + EOL + " \"cidr\" : \"cidr\"" + EOL + " }" + EOL
+ + " }, {" + EOL + " \"id\" : \"id\"," + EOL + " \"name\" : \"name\"," + EOL
+ + " \"group\" : {" + EOL + " \"name\" : \"name\"," + EOL
+ + " \"tenant_id\" : \"tenantid\"" + EOL + " }," + EOL
+ + " \"parent_group_id\" : \"parentgroupid\"," + EOL + " \"from_port\" : 7," + EOL
+ + " \"to_port\" : 98," + EOL + " \"ip_protocol\" : \"ipprotocol\"," + EOL
+ + " \"ip_range\" : {" + EOL + " \"cidr\" : \"cidr\"" + EOL + " }" + EOL
+ + " } ]," + EOL + " \"links\" : [ {" + EOL + " \"rel\" : \"rel\"," + EOL
+ + " \"href\" : \"href\"," + EOL + " \"type\" : \"type\"" + EOL + " }, {" + EOL
+ + " \"rel\" : \"rel\"," + EOL + " \"href\" : \"href\"," + EOL + " \"type\" : \"type\""
+ + EOL + " } ]," + EOL + " \"tenant_id\" : \"tenantid\"" + EOL + " }, {" + EOL
+ + " \"id\" : \"id\"," + EOL + " \"name\" : \"name\"," + EOL
+ + " \"description\" : \"description\"," + EOL + " \"rules\" : [ {" + EOL
+ + " \"id\" : \"id\"," + EOL + " \"name\" : \"name\"," + EOL + " \"group\" : {" + EOL
+ + " \"name\" : \"name\"," + EOL + " \"tenant_id\" : \"tenantid\"" + EOL + " },"
+ + EOL + " \"parent_group_id\" : \"parentgroupid\"," + EOL + " \"from_port\" : 7," + EOL
+ + " \"to_port\" : 98," + EOL + " \"ip_protocol\" : \"ipprotocol\"," + EOL
+ + " \"ip_range\" : {" + EOL + " \"cidr\" : \"cidr\"" + EOL + " }" + EOL
+ + " }, {" + EOL + " \"id\" : \"id\"," + EOL + " \"name\" : \"name\"," + EOL
+ + " \"group\" : {" + EOL + " \"name\" : \"name\"," + EOL
+ + " \"tenant_id\" : \"tenantid\"" + EOL + " }," + EOL
+ + " \"parent_group_id\" : \"parentgroupid\"," + EOL + " \"from_port\" : 7," + EOL
+ + " \"to_port\" : 98," + EOL + " \"ip_protocol\" : \"ipprotocol\"," + EOL
+ + " \"ip_range\" : {" + EOL + " \"cidr\" : \"cidr\"" + EOL + " }" + EOL
+ + " } ]," + EOL + " \"links\" : [ {" + EOL + " \"rel\" : \"rel\"," + EOL
+ + " \"href\" : \"href\"," + EOL + " \"type\" : \"type\"" + EOL + " }, {" + EOL
+ + " \"rel\" : \"rel\"," + EOL + " \"href\" : \"href\"," + EOL + " \"type\" : \"type\""
+ + EOL + " } ]," + EOL + " \"tenant_id\" : \"tenantid\"" + EOL + " } ]," + EOL
+ + " \"OS-EXT-STS:task_state\" : \"taskstate\"," + EOL
+ + " \"OS-EXT-STS:power_state\" : \"powerstate\"," + EOL + " \"OS-EXT-STS:vm_state\" : \"vmstate\","
+ + EOL + " \"OS-EXT-SRV-ATTR:host\" : \"host\"," + EOL
+ + " \"OS-EXT-SRV-ATTR:instance_name\" : \"instancename\"," + EOL
+ + " \"OS-EXT-SRV-ATTR:hypervisor_hostname\" : \"hypervisorhostname\"," + EOL
+ + " \"OS-DCF:diskConfig\" : \"diskconfig\"," + EOL
+ + " \"OS-EXT-AZ:availability_zone\" : \"availabilityzone\"," + EOL
+ + " \"OS-SRV-USG:launched_at\" : \"launchedat\"," + EOL
+ + " \"OS-SRV-USG:terminated_at\" : \"terminatedat\"," + EOL
+ + " \"os-extended-volumes:volumes_attached\" : [ \"osextendedvolumesattached-v1\", \"osextendedvolumesattached-v2\" ]"
+ + EOL + " }" + EOL + "}";
+
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE)
+ .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
Server server = objectMapper.readValue(JSON_FULL, Server.class);
server.toString();
-
+
Addresses addresses = server.getAddresses();
Assert.assertNotNull(addresses);
-
- Map<String,String> metadata = server.getMetadata();
+
+ Map<String, String> metadata = server.getMetadata();
Assert.assertNotNull(metadata);
Assert.assertEquals(2, metadata.size());
-
+
String hostId = server.getHostId();
Assert.assertNotNull(hostId);
-
+
String uuid = server.getUuid();
Assert.assertNotNull(uuid);
-
+
String userId = server.getUserId();
Assert.assertNotNull(userId);
-
+
String taskState = server.getTaskState();
Assert.assertNotNull(taskState);
-
+
String powerState = server.getPowerState();
Assert.assertNotNull(powerState);
-
+
String vmState = server.getVmState();
Assert.assertNotNull(vmState);
-
+
String tenantId = server.getTenantId();
Assert.assertNotNull(tenantId);
-
+
String configDrive = server.getConfigDrive();
Assert.assertNotNull(configDrive);
-
+
String host = server.getHost();
Assert.assertNotNull(host);
-
+
String keyName = server.getKeyName();
Assert.assertNotNull(keyName);
-
+
List<Link> links = server.getLinks();
Assert.assertNotNull(links);
Assert.assertEquals(2, links.size());
-
+
String id = server.getId();
Assert.assertNotNull(id);
-
+
String launchedAt = server.getLaunchedAt();
Assert.assertNotNull(launchedAt);
-
+
Image image = server.getImage();
Assert.assertNotNull(image);
server.setImage(image);
-
+
String terminatedAt = server.getTerminatedAt();
Assert.assertNotNull(terminatedAt);
-
+
String created = server.getCreated();
Assert.assertNotNull(created);
-
+
Fault fault = server.getFault();
Assert.assertNotNull(fault);
-
+
String hypervisorHostname = server.getHypervisorHostname();
Assert.assertNotNull(hypervisorHostname);
-
+
Flavor flavor = server.getFlavor();
Assert.assertNotNull(flavor);
server.setFlavor(flavor);
-
+
String instanceName = server.getInstanceName();
Assert.assertNotNull(instanceName);
-
+
List<String> osExtendedVolumesAttached = server.getOsExtendedVolumesAttached();
Assert.assertNotNull(osExtendedVolumesAttached);
Assert.assertEquals(2, osExtendedVolumesAttached.size());
-
+
String name = server.getName();
Assert.assertNotNull(name);
-
+
Integer progress = server.getProgress();
Assert.assertNotNull(progress);
-
+
String adminPass = server.getAdminPass();
Assert.assertNotNull(adminPass);
-
+
String accessIPv6 = server.getAccessIPv6();
Assert.assertNotNull(accessIPv6);
-
+
String diskConfig = server.getDiskConfig();
Assert.assertNotNull(diskConfig);
-
+
List<SecurityGroup> securityGroups = server.getSecurityGroups();
Assert.assertNotNull(securityGroups);
Assert.assertEquals(2, securityGroups.size());
-
+
String updated = server.getUpdated();
Assert.assertNotNull(updated);
-
+
String availabilityZone = server.getAvailabilityZone();
Assert.assertNotNull(availabilityZone);
-
+
String accessIPv4 = server.getAccessIPv4();
Assert.assertNotNull(accessIPv4);
-
+
String status = server.getStatus();
Assert.assertNotNull(status);
}
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.woorea.openstack.nova.model.SimpleTenantUsage.ServerUsage;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"uptime\" : 78," + EOL
- + " \"state\" : \"state\"," + EOL
- + " \"hours\" : 64.0," + EOL
- + " \"vcpus\" : 79," + EOL
- + " \"flavor\" : \"flavor\"," + EOL
- + " \"name\" : \"name\"," + EOL
- + " \"instance_id\" : \"instanceid\"," + EOL
- + " \"started_at\" : \"startedat\"," + EOL
- + " \"ended_at\" : \"endedat\"," + EOL
- + " \"memory_mb\" : 90," + EOL
- + " \"tenant_id\" : \"tenantid\"," + EOL
- + " \"local_gb\" : 11" + EOL
- + "}";
-
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private static final String JSON_FULL =
+ "{" + EOL + " \"uptime\" : 78," + EOL + " \"state\" : \"state\"," + EOL + " \"hours\" : 64.0," + EOL
+ + " \"vcpus\" : 79," + EOL + " \"flavor\" : \"flavor\"," + EOL + " \"name\" : \"name\"," + EOL
+ + " \"instance_id\" : \"instanceid\"," + EOL + " \"started_at\" : \"startedat\"," + EOL
+ + " \"ended_at\" : \"endedat\"," + EOL + " \"memory_mb\" : 90," + EOL
+ + " \"tenant_id\" : \"tenantid\"," + EOL + " \"local_gb\" : 11" + EOL + "}";
+
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
ServerUsage serverusage = objectMapper.readValue(JSON_FULL, ServerUsage.class);
serverusage.toString();
-
+
String flavor = serverusage.getFlavor();
Assert.assertNotNull(flavor);
-
+
Integer memoryMb = serverusage.getMemoryMb();
Assert.assertNotNull(memoryMb);
-
+
Double hours = serverusage.getHours();
Assert.assertNotNull(hours);
-
+
String instanceId = serverusage.getInstanceId();
Assert.assertNotNull(instanceId);
-
+
Integer localDiskSize = serverusage.getLocalDiskSize();
Assert.assertNotNull(localDiskSize);
-
+
String endedAt = serverusage.getEndedAt();
Assert.assertNotNull(endedAt);
-
+
String name = serverusage.getName();
Assert.assertNotNull(name);
-
+
String tenantId = serverusage.getTenantId();
Assert.assertNotNull(tenantId);
-
+
String startedAt = serverusage.getStartedAt();
Assert.assertNotNull(startedAt);
-
+
String state = serverusage.getState();
Assert.assertNotNull(state);
-
+
Integer vcpus = serverusage.getVcpus();
Assert.assertNotNull(vcpus);
-
+
Integer uptime = serverusage.getUptime();
Assert.assertNotNull(uptime);
}
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
-
import java.util.List;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
sb.append(" \"OS-EXT-AZ:availability_zone\" : \"availabilityzone\"," + EOL);
sb.append(" \"OS-SRV-USG:launched_at\" : \"launchedat\"," + EOL);
sb.append(" \"OS-SRV-USG:terminated_at\" : \"terminatedat\"," + EOL);
- sb.append(" \"os-extended-volumes:volumes_attached\" : [ \"osextendedvolumesattached-v1\", \"osextendedvolumesattached-v2\" ]" + EOL);
+ sb.append(
+ " \"os-extended-volumes:volumes_attached\" : [ \"osextendedvolumesattached-v1\", \"osextendedvolumesattached-v2\" ]"
+ + EOL);
sb.append(" }, {" + EOL);
sb.append(" \"id\" : \"id\"," + EOL);
sb.append(" \"name\" : \"name\"," + EOL);
sb.append(" \"OS-EXT-AZ:availability_zone\" : \"availabilityzone\"," + EOL);
sb.append(" \"OS-SRV-USG:launched_at\" : \"launchedat\"," + EOL);
sb.append(" \"OS-SRV-USG:terminated_at\" : \"terminatedat\"," + EOL);
- sb.append(" \"os-extended-volumes:volumes_attached\" : [ \"osextendedvolumesattached-v1\", \"osextendedvolumesattached-v2\" ]" + EOL);
+ sb.append(
+ " \"os-extended-volumes:volumes_attached\" : [ \"osextendedvolumesattached-v1\", \"osextendedvolumesattached-v2\" ]"
+ + EOL);
sb.append(" } ]" + EOL);
sb.append("}");
JSON_FULL = sb.toString();
}
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
Servers servers = objectMapper.readValue(JSON_FULL, Servers.class);
servers.toString();
-
+
List<Server> list = servers.getList();
Assert.assertNotNull(list);
Assert.assertEquals(2, list.size());
-
+
int cnt = 0;
- for (@SuppressWarnings("unused") Server x : servers) {
+ for (@SuppressWarnings("unused")
+ Server x : servers) {
++cnt;
}
Assert.assertEquals(2, cnt);
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.woorea.openstack.nova.model.SimpleTenantUsage.ServerUsage;
-
import java.math.BigDecimal;
import java.util.List;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"tenant_usage\" : {" + EOL
- + " \"start\" : \"start\"," + EOL
- + " \"stop\" : \"stop\"," + EOL
- + " \"total_memory_mb_usage\" : 14," + EOL
- + " \"total_vcpus_usage\" : 3," + EOL
- + " \"total_local_gb_usage\" : 66," + EOL
- + " \"tenant_id\" : \"tenantid\"," + EOL
- + " \"total_hours\" : \"totalhours\"," + EOL
- + " \"server_usages\" : [ {" + EOL
- + " \"uptime\" : 78," + EOL
- + " \"state\" : \"state\"," + EOL
- + " \"hours\" : 64.0," + EOL
- + " \"vcpus\" : 79," + EOL
- + " \"flavor\" : \"flavor\"," + EOL
- + " \"name\" : \"name\"," + EOL
- + " \"instance_id\" : \"instanceid\"," + EOL
- + " \"started_at\" : \"startedat\"," + EOL
- + " \"ended_at\" : \"endedat\"," + EOL
- + " \"memory_mb\" : 90," + EOL
- + " \"tenant_id\" : \"tenantid\"," + EOL
- + " \"local_gb\" : 11" + EOL
- + " }, {" + EOL
- + " \"uptime\" : 78," + EOL
- + " \"state\" : \"state\"," + EOL
- + " \"hours\" : 64.0," + EOL
- + " \"vcpus\" : 79," + EOL
- + " \"flavor\" : \"flavor\"," + EOL
- + " \"name\" : \"name\"," + EOL
- + " \"instance_id\" : \"instanceid\"," + EOL
- + " \"started_at\" : \"startedat\"," + EOL
- + " \"ended_at\" : \"endedat\"," + EOL
- + " \"memory_mb\" : 90," + EOL
- + " \"tenant_id\" : \"tenantid\"," + EOL
- + " \"local_gb\" : 11" + EOL
- + " } ]" + EOL
- + " }" + EOL
- + "}";
-
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(SerializationFeature.WRAP_ROOT_VALUE)
- .enable(DeserializationFeature.UNWRAP_ROOT_VALUE)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private static final String JSON_FULL = "{" + EOL + " \"tenant_usage\" : {" + EOL + " \"start\" : \"start\","
+ + EOL + " \"stop\" : \"stop\"," + EOL + " \"total_memory_mb_usage\" : 14," + EOL
+ + " \"total_vcpus_usage\" : 3," + EOL + " \"total_local_gb_usage\" : 66," + EOL
+ + " \"tenant_id\" : \"tenantid\"," + EOL + " \"total_hours\" : \"totalhours\"," + EOL
+ + " \"server_usages\" : [ {" + EOL + " \"uptime\" : 78," + EOL + " \"state\" : \"state\","
+ + EOL + " \"hours\" : 64.0," + EOL + " \"vcpus\" : 79," + EOL + " \"flavor\" : \"flavor\","
+ + EOL + " \"name\" : \"name\"," + EOL + " \"instance_id\" : \"instanceid\"," + EOL
+ + " \"started_at\" : \"startedat\"," + EOL + " \"ended_at\" : \"endedat\"," + EOL
+ + " \"memory_mb\" : 90," + EOL + " \"tenant_id\" : \"tenantid\"," + EOL
+ + " \"local_gb\" : 11" + EOL + " }, {" + EOL + " \"uptime\" : 78," + EOL
+ + " \"state\" : \"state\"," + EOL + " \"hours\" : 64.0," + EOL + " \"vcpus\" : 79," + EOL
+ + " \"flavor\" : \"flavor\"," + EOL + " \"name\" : \"name\"," + EOL
+ + " \"instance_id\" : \"instanceid\"," + EOL + " \"started_at\" : \"startedat\"," + EOL
+ + " \"ended_at\" : \"endedat\"," + EOL + " \"memory_mb\" : 90," + EOL
+ + " \"tenant_id\" : \"tenantid\"," + EOL + " \"local_gb\" : 11" + EOL + " } ]" + EOL + " }"
+ + EOL + "}";
+
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE)
+ .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
SimpleTenantUsage simpletenantusage = objectMapper.readValue(JSON_FULL, SimpleTenantUsage.class);
simpletenantusage.toString();
-
+
BigDecimal totalMemoryMbUsage = simpletenantusage.getTotalMemoryMbUsage();
Assert.assertNotNull(totalMemoryMbUsage);
simpletenantusage.setTotalMemoryMbUsage(totalMemoryMbUsage);
-
+
String stop = simpletenantusage.getStop();
Assert.assertNotNull(stop);
simpletenantusage.setStop(stop);
-
+
BigDecimal totalVcpusUsage = simpletenantusage.getTotalVcpusUsage();
Assert.assertNotNull(totalVcpusUsage);
simpletenantusage.setTotalVcpusUsage(totalVcpusUsage);
-
+
String tenantId = simpletenantusage.getTenantId();
Assert.assertNotNull(tenantId);
simpletenantusage.setTenantId(tenantId);
-
+
String start = simpletenantusage.getStart();
Assert.assertNotNull(start);
simpletenantusage.setStart(start);
-
+
List<ServerUsage> serverUsages = simpletenantusage.getServerUsages();
Assert.assertNotNull(serverUsages);
Assert.assertEquals(2, serverUsages.size());
simpletenantusage.setServerUsages(serverUsages);
-
+
BigDecimal totalLocalGbUsage = simpletenantusage.getTotalLocalGbUsage();
Assert.assertNotNull(totalLocalGbUsage);
simpletenantusage.setTotalLocalGbUsage(totalLocalGbUsage);
-
+
String totalHours = simpletenantusage.getTotalHours();
Assert.assertNotNull(totalHours);
simpletenantusage.setTotalHours(totalHours);
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
-
import java.util.List;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"tenant_usages\" : [ {" + EOL
- + " \"start\" : \"start\"," + EOL
- + " \"stop\" : \"stop\"," + EOL
- + " \"total_memory_mb_usage\" : 14," + EOL
- + " \"total_vcpus_usage\" : 3," + EOL
- + " \"total_local_gb_usage\" : 66," + EOL
- + " \"tenant_id\" : \"tenantid\"," + EOL
- + " \"total_hours\" : \"totalhours\"," + EOL
- + " \"server_usages\" : [ {" + EOL
- + " \"uptime\" : 78," + EOL
- + " \"state\" : \"state\"," + EOL
- + " \"hours\" : 64.0," + EOL
- + " \"vcpus\" : 79," + EOL
- + " \"flavor\" : \"flavor\"," + EOL
- + " \"name\" : \"name\"," + EOL
- + " \"instance_id\" : \"instanceid\"," + EOL
- + " \"started_at\" : \"startedat\"," + EOL
- + " \"ended_at\" : \"endedat\"," + EOL
- + " \"memory_mb\" : 90," + EOL
- + " \"tenant_id\" : \"tenantid\"," + EOL
- + " \"local_gb\" : 11" + EOL
- + " }, {" + EOL
- + " \"uptime\" : 78," + EOL
- + " \"state\" : \"state\"," + EOL
- + " \"hours\" : 64.0," + EOL
- + " \"vcpus\" : 79," + EOL
- + " \"flavor\" : \"flavor\"," + EOL
- + " \"name\" : \"name\"," + EOL
- + " \"instance_id\" : \"instanceid\"," + EOL
- + " \"started_at\" : \"startedat\"," + EOL
- + " \"ended_at\" : \"endedat\"," + EOL
- + " \"memory_mb\" : 90," + EOL
- + " \"tenant_id\" : \"tenantid\"," + EOL
- + " \"local_gb\" : 11" + EOL
- + " } ]" + EOL
- + " }, {" + EOL
- + " \"start\" : \"start\"," + EOL
- + " \"stop\" : \"stop\"," + EOL
- + " \"total_memory_mb_usage\" : 14," + EOL
- + " \"total_vcpus_usage\" : 3," + EOL
- + " \"total_local_gb_usage\" : 66," + EOL
- + " \"tenant_id\" : \"tenantid\"," + EOL
- + " \"total_hours\" : \"totalhours\"," + EOL
- + " \"server_usages\" : [ {" + EOL
- + " \"uptime\" : 78," + EOL
- + " \"state\" : \"state\"," + EOL
- + " \"hours\" : 64.0," + EOL
- + " \"vcpus\" : 79," + EOL
- + " \"flavor\" : \"flavor\"," + EOL
- + " \"name\" : \"name\"," + EOL
- + " \"instance_id\" : \"instanceid\"," + EOL
- + " \"started_at\" : \"startedat\"," + EOL
- + " \"ended_at\" : \"endedat\"," + EOL
- + " \"memory_mb\" : 90," + EOL
- + " \"tenant_id\" : \"tenantid\"," + EOL
- + " \"local_gb\" : 11" + EOL
- + " }, {" + EOL
- + " \"uptime\" : 78," + EOL
- + " \"state\" : \"state\"," + EOL
- + " \"hours\" : 64.0," + EOL
- + " \"vcpus\" : 79," + EOL
- + " \"flavor\" : \"flavor\"," + EOL
- + " \"name\" : \"name\"," + EOL
- + " \"instance_id\" : \"instanceid\"," + EOL
- + " \"started_at\" : \"startedat\"," + EOL
- + " \"ended_at\" : \"endedat\"," + EOL
- + " \"memory_mb\" : 90," + EOL
- + " \"tenant_id\" : \"tenantid\"," + EOL
- + " \"local_gb\" : 11" + EOL
- + " } ]" + EOL
- + " } ]" + EOL
- + "}";
+ private static final String JSON_FULL = "{" + EOL + " \"tenant_usages\" : [ {" + EOL + " \"start\" : \"start\","
+ + EOL + " \"stop\" : \"stop\"," + EOL + " \"total_memory_mb_usage\" : 14," + EOL
+ + " \"total_vcpus_usage\" : 3," + EOL + " \"total_local_gb_usage\" : 66," + EOL
+ + " \"tenant_id\" : \"tenantid\"," + EOL + " \"total_hours\" : \"totalhours\"," + EOL
+ + " \"server_usages\" : [ {" + EOL + " \"uptime\" : 78," + EOL + " \"state\" : \"state\","
+ + EOL + " \"hours\" : 64.0," + EOL + " \"vcpus\" : 79," + EOL + " \"flavor\" : \"flavor\","
+ + EOL + " \"name\" : \"name\"," + EOL + " \"instance_id\" : \"instanceid\"," + EOL
+ + " \"started_at\" : \"startedat\"," + EOL + " \"ended_at\" : \"endedat\"," + EOL
+ + " \"memory_mb\" : 90," + EOL + " \"tenant_id\" : \"tenantid\"," + EOL
+ + " \"local_gb\" : 11" + EOL + " }, {" + EOL + " \"uptime\" : 78," + EOL
+ + " \"state\" : \"state\"," + EOL + " \"hours\" : 64.0," + EOL + " \"vcpus\" : 79," + EOL
+ + " \"flavor\" : \"flavor\"," + EOL + " \"name\" : \"name\"," + EOL
+ + " \"instance_id\" : \"instanceid\"," + EOL + " \"started_at\" : \"startedat\"," + EOL
+ + " \"ended_at\" : \"endedat\"," + EOL + " \"memory_mb\" : 90," + EOL
+ + " \"tenant_id\" : \"tenantid\"," + EOL + " \"local_gb\" : 11" + EOL + " } ]" + EOL + " }, {"
+ + EOL + " \"start\" : \"start\"," + EOL + " \"stop\" : \"stop\"," + EOL
+ + " \"total_memory_mb_usage\" : 14," + EOL + " \"total_vcpus_usage\" : 3," + EOL
+ + " \"total_local_gb_usage\" : 66," + EOL + " \"tenant_id\" : \"tenantid\"," + EOL
+ + " \"total_hours\" : \"totalhours\"," + EOL + " \"server_usages\" : [ {" + EOL
+ + " \"uptime\" : 78," + EOL + " \"state\" : \"state\"," + EOL + " \"hours\" : 64.0," + EOL
+ + " \"vcpus\" : 79," + EOL + " \"flavor\" : \"flavor\"," + EOL + " \"name\" : \"name\","
+ + EOL + " \"instance_id\" : \"instanceid\"," + EOL + " \"started_at\" : \"startedat\"," + EOL
+ + " \"ended_at\" : \"endedat\"," + EOL + " \"memory_mb\" : 90," + EOL
+ + " \"tenant_id\" : \"tenantid\"," + EOL + " \"local_gb\" : 11" + EOL + " }, {" + EOL
+ + " \"uptime\" : 78," + EOL + " \"state\" : \"state\"," + EOL + " \"hours\" : 64.0," + EOL
+ + " \"vcpus\" : 79," + EOL + " \"flavor\" : \"flavor\"," + EOL + " \"name\" : \"name\","
+ + EOL + " \"instance_id\" : \"instanceid\"," + EOL + " \"started_at\" : \"startedat\"," + EOL
+ + " \"ended_at\" : \"endedat\"," + EOL + " \"memory_mb\" : 90," + EOL
+ + " \"tenant_id\" : \"tenantid\"," + EOL + " \"local_gb\" : 11" + EOL + " } ]" + EOL + " } ]"
+ + EOL + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
SimpleTenantUsages simpletenantusages = objectMapper.readValue(JSON_FULL, SimpleTenantUsages.class);
simpletenantusages.toString();
-
+
List<SimpleTenantUsage> list = simpletenantusages.getList();
Assert.assertNotNull(list);
Assert.assertEquals(2, list.size());
-
+
int cnt = 0;
- for (@SuppressWarnings("unused") SimpleTenantUsage x : simpletenantusages) {
+ for (@SuppressWarnings("unused")
+ SimpleTenantUsage x : simpletenantusages) {
++cnt;
}
Assert.assertEquals(2, cnt);
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"snapshot\" : {" + EOL
- + " \"force\" : false," + EOL
- + " \"volume_id\" : \"volumeid\"," + EOL
- + " \"display_name\" : \"name\"," + EOL
- + " \"display_description\" : \"description\"" + EOL
- + " }" + EOL
- + "}";
+ private static final String JSON_FULL = "{" + EOL + " \"snapshot\" : {" + EOL + " \"force\" : false," + EOL
+ + " \"volume_id\" : \"volumeid\"," + EOL + " \"display_name\" : \"name\"," + EOL
+ + " \"display_description\" : \"description\"" + EOL + " }" + EOL + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(SerializationFeature.WRAP_ROOT_VALUE)
- .enable(DeserializationFeature.UNWRAP_ROOT_VALUE)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE)
+ .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
SnapshotForCreate snapshotforcreate = objectMapper.readValue(JSON_FULL, SnapshotForCreate.class);
snapshotforcreate.toString();
-
+
String name = snapshotforcreate.getName();
Assert.assertNotNull(name);
snapshotforcreate.setName(name);
-
+
String volumeId = snapshotforcreate.getVolumeId();
Assert.assertNotNull(volumeId);
snapshotforcreate.setVolumeId(volumeId);
-
+
String description = snapshotforcreate.getDescription();
Assert.assertNotNull(description);
snapshotforcreate.setDescription(description);
-
+
Boolean force = snapshotforcreate.getForce();
Assert.assertNotNull(force);
snapshotforcreate.setForce(force);
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"snapshot\" : {" + EOL
- + " \"id\" : \"id\"," + EOL
- + " \"status\" : \"status\"," + EOL
- + " \"volumeId\" : \"volumeid\"," + EOL
- + " \"size\" : 61," + EOL
- + " \"createdAt\" : \"createdat\"," + EOL
- + " \"displayName\" : \"name\"," + EOL
- + " \"displayDescription\" : \"description\"" + EOL
- + " }" + EOL
- + "}";
+ private static final String JSON_FULL = "{" + EOL + " \"snapshot\" : {" + EOL + " \"id\" : \"id\"," + EOL
+ + " \"status\" : \"status\"," + EOL + " \"volumeId\" : \"volumeid\"," + EOL + " \"size\" : 61,"
+ + EOL + " \"createdAt\" : \"createdat\"," + EOL + " \"displayName\" : \"name\"," + EOL
+ + " \"displayDescription\" : \"description\"" + EOL + " }" + EOL + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(SerializationFeature.WRAP_ROOT_VALUE)
- .enable(DeserializationFeature.UNWRAP_ROOT_VALUE)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE)
+ .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
Snapshot snapshot = objectMapper.readValue(JSON_FULL, Snapshot.class);
snapshot.toString();
-
+
String createdAt = snapshot.getCreatedAt();
Assert.assertNotNull(createdAt);
-
+
Integer size = snapshot.getSize();
Assert.assertNotNull(size);
-
+
String name = snapshot.getName();
Assert.assertNotNull(name);
-
+
String volumeId = snapshot.getVolumeId();
Assert.assertNotNull(volumeId);
-
+
String description = snapshot.getDescription();
Assert.assertNotNull(description);
-
+
String id = snapshot.getId();
Assert.assertNotNull(id);
-
+
String status = snapshot.getStatus();
Assert.assertNotNull(status);
}
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
-
import java.util.List;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"snapshots\" : [ {" + EOL
- + " \"id\" : \"id\"," + EOL
- + " \"status\" : \"status\"," + EOL
- + " \"volumeId\" : \"volumeid\"," + EOL
- + " \"size\" : 61," + EOL
- + " \"createdAt\" : \"createdat\"," + EOL
- + " \"displayName\" : \"name\"," + EOL
- + " \"displayDescription\" : \"description\"" + EOL
- + " }, {" + EOL
- + " \"id\" : \"id\"," + EOL
- + " \"status\" : \"status\"," + EOL
- + " \"volumeId\" : \"volumeid\"," + EOL
- + " \"size\" : 61," + EOL
- + " \"createdAt\" : \"createdat\"," + EOL
- + " \"displayName\" : \"name\"," + EOL
- + " \"displayDescription\" : \"description\"" + EOL
- + " } ]" + EOL
- + "}";
+ private static final String JSON_FULL = "{" + EOL + " \"snapshots\" : [ {" + EOL + " \"id\" : \"id\"," + EOL
+ + " \"status\" : \"status\"," + EOL + " \"volumeId\" : \"volumeid\"," + EOL + " \"size\" : 61,"
+ + EOL + " \"createdAt\" : \"createdat\"," + EOL + " \"displayName\" : \"name\"," + EOL
+ + " \"displayDescription\" : \"description\"" + EOL + " }, {" + EOL + " \"id\" : \"id\"," + EOL
+ + " \"status\" : \"status\"," + EOL + " \"volumeId\" : \"volumeid\"," + EOL + " \"size\" : 61,"
+ + EOL + " \"createdAt\" : \"createdat\"," + EOL + " \"displayName\" : \"name\"," + EOL
+ + " \"displayDescription\" : \"description\"" + EOL + " } ]" + EOL + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
Snapshots snapshots = objectMapper.readValue(JSON_FULL, Snapshots.class);
snapshots.toString();
-
+
List<Snapshot> list = snapshots.getList();
Assert.assertNotNull(list);
Assert.assertEquals(2, list.size());
-
+
int cnt = 0;
- for (@SuppressWarnings("unused") Snapshot x : snapshots) {
+ for (@SuppressWarnings("unused")
+ Snapshot x : snapshots) {
++cnt;
}
Assert.assertEquals(2, cnt);
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.woorea.openstack.nova.model.ServerAction.Start;
-
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
import org.skyscreamer.jsonassert.JSONCompareMode;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"os-start\" : { }" + EOL
- + "}";
+ private static final String JSON_FULL = "{" + EOL + " \"os-start\" : { }" + EOL + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(SerializationFeature.WRAP_ROOT_VALUE)
- .enable(DeserializationFeature.UNWRAP_ROOT_VALUE)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE)
+ .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.woorea.openstack.nova.model.ServerAction.Stop;
-
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
import org.skyscreamer.jsonassert.JSONCompareMode;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"os-stop\" : { }" + EOL
- + "}";
+ private static final String JSON_FULL = "{" + EOL + " \"os-stop\" : { }" + EOL + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(SerializationFeature.WRAP_ROOT_VALUE)
- .enable(DeserializationFeature.UNWRAP_ROOT_VALUE)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE)
+ .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.woorea.openstack.nova.model.ServerAction.Suspend;
-
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
import org.skyscreamer.jsonassert.JSONCompareMode;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"suspend\" : { }" + EOL
- + "}";
+ private static final String JSON_FULL = "{" + EOL + " \"suspend\" : { }" + EOL + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(SerializationFeature.WRAP_ROOT_VALUE)
- .enable(DeserializationFeature.UNWRAP_ROOT_VALUE)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE)
+ .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.woorea.openstack.nova.model.ServerAction.Unlock;
-
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
import org.skyscreamer.jsonassert.JSONCompareMode;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"unlock\" : { }" + EOL
- + "}";
+ private static final String JSON_FULL = "{" + EOL + " \"unlock\" : { }" + EOL + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(SerializationFeature.WRAP_ROOT_VALUE)
- .enable(DeserializationFeature.UNWRAP_ROOT_VALUE)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE)
+ .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.woorea.openstack.nova.model.ServerAction.Unpause;
-
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
import org.skyscreamer.jsonassert.JSONCompareMode;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"unpause\" : { }" + EOL
- + "}";
+ private static final String JSON_FULL = "{" + EOL + " \"unpause\" : { }" + EOL + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(SerializationFeature.WRAP_ROOT_VALUE)
- .enable(DeserializationFeature.UNWRAP_ROOT_VALUE)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE)
+ .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.woorea.openstack.nova.model.ServerAction.Unrescue;
-
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
import org.skyscreamer.jsonassert.JSONCompareMode;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"unrescue\" : { }" + EOL
- + "}";
+ private static final String JSON_FULL = "{" + EOL + " \"unrescue\" : { }" + EOL + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(SerializationFeature.WRAP_ROOT_VALUE)
- .enable(DeserializationFeature.UNWRAP_ROOT_VALUE)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE)
+ .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.woorea.openstack.nova.model.ServerAction.VncConsole;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"console\" : {" + EOL
- + " \"type\" : \"type\"," + EOL
- + " \"url\" : \"url\"" + EOL
- + " }" + EOL
- + "}";
+ private static final String JSON_FULL = "{" + EOL + " \"console\" : {" + EOL + " \"type\" : \"type\"," + EOL
+ + " \"url\" : \"url\"" + EOL + " }" + EOL + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(SerializationFeature.WRAP_ROOT_VALUE)
- .enable(DeserializationFeature.UNWRAP_ROOT_VALUE)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE)
+ .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
VncConsole vncconsole = objectMapper.readValue(JSON_FULL, VncConsole.class);
vncconsole.toString();
-
+
String type = vncconsole.getType();
Assert.assertNotNull(type);
-
+
String url = vncconsole.getUrl();
Assert.assertNotNull(url);
}
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"volumeAttachment\" : {" + EOL
- + " \"id\" : \"id\"," + EOL
- + " \"volumeId\" : \"volumeid\"," + EOL
- + " \"serverId\" : \"serverid\"," + EOL
- + " \"device\" : \"device\"" + EOL
- + " }" + EOL
- + "}";
+ private static final String JSON_FULL = "{" + EOL + " \"volumeAttachment\" : {" + EOL + " \"id\" : \"id\","
+ + EOL + " \"volumeId\" : \"volumeid\"," + EOL + " \"serverId\" : \"serverid\"," + EOL
+ + " \"device\" : \"device\"" + EOL + " }" + EOL + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(SerializationFeature.WRAP_ROOT_VALUE)
- .enable(DeserializationFeature.UNWRAP_ROOT_VALUE)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE)
+ .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
VolumeAttachment volumeattachment = objectMapper.readValue(JSON_FULL, VolumeAttachment.class);
volumeattachment.toString();
-
+
String volumeId = volumeattachment.getVolumeId();
Assert.assertNotNull(volumeId);
volumeattachment.setVolumeId(volumeId);
-
+
String id = volumeattachment.getId();
Assert.assertNotNull(id);
volumeattachment.setId(id);
-
+
String device = volumeattachment.getDevice();
Assert.assertNotNull(device);
volumeattachment.setDevice(device);
-
+
String serverId = volumeattachment.getServerId();
Assert.assertNotNull(serverId);
volumeattachment.setServerId(serverId);
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
-
import java.util.List;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"volumeAttachments\" : [ {" + EOL
- + " \"id\" : \"id\"," + EOL
- + " \"volumeId\" : \"volumeid\"," + EOL
- + " \"serverId\" : \"serverid\"," + EOL
- + " \"device\" : \"device\"" + EOL
- + " }, {" + EOL
- + " \"id\" : \"id\"," + EOL
- + " \"volumeId\" : \"volumeid\"," + EOL
- + " \"serverId\" : \"serverid\"," + EOL
- + " \"device\" : \"device\"" + EOL
- + " } ]" + EOL
- + "}";
+ private static final String JSON_FULL = "{" + EOL + " \"volumeAttachments\" : [ {" + EOL + " \"id\" : \"id\","
+ + EOL + " \"volumeId\" : \"volumeid\"," + EOL + " \"serverId\" : \"serverid\"," + EOL
+ + " \"device\" : \"device\"" + EOL + " }, {" + EOL + " \"id\" : \"id\"," + EOL
+ + " \"volumeId\" : \"volumeid\"," + EOL + " \"serverId\" : \"serverid\"," + EOL
+ + " \"device\" : \"device\"" + EOL + " } ]" + EOL + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
VolumeAttachments volumeattachments = objectMapper.readValue(JSON_FULL, VolumeAttachments.class);
volumeattachments.toString();
-
+
List<VolumeAttachment> list = volumeattachments.getList();
Assert.assertNotNull(list);
Assert.assertEquals(2, list.size());
-
+
int cnt = 0;
- for (@SuppressWarnings("unused") VolumeAttachment x : volumeattachments) {
+ for (@SuppressWarnings("unused")
+ VolumeAttachment x : volumeattachments) {
++cnt;
}
Assert.assertEquals(2, cnt);
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
-
import java.util.Map;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"volume\" : {" + EOL
- + " \"size\" : 61," + EOL
- + " \"metadata\" : {" + EOL
- + " \"metadata-k1\" : \"metadata-v1\"," + EOL
- + " \"metadata-k2\" : \"metadata-v2\"" + EOL
- + " }," + EOL
- + " \"availability_zone\" : \"availabilityzone\"," + EOL
- + " \"display_name\" : \"name\"," + EOL
- + " \"display_description\" : \"description\"," + EOL
- + " \"snapshot_id\" : 3" + EOL
- + " }" + EOL
- + "}";
+ private static final String JSON_FULL =
+ "{" + EOL + " \"volume\" : {" + EOL + " \"size\" : 61," + EOL + " \"metadata\" : {" + EOL
+ + " \"metadata-k1\" : \"metadata-v1\"," + EOL + " \"metadata-k2\" : \"metadata-v2\"" + EOL
+ + " }," + EOL + " \"availability_zone\" : \"availabilityzone\"," + EOL
+ + " \"display_name\" : \"name\"," + EOL + " \"display_description\" : \"description\"," + EOL
+ + " \"snapshot_id\" : 3" + EOL + " }" + EOL + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(SerializationFeature.WRAP_ROOT_VALUE)
- .enable(DeserializationFeature.UNWRAP_ROOT_VALUE)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE)
+ .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
VolumeForCreate volumeforcreate = objectMapper.readValue(JSON_FULL, VolumeForCreate.class);
volumeforcreate.toString();
-
- Map<String,String> metadata = volumeforcreate.getMetadata();
+
+ Map<String, String> metadata = volumeforcreate.getMetadata();
Assert.assertNotNull(metadata);
Assert.assertEquals(2, metadata.size());
volumeforcreate.setMetadata(metadata);
-
+
Integer snapshotId = volumeforcreate.getSnapshotId();
Assert.assertNotNull(snapshotId);
volumeforcreate.setSnapshotId(snapshotId);
-
+
Integer size = volumeforcreate.getSize();
Assert.assertNotNull(size);
volumeforcreate.setSize(size);
-
+
String name = volumeforcreate.getName();
Assert.assertNotNull(name);
volumeforcreate.setName(name);
-
+
String description = volumeforcreate.getDescription();
Assert.assertNotNull(description);
volumeforcreate.setDescription(description);
-
+
String availabilityZone = volumeforcreate.getAvailabilityZone();
Assert.assertNotNull(availabilityZone);
volumeforcreate.setAvailabilityZone(availabilityZone);
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"os-volume_upload_image\" : {" + EOL
- + " \"volumeId\" : \"volumeid\"," + EOL
- + " \"tenantId\" : \"tenantid\"," + EOL
- + " \"force\" : false," + EOL
- + " \"container_format\" : \"container_format\"," + EOL
- + " \"disk_format\" : \"disk_format\"," + EOL
- + " \"image_name\" : \"image_name\"" + EOL
- + " }" + EOL
- + "}";
+ private static final String JSON_FULL = "{" + EOL + " \"os-volume_upload_image\" : {" + EOL
+ + " \"volumeId\" : \"volumeid\"," + EOL + " \"tenantId\" : \"tenantid\"," + EOL
+ + " \"force\" : false," + EOL + " \"container_format\" : \"container_format\"," + EOL
+ + " \"disk_format\" : \"disk_format\"," + EOL + " \"image_name\" : \"image_name\"" + EOL + " }" + EOL
+ + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(SerializationFeature.WRAP_ROOT_VALUE)
- .enable(DeserializationFeature.UNWRAP_ROOT_VALUE)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE)
+ .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
VolumeForImageCreate volumeforimagecreate = objectMapper.readValue(JSON_FULL, VolumeForImageCreate.class);
volumeforimagecreate.toString();
-
+
String image_name = volumeforimagecreate.getImage_name();
Assert.assertNotNull(image_name);
volumeforimagecreate.setImage_name(image_name);
-
+
String tenantId = volumeforimagecreate.getTenantId();
Assert.assertNotNull(tenantId);
volumeforimagecreate.setTenantId(tenantId);
-
+
String volumeId = volumeforimagecreate.getVolumeId();
Assert.assertNotNull(volumeId);
volumeforimagecreate.setVolumeId(volumeId);
-
+
String disk_format = volumeforimagecreate.getDisk_format();
Assert.assertNotNull(disk_format);
volumeforimagecreate.setDisk_format(disk_format);
-
+
Boolean force = volumeforimagecreate.getForce();
Assert.assertNotNull(force);
volumeforimagecreate.setForce(force);
-
+
String container_format = volumeforimagecreate.getContainer_format();
Assert.assertNotNull(container_format);
volumeforimagecreate.setContainer_format(container_format);
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
-
+import java.util.Date;
import java.util.List;
import java.util.Map;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"volume\" : {" + EOL
- + " \"id\" : \"id\"," + EOL
- + " \"status\" : \"status\"," + EOL
- + " \"availabilityZone\" : \"availabilityzone\"," + EOL
- + " \"volumeType\" : \"volumetype\"," + EOL
- + " \"snapshotId\" : \"snapshotid\"," + EOL
- + " \"attachments\" : [ {" + EOL
- + " \"attachments-v1-k1\" : \"attachments-v1-v1\"," + EOL
- + " \"attachments-v1-k2\" : \"attachments-v1-v2\"" + EOL
- + " }, {" + EOL
- + " \"attachments-v2-k1\" : \"attachments-v2-v1\"," + EOL
- + " \"attachments-v2-k2\" : \"attachments-v2-v2\"" + EOL
- + " } ]," + EOL
- + " \"metadata\" : {" + EOL
- + " \"metadata-k1\" : \"metadata-v1\"," + EOL
- + " \"metadata-k2\" : \"metadata-v2\"" + EOL
- + " }," + EOL
- + " \"createdAt\" : \"createdat\"," + EOL
- + " \"size\" : 61," + EOL
- + " \"displayName\" : \"name\"," + EOL
- + " \"displayDescription\" : \"description\"" + EOL
- + " }" + EOL
- + "}";
-
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(SerializationFeature.WRAP_ROOT_VALUE)
- .enable(DeserializationFeature.UNWRAP_ROOT_VALUE)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private static final String JSON_FULL = "{" + EOL + " \"volume\" : {" + EOL + " \"id\" : \"id\"," + EOL
+ + " \"status\" : \"status\"," + EOL + " \"availabilityZone\" : \"availabilityzone\"," + EOL
+ + " \"volumeType\" : \"volumetype\"," + EOL + " \"snapshotId\" : \"snapshotid\"," + EOL
+ + " \"attachments\" : [ {" + EOL + " \"attachments-v1-k1\" : \"attachments-v1-v1\"," + EOL
+ + " \"attachments-v1-k2\" : \"attachments-v1-v2\"" + EOL + " }, {" + EOL
+ + " \"attachments-v2-k1\" : \"attachments-v2-v1\"," + EOL
+ + " \"attachments-v2-k2\" : \"attachments-v2-v2\"" + EOL + " } ]," + EOL + " \"metadata\" : {"
+ + EOL + " \"metadata-k1\" : \"metadata-v1\"," + EOL + " \"metadata-k2\" : \"metadata-v2\"" + EOL
+ + " }," + EOL + " \"createdAt\" : \"createdat\"," + EOL + " \"size\" : 61," + EOL
+ + " \"displayName\" : \"name\"," + EOL + " \"displayDescription\" : \"description\"" + EOL + " }"
+ + EOL + "}";
+
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE)
+ .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
Volume volume = objectMapper.readValue(JSON_FULL, Volume.class);
volume.toString();
-
+
String volumeType = volume.getVolumeType();
Assert.assertNotNull(volumeType);
-
+
String createdAt = volume.getCreatedAt();
Assert.assertNotNull(createdAt);
-
- Map<String,String> metadata = volume.getMetadata();
+
+ Map<String, String> metadata = volume.getMetadata();
Assert.assertNotNull(metadata);
Assert.assertEquals(2, metadata.size());
-
- List<Map<String,Object>> attachments = volume.getAttachments();
+
+ List<Map<String, Object>> attachments = volume.getAttachments();
Assert.assertNotNull(attachments);
Assert.assertEquals(2, attachments.size());
-
+
String snapshotId = volume.getSnapshotId();
Assert.assertNotNull(snapshotId);
-
+
Integer size = volume.getSize();
Assert.assertNotNull(size);
-
+
String name = volume.getName();
Assert.assertNotNull(name);
-
+
String description = volume.getDescription();
Assert.assertNotNull(description);
-
+
String id = volume.getId();
Assert.assertNotNull(id);
-
+
String availabilityZone = volume.getAvailabilityZone();
Assert.assertNotNull(availabilityZone);
-
+
String status = volume.getStatus();
Assert.assertNotNull(status);
}
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
-
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
import org.skyscreamer.jsonassert.JSONCompareMode;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"volume-type\" : { }" + EOL
- + "}";
-
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(SerializationFeature.WRAP_ROOT_VALUE)
- .enable(DeserializationFeature.UNWRAP_ROOT_VALUE)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private static final String JSON_FULL = "{" + EOL + " \"volume-type\" : { }" + EOL + "}";
+
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE)
+ .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
-
import java.util.List;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"volume-types\" : [ { }, { } ]" + EOL
- + "}";
+ private static final String JSON_FULL = "{" + EOL + " \"volume-types\" : [ { }, { } ]" + EOL + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
VolumeTypes volumetypes = objectMapper.readValue(JSON_FULL, VolumeTypes.class);
volumetypes.toString();
-
+
List<VolumeType> list = volumetypes.getList();
Assert.assertNotNull(list);
Assert.assertEquals(2, list.size());
-
+
int cnt = 0;
- for (@SuppressWarnings("unused") VolumeType x : volumetypes) {
+ for (@SuppressWarnings("unused")
+ VolumeType x : volumetypes) {
++cnt;
}
Assert.assertEquals(2, cnt);
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
-
import java.util.List;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"volumes\" : [ {" + EOL
- + " \"id\" : \"id\"," + EOL
- + " \"status\" : \"status\"," + EOL
- + " \"availabilityZone\" : \"availabilityzone\"," + EOL
- + " \"volumeType\" : \"volumetype\"," + EOL
- + " \"snapshotId\" : \"snapshotid\"," + EOL
- + " \"attachments\" : [ {" + EOL
- + " \"attachments-v1-k1\" : \"attachments-v1-v1\"," + EOL
- + " \"attachments-v1-k2\" : \"attachments-v1-v2\"" + EOL
- + " }, {" + EOL
- + " \"attachments-v2-k1\" : \"attachments-v2-v1\"," + EOL
- + " \"attachments-v2-k2\" : \"attachments-v2-v2\"" + EOL
- + " } ]," + EOL
- + " \"metadata\" : {" + EOL
- + " \"metadata-k1\" : \"metadata-v1\"," + EOL
- + " \"metadata-k2\" : \"metadata-v2\"" + EOL
- + " }," + EOL
- + " \"createdAt\" : \"createdat\"," + EOL
- + " \"size\" : 61," + EOL
- + " \"displayName\" : \"name\"," + EOL
- + " \"displayDescription\" : \"description\"" + EOL
- + " }, {" + EOL
- + " \"id\" : \"id\"," + EOL
- + " \"status\" : \"status\"," + EOL
- + " \"availabilityZone\" : \"availabilityzone\"," + EOL
- + " \"volumeType\" : \"volumetype\"," + EOL
- + " \"snapshotId\" : \"snapshotid\"," + EOL
- + " \"attachments\" : [ {" + EOL
- + " \"attachments-v1-k1\" : \"attachments-v1-v1\"," + EOL
- + " \"attachments-v1-k2\" : \"attachments-v1-v2\"" + EOL
- + " }, {" + EOL
- + " \"attachments-v2-k1\" : \"attachments-v2-v1\"," + EOL
- + " \"attachments-v2-k2\" : \"attachments-v2-v2\"" + EOL
- + " } ]," + EOL
- + " \"metadata\" : {" + EOL
- + " \"metadata-k1\" : \"metadata-v1\"," + EOL
- + " \"metadata-k2\" : \"metadata-v2\"" + EOL
- + " }," + EOL
- + " \"createdAt\" : \"createdat\"," + EOL
- + " \"size\" : 61," + EOL
- + " \"displayName\" : \"name\"," + EOL
- + " \"displayDescription\" : \"description\"" + EOL
- + " } ]" + EOL
- + "}";
+ private static final String JSON_FULL = "{" + EOL + " \"volumes\" : [ {" + EOL + " \"id\" : \"id\"," + EOL
+ + " \"status\" : \"status\"," + EOL + " \"availabilityZone\" : \"availabilityzone\"," + EOL
+ + " \"volumeType\" : \"volumetype\"," + EOL + " \"snapshotId\" : \"snapshotid\"," + EOL
+ + " \"attachments\" : [ {" + EOL + " \"attachments-v1-k1\" : \"attachments-v1-v1\"," + EOL
+ + " \"attachments-v1-k2\" : \"attachments-v1-v2\"" + EOL + " }, {" + EOL
+ + " \"attachments-v2-k1\" : \"attachments-v2-v1\"," + EOL
+ + " \"attachments-v2-k2\" : \"attachments-v2-v2\"" + EOL + " } ]," + EOL + " \"metadata\" : {"
+ + EOL + " \"metadata-k1\" : \"metadata-v1\"," + EOL + " \"metadata-k2\" : \"metadata-v2\"" + EOL
+ + " }," + EOL + " \"createdAt\" : \"createdat\"," + EOL + " \"size\" : 61," + EOL
+ + " \"displayName\" : \"name\"," + EOL + " \"displayDescription\" : \"description\"" + EOL + " }, {"
+ + EOL + " \"id\" : \"id\"," + EOL + " \"status\" : \"status\"," + EOL
+ + " \"availabilityZone\" : \"availabilityzone\"," + EOL + " \"volumeType\" : \"volumetype\"," + EOL
+ + " \"snapshotId\" : \"snapshotid\"," + EOL + " \"attachments\" : [ {" + EOL
+ + " \"attachments-v1-k1\" : \"attachments-v1-v1\"," + EOL
+ + " \"attachments-v1-k2\" : \"attachments-v1-v2\"" + EOL + " }, {" + EOL
+ + " \"attachments-v2-k1\" : \"attachments-v2-v1\"," + EOL
+ + " \"attachments-v2-k2\" : \"attachments-v2-v2\"" + EOL + " } ]," + EOL + " \"metadata\" : {"
+ + EOL + " \"metadata-k1\" : \"metadata-v1\"," + EOL + " \"metadata-k2\" : \"metadata-v2\"" + EOL
+ + " }," + EOL + " \"createdAt\" : \"createdat\"," + EOL + " \"size\" : 61," + EOL
+ + " \"displayName\" : \"name\"," + EOL + " \"displayDescription\" : \"description\"" + EOL + " } ]"
+ + EOL + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
Volumes volumes = objectMapper.readValue(JSON_FULL, Volumes.class);
volumes.toString();
-
+
List<Volume> list = volumes.getList();
Assert.assertNotNull(list);
Assert.assertEquals(2, list.size());
-
+
int cnt = 0;
- for (@SuppressWarnings("unused") Volume x : volumes) {
+ for (@SuppressWarnings("unused")
+ Volume x : volumes) {
++cnt;
}
Assert.assertEquals(2, cnt);
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.onap.so.libs.openstack-java-sdk</groupId>
- <artifactId>client-connectors</artifactId>
- <version>1.4.0-SNAPSHOT</version>
- </parent>
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.onap.so.libs.openstack-java-sdk</groupId>
+ <artifactId>client-connectors</artifactId>
+ <version>1.4.0-SNAPSHOT</version>
+ </parent>
- <groupId>org.onap.so.libs.openstack-java-sdk.client-connectors</groupId>
- <artifactId>http-connector</artifactId>
- <name>OpenStack HTTP-Client Connector</name>
- <description>OpenStack HTTP-Client Connector</description>
- <dependencies>
- <dependency>
- <groupId>org.apache.httpcomponents</groupId>
- <artifactId>httpclient</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.httpcomponents</groupId>
- <artifactId>httpcore</artifactId>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- <version>1.7.25</version>
- </dependency>
- <dependency>
- <groupId>ch.qos.logback</groupId>
- <artifactId>logback-classic</artifactId>
- <version>1.2.3</version>
- </dependency>
- </dependencies>
+ <groupId>org.onap.so.libs.openstack-java-sdk.client-connectors</groupId>
+ <artifactId>http-connector</artifactId>
+ <name>OpenStack HTTP-Client Connector</name>
+ <description>OpenStack HTTP-Client Connector</description>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.httpcomponents</groupId>
+ <artifactId>httpclient</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.httpcomponents</groupId>
+ <artifactId>httpcore</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ <version>1.7.25</version>
+ </dependency>
+ <dependency>
+ <groupId>ch.qos.logback</groupId>
+ <artifactId>logback-classic</artifactId>
+ <version>1.2.3</version>
+ </dependency>
+ </dependencies>
</project>
-/*
- * ONAP-SO
- * ============LICENSE_START==========================================
- * ===================================================================
- * Copyright (c) 2017 AT&T Intellectual Property. All rights reserved.
- * ===================================================================
+/*-
+ * ============LICENSE_START=======================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- * ============LICENSE_END============================================
- *
- * ECOMP and OpenECOMP are trademarks
- * and service marks of AT&T Intellectual Property.
- *
+ * ============LICENSE_END=========================================================
*/
+
package com.woorea.openstack.connector;
import java.io.IOException;
import java.net.UnknownHostException;
import java.util.List;
import java.util.Map.Entry;
-
import org.apache.http.HttpEntity;
import org.apache.http.HttpStatus;
import org.apache.http.client.HttpResponseException;
import org.apache.http.impl.client.HttpClients;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.annotation.JsonRootName;
import com.fasterxml.jackson.core.JsonProcessingException;
WRAPPED_MAPPER.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
}
- protected static <T> ObjectMapper getObjectMapper (Class<T> type) {
+ protected static <T> ObjectMapper getObjectMapper(Class<T> type) {
return type.getAnnotation(JsonRootName.class) == null ? DEFAULT_MAPPER : WRAPPED_MAPPER;
}
uri = uriBuilder.build();
} catch (URISyntaxException e) {
- throw new HttpClientException (e);
+ throw new HttpClientException(e);
}
HttpEntity entity = null;
try {
// Get appropriate mapper, based on existence of a root element in Entity class
- ObjectMapper mapper = getObjectMapper (request.entity().getEntity().getClass());
+ ObjectMapper mapper = getObjectMapper(request.entity().getEntity().getClass());
- String entityJson = mapper.writeValueAsString (request.entity().getEntity());
+ String entityJson = mapper.writeValueAsString(request.entity().getEntity());
entity = new StringEntity(entityJson, ContentType.create(request.entity().getContentType()));
- logger.debug ("Request JSON Body: " + entityJson.replaceAll("\"password\":\"[^\"]*\"", "\"password\":\"***\""));
+ logger.debug("Request JSON Body: "
+ + entityJson.replaceAll("\"password\":\"[^\"]*\"", "\"password\":\"***\""));
} catch (JsonProcessingException e) {
- throw new HttpClientException ("Json processing error on request entity", e);
+ throw new HttpClientException("Json processing error on request entity", e);
} catch (IOException e) {
- throw new HttpClientException ("Json IO error on request entity", e);
+ throw new HttpClientException("Json IO error on request entity", e);
}
}
httpRequest.addHeader(h.getKey(), sb.toString());
}
- logger.debug ("Sending HTTP request: " + httpRequest.toString());
+ logger.debug("Sending HTTP request: " + httpRequest.toString());
- // Get the Response. But don't get the body entity yet, as this response
- // will be wrapped in an HttpClientResponse. The HttpClientResponse
+ // Get the Response. But don't get the body entity yet, as this response
+ // will be wrapped in an HttpClientResponse. The HttpClientResponse
// buffers the body in constructor, so can close the response here.
HttpClientResponse httpClientResponse = null;
CloseableHttpResponse httpResponse = null;
// Catch known HttpClient exceptions, and wrap them in OpenStack Client Exceptions
- // so calling functions can distinguish. Only RuntimeExceptions are allowed.
+ // so calling functions can distinguish. Only RuntimeExceptions are allowed.
try {
httpResponse = httpClient.execute(httpRequest);
- logger.debug ("Response status: " + httpResponse.getStatusLine().getStatusCode());
+ logger.debug("Response status: " + httpResponse.getStatusLine().getStatusCode());
- httpClientResponse = new HttpClientResponse (httpResponse);
+ httpClientResponse = new HttpClientResponse(httpResponse);
int status = httpResponse.getStatusLine().getStatusCode();
- if (status == HttpStatus.SC_OK || status == HttpStatus.SC_CREATED ||
- status == HttpStatus.SC_NO_CONTENT || status == HttpStatus.SC_ACCEPTED)
- {
+ if (status == HttpStatus.SC_OK || status == HttpStatus.SC_CREATED || status == HttpStatus.SC_NO_CONTENT
+ || status == HttpStatus.SC_ACCEPTED) {
return httpClientResponse;
}
- }
- catch (HttpResponseException e) {
- // What exactly does this mean? It does not appear to get thrown for
+ } catch (HttpResponseException e) {
+ // What exactly does this mean? It does not appear to get thrown for
// non-2XX responses as documented.
- logger.error ("HttpResponseException: " +e.getMessage());
+ logger.error("HttpResponseException: " + e.getMessage());
throw new OpenStackResponseException(e.getMessage(), e.getStatusCode());
- }
- catch (UnknownHostException e) {
- logger.error ("Unknown Host: " +e.getMessage());
+ } catch (UnknownHostException e) {
+ logger.error("Unknown Host: " + e.getMessage());
throw new OpenStackConnectException("Unknown Host: " + e.getMessage());
- }
- catch (IOException e) {
- logger.error ("IOException: " +e.getMessage());
+ } catch (IOException e) {
+ logger.error("IOException: " + e.getMessage());
// Catch all other IOExceptions and throw as OpenStackConnectException
throw new OpenStackConnectException(e.getMessage());
- }
- catch (Exception e) {
+ } catch (Exception e) {
// Catchall for anything else, must throw as a RuntimeException
- logger.error ("Unexpected client exception: " +e.getMessage());
+ logger.error("Unexpected client exception: " + e.getMessage());
throw new RuntimeException("Unexpected client exception", e);
- }
- finally {
- // Have the body. Close the stream
+ } finally {
+ // Have the body. Close the stream
if (httpResponse != null)
try {
httpResponse.close();
// Get here on an error response (4XX-5XX)
throw new OpenStackResponseException(httpResponse.getStatusLine().getReasonPhrase(),
- httpResponse.getStatusLine().getStatusCode(),
- httpClientResponse);
+ httpResponse.getStatusLine().getStatusCode(), httpClientResponse);
}
private <T> HttpUriRequest getHttpUriRequest(OpenStackRequest<T> request, URI uri, HttpEntity entity) {
switch (request.method()) {
case POST:
HttpPost post = new HttpPost(uri);
- post.setEntity (entity);
+ post.setEntity(entity);
httpRequest = post;
break;
case PUT:
HttpPut put = new HttpPut(uri);
- put.setEntity (entity);
+ put.setEntity(entity);
httpRequest = put;
break;
}
private <T> void setUriBuilderParams(OpenStackRequest<T> request, URIBuilder uriBuilder) {
- for(Entry<String, List<Object>> entry : request.queryParams().entrySet()) {
+ for (Entry<String, List<Object>> entry : request.queryParams().entrySet()) {
for (Object o : entry.getValue()) {
uriBuilder.setParameter(entry.getKey(), String.valueOf(o));
}
}
}
-}
\ No newline at end of file
+}
-/*-\r
- * ============LICENSE_START=======================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-\r
-package com.woorea.openstack.connector;\r
-\r
-/*\r
- * Declare a RuntimeException since the Interface does not declare any\r
- * throwables. Any caught exception will be wrapped in HttpClientException\r
- */\r
-public class HttpClientException extends RuntimeException {\r
-\r
- private static final long serialVersionUID = 1L;\r
-\r
- public HttpClientException (String s) {\r
- super (s);\r
- }\r
-\r
- public HttpClientException (Exception e) {\r
- super ("Caught nested exception in HttpClient", e);\r
- }\r
-\r
- public HttpClientException (String s, Exception e) {\r
- super (s, e);\r
- }\r
-}
\ No newline at end of file
+/*-
+ * ============LICENSE_START=======================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+
+package com.woorea.openstack.connector;
+
+/*
+ * Declare a RuntimeException since the Interface does not declare any throwables. Any caught exception will be wrapped
+ * in HttpClientException
+ */
+public class HttpClientException extends RuntimeException {
+
+ private static final long serialVersionUID = 1L;
+
+ public HttpClientException(String s) {
+ super(s);
+ }
+
+ public HttpClientException(Exception e) {
+ super("Caught nested exception in HttpClient", e);
+ }
+
+ public HttpClientException(String s, Exception e) {
+ super(s, e);
+ }
+}
-/*-\r
- * ============LICENSE_START=======================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-\r
-package com.woorea.openstack.connector;\r
-\r
-import java.net.URI;\r
-\r
-import org.apache.http.HttpRequest;\r
-import org.apache.http.HttpResponse;\r
-import org.apache.http.HttpStatus;\r
-import org.apache.http.ProtocolException;\r
-import org.apache.http.annotation.Immutable;\r
-import org.apache.http.client.methods.HttpGet;\r
-import org.apache.http.client.methods.HttpHead;\r
-import org.apache.http.client.methods.HttpDelete;\r
-import org.apache.http.client.methods.HttpUriRequest;\r
-import org.apache.http.client.methods.RequestBuilder;\r
-import org.apache.http.impl.client.DefaultRedirectStrategy;\r
-import org.apache.http.protocol.HttpContext;\r
-\r
-/**\r
- * Custom {@link org.apache.http.client.RedirectStrategy} implementation\r
- * that automatically redirects all HEAD, GET and DELETE requests.\r
- * The {@link org.apache.http.client.DefaultRedirectStrategy} only\r
- * redirects GET and HEAD automatically, per the HTTP specification\r
- * (POST and PUT typically have bodies and thus cannot be redirected).\r
- *\r
- * A custom strategy is needed for the Openstack API, which can also send\r
- * 302 on a DELETE (by name) request, expecting the client to follow the\r
- * redirect to perform the actual deletion.\r
- */\r
-@Immutable\r
-public class HttpClientRedirectStrategy extends DefaultRedirectStrategy {\r
-\r
- /**\r
- * Redirectable methods.\r
- */\r
- private static final String[] REDIRECT_METHODS = new String[] {\r
- HttpGet.METHOD_NAME,\r
- HttpDelete.METHOD_NAME,\r
- HttpHead.METHOD_NAME\r
- };\r
-\r
- /**\r
- * Determine if the request should be redirected.\r
- * This may not actually be needed, since the REDIRECT_METHODS\r
- * array has been updated with the DELETE.\r
- */\r
- @Override\r
- protected boolean isRedirectable(final String method) {\r
- for (final String m: REDIRECT_METHODS) {\r
- if (m.equalsIgnoreCase(method)) {\r
- return true;\r
- }\r
- }\r
- return false;\r
- }\r
-\r
- /**\r
- * Override the default redirect handling method. As implemented\r
- * in HttpClient, it does not preserve the method on 301 or 302\r
- * responses, always redirecting to a GET.\r
- */\r
- @Override\r
- public HttpUriRequest getRedirect(\r
- final HttpRequest request,\r
- final HttpResponse response,\r
- final HttpContext context) throws ProtocolException {\r
-\r
- final URI uri = getLocationURI(request, response, context);\r
- final String method = request.getRequestLine().getMethod();\r
- if (method.equalsIgnoreCase(HttpHead.METHOD_NAME)) {\r
- return new HttpHead(uri);\r
- } else if (method.equalsIgnoreCase(HttpGet.METHOD_NAME)) {\r
- return new HttpGet(uri);\r
- } else {\r
-\r
- final int status = response.getStatusLine().getStatusCode();\r
-\r
- HttpUriRequest newRequest;\r
- if (status == HttpStatus.SC_TEMPORARY_REDIRECT || status == HttpStatus.SC_MOVED_TEMPORARILY) {\r
- newRequest = RequestBuilder.copy(request).setUri(uri).build();\r
- } else {\r
- newRequest = new HttpGet(uri);\r
- }\r
- return newRequest;\r
- }\r
- }\r
-}
\ No newline at end of file
+/*-
+ * ============LICENSE_START=======================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+
+package com.woorea.openstack.connector;
+
+import java.net.URI;
+import org.apache.http.HttpRequest;
+import org.apache.http.HttpResponse;
+import org.apache.http.HttpStatus;
+import org.apache.http.ProtocolException;
+import org.apache.http.annotation.Immutable;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.client.methods.HttpHead;
+import org.apache.http.client.methods.HttpDelete;
+import org.apache.http.client.methods.HttpUriRequest;
+import org.apache.http.client.methods.RequestBuilder;
+import org.apache.http.impl.client.DefaultRedirectStrategy;
+import org.apache.http.protocol.HttpContext;
+
+/**
+ * Custom {@link org.apache.http.client.RedirectStrategy} implementation that automatically redirects all HEAD, GET and
+ * DELETE requests. The {@link org.apache.http.client.DefaultRedirectStrategy} only redirects GET and HEAD
+ * automatically, per the HTTP specification (POST and PUT typically have bodies and thus cannot be redirected).
+ *
+ * A custom strategy is needed for the Openstack API, which can also send 302 on a DELETE (by name) request, expecting
+ * the client to follow the redirect to perform the actual deletion.
+ */
+@Immutable
+public class HttpClientRedirectStrategy extends DefaultRedirectStrategy {
+
+ /**
+ * Redirectable methods.
+ */
+ private static final String[] REDIRECT_METHODS =
+ new String[] {HttpGet.METHOD_NAME, HttpDelete.METHOD_NAME, HttpHead.METHOD_NAME};
+
+ /**
+ * Determine if the request should be redirected. This may not actually be needed, since the REDIRECT_METHODS array
+ * has been updated with the DELETE.
+ */
+ @Override
+ protected boolean isRedirectable(final String method) {
+ for (final String m : REDIRECT_METHODS) {
+ if (m.equalsIgnoreCase(method)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Override the default redirect handling method. As implemented in HttpClient, it does not preserve the method on
+ * 301 or 302 responses, always redirecting to a GET.
+ */
+ @Override
+ public HttpUriRequest getRedirect(final HttpRequest request, final HttpResponse response, final HttpContext context)
+ throws ProtocolException {
+
+ final URI uri = getLocationURI(request, response, context);
+ final String method = request.getRequestLine().getMethod();
+ if (method.equalsIgnoreCase(HttpHead.METHOD_NAME)) {
+ return new HttpHead(uri);
+ } else if (method.equalsIgnoreCase(HttpGet.METHOD_NAME)) {
+ return new HttpGet(uri);
+ } else {
+
+ final int status = response.getStatusLine().getStatusCode();
+
+ HttpUriRequest newRequest;
+ if (status == HttpStatus.SC_TEMPORARY_REDIRECT || status == HttpStatus.SC_MOVED_TEMPORARILY) {
+ newRequest = RequestBuilder.copy(request).setUri(uri).build();
+ } else {
+ newRequest = new HttpGet(uri);
+ }
+ return newRequest;
+ }
+ }
+}
import org.apache.http.HttpResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-
import com.fasterxml.jackson.databind.ObjectMapper;
import com.woorea.openstack.base.client.OpenStackResponse;
-
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
private HttpResponse response = null;
private String entityBody = null;
- public HttpClientResponse(HttpResponse response)
- {
+ public HttpClientResponse(HttpResponse response) {
this.response = response;
// Read the body so InputStream can be closed
if (response.getEntity() == null) {
// No body
- logger.debug ("No Response Body");
+ logger.debug("No Response Body");
return;
}
try {
response.getEntity().writeTo(responseBody);
} catch (IOException e) {
- throw new HttpClientException ("Error Reading Response Body", e);
+ throw new HttpClientException("Error Reading Response Body", e);
}
entityBody = responseBody.toString();
- logger.debug (entityBody);
+ logger.debug(entityBody);
}
@Override
- public <T> T getEntity (Class<T> returnType) {
+ public <T> T getEntity(Class<T> returnType) {
// Get appropriate mapper, based on existence of a root element
- ObjectMapper mapper = HttpClientConnector.getObjectMapper (returnType);
+ ObjectMapper mapper = HttpClientConnector.getObjectMapper(returnType);
T resp = null;
try {
resp = mapper.readValue(entityBody, returnType);
} catch (Exception e) {
- throw new HttpClientException ("Caught exception in getEntity", e);
+ throw new HttpClientException("Caught exception in getEntity", e);
}
return resp;
}
@Override
public InputStream getInputStream() {
- return new ByteArrayInputStream (entityBody.getBytes());
+ return new ByteArrayInputStream(entityBody.getBytes());
}
@Override
return headers;
}
-}
\ No newline at end of file
+}
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.onap.so.libs</groupId>
- <artifactId>openstack-java-sdk</artifactId>
- <version>1.4.0-SNAPSHOT</version>
- </parent>
- <groupId>org.onap.so.libs.openstack-java-sdk</groupId>
- <artifactId>client-connectors</artifactId>
- <name>OpenStack Client Connectors</name>
- <description>OpenStack Client Connectors</description>
- <packaging>pom</packaging>
- <profiles>
- <profile>
- <id>http</id>
- <activation>
- <activeByDefault>true</activeByDefault>
- </activation>
- <modules>
- <module>http-connector</module>
- </modules>
- </profile>
- </profiles>
- <dependencies>
- <dependency>
- <groupId>org.onap.so.libs.openstack-java-sdk</groupId>
- <artifactId>openstack-client</artifactId>
- <version>${project.version}</version>
- </dependency>
- </dependencies>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.onap.so.libs</groupId>
+ <artifactId>openstack-java-sdk</artifactId>
+ <version>1.4.0-SNAPSHOT</version>
+ </parent>
+ <groupId>org.onap.so.libs.openstack-java-sdk</groupId>
+ <artifactId>client-connectors</artifactId>
+ <name>OpenStack Client Connectors</name>
+ <description>OpenStack Client Connectors</description>
+ <packaging>pom</packaging>
+ <profiles>
+ <profile>
+ <id>http</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <modules>
+ <module>http-connector</module>
+ </modules>
+ </profile>
+ </profiles>
+ <dependencies>
+ <dependency>
+ <groupId>org.onap.so.libs.openstack-java-sdk</groupId>
+ <artifactId>openstack-client</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
</project>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.onap.so.libs</groupId>
- <artifactId>openstack-java-sdk</artifactId>
- <version>1.4.0-SNAPSHOT</version>
- </parent>
- <groupId>org.onap.so.libs.openstack-java-sdk</groupId>
- <artifactId>openstack-client</artifactId>
- <name>OpenStack Client</name>
- <description>OpenStack Client</description>
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.onap.so.libs</groupId>
+ <artifactId>openstack-java-sdk</artifactId>
+ <version>1.4.0-SNAPSHOT</version>
+ </parent>
+ <groupId>org.onap.so.libs.openstack-java-sdk</groupId>
+ <artifactId>openstack-client</artifactId>
+ <name>OpenStack Client</name>
+ <description>OpenStack Client</description>
- <dependencies>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.mockito</groupId>
- <artifactId>mockito-all</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.powermock</groupId>
- <artifactId>powermock-api-mockito</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-all</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.powermock</groupId>
+ <artifactId>powermock-api-mockito</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-jar-plugin</artifactId>
- <version>3.0.2</version>
- <executions>
- <execution>
- <id>test-jar</id>
- <goals>
- <goal>test-jar</goal>
- </goals>
- <configuration>
- <skip>false</skip>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <version>3.0.2</version>
+ <executions>
+ <execution>
+ <id>test-jar</id>
+ <goals>
+ <goal>test-jar</goal>
+ </goals>
+ <configuration>
+ <skip>false</skip>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
</project>
-/*-\r
- * ============LICENSE_START=======================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-\r
-package com.woorea.openstack.base.client;\r
-\r
-/**\r
- * A common abstract parent of all Openstack Exception types, allowing\r
- * calling classes the choice to catch all error exceptions together.\r
- */\r
-public abstract class OpenStackBaseException extends RuntimeException\r
-{\r
- private static final long serialVersionUID = 1L;\r
-\r
- /*\r
- * Implement only the basic constructors\r
- */\r
- public OpenStackBaseException () {}\r
-\r
- public OpenStackBaseException(String message) {\r
- super(message);\r
- }\r
-\r
- public OpenStackBaseException(String message, Throwable cause) {\r
- super(message, cause);\r
- }\r
-}
\ No newline at end of file
+/*-
+ * ============LICENSE_START=======================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+
+package com.woorea.openstack.base.client;
+
+/**
+ * A common abstract parent of all Openstack Exception types, allowing calling classes the choice to catch all error
+ * exceptions together.
+ */
+public abstract class OpenStackBaseException extends RuntimeException {
+ private static final long serialVersionUID = 1L;
+
+ /*
+ * Implement only the basic constructors
+ */
+ public OpenStackBaseException() {}
+
+ public OpenStackBaseException(String message) {
+ super(message);
+ }
+
+ public OpenStackBaseException(String message, Throwable cause) {
+ super(message, cause);
+ }
+}
try {
return connector.request(request);
} catch (OpenStackResponseException e) {
- if (e.getStatus() != OpenStackResponseStatus.NOT_AUTHORIZED
- || tokenProvider == null) {
+ if (e.getStatus() != OpenStackResponseStatus.NOT_AUTHORIZED || tokenProvider == null) {
throw e;
}
authException = e;
tokenProvider.expireToken();
}
}
- if(null == authException){
- authException = new OpenStackResponseException("Unknown issue",500);
+ if (null == authException) {
+ authException = new OpenStackResponseException("Unknown issue", 500);
}
throw authException;
}
public <T> T execute(OpenStackRequest<T> request) {
- OpenStackResponse response = request(request);
- return (request.returnType() != null && request.returnType() != Void.class) ? response.getEntity(request.returnType()) : null;
+ OpenStackResponse response = request(request);
+ return (request.returnType() != null && request.returnType() != Void.class)
+ ? response.getEntity(request.returnType())
+ : null;
}
public void property(String property, String value) {
return new OpenStackRequest<>(this, HttpMethod.GET, path, null, returnType);
}
-}
\ No newline at end of file
+}
package com.woorea.openstack.base.client;
/**
- * Custom RuntimeException to report connection errors to Openstack endpoints.
- * Must be a RuntimeException to conform with OpenstackClient interface, which
- * does not declare specific Exceptions.
+ * Custom RuntimeException to report connection errors to Openstack endpoints. Must be a RuntimeException to conform
+ * with OpenstackClient interface, which does not declare specific Exceptions.
*/
public class OpenStackConnectException extends OpenStackBaseException {
public OpenStackConnectException(String message, Throwable cause) {
super(message, cause);
}
-}
\ No newline at end of file
+}
public class OpenStackRequest<R> {
- private OpenStackClient client;
+ private OpenStackClient client;
- private String endpoint;
-
- private HttpMethod method;
+ private String endpoint;
+
+ private HttpMethod method;
- private StringBuilder path = new StringBuilder();
+ private StringBuilder path = new StringBuilder();
- private Map<String, List<Object>> headers = new HashMap<>();
+ private Map<String, List<Object>> headers = new HashMap<>();
- private Entity<?> entity;
+ private Entity<?> entity;
- private Class<R> returnType;
+ private Class<R> returnType;
- public OpenStackRequest() {
-
- }
-
- public OpenStackRequest(OpenStackClient client, HttpMethod method, CharSequence path, Entity<?> entity,
- Class<R> returnType) {
- this.client = client;
- this.method = method;
- this.path = new StringBuilder(path);
- this.entity = entity;
- this.returnType = returnType;
- header("Accept", "application/json");
- }
-
- public OpenStackRequest<R> endpoint(String endpoint) {
- this.endpoint = endpoint;
- return this;
- }
-
- public String endpoint() {
- return endpoint;
- }
-
- public OpenStackRequest<R> method(HttpMethod method) {
- this.method = method;
- return this;
- }
-
- public HttpMethod method() {
- return method;
- }
-
- public OpenStackRequest<R> path(String path) {
- this.path.append(path);
- return this;
- }
-
- public String path() {
- return path.toString();
- }
-
- public OpenStackRequest<R> header(String name, Object value) {
- if (value != null) {
- headers.put(name, Arrays.asList(value));
- }
- return this;
- }
-
- public Map<String, List<Object>> headers() {
- return headers;
- }
-
- public <T> Entity<T> entity(T entity, String contentType) {
- return new Entity<>(entity, contentType);
- }
-
- public Entity<?> entity() {
- return entity;
- }
-
- public <T> Entity<T> json(T entity) {
- return entity(entity, "application/json");
- }
-
- public void returnType(Class<R> returnType) {
- this.returnType = returnType;
- }
-
- public Class<R> returnType() {
- return returnType;
- }
-
- public R execute() {
- return client.execute(this);
- }
-
- public OpenStackResponse request() {
- return client.request(this);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Object#toString()
- */
- @Override
- public String toString() {
- return "OpenStackRequest [endpoint=" + endpoint + ", method=" + method + ", path=" + path + ", headers="
- + headers + ", entity=" + entity + ", returnType=" + returnType + "]";
- }
-
- private Map<String, List<Object>> queryParams = new LinkedHashMap<>();
-
- public Map<String, List<Object>> queryParams() {
- return queryParams;
- }
-
- public OpenStackRequest<R> queryParam(String key, Object value) {
- if (value != null) {
- if (queryParams.containsKey(key)) {
- List<Object> values = queryParams.get(key);
- values.add(value);
- } else {
- List<Object> values = new ArrayList<>();
- values.add(value);
- queryParams.put(key, values);
- }
- }
- return this;
- }
-
- protected static String buildPath(String... elements) {
- StringBuilder stringBuilder = new StringBuilder();
- for (String element : elements) {
- stringBuilder.append(element);
- }
-
- return stringBuilder.toString();
- }
+ public OpenStackRequest() {
+
+ }
+
+ public OpenStackRequest(OpenStackClient client, HttpMethod method, CharSequence path, Entity<?> entity,
+ Class<R> returnType) {
+ this.client = client;
+ this.method = method;
+ this.path = new StringBuilder(path);
+ this.entity = entity;
+ this.returnType = returnType;
+ header("Accept", "application/json");
+ }
+
+ public OpenStackRequest<R> endpoint(String endpoint) {
+ this.endpoint = endpoint;
+ return this;
+ }
+
+ public String endpoint() {
+ return endpoint;
+ }
+
+ public OpenStackRequest<R> method(HttpMethod method) {
+ this.method = method;
+ return this;
+ }
+
+ public HttpMethod method() {
+ return method;
+ }
+
+ public OpenStackRequest<R> path(String path) {
+ this.path.append(path);
+ return this;
+ }
+
+ public String path() {
+ return path.toString();
+ }
+
+ public OpenStackRequest<R> header(String name, Object value) {
+ if (value != null) {
+ headers.put(name, Arrays.asList(value));
+ }
+ return this;
+ }
+
+ public Map<String, List<Object>> headers() {
+ return headers;
+ }
+
+ public <T> Entity<T> entity(T entity, String contentType) {
+ return new Entity<>(entity, contentType);
+ }
+
+ public Entity<?> entity() {
+ return entity;
+ }
+
+ public <T> Entity<T> json(T entity) {
+ return entity(entity, "application/json");
+ }
+
+ public void returnType(Class<R> returnType) {
+ this.returnType = returnType;
+ }
+
+ public Class<R> returnType() {
+ return returnType;
+ }
+
+ public R execute() {
+ return client.execute(this);
+ }
+
+ public OpenStackResponse request() {
+ return client.request(this);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Object#toString()
+ */
+ @Override
+ public String toString() {
+ return "OpenStackRequest [endpoint=" + endpoint + ", method=" + method + ", path=" + path + ", headers="
+ + headers + ", entity=" + entity + ", returnType=" + returnType + "]";
+ }
+
+ private Map<String, List<Object>> queryParams = new LinkedHashMap<>();
+
+ public Map<String, List<Object>> queryParams() {
+ return queryParams;
+ }
+
+ public OpenStackRequest<R> queryParam(String key, Object value) {
+ if (value != null) {
+ if (queryParams.containsKey(key)) {
+ List<Object> values = queryParams.get(key);
+ values.add(value);
+ } else {
+ List<Object> values = new ArrayList<>();
+ values.add(value);
+ queryParams.put(key, values);
+ }
+ }
+ return this;
+ }
+
+ protected static String buildPath(String... elements) {
+ StringBuilder stringBuilder = new StringBuilder();
+ for (String element : elements) {
+ stringBuilder.append(element);
+ }
+
+ return stringBuilder.toString();
+ }
}
public InputStream getInputStream();
public String header(String name);
-
+
public Map<String, String> headers();
-
+
}
return response;
}
-}
\ No newline at end of file
+}
public class OpenStackResponseStatus {
- private OpenStackResponseStatus(){
+ private OpenStackResponseStatus() {
}
public static final int CONFLICT = 409;
-}
\ No newline at end of file
+}
}
@Override
- public void expireToken() {
- }
+ public void expireToken() {}
}
* ============LICENSE_END=========================================================
*/
-package com.woorea.openstack.common.session;
\ No newline at end of file
+package com.woorea.openstack.common.session;
* ============LICENSE_END=========================================================
*/
-package com.woorea.openstack.common.session;
\ No newline at end of file
+package com.woorea.openstack.common.session;
return this;
}
- public <T extends OpenStackRequest> OpenStackClientMockUtils mockRequestThrow(T request, String message, int status) {
- Mockito.when(connector.request(Mockito.eq(request)))
- .thenThrow(new OpenStackResponseException(message, status));
+ public <T extends OpenStackRequest> OpenStackClientMockUtils mockRequestThrow(T request, String message,
+ int status) {
+ Mockito.when(connector.request(Mockito.eq(request))).thenThrow(new OpenStackResponseException(message, status));
return this;
}
}
private OpenStackClientConnector mockClientConnector() {
- return OpenStackClientMockUtils.getInstance()
- .mockRequestResponse(Entity.class, Entity.json(SUCCESS))
+ return OpenStackClientMockUtils.getInstance().mockRequestResponse(Entity.class, Entity.json(SUCCESS))
.mockRequestThrow(notAuthorizedRequest, "Not Authorized", OpenStackResponseStatus.NOT_AUTHORIZED)
- .mockRequestThrow(conflictRequest, "Conflict", OpenStackResponseStatus.CONFLICT)
- .getConnector();
+ .mockRequestThrow(conflictRequest, "Conflict", OpenStackResponseStatus.CONFLICT).getConnector();
}
public void executeConflict() {
client.execute(conflictRequest);
}
-}
\ No newline at end of file
+}
<?xml version="1.0"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.onap.oparent</groupId>
- <artifactId>oparent</artifactId>
- <version>1.2.1</version>
- <relativePath/>
- </parent>
+ <parent>
+ <groupId>org.onap.oparent</groupId>
+ <artifactId>oparent</artifactId>
+ <version>1.2.1</version>
+ <relativePath />
+ </parent>
- <groupId>org.onap.so.libs</groupId>
- <artifactId>openstack-java-sdk</artifactId>
- <version>1.4.0-SNAPSHOT</version>
- <packaging>pom</packaging>
- <name>so-libs</name>
- <description>OpenStack Java SDK</description>
- <properties>
- <skip.sign>false</skip.sign>
- <nexusproxy>https://nexus.onap.org</nexusproxy>
- <snapshotNexusPath>/content/repositories/snapshots/</snapshotNexusPath>
- <releaseNexusPath>/content/repositories/releases/</releaseNexusPath>
- <siteNexusPath>/content/sites/site/org/onap/so/libs/${project.version}</siteNexusPath>
- </properties>
- <distributionManagement>
- <repository>
- <id>ecomp-releases</id>
- <name>OpenECOMP - Release Repository</name>
- <url>${nexusproxy}/${releaseNexusPath}</url>
- </repository>
- <snapshotRepository>
- <id>ecomp-snapshots</id>
- <name>OpenECOMP - Snapshot Repository</name>
- <url>${nexusproxy}/${snapshotNexusPath}</url>
- </snapshotRepository>
- <site>
- <id>ecomp-site</id>
- <url>dav:${nexusproxy}${siteNexusPath}</url>
- </site>
- </distributionManagement>
- <modules>
- <module>openstack-client</module>
- <module>nova-model</module>
- <module>nova-client</module>
- <module>keystone-client</module>
- <module>swift-client</module>
- <module>quantum-client</module>
- <module>heat-client</module>
- <module>glance-model</module>
- <module>glance-client</module>
- <module>keystone-model</module>
- <module>swift-model</module>
- <module>quantum-model</module>
- <module>ceilometer-model</module>
- <module>ceilometer-client</module>
- <module>openstack-client-connectors</module>
- <module>heat-model</module>
- <module>cinder-model</module>
- <module>cinder-client</module>
- </modules>
- <licenses>
- <license>
- <name>Apache2</name>
- <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
- </license>
- </licenses>
- <inceptionYear>2012</inceptionYear>
- <repositories>
- <repository>
- <id>ecomp-staging</id>
- <url>https://nexus.onap.org/content/repositories/staging/</url>
- <snapshots>
- <enabled>false</enabled>
- </snapshots>
- </repository>
- <repository>
- <id>ecomp-public</id>
- <url>https://nexus.onap.org/content/repositories/public/</url>
- <snapshots>
- <enabled>false</enabled>
- </snapshots>
- </repository>
- <repository>
- <id>ecomp-releases</id>
- <url>https://nexus.onap.org/content/repositories/releases/</url>
- <snapshots>
- <enabled>false</enabled>
- </snapshots>
- </repository>
- <repository>
- <id>ecomp-snapshots</id>
- <url>https://nexus.onap.org/content/repositories/snapshots/</url>
- <releases>
- <enabled>false</enabled>
- </releases>
- </repository>
- <repository>
- <id>central</id>
- <name>Maven 2 repository</name>
- <url>http://repo2.maven.org/maven2/</url>
- </repository>
- </repositories>
- <pluginRepositories>
- <pluginRepository>
- <id>central</id>
- <name>Maven 2 plugin repository</name>
- <url>http://repo2.maven.org/maven2/</url>
- </pluginRepository>
- </pluginRepositories>
- <dependencyManagement>
- <dependencies>
- <dependency>
- <groupId>org.apache.httpcomponents</groupId>
- <artifactId>httpcore</artifactId>
- <version>4.4.4</version>
- <scope>compile</scope>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.12</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.mockito</groupId>
- <artifactId>mockito-all</artifactId>
- <version>1.10.19</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.powermock</groupId>
- <artifactId>powermock-api-mockito</artifactId>
- <version>1.6.2</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.powermock</groupId>
- <artifactId>powermock-module-junit4</artifactId>
- <version>1.6.2</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.skyscreamer</groupId>
- <artifactId>jsonassert</artifactId>
- <version>1.4.0</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.onap.so.libs.openstack-java-sdk</groupId>
- <artifactId>openstack-client</artifactId>
- <version>${project.version}</version>
- <type>test-jar</type>
- <scope>test</scope>
- </dependency>
- </dependencies>
- </dependencyManagement>
- <dependencies>
- <dependency>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-databind</artifactId>
- <version>2.9.6</version>
- </dependency>
- </dependencies>
- <reporting>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-javadoc-plugin</artifactId>
- <version>2.10.4</version>
- <configuration>
- <failOnError>false</failOnError>
- <doclet>org.umlgraph.doclet.UmlGraphDoc</doclet>
- <docletArtifact>
- <groupId>org.umlgraph</groupId>
- <artifactId>umlgraph</artifactId>
- <version>5.6</version>
- </docletArtifact>
- <additionalparam>-views</additionalparam>
- <useStandardDocletOptions>true</useStandardDocletOptions>
- </configuration>
- </plugin>
- </plugins>
- </reporting>
- <build>
- <pluginManagement>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <version>2.19.1</version>
- </plugin>
- </plugins>
- </pluginManagement>
- <!-- To use the plugin goals in your POM or parent POM -->
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-site-plugin</artifactId>
- <version>3.6</version>
- <dependencies>
- <dependency>
- <groupId>org.apache.maven.wagon</groupId>
- <artifactId>wagon-webdav-jackrabbit</artifactId>
- <version>2.10</version>
- </dependency>
- </dependencies>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <version>2.19.1</version>
- </plugin>
- <plugin>
- <groupId>org.sonatype.plugins</groupId>
- <artifactId>nexus-staging-maven-plugin</artifactId>
- <version>1.6.7</version>
- <extensions>true</extensions>
- <configuration>
- <nexusUrl>${nexusproxy}</nexusUrl>
- <stagingProfileId>176c31dfe190a</stagingProfileId>
- <serverId>ecomp-staging</serverId>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-deploy-plugin</artifactId>
- <version>2.8</version>
- <configuration>
- <skip/>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <version>3.1</version>
- <configuration>
- <source>1.7</source>
- <target>1.7</target>
- <encoding>UTF-8</encoding>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-eclipse-plugin</artifactId>
- <version>2.9</version>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-resources-plugin</artifactId>
- <version>2.6</version>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-source-plugin</artifactId>
- <version>2.2.1</version>
- <executions>
- <execution>
- <id>attach-sources</id>
- <phase>verify</phase>
- <goals>
- <goal>jar-no-fork</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
+ <groupId>org.onap.so.libs</groupId>
+ <artifactId>openstack-java-sdk</artifactId>
+ <version>1.4.0-SNAPSHOT</version>
+ <packaging>pom</packaging>
+ <name>so-libs</name>
+ <description>OpenStack Java SDK</description>
+ <properties>
+ <skip.sign>false</skip.sign>
+ <nexusproxy>https://nexus.onap.org</nexusproxy>
+ <snapshotNexusPath>/content/repositories/snapshots/</snapshotNexusPath>
+ <releaseNexusPath>/content/repositories/releases/</releaseNexusPath>
+ <siteNexusPath>/content/sites/site/org/onap/so/libs/${project.version}</siteNexusPath>
+ <format.skipValidate>false</format.skipValidate>
+ <format.skipExecute>true</format.skipExecute>
+ </properties>
+ <distributionManagement>
+ <repository>
+ <id>ecomp-releases</id>
+ <name>OpenECOMP - Release Repository</name>
+ <url>${nexusproxy}/${releaseNexusPath}</url>
+ </repository>
+ <snapshotRepository>
+ <id>ecomp-snapshots</id>
+ <name>OpenECOMP - Snapshot Repository</name>
+ <url>${nexusproxy}/${snapshotNexusPath}</url>
+ </snapshotRepository>
+ <site>
+ <id>ecomp-site</id>
+ <url>dav:${nexusproxy}${siteNexusPath}</url>
+ </site>
+ </distributionManagement>
+ <modules>
+ <module>openstack-client</module>
+ <module>nova-model</module>
+ <module>nova-client</module>
+ <module>keystone-client</module>
+ <module>swift-client</module>
+ <module>quantum-client</module>
+ <module>heat-client</module>
+ <module>glance-model</module>
+ <module>glance-client</module>
+ <module>keystone-model</module>
+ <module>swift-model</module>
+ <module>quantum-model</module>
+ <module>ceilometer-model</module>
+ <module>ceilometer-client</module>
+ <module>openstack-client-connectors</module>
+ <module>heat-model</module>
+ <module>cinder-model</module>
+ <module>cinder-client</module>
+ </modules>
+ <licenses>
+ <license>
+ <name>Apache2</name>
+ <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
+ </license>
+ </licenses>
+ <inceptionYear>2012</inceptionYear>
+ <repositories>
+ <repository>
+ <id>ecomp-staging</id>
+ <url>https://nexus.onap.org/content/repositories/staging/</url>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </repository>
+ <repository>
+ <id>ecomp-public</id>
+ <url>https://nexus.onap.org/content/repositories/public/</url>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </repository>
+ <repository>
+ <id>ecomp-releases</id>
+ <url>https://nexus.onap.org/content/repositories/releases/</url>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </repository>
+ <repository>
+ <id>ecomp-snapshots</id>
+ <url>https://nexus.onap.org/content/repositories/snapshots/</url>
+ <releases>
+ <enabled>false</enabled>
+ </releases>
+ </repository>
+ <repository>
+ <id>central</id>
+ <name>Maven 2 repository</name>
+ <url>http://repo2.maven.org/maven2/</url>
+ </repository>
+ </repositories>
+ <pluginRepositories>
+ <pluginRepository>
+ <id>central</id>
+ <name>Maven 2 plugin repository</name>
+ <url>http://repo2.maven.org/maven2/</url>
+ </pluginRepository>
+ </pluginRepositories>
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.httpcomponents</groupId>
+ <artifactId>httpcore</artifactId>
+ <version>4.4.4</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.12</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-all</artifactId>
+ <version>1.10.19</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.powermock</groupId>
+ <artifactId>powermock-api-mockito</artifactId>
+ <version>1.6.2</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.powermock</groupId>
+ <artifactId>powermock-module-junit4</artifactId>
+ <version>1.6.2</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.skyscreamer</groupId>
+ <artifactId>jsonassert</artifactId>
+ <version>1.4.0</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.so.libs.openstack-java-sdk</groupId>
+ <artifactId>openstack-client</artifactId>
+ <version>${project.version}</version>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+ <profiles>
+ <profile>
+ <id>format</id>
+ <properties>
+ <format.skipValidate>true</format.skipValidate>
+ <format.skipExecute>false</format.skipExecute>
+ </properties>
+ </profile>
+ </profiles>
+ <dependencies>
+ <dependency>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-databind</artifactId>
+ <version>2.9.6</version>
+ </dependency>
+ </dependencies>
+ <reporting>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <version>2.10.4</version>
+ <configuration>
+ <failOnError>false</failOnError>
+ <doclet>org.umlgraph.doclet.UmlGraphDoc</doclet>
+ <docletArtifact>
+ <groupId>org.umlgraph</groupId>
+ <artifactId>umlgraph</artifactId>
+ <version>5.6</version>
+ </docletArtifact>
+ <additionalparam>-views</additionalparam>
+ <useStandardDocletOptions>true</useStandardDocletOptions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </reporting>
+ <build>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.19.1</version>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ <!-- To use the plugin goals in your POM or parent POM -->
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-site-plugin</artifactId>
+ <version>3.6</version>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.maven.wagon</groupId>
+ <artifactId>wagon-webdav-jackrabbit</artifactId>
+ <version>2.10</version>
+ </dependency>
+ </dependencies>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.19.1</version>
+ </plugin>
+ <plugin>
+ <groupId>org.sonatype.plugins</groupId>
+ <artifactId>nexus-staging-maven-plugin</artifactId>
+ <version>1.6.7</version>
+ <extensions>true</extensions>
+ <configuration>
+ <nexusUrl>${nexusproxy}</nexusUrl>
+ <stagingProfileId>176c31dfe190a</stagingProfileId>
+ <serverId>ecomp-staging</serverId>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-deploy-plugin</artifactId>
+ <version>2.8</version>
+ <configuration>
+ <skip />
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>3.1</version>
+ <configuration>
+ <source>1.7</source>
+ <target>1.7</target>
+ <encoding>UTF-8</encoding>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-eclipse-plugin</artifactId>
+ <version>2.9</version>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-resources-plugin</artifactId>
+ <version>2.6</version>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-source-plugin</artifactId>
+ <version>2.2.1</version>
+ <executions>
+ <execution>
+ <id>attach-sources</id>
+ <phase>verify</phase>
+ <goals>
+ <goal>jar-no-fork</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.gmaven</groupId>
+ <artifactId>groovy-maven-plugin</artifactId>
+ <version>2.0</version>
+ <executions>
+ <!-- set absolute base path from super pom -->
+ <execution>
+ <id>find-basepath</id>
+ <phase>validate</phase>
+ <goals>
+ <goal>execute</goal>
+ </goals>
+ <configuration>
+ <source>
+ <![CDATA[
+ import java.io.File;
+ log.info('## define projects super pom absolute path through basepath_marker')
+ String p = "basepath_marker";
+ File f = null;
+ if( p != null ) {
+ def _max_child_poms = 0
+ while( _max_child_poms++ < 5 ) {
+ f = new File( p );
+ if( f.exists() ) {
+ break;
+ }
+ p = "../" + p;
+ }
+ }
+ if( f != null ) {
+ String basePath = f.getCanonicalPath();
+ basePath = basePath.substring( 0, basePath.lastIndexOf( File.separator ) );
+ project.properties['base-path'] = basePath.replace( '\\' , '/');
+ log.info(' - used base path = ' + project.properties['base-path'] );
+ } else {
+ log.error( 'Could not find basepath_marker marker file!' );
+ System.stop( 0 );
+ }
+ ]]>
+ </source>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>net.revelc.code.formatter</groupId>
+ <artifactId>formatter-maven-plugin</artifactId>
+ <version>2.9.0</version>
+ <executions>
+ <execution>
+ <id>format-java</id>
+ <goals>
+ <goal>format</goal>
+ </goals>
+ <configuration>
+ <skip>${format.skipExecute}</skip>
+ <configFile>${base-path}/project-configs/code-tools/onap-eclipse-format.xml</configFile>
+ </configuration>
+ </execution>
+ <execution>
+ <id>format-xml</id>
+ <goals>
+ <goal>format</goal>
+ </goals>
+ <configuration>
+ <skip>${format.skipExecute}</skip>
+ <sourceDirectory>${project.basedir}</sourceDirectory>
+ <configXmlFile>${base-path}/project-configs/code-tools/pom-format.properties</configXmlFile>
+ <includes>
+ <include>pom.xml</include>
+ </includes>
+ </configuration>
+ </execution>
+ <execution>
+ <id>validate-java</id>
+ <goals>
+ <goal>validate</goal>
+ </goals>
+ <configuration>
+ <skip>${format.skipValidate}</skip>
+ <configFile>${base-path}/project-configs/code-tools/onap-eclipse-format.xml</configFile>
+ </configuration>
+ </execution>
+ <execution>
+ <id>validate-poms</id>
+ <goals>
+ <goal>validate</goal>
+ </goals>
+ <configuration>
+ <skip>${format.skipValidate}</skip>
+ <configFile>${base-path}/project-configs/code-tools/pom-format.properties</configFile>
+ <includes>
+ <include>pom.xml</include>
+ </includes>
+ </configuration>
+ </execution>
+ </executions>
+ <dependencies>
+ <dependency>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-annotations</artifactId>
+ <version>2.9.8</version>
+ </dependency>
+ </dependencies>
+ </plugin>
+ </plugins>
+ </build>
</project>
--- /dev/null
+<FindBugsFilter>
+ <Match>
+ <Package name="~org\.openecomp\.mso.*" />
+ </Match>
+</FindBugsFilter>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE module PUBLIC "-//Puppy Crawl//DTD Check Configuration 1.3//EN" "http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
+
+<!--
+ This configuration file was written by the eclipse-cs plugin configuration editor
+-->
+<!--
+ Checkstyle-Configuration: OpenECOMP MSO Checkstyle 1.0
+ Description: none
+-->
+<module name="Checker">
+ <property name="severity" value="warning"/>
+ <module name="TreeWalker">
+ <property name="fileExtensions" value="java,js"/>
+ <module name="FileContentsHolder"/>
+ <module name="JavadocMethod">
+ <property name="suppressLoadErrors" value="true"/>
+ </module>
+ <module name="JavadocType"/>
+ <module name="JavadocVariable"/>
+ <module name="JavadocStyle"/>
+ <module name="ConstantName"/>
+ <module name="LocalFinalVariableName"/>
+ <module name="LocalVariableName"/>
+ <module name="MemberName"/>
+ <module name="MethodName"/>
+ <module name="PackageName"/>
+ <module name="ParameterName"/>
+ <module name="StaticVariableName"/>
+ <module name="TypeName"/>
+ <module name="AvoidStarImport"/>
+ <module name="IllegalImport"/>
+ <module name="RedundantImport"/>
+ <module name="UnusedImports"/>
+ <module name="MethodLength">
+ <property name="max" value="250"/>
+ </module>
+ <module name="ParameterNumber">
+ <property name="max" value="8"/>
+ </module>
+ <module name="EmptyForIteratorPad"/>
+ <module name="MethodParamPad">
+ <property name="option" value="space"/>
+ </module>
+ <module name="NoWhitespaceAfter"/>
+ <module name="NoWhitespaceBefore"/>
+ <module name="OperatorWrap"/>
+ <module name="ParenPad"/>
+ <module name="TypecastParenPad"/>
+ <module name="WhitespaceAfter"/>
+ <module name="WhitespaceAround"/>
+ <module name="ModifierOrder"/>
+ <module name="RedundantModifier"/>
+ <module name="AvoidNestedBlocks"/>
+ <module name="EmptyBlock"/>
+ <module name="LeftCurly"/>
+ <module name="NeedBraces"/>
+ <module name="RightCurly"/>
+ <!-- <module name="DoubleCheckedLocking"/> -->
+ <module name="EmptyStatement"/>
+ <module name="EqualsHashCode"/>
+ <module name="HiddenField"/>
+ <module name="IllegalInstantiation"/>
+ <module name="InnerAssignment"/>
+ <module name="MissingSwitchDefault"/>
+ <module name="RedundantThrows">
+ <property name="suppressLoadErrors" value="true"/>
+ </module>
+ <module name="SimplifyBooleanExpression"/>
+ <module name="SimplifyBooleanReturn"/>
+ <module name="DesignForExtension"/>
+ <module name="FinalClass"/>
+ <module name="HideUtilityClassConstructor"/>
+ <module name="InterfaceIsType"/>
+ <module name="VisibilityModifier"/>
+ <module name="ArrayTypeStyle"/>
+ <module name="FinalParameters"/>
+ <module name="UpperEll"/>
+ <module name="TodoComment"/>
+ </module>
+ <module name="JavadocPackage"/>
+ <module name="NewlineAtEndOfFile">
+ <property name="fileExtensions" value="java,js"/>
+ </module>
+ <module name="Translation"/>
+ <module name="FileLength">
+ <property name="max" value="5000"/>
+ </module>
+ <module name="FileTabCharacter"/>
+ <module name="RegexpSingleline">
+ <property name="format" value="\s+$"/>
+ <property name="message" value="Line has trailing spaces."/>
+ </module>
+ <module name="SuppressionCommentFilter">
+ <property name="offCommentFormat" value="CHECKSTYLE_LEGACY_CODE_OFF"/>
+ <property name="onCommentFormat" value="CHECKSTYLE_LEGACY_CODE_ON"/>
+ </module>
+</module>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" standalone="no"?><templates><template autoinsert="true" context="gettercomment_context" deleted="false" description="Comment for getter method" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name="gettercomment">/**
+ * @return the ${bare_field_name}
+ */</template><template autoinsert="true" context="settercomment_context" deleted="false" description="Comment for setter method" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.settercomment" name="settercomment">/**
+ * @param ${param} the ${bare_field_name} to set
+ */</template><template autoinsert="true" context="constructorcomment_context" deleted="false" description="Comment for created constructors" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name="constructorcomment">/**
+ * ${tags}
+ */</template><template autoinsert="false" context="filecomment_context" deleted="false" description="Comment for created Java files" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.filecomment" name="filecomment">/**
+ * @author ${user}
+ */</template><template autoinsert="false" context="typecomment_context" deleted="false" description="Comment for created types" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.typecomment" name="typecomment">/**
+ * @author ${user}
+ *
+ * ${tags}
+ */
+</template><template autoinsert="true" context="fieldcomment_context" deleted="false" description="Comment for fields" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name="fieldcomment">/**
+ *
+ */</template><template autoinsert="true" context="methodcomment_context" deleted="false" description="Comment for non-overriding methods" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name="methodcomment">/**
+ * ${tags}
+ */</template><template autoinsert="true" context="overridecomment_context" deleted="false" description="Comment for overriding methods" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name="overridecomment">/* (non-Javadoc)
+ * ${see_to_overridden}
+ */</template><template autoinsert="true" context="delegatecomment_context" deleted="false" description="Comment for delegate methods" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.delegatecomment" name="delegatecomment">/**
+ * ${tags}
+ * ${see_to_target}
+ */</template><template autoinsert="false" context="newtype_context" deleted="false" description="Newly created files" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.newtype" name="newtype">${package_declaration}
+
+ /*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+${typecomment}
+${type_declaration}</template><template autoinsert="true" context="classbody_context" deleted="false" description="Code in new class type bodies" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.classbody" name="classbody">
+</template><template autoinsert="true" context="interfacebody_context" deleted="false" description="Code in new interface type bodies" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name="interfacebody">
+</template><template autoinsert="true" context="enumbody_context" deleted="false" description="Code in new enum type bodies" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.enumbody" name="enumbody">
+</template><template autoinsert="true" context="annotationbody_context" deleted="false" description="Code in new annotation type bodies" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name="annotationbody">
+</template><template autoinsert="true" context="catchblock_context" deleted="false" description="Code in new catch blocks" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.catchblock" name="catchblock">// ${todo} Auto-generated catch block
+${exception_var}.printStackTrace();</template><template autoinsert="true" context="methodbody_context" deleted="false" description="Code in created method stubs" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.methodbody" name="methodbody">// ${todo} Auto-generated method stub
+${body_statement}</template><template autoinsert="true" context="constructorbody_context" deleted="false" description="Code in created constructor stubs" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name="constructorbody">${body_statement}
+// ${todo} Auto-generated constructor stub</template><template autoinsert="true" context="getterbody_context" deleted="false" description="Code in created getters" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.getterbody" name="getterbody">return ${field};</template><template autoinsert="true" context="setterbody_context" deleted="false" description="Code in created setters" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.setterbody" name="setterbody">${field} = ${param};</template></templates>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<profiles version="12">
+<profile kind="CodeFormatterProfile" name="ONAP Java Rule" version="12">
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_ellipsis" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_for_statment" value="common_lines"/>
+<setting id="org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_method_invocation" value="common_lines"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.blank_lines_after_imports" value="1"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_switch_statement" value="common_lines"/>
+<setting id="org.eclipse.jdt.core.formatter.comment.format_javadoc_comments" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.indentation.size" value="2"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_enum_constant_declaration" value="common_lines"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.disabling_tag" value="@formatter:off"/>
+<setting id="org.eclipse.jdt.core.formatter.continuation_indentation" value="2"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_enum_constants" value="0"/>
+<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_imports" value="0"/>
+<setting id="org.eclipse.jdt.core.formatter.blank_lines_after_package" value="1"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_binary_operator" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_if_while_statement" value="common_lines"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant" value="16"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.comment.indent_root_tags" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.enabling_tag" value="@formatter:on"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration" value="16"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line" value="false"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations" value="2"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_parameterized_type_references" value="0"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_enum_constant" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column" value="false"/>
+<setting id="org.eclipse.jdt.core.compiler.problem.enumIdentifier" value="error"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.indent_statements_compare_to_block" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration" value="end_of_line"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.comment.line_length" value="120"/>
+<setting id="org.eclipse.jdt.core.formatter.use_on_off_tags" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments" value="false"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.brace_position_for_method_declaration" value="end_of_line"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch" value="16"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body" value="0"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line" value="false"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_binary_expression" value="16"/>
+<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_catch_clause" value="common_lines"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call" value="16"/>
+<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.brace_position_for_block" value="end_of_line"/>
+<setting id="org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration" value="end_of_line"/>
+<setting id="org.eclipse.jdt.core.formatter.brace_position_for_lambda_body" value="end_of_line"/>
+<setting id="org.eclipse.jdt.core.formatter.compact_else_if" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line" value="false"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration" value="16"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_type_parameters" value="0"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation" value="16"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration" value="16"/>
+<setting id="org.eclipse.jdt.core.compiler.problem.assertIdentifier" value="error"/>
+<setting id="org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment" value="false"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment" value="false"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_binary_operator" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_unary_operator" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer" value="16"/>
+<setting id="org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve" value="3"/>
+<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_annotation" value="common_lines"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_ellipsis" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.comment.format_line_comments" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.align_type_members_on_columns" value="false"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_assignment" value="16"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration" value="16"/>
+<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration" value="0"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_conditional_expression" value="80"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line" value="false"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration" value="end_of_line"/>
+<setting id="org.eclipse.jdt.core.formatter.brace_position_for_block_in_case" value="end_of_line"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.comment.format_header" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression" value="16"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while" value="insert"/>
+<setting id="org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode" value="enabled"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_method_declaration" value="0"/>
+<setting id="org.eclipse.jdt.core.formatter.join_wrapped_lines" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.wrap_before_conditional_operator" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.align_fields_grouping_blank_lines" value="2147483647"/>
+<setting id="org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration" value="end_of_line"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_resources_in_try" value="80"/>
+<setting id="org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations" value="false"/>
+<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_try_clause" value="common_lines"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation" value="16"/>
+<setting id="org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column" value="false"/>
+<setting id="org.eclipse.jdt.core.compiler.source" value="1.8"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.tabulation.size" value="4"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.comment.format_source_code" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_field" value="0"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer" value="2"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_method" value="1"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration" value="16"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration" value="16"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.wrap_before_assignment_operator" value="false"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.compiler.codegen.targetPlatform" value="1.8"/>
+<setting id="org.eclipse.jdt.core.formatter.brace_position_for_switch" value="end_of_line"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_type_annotation" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.comment.format_html" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_method_delcaration" value="common_lines"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_compact_if" value="16"/>
+<setting id="org.eclipse.jdt.core.formatter.indent_empty_lines" value="false"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_type_arguments" value="0"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_unary_operator" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation" value="16"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line" value="false"/>
+<setting id="org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk" value="1"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_label" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_member_type" value="0"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression" value="16"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.comment.format_block_comments" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_lambda_arrow" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line" value="false"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration" value="16"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.indent_statements_compare_to_body" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_multiple_fields" value="16"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.brace_position_for_array_initializer" value="end_of_line"/>
+<setting id="org.eclipse.jdt.core.formatter.wrap_before_binary_operator" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.compiler.compliance" value="1.8"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_lambda_declaration" value="common_lines"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.brace_position_for_enum_constant" value="end_of_line"/>
+<setting id="org.eclipse.jdt.core.formatter.brace_position_for_type_declaration" value="end_of_line"/>
+<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_package" value="0"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_expressions_in_for_loop_header" value="0"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.join_lines_in_comments" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.comment.indent_parameter_description" value="false"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.tabulation.char" value="space"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.blank_lines_between_import_groups" value="0"/>
+<setting id="org.eclipse.jdt.core.formatter.lineSplit" value="120"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch" value="insert"/>
+</profile>
+</profiles>
--- /dev/null
+maxLineLength=120
+wrapLongLines=true
+tabInsteadOfSpaces=false
+tabWidth=2
+splitMultiAttrs=false
\ No newline at end of file
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.onap.so.libs</groupId>
- <artifactId>openstack-java-sdk</artifactId>
- <version>1.4.0-SNAPSHOT</version>
- </parent>
- <groupId>org.onap.so.libs.openstack-java-sdk</groupId>
- <artifactId>quantum-client</artifactId>
- <name>OpenStack Quantum Client</name>
- <description>OpenStack Quantum Client</description>
- <dependencies>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.11</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.onap.so.libs.openstack-java-sdk</groupId>
- <artifactId>openstack-client</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.onap.so.libs.openstack-java-sdk</groupId>
- <artifactId>quantum-model</artifactId>
- <version>${project.version}</version>
- </dependency>
- </dependencies>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.onap.so.libs</groupId>
+ <artifactId>openstack-java-sdk</artifactId>
+ <version>1.4.0-SNAPSHOT</version>
+ </parent>
+ <groupId>org.onap.so.libs.openstack-java-sdk</groupId>
+ <artifactId>quantum-client</artifactId>
+ <name>OpenStack Quantum Client</name>
+ <description>OpenStack Quantum Client</description>
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.11</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.so.libs.openstack-java-sdk</groupId>
+ <artifactId>openstack-client</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.so.libs.openstack-java-sdk</groupId>
+ <artifactId>quantum-model</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
</project>
public class Quantum extends OpenStackClient {
-
+
private final NetworksResource NETWORKS;
-
+
private final PortsResource PORTS;
-
+
private final SubnetsResource SUBNETS;
private final RoutersResource ROUTERS;
-
+
public Quantum(String endpoint, OpenStackClientConnector connector) {
super(endpoint, connector);
NETWORKS = new NetworksResource(this);
PORTS = new PortsResource(this);
SUBNETS = new SubnetsResource(this);
- ROUTERS=new RoutersResource(this);
-
+ ROUTERS = new RoutersResource(this);
+
}
-
+
public Quantum(String endpoint) {
this(endpoint, null);
}
-
+
public NetworksResource networks() {
return NETWORKS;
}
-
+
public PortsResource ports() {
return PORTS;
}
-
+
public SubnetsResource subnets() {
return SUBNETS;
}
- public RoutersResource routers()
- {
+
+ public RoutersResource routers() {
return ROUTERS;
}
-
+
}
return new Update(net);
}
- public Delete delete(String netId){
+ public Delete delete(String netId) {
return new Delete(netId);
}
- public Show show(String netId){
+ public Show show(String netId) {
return new Show(netId);
}
public class Query extends OpenStackRequest<Networks> {
public Query(Network network) {
-
+
}
}
public class Delete extends OpenStackRequest<Void> {
- public Delete(String id){
+ public Delete(String id) {
super(CLIENT, HttpMethod.DELETE, buildPath("networks/", id), null, Void.class);
}
}
return new List();
}
- public Create create(Port port){
+ public Create create(Port port) {
return new Create(port);
}
- public Update update(Port port){
+ public Update update(Port port) {
return new Update(port);
}
- public Delete delete(String portId){
+ public Delete delete(String portId) {
return new Delete(portId);
}
- public Show show(String portId){
+ public Show show(String portId) {
return new Show(portId);
}
public class Query extends OpenStackRequest<Ports> {
- public Query(Port port) {
- }
+ public Query(Port port) {}
}
public class Create extends OpenStackRequest<Port> {
- public Create(Port port){
+ public Create(Port port) {
super(CLIENT, HttpMethod.POST, "ports", Entity.json(port), Port.class);
}
}
public class Update extends OpenStackRequest<Port> {
- public Update(Port port){
+ public Update(Port port) {
super(CLIENT, HttpMethod.PUT, buildPath("ports/", port.getId()), Entity.json(port), Port.class);
}
}
public class Delete extends OpenStackRequest<Void> {
- public Delete(String id){
+ public Delete(String id) {
super(CLIENT, HttpMethod.DELETE, buildPath("ports/", id), null, Void.class);
}
}
public class RoutersResource {
- private final OpenStackClient CLIENT;
+ private final OpenStackClient CLIENT;
- public RoutersResource(OpenStackClient client) {
- CLIENT = client;
- }
+ public RoutersResource(OpenStackClient client) {
+ CLIENT = client;
+ }
- public List list() {
- return new List();
- }
+ public List list() {
+ return new List();
+ }
- public Create create(RouterForCreate router){
- return new Create(router);
- }
+ public Create create(RouterForCreate router) {
+ return new Create(router);
+ }
- public Delete delete(String netId){
- return new Delete(netId);
- }
+ public Delete delete(String netId) {
+ return new Delete(netId);
+ }
- public Show show(String netId){
- return new Show(netId);
- }
+ public Show show(String netId) {
+ return new Show(netId);
+ }
- public class List extends OpenStackRequest<Routers> {
+ public class List extends OpenStackRequest<Routers> {
- public List() {
- super(CLIENT, HttpMethod.GET, "routers", null, Routers.class);
- }
+ public List() {
+ super(CLIENT, HttpMethod.GET, "routers", null, Routers.class);
}
+ }
- public class Query extends OpenStackRequest<Routers> {
+ public class Query extends OpenStackRequest<Routers> {
- public Query(Router router) {
- }
- }
- public class Create extends OpenStackRequest<Router> {
+ public Query(Router router) {}
+ }
+ public class Create extends OpenStackRequest<Router> {
- public Create(RouterForCreate router){
- super(CLIENT, HttpMethod.POST, "routers", Entity.json(router), Router.class);
- }
+ public Create(RouterForCreate router) {
+ super(CLIENT, HttpMethod.POST, "routers", Entity.json(router), Router.class);
}
+ }
-
- public class Show extends OpenStackRequest<Router> {
- public Show(String id) {
- super(CLIENT, HttpMethod.GET, buildPath("routers/", id), null, Router.class);
- }
+ public class Show extends OpenStackRequest<Router> {
+
+ public Show(String id) {
+ super(CLIENT, HttpMethod.GET, buildPath("routers/", id), null, Router.class);
}
+ }
- public class Delete extends OpenStackRequest<Void> {
+ public class Delete extends OpenStackRequest<Void> {
- public Delete(String id){
- super(CLIENT, HttpMethod.DELETE, buildPath("routers/", id), null, Void.class);
- }
+ public Delete(String id) {
+ super(CLIENT, HttpMethod.DELETE, buildPath("routers/", id), null, Void.class);
}
- public Attach addInterface(RouterForAddInterface interfaceToAdd){
- return new Attach(interfaceToAdd);
- }
- public class Attach extends OpenStackRequest<RouterInterface> {
+ }
- public Attach(RouterForAddInterface interfaceToAdd){
- super(CLIENT, HttpMethod.PUT, buildPath("routers/",interfaceToAdd.getRouterId(),"/add_router_interface"), Entity.json(interfaceToAdd),RouterInterface.class);
- }
-
- }
- public Detach deleteInterface(RouterForAddInterface interfaceRouter) {
- return new Detach(interfaceRouter);
+ public Attach addInterface(RouterForAddInterface interfaceToAdd) {
+ return new Attach(interfaceToAdd);
+ }
+
+ public class Attach extends OpenStackRequest<RouterInterface> {
+
+ public Attach(RouterForAddInterface interfaceToAdd) {
+ super(CLIENT, HttpMethod.PUT, buildPath("routers/", interfaceToAdd.getRouterId(), "/add_router_interface"),
+ Entity.json(interfaceToAdd), RouterInterface.class);
}
- public class Detach extends OpenStackRequest<RouterInterface> {
+ }
+
+ public Detach deleteInterface(RouterForAddInterface interfaceRouter) {
+ return new Detach(interfaceRouter);
+ }
+
+ public class Detach extends OpenStackRequest<RouterInterface> {
public Detach(RouterForAddInterface interfaceToAdd) {
- super(CLIENT, HttpMethod.PUT, buildPath("routers/",
- interfaceToAdd.getRouterId(), "/remove_router_interface"),
+ super(CLIENT, HttpMethod.PUT,
+ buildPath("routers/", interfaceToAdd.getRouterId(), "/remove_router_interface"),
Entity.json(interfaceToAdd), RouterInterface.class);
}
}
-
-
+
}
return new Update(net);
}
- public Delete delete(String netId){
+ public Delete delete(String netId) {
return new Delete(netId);
}
- public Show show(String netId){
+ public Show show(String netId) {
return new Show(netId);
}
public class Query extends OpenStackRequest<Subnets> {
- public Query(Subnet subnet) {
- }
+ public Query(Subnet subnet) {}
}
public class Delete extends OpenStackRequest<Void> {
- public Delete(String id){
+ public Delete(String id) {
super(CLIENT, HttpMethod.DELETE, buildPath("subnets/", id), null, Void.class);
}
}
import java.lang.reflect.Field;
import java.util.HashMap;
import java.util.Map;
-
import com.fasterxml.jackson.annotation.JsonProperty;
import com.woorea.openstack.base.client.OpenStackRequest;
private T query;
- protected AbsOpenStackCmd(T query)
- {
+ protected AbsOpenStackCmd(T query) {
this.setQuery(query);
}
return query;
}
- private String getFieldValue(Field field, T target)
- {
+ private String getFieldValue(Field field, T target) {
try {
field.setAccessible(true);
Object obj = field.get(target);
}
}
- private Map<String, String> getObjectParamMap(T target)
- {
+ private Map<String, String> getObjectParamMap(T target) {
Map<String, String> resultMap = new HashMap<>();
if (target == null)
return resultMap;
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.onap.so.libs</groupId>
- <artifactId>openstack-java-sdk</artifactId>
- <version>1.4.0-SNAPSHOT</version>
- </parent>
- <groupId>org.onap.so.libs.openstack-java-sdk</groupId>
- <artifactId>quantum-model</artifactId>
- <name>OpenStack Quantum Model</name>
- <description>OpenStack Quantum Model</description>
- <dependencies>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.skyscreamer</groupId>
- <artifactId>jsonassert</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.onap.so.libs</groupId>
+ <artifactId>openstack-java-sdk</artifactId>
+ <version>1.4.0-SNAPSHOT</version>
+ </parent>
+ <groupId>org.onap.so.libs.openstack-java-sdk</groupId>
+ <artifactId>quantum-model</artifactId>
+ <name>OpenStack Quantum Model</name>
+ <description>OpenStack Quantum Model</description>
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.skyscreamer</groupId>
+ <artifactId>jsonassert</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
</project>
package com.woorea.openstack.quantum.model;
import com.fasterxml.jackson.annotation.JsonProperty;
-
import java.io.Serializable;
public class GatewayInfo implements Serializable {
this.networkId = id;
}
- @Override public String toString() {
+ @Override
+ public String toString() {
return "[networkId=" + networkId + "]";
}
}
public String getDestination() {
return destination;
}
+
public void setDestination(String destination) {
this.destination = destination;
}
public String getNexthop() {
return nexthop;
}
+
public void setNexthop(String nexthop) {
this.nexthop = nexthop;
}
- @Override public String toString() {
+ @Override
+ public String toString() {
return "[destination=" + destination + ", nexthop=" + nexthop + "]";
}
}
--- /dev/null
+/*-
+ * ============LICENSE_START=======================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package com.woorea.openstack.quantum.model;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+public class Link {
+ @JsonProperty("href")
+ private String href;
+
+ @JsonProperty("rel")
+ private String rel;
+
+ public String getHref() {
+ return href;
+ }
+
+ public void setHref(String href) {
+ this.href = href;
+ }
+
+ public String getRel() {
+ return rel;
+ }
+
+ public void setRel(String rel) {
+ this.rel = rel;
+ }
+
+ @Override
+ public String toString() {
+ return "Link{" + "href='" + href + '\'' + ", rel='" + rel + '\'' + '}';
+ }
+}
*/
import java.io.Serializable;
+import java.util.Date;
import java.util.List;
-
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonRootName;
/**
- * Network Extension supporting both Provider networks and Multi-Provider networks.
- * The attributes for both of these network extensions are included.
- * It is the responsibility of users to populate only one or the other. It is
- * also critical that the Mapper is set for serialization inclusion.NON_NULL, or
- * both would be sent to Openstack which would cause an error.
+ * Network Extension supporting both Provider networks and Multi-Provider networks. The attributes for both of these
+ * network extensions are included. It is the responsibility of users to populate only one or the other. It is also
+ * critical that the Mapper is set for serialization inclusion.NON_NULL, or both would be sent to Openstack which would
+ * cause an error.
*
*/
@SuppressWarnings("serial")
@JsonIgnoreProperties(ignoreUnknown = true)
public class Network implements Serializable {
+ @JsonProperty("status")
private String status;
+ @JsonProperty("subnets")
private List<String> subnets;
+ @JsonProperty("availability_zones")
+ private List<String> availabilityZones;
+
+ @JsonProperty("availability_zone_hints")
+ private List<String> availabilityZoneHints;
+
+ @JsonProperty("name")
private String name;
@JsonProperty("admin_state_up")
private Boolean adminStateUp;
+ @JsonProperty("project_id")
+ private String projectId;
+
@JsonProperty("tenant_id")
private String tenantId;
private Integer providerSegmentationId;
@JsonProperty("router:external")
- private String routerExternal;
+ private Boolean routerExternal;
+
+ @JsonProperty("ipv6_address_scope")
+ private String ipv6AddressScope;
+
+ @JsonProperty("ipv4_address_scope")
+ private String ipv4AddressScope;
+
+ @JsonProperty("revision_number")
+ private Integer revisionNumber;
+
+ @JsonProperty("port_security_enabled")
+ private Boolean portSecurityEnabled;
+
+ @JsonProperty("mtu")
+ private Integer mtu;
private String id;
- private String shared;
-
+ @JsonProperty("shared")
+ private Boolean shared;
+
+ @JsonProperty("updated_at")
+ private Date updatedAt;
+
+ @JsonProperty("created_at")
+ private Date createdAt;
+
+ @JsonProperty("description")
+ private String description;
+
+
+
+ @JsonProperty("is_default")
+ private Boolean isDefault;
+
private List<Segment> segments;
+ @JsonProperty("tags")
+ private List<String> tags;
+
/**
* @return the status
*/
-
+
public String getStatus() {
return status;
}
/**
- * @param status
- * the status to set
+ * @param status the status to set
*/
@JsonProperty
public void setStatus(String status) {
/**
* @return the subnets
*/
-
+
public List<String> getSubnets() {
return subnets;
}
/**
- * @param subnets
- * the subnets to set
+ * @param subnets the subnets to set
*/
@JsonProperty
public void setSubnets(List<String> subnets) {
}
/**
- * @param name
- * the name to set
+ * @param name the name to set
*/
public void setName(String name) {
this.name = name;
* @deprecated
*/
@Deprecated
-
+
public String getProviderPhyNet() {
return getProviderPhysicalNetwork();
}
/**
- * @param providerPhyNet
- * the providerPhyNet to set
+ * @param providerPhyNet the providerPhyNet to set
* @deprecated
*/
@Deprecated
-
+
public void setProviderPhyNet(String providerPhyNet) {
setProviderPhysicalNetwork(providerPhyNet);
}
/**
* @return the adminStateUp
*/
-
+
public boolean isAdminStateUp() {
return adminStateUp;
}
}
/**
- * @param adminStateUp
- * the adminStateUp to set
+ * @param adminStateUp the adminStateUp to set
*/
public void setAdminStateUp(Boolean adminStateUp) {
this.adminStateUp = adminStateUp;
}
/**
- * @param tenantId
- * the tenantId to set
+ * @param tenantId the tenantId to set
*/
public void setTenantId(String tenantId) {
this.tenantId = tenantId;
* @deprecated
*/
@Deprecated
-
+
public String getNetType() {
return getProviderNetworkType();
}
/**
- * @param netType
- * the netType to set
+ * @param netType the netType to set
* @deprecated
*/
@Deprecated
-
+
public void setNetType(String netType) {
setProviderNetworkType(netType);
}
/**
* @return the routerExternal
*/
- public String getRouterExternal() {
+ public Boolean getRouterExternal() {
return routerExternal;
}
/**
- * @param routerExternal
- * the routerExternal to set
+ * @param routerExternal the routerExternal to set
*/
- public void setRouterExternal(String routerExternal) {
+ public void setRouterExternal(Boolean routerExternal) {
this.routerExternal = routerExternal;
}
/**
* @return the id
*/
-
+
public String getId() {
return id;
}
/**
- * @param id
- * the id to set
+ * @param id the id to set
*/
@JsonProperty
public void setId(String id) {
/**
* @return the shared
*/
- public String getShared() {
+ public Boolean getShared() {
return shared;
}
/**
- * @param shared
- * the shared to set
+ * @param shared the shared to set
*/
- public void setShared(String shared) {
+ public void setShared(Boolean shared) {
this.shared = shared;
}
* @deprecated
*/
@Deprecated
-
+
public String getProviderSegID() {
return getProviderSegmentationId() == null ? null : Integer.toString(getProviderSegmentationId());
}
/**
- * @param providerSegID
- * the providerSegID to set
+ * @param providerSegID the providerSegID to set
* @deprecated
*/
@Deprecated
-
+
public void setProviderSegID(String providerSegID) {
setProviderSegmentationId(providerSegID == null ? null : Integer.parseInt(providerSegID));
}
/**
* Function to detect and return the network type
*/
- public enum NetworkType { BASIC, PROVIDER, MULTI_PROVIDER };
-
-
- public NetworkType getNetworkType () {
+ public enum NetworkType {
+ BASIC, PROVIDER, MULTI_PROVIDER
+ };
+
+
+ public NetworkType getNetworkType() {
if (segments != null)
return NetworkType.MULTI_PROVIDER;
else if (providerNetworkType != null)
*/
@Override
public String toString() {
- StringBuilder buf = new StringBuilder("Network [id=" + id + ", name=" + name + ", subnets="
- + subnets + ", status=" + status + ", admin_state_up=" + adminStateUp + ", tenant_id=" +
- tenantId + ", shared=" + shared + ", router:external=" + routerExternal);
+ StringBuilder buf = new StringBuilder("Network [id=" + id + ", name=" + name + ", subnets=" + subnets
+ + ", status=" + status + ", admin_state_up=" + adminStateUp + ", tenant_id=" + tenantId + ", shared="
+ + shared + ", router:external=" + routerExternal);
if (getNetworkType() == NetworkType.PROVIDER)
- buf.append (", provider:physical_network=" + providerPhysicalNetwork +
- ", provider:network_type=" + providerNetworkType +
- ", provider:segmentation_id=" + providerSegmentationId);
+ buf.append(", provider:physical_network=" + providerPhysicalNetwork + ", provider:network_type="
+ + providerNetworkType + ", provider:segmentation_id=" + providerSegmentationId);
if (getNetworkType() == NetworkType.MULTI_PROVIDER) {
- buf.append (", segments: ");
+ buf.append(", segments: ");
for (Segment s : segments)
- buf.append (s.toString()).append(" ");
+ buf.append(s.toString()).append(" ");
}
- buf.append ("]");
+ buf.append("]");
return buf.toString();
}
}
import java.io.Serializable;
import java.util.Iterator;
import java.util.List;
-
import com.fasterxml.jackson.annotation.JsonProperty;
-public class Networks implements Iterable<Network>, Serializable{
-
+public class Networks implements Iterable<Network>, Serializable {
+
@JsonProperty("networks")
private List<Network> list;
+ @JsonProperty("networks_links")
+ private List<Link> links;
+
+ public List<Link> getLinks() {
+ return links;
+ }
+
+ public void setLinks(List<Link> links) {
+ this.links = links;
+ }
+
/**
* @return the list
*/
public Iterator<Network> iterator() {
return list.iterator();
}
-
+
}
package com.woorea.openstack.quantum.model;
import java.io.Serializable;
-
import com.fasterxml.jackson.annotation.JsonRootName;
@JsonRootName("NeutronError")
public class NeutronError implements Serializable {
private String type;
-
+
private String message;
private String detail;
-
+
/**
* @return the code
*/
return detail;
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
- return "NeutronError [type=" + type + ", title=" + detail + ", message="
- + message + "]";
+ return "NeutronError [type=" + type + ", title=" + detail + ", message=" + message + "]";
}
-
+
}
import java.io.Serializable;
-public class Pool implements Serializable{
-
+public class Pool implements Serializable {
+
private String start;
private String end;
-
+
/**
* @return the start
*/
public String getStart() {
return start;
}
+
/**
* @param start the start to set
*/
public void setStart(String start) {
this.start = start;
}
+
/**
* @return the end
*/
public String getEnd() {
return end;
}
+
/**
* @param end the end to set
*/
public void setEnd(String end) {
this.end = end;
}
-
+
@Override
public String toString() {
return "Allocation_pool [start=" + start + ", end=" + end + "]";
}
-
+
}
import java.io.Serializable;
import java.util.List;
import java.util.Map;
-
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
}
/**
- * @param address
- * the address to set
+ * @param address the address to set
*/
public void setAddress(String address) {
this.address = address;
}
/**
- * @param subnetId
- * the subnetId to set
+ * @param subnetId the subnetId to set
*/
public void setSubnetId(String subnetId) {
this.subnetId = subnetId;
@Override
public String toString() {
- return "Binding [hostId=" + hostId
- + ", vifType=" + vifType +
- ", vnicType=" + vnicType +
- ", vifDetails=" + vifDetails +
- ", profile=" + profile + "]";
+ return "Binding [hostId=" + hostId + ", vifType=" + vifType + ", vnicType=" + vnicType + ", vifDetails="
+ + vifDetails + ", profile=" + profile + "]";
}
}
private List<String> securityGroups;
@JsonUnwrapped
- private Binding binding;
+ private Binding binding;
/**
* @return the adminStateUp
}
/**
- * @param adminStateUp
- * the adminStateUp to set
+ * @param adminStateUp the adminStateUp to set
*/
public void setAdminStateUp(Boolean adminStateUp) {
this.adminStateUp = adminStateUp;
}
/**
- * @param deviceId
- * the deviceId to set
+ * @param deviceId the deviceId to set
*/
public void setDeviceId(String deviceId) {
this.deviceId = deviceId;
}
/**
- * @param deviceOwner
- * the deviceOwner to set
+ * @param deviceOwner the deviceOwner to set
*/
public void setDeviceOwner(String deviceOwner) {
this.deviceOwner = deviceOwner;
}
/**
- * @param list
- * the list to set
+ * @param list the list to set
*/
public void setList(List<Ip> list) {
this.list = list;
}
/**
- * @param id
- * the id to set
+ * @param id the id to set
*/
@JsonProperty
public void setId(String id) {
}
/**
- * @param macAddress
- * the macAddress to set
+ * @param macAddress the macAddress to set
*/
public void setMacAddress(String macAddress) {
this.macAddress = macAddress;
}
/**
- * @param name
- * the name to set
+ * @param name the name to set
*/
public void setName(String name) {
this.name = name;
}
/**
- * @param networkId
- * the networkId to set
+ * @param networkId the networkId to set
*/
public void setNetworkId(String networkId) {
this.networkId = networkId;
}
/**
- * @param status
- * the status to set
+ * @param status the status to set
*/
@JsonProperty
public void setStatus(String status) {
}
/**
- * @param tenantId
- * the tenantId to set
+ * @param tenantId the tenantId to set
*/
public void setTenantId(String tenantId) {
this.tenantId = tenantId;
}
/**
- * @param securityGroups
- * IDs of security groups to associate to the port
+ * @param securityGroups IDs of security groups to associate to the port
*/
public void setSecurityGroups(List<String> securityGroups) {
this.securityGroups = securityGroups;
}
/**
- * @param binding
- * The port bindings by which the port is bind to network on host
+ * @param binding The port bindings by which the port is bind to network on host
*/
public void setBinding(Binding binding) {
this.binding = binding;
@Override
public String toString() {
- return "Port [id=" + id + ", name=" + name + ", mac_address="
- + macAddress + ", admin_state_up=" + adminStateUp + ", device_id=" + deviceId
- + ", device_owner=" + deviceOwner + ", fixed_ips=" + list
- + ", network_id=" + networkId + ", status=" + status
- + ", tenant_id=" + tenantId
- + ", securityGroups=" + securityGroups
+ return "Port [id=" + id + ", name=" + name + ", mac_address=" + macAddress + ", admin_state_up=" + adminStateUp
+ + ", device_id=" + deviceId + ", device_owner=" + deviceOwner + ", fixed_ips=" + list + ", network_id="
+ + networkId + ", status=" + status + ", tenant_id=" + tenantId + ", securityGroups=" + securityGroups
+ ", binding=" + binding + "]";
}
-}
\ No newline at end of file
+}
import java.io.Serializable;
import java.util.Iterator;
import java.util.List;
-
import com.fasterxml.jackson.annotation.JsonProperty;
@SuppressWarnings("serial")
}
/**
- * @param list
- * the list to set
+ * @param list the list to set
*/
public void setList(List<Port> list) {
this.list = list;
package com.woorea.openstack.quantum.model;
import java.util.List;
-
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonRootName;
-
import java.io.Serializable;
@JsonRootName("router")
public String getName() {
return name;
}
+
public void setName(String name) {
this.name = name;
}
+
public List<HostRoute> getRoutes() {
return routes;
}
+
public void setRoutes(List<HostRoute> routes) {
this.routes = routes;
}
+
public String getAdminStateUp() {
return adminStateUp;
}
+
public void setAdminStateUp(String adminStateUp) {
this.adminStateUp = adminStateUp;
}
+
public String getStatus() {
return status;
}
+
public void setStatus(String status) {
this.status = status;
}
+
public GatewayInfo getExternalGatewayInfo() {
return externalGatewayInfo;
}
+
public void setExternalGatewayInfo(GatewayInfo externalGatewayInfo) {
this.externalGatewayInfo = externalGatewayInfo;
}
+
public String getTenantId() {
return tenantId;
}
+
public void setTenantId(String tenantId) {
this.tenantId = tenantId;
}
+
public String getId() {
return id;
}
+
public void setId(String id) {
this.id = id;
}
-
+
}
package com.woorea.openstack.quantum.model;
import java.io.Serializable;
-
import com.fasterxml.jackson.annotation.JsonProperty;
public class RouterForAddInterface implements Serializable {
- @JsonProperty("subnet_id")
- String subnetId;
- String routerId;
+ @JsonProperty("subnet_id")
+ String subnetId;
+ String routerId;
- public String getSubnetId() {
- return subnetId;
- }
+ public String getSubnetId() {
+ return subnetId;
+ }
- public void setSubnetId(String subnetId) {
- this.subnetId = subnetId;
- }
+ public void setSubnetId(String subnetId) {
+ this.subnetId = subnetId;
+ }
- public String getRouterId() {
- return routerId;
- }
+ public String getRouterId() {
+ return routerId;
+ }
- public void setRouterId(String routerId) {
- this.routerId = routerId;
- }
+ public void setRouterId(String routerId) {
+ this.routerId = routerId;
}
+}
package com.woorea.openstack.quantum.model;
import java.util.List;
-
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonRootName;
-
import java.io.Serializable;
@JsonRootName("router")
public String getName() {
return name;
}
+
public void setName(String name) {
this.name = name;
}
+
public List<HostRoute> getRoutes() {
return routes;
}
+
public void setRoutes(List<HostRoute> routes) {
this.routes = routes;
}
+
public String getAdminStateUp() {
return adminStateUp;
}
public void setAdminStateUp(String adminStateUp) {
this.adminStateUp = adminStateUp;
}
+
public String getStatus() {
return status;
}
+
public void setStatus(String status) {
this.status = status;
}
+
public GatewayInfo getExternalGatewayInfo() {
return externalGatewayInfo;
}
+
public void setExternalGatewayInfo(GatewayInfo externalGatewayInfo) {
this.externalGatewayInfo = externalGatewayInfo;
}
+
public String getTenantId() {
return tenantId;
}
+
public void setTenantId(String tenantId) {
this.tenantId = tenantId;
}
+
public String getId() {
return id;
}
+
public void setId(String id) {
this.id = id;
}
-
+
}
package com.woorea.openstack.quantum.model;
import java.io.Serializable;
-
import com.fasterxml.jackson.annotation.JsonProperty;
public class RouterInterface implements Serializable {
import java.io.Serializable;
import java.util.Iterator;
import java.util.List;
-
import com.fasterxml.jackson.annotation.JsonProperty;
-public class Routers implements Iterable<Router>, Serializable{
-
+public class Routers implements Iterable<Router>, Serializable {
+
@JsonProperty("routers")
private List<Router> list;
public Iterator<Router> iterator() {
return list.iterator();
}
-
+
}
package com.woorea.openstack.quantum.model;
import java.io.Serializable;
-
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
*/
@Override
public String toString() {
- return "Segment [ provider:physical_network=" + providerPhysicalNetwork +
- ", provider:network_type=" + providerNetworkType +
- ", provider:segmentation_id=" + providerSegmentationId + "]";
+ return "Segment [ provider:physical_network=" + providerPhysicalNetwork + ", provider:network_type="
+ + providerNetworkType + ", provider:segmentation_id=" + providerSegmentationId + "]";
}
-}
\ No newline at end of file
+}
package com.woorea.openstack.quantum.model;
import java.io.Serializable;
+import java.util.Date;
import java.util.List;
-
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
@JsonIgnoreProperties(ignoreUnknown = true)
public class Subnet implements Serializable {
+ @JsonProperty("name")
private String name;
@JsonProperty("enable_dhcp")
@JsonProperty("tenant_id")
private String tenantId;
+ @JsonProperty("project_id")
+ private String projectId;
+
@JsonProperty("dns_nameservers")
private List<String> dnsNames;
@JsonProperty("host_routes")
private List<String> hostRoutes;
+ @JsonProperty("service_types")
+ private List<String> serviceTypes;
+
@JsonProperty("ip_version")
private IpVersion ipversion;
+ @JsonProperty("ipv6_address_mode")
+ private String ipv6AddressMode;
+
+ @JsonProperty("ipv6_ra_mode")
+ private String ipv6RAMode;
+
@JsonProperty("gateway_ip")
private String gw;
+ @JsonProperty("cidr")
private String cidr;
+ @JsonProperty("created_at")
+ private Date createdAt;
+
+ @JsonProperty("updated_at")
+ private Date updatedAt;
+
+ @JsonProperty("id")
private String id;
public enum IpVersion implements Serializable {
- IPV4(4),
- IPV6(6);
+ IPV4(4), IPV6(6);
private int code;
IpVersion(int code) {
}
/**
- * @param name
- * the name to set
+ * @param name the name to set
*/
public void setName(String name) {
this.name = name;
/**
* @return the enableDHCP
*/
- @JsonIgnore
public boolean isEnableDHCP() {
return enableDHCP;
}
}
/**
- * @param enableDHCP
- * the enableDHCP to set
+ * @param enableDHCP the enableDHCP to set
*/
public void setEnableDHCP(Boolean enableDHCP) {
this.enableDHCP = enableDHCP;
}
/**
- * @param networkId
- * the networkId to set
+ * @param networkId the networkId to set
*/
public void setNetworkId(String networkId) {
this.networkId = networkId;
}
/**
- * @param tenantId
- * the tenantId to set
+ * @param tenantId the tenantId to set
*/
public void setTenantId(String tenantId) {
this.tenantId = tenantId;
}
/**
- * @param dnsNames
- * the dnsNames to set
+ * @param dnsNames the dnsNames to set
*/
public void setDnsNames(List<String> dnsNames) {
this.dnsNames = dnsNames;
}
/**
- * @param list
- * the list to set
+ * @param list the list to set
*/
public void setList(List<Pool> list) {
this.list = list;
}
/**
- * @param hostRoutes
- * the hostRoutes to set
+ * @param hostRoutes the hostRoutes to set
*/
public void setHostRoutes(List<String> hostRoutes) {
this.hostRoutes = hostRoutes;
}
/**
- * @param ipversion
- * the ipversion to set
+ * @param ipversion the ipversion to set
*/
public void setIpversion(IpVersion ipversion) {
this.ipversion = ipversion;
}
/**
- * @param gw
- * the gw to set
+ * @param gw the gw to set
*/
public void setGw(String gw) {
this.gw = gw;
}
/**
- * @param cidr
- * the cidr to set
+ * @param cidr the cidr to set
*/
public void setCidr(String cidr) {
this.cidr = cidr;
/**
* @return the id
*/
- @JsonIgnore
public String getId() {
return id;
}
/**
- * @param id
- * the id to set
+ * @param id the id to set
*/
@JsonProperty
public void setId(String id) {
*/
@Override
public String toString() {
- return "Subnet [id=" + id + ", name=" + name + ", network_id="
- + networkId + ", tenant_id=" + tenantId + ", allocation_pools=" + list
- + ", gateway_ip=" + gw + ", ip_version=" + ipversion
- + ", cidr=" + cidr + ", enable_dhcp=" + enableDHCP + ", dns_nameservers="
- + dnsNames + ", host_routes=" + hostRoutes + "]";
+ return "Subnet [id=" + id + ", name=" + name + ", network_id=" + networkId + ", tenant_id=" + tenantId
+ + ", allocation_pools=" + list + ", gateway_ip=" + gw + ", ip_version=" + ipversion + ", cidr=" + cidr
+ + ", enable_dhcp=" + enableDHCP + ", dns_nameservers=" + dnsNames + ", host_routes=" + hostRoutes + "]";
}
-}
\ No newline at end of file
+}
/**
* Please use {@link Subnet} directly.
+ *
* @Deprecated
*/
@SuppressWarnings("serial")
}
/**
- * @param ipVersion
- * the ipVersion to set
+ * @param ipVersion the ipVersion to set
* @deprecated
*/
@Deprecated
import java.io.Serializable;
import java.util.Iterator;
import java.util.List;
-
import com.fasterxml.jackson.annotation.JsonProperty;
public class Subnets implements Serializable, Iterable<Subnet> {
-
+
@JsonProperty("subnets")
private List<Subnet> list;
-
+
/**
* @return the list
*/
public String toString() {
return "Subnets [list=" + list + "]";
}
-
+
@Override
public Iterator<Subnet> iterator() {
return list.iterator();
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.woorea.openstack.quantum.model.Port.Binding;
-
import java.util.Map;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"binding:host_id\" : \"hostid\"," + EOL
- + " \"binding:vif_type\" : \"viftype\"," + EOL
- + " \"binding:vnic_type\" : \"vnictype\"," + EOL
- + " \"binding:vif_details\" : {" + EOL
- + " \"vifdetails-k1\" : \"vifdetails-v1\"," + EOL
- + " \"vifdetails-k2\" : \"vifdetails-v2\"" + EOL
- + " }," + EOL
- + " \"binding:profile\" : {" + EOL
- + " \"profile-k1\" : \"profile-v1\"," + EOL
- + " \"profile-k2\" : \"profile-v2\"" + EOL
- + " }" + EOL
- + "}";
+ private static final String JSON_FULL =
+ "{" + EOL + " \"binding:host_id\" : \"hostid\"," + EOL + " \"binding:vif_type\" : \"viftype\"," + EOL
+ + " \"binding:vnic_type\" : \"vnictype\"," + EOL + " \"binding:vif_details\" : {" + EOL
+ + " \"vifdetails-k1\" : \"vifdetails-v1\"," + EOL + " \"vifdetails-k2\" : \"vifdetails-v2\""
+ + EOL + " }," + EOL + " \"binding:profile\" : {" + EOL + " \"profile-k1\" : \"profile-v1\","
+ + EOL + " \"profile-k2\" : \"profile-v2\"" + EOL + " }" + EOL + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
Binding binding = objectMapper.readValue(JSON_FULL, Binding.class);
binding.toString();
-
+
String vnicType = binding.getVnicType();
Assert.assertNotNull(vnicType);
binding.setVnicType(vnicType);
-
- Map<String,Object> vifDetails = binding.getVifDetails();
+
+ Map<String, Object> vifDetails = binding.getVifDetails();
Assert.assertNotNull(vifDetails);
Assert.assertEquals(2, vifDetails.size());
binding.setVifDetails(vifDetails);
-
- Map<String,Object> profile = binding.getProfile();
+
+ Map<String, Object> profile = binding.getProfile();
Assert.assertNotNull(profile);
Assert.assertEquals(2, profile.size());
binding.setProfile(profile);
-
+
String hostId = binding.getHostId();
Assert.assertNotNull(hostId);
binding.setHostId(hostId);
-
+
String vifType = binding.getVifType();
Assert.assertNotNull(vifType);
binding.setVifType(vifType);
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"network_id\" : \"networkid\"" + EOL
- + "}";
+ private static final String JSON_FULL = "{" + EOL + " \"network_id\" : \"networkid\"" + EOL + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
GatewayInfo gatewayinfo = objectMapper.readValue(JSON_FULL, GatewayInfo.class);
gatewayinfo.toString();
-
+
String networkId = gatewayinfo.getNetworkId();
Assert.assertNotNull(networkId);
gatewayinfo.setNetworkId(networkId);
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"destination\" : \"destination\"," + EOL
- + " \"nexthop\" : \"nexthop\"" + EOL
- + "}";
+ private static final String JSON_FULL =
+ "{" + EOL + " \"destination\" : \"destination\"," + EOL + " \"nexthop\" : \"nexthop\"" + EOL + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
HostRoute hostroute = objectMapper.readValue(JSON_FULL, HostRoute.class);
hostroute.toString();
-
+
String destination = hostroute.getDestination();
Assert.assertNotNull(destination);
hostroute.setDestination(destination);
-
+
String nexthop = hostroute.getNexthop();
Assert.assertNotNull(nexthop);
hostroute.setNexthop(nexthop);
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.woorea.openstack.quantum.model.Port.Ip;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"ip_address\" : \"address\"," + EOL
- + " \"subnet_id\" : \"subnetid\"" + EOL
- + "}";
+ private static final String JSON_FULL =
+ "{" + EOL + " \"ip_address\" : \"address\"," + EOL + " \"subnet_id\" : \"subnetid\"" + EOL + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
Ip ip = objectMapper.readValue(JSON_FULL, Ip.class);
ip.toString();
-
+
String subnetId = ip.getSubnetId();
Assert.assertNotNull(subnetId);
ip.setSubnetId(subnetId);
-
+
String address = ip.getAddress();
Assert.assertNotNull(address);
ip.setAddress(address);
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.woorea.openstack.quantum.model.Subnet.IpVersion;
-
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
import org.skyscreamer.jsonassert.JSONCompareMode;
private static final String JSON_FULL = "4";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
-
import java.util.List;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"network\" : {" + EOL
- + " \"name\" : \"name\"," + EOL
- + " \"shared\" : \"shared\"," + EOL
- + " \"segments\" : [ {" + EOL
- + " \"provider:physical_network\" : \"providerphysicalnetwork\"," + EOL
- + " \"provider:network_type\" : \"providernetworktype\"," + EOL
- + " \"provider:segmentation_id\" : 92" + EOL
- + " }, {" + EOL
- + " \"provider:physical_network\" : \"providerphysicalnetwork\"," + EOL
- + " \"provider:network_type\" : \"providernetworktype\"," + EOL
- + " \"provider:segmentation_id\" : 92" + EOL
- + " } ]," + EOL
- + " \"admin_state_up\" : false," + EOL
- + " \"tenant_id\" : \"tenantid\"," + EOL
- + " \"provider:physical_network\" : \"providerphysicalnetwork\"," + EOL
- + " \"provider:network_type\" : \"providernetworktype\"," + EOL
- + " \"provider:segmentation_id\" : 92," + EOL
- + " \"router:external\" : \"routerexternal\"" + EOL
- + " }" + EOL
- + "}";
-
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(SerializationFeature.WRAP_ROOT_VALUE)
- .enable(DeserializationFeature.UNWRAP_ROOT_VALUE)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private static final String JSON_FULL = "{" + EOL + " \"network\" : {" + EOL + " \"name\" : \"name\"," + EOL
+ + " \"shared\" : true," + EOL + " \"segments\" : [ {" + EOL
+ + " \"provider:physical_network\" : \"providerphysicalnetwork\"," + EOL
+ + " \"provider:network_type\" : \"providernetworktype\"," + EOL
+ + " \"provider:segmentation_id\" : 92" + EOL + " }, {" + EOL
+ + " \"provider:physical_network\" : \"providerphysicalnetwork\"," + EOL
+ + " \"provider:network_type\" : \"providernetworktype\"," + EOL
+ + " \"provider:segmentation_id\" : 92" + EOL + " } ]," + EOL + " \"admin_state_up\" : false,"
+ + EOL + " \"tenant_id\" : \"tenantid\"," + EOL
+ + " \"provider:physical_network\" : \"providerphysicalnetwork\"," + EOL
+ + " \"provider:network_type\" : \"providernetworktype\"," + EOL
+ + " \"provider:segmentation_id\" : 92," + EOL + " \"router:external\" : true" + EOL + " }" + EOL
+ + "}";
+
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE)
+ .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
Network network = objectMapper.readValue(JSON_FULL, Network.class);
network.toString();
-
- String shared = network.getShared();
+
+ Boolean shared = network.getShared();
Assert.assertNotNull(shared);
network.setShared(shared);
-
+
String providerNetworkType = network.getProviderNetworkType();
Assert.assertNotNull(providerNetworkType);
network.setProviderNetworkType(providerNetworkType);
-
- String routerExternal = network.getRouterExternal();
+
+ Boolean routerExternal = network.getRouterExternal();
Assert.assertNotNull(routerExternal);
network.setRouterExternal(routerExternal);
-
+
Integer providerSegmentationId = network.getProviderSegmentationId();
Assert.assertNotNull(providerSegmentationId);
network.setProviderSegmentationId(providerSegmentationId);
-
+
List<Segment> segments = network.getSegments();
Assert.assertNotNull(segments);
Assert.assertEquals(2, segments.size());
network.setSegments(segments);
-
+
Boolean adminStateUp = network.getAdminStateUp();
Assert.assertNotNull(adminStateUp);
network.setAdminStateUp(adminStateUp);
-
+
String tenantId = network.getTenantId();
Assert.assertNotNull(tenantId);
network.setTenantId(tenantId);
-
+
String name = network.getName();
Assert.assertNotNull(name);
network.setName(name);
-
+
String providerPhysicalNetwork = network.getProviderPhysicalNetwork();
Assert.assertNotNull(providerPhysicalNetwork);
network.setProviderPhysicalNetwork(providerPhysicalNetwork);
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
-
import java.util.List;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"networks\" : [ {" + EOL
- + " \"name\" : \"name\"," + EOL
- + " \"shared\" : \"shared\"," + EOL
- + " \"segments\" : [ {" + EOL
- + " \"provider:physical_network\" : \"providerphysicalnetwork\"," + EOL
- + " \"provider:network_type\" : \"providernetworktype\"," + EOL
- + " \"provider:segmentation_id\" : 92" + EOL
- + " }, {" + EOL
- + " \"provider:physical_network\" : \"providerphysicalnetwork\"," + EOL
- + " \"provider:network_type\" : \"providernetworktype\"," + EOL
- + " \"provider:segmentation_id\" : 92" + EOL
- + " } ]," + EOL
- + " \"admin_state_up\" : false," + EOL
- + " \"tenant_id\" : \"tenantid\"," + EOL
- + " \"provider:physical_network\" : \"providerphysicalnetwork\"," + EOL
- + " \"provider:network_type\" : \"providernetworktype\"," + EOL
- + " \"provider:segmentation_id\" : 92," + EOL
- + " \"router:external\" : \"routerexternal\"" + EOL
- + " }, {" + EOL
- + " \"name\" : \"name\"," + EOL
- + " \"shared\" : \"shared\"," + EOL
- + " \"segments\" : [ {" + EOL
- + " \"provider:physical_network\" : \"providerphysicalnetwork\"," + EOL
- + " \"provider:network_type\" : \"providernetworktype\"," + EOL
- + " \"provider:segmentation_id\" : 92" + EOL
- + " }, {" + EOL
- + " \"provider:physical_network\" : \"providerphysicalnetwork\"," + EOL
- + " \"provider:network_type\" : \"providernetworktype\"," + EOL
- + " \"provider:segmentation_id\" : 92" + EOL
- + " } ]," + EOL
- + " \"admin_state_up\" : false," + EOL
- + " \"tenant_id\" : \"tenantid\"," + EOL
- + " \"provider:physical_network\" : \"providerphysicalnetwork\"," + EOL
- + " \"provider:network_type\" : \"providernetworktype\"," + EOL
- + " \"provider:segmentation_id\" : 92," + EOL
- + " \"router:external\" : \"routerexternal\"" + EOL
- + " } ]" + EOL
- + "}";
+ private static final String JSON_FULL = "{" + EOL + " \"networks\" : [ {" + EOL + " \"name\" : \"name\"," + EOL
+ + " \"shared\" : true," + EOL + " \"segments\" : [ {" + EOL
+ + " \"provider:physical_network\" : \"providerphysicalnetwork\"," + EOL
+ + " \"provider:network_type\" : \"providernetworktype\"," + EOL
+ + " \"provider:segmentation_id\" : 92" + EOL + " }, {" + EOL
+ + " \"provider:physical_network\" : \"providerphysicalnetwork\"," + EOL
+ + " \"provider:network_type\" : \"providernetworktype\"," + EOL
+ + " \"provider:segmentation_id\" : 92" + EOL + " } ]," + EOL + " \"admin_state_up\" : false,"
+ + EOL + " \"tenant_id\" : \"tenantid\"," + EOL
+ + " \"provider:physical_network\" : \"providerphysicalnetwork\"," + EOL
+ + " \"provider:network_type\" : \"providernetworktype\"," + EOL
+ + " \"provider:segmentation_id\" : 92," + EOL + " \"router:external\" : true " + EOL + " }, {" + EOL
+ + " \"name\" : \"name\"," + EOL + " \"shared\" : true," + EOL + " \"segments\" : [ {" + EOL
+ + " \"provider:physical_network\" : \"providerphysicalnetwork\"," + EOL
+ + " \"provider:network_type\" : \"providernetworktype\"," + EOL
+ + " \"provider:segmentation_id\" : 92" + EOL + " }, {" + EOL
+ + " \"provider:physical_network\" : \"providerphysicalnetwork\"," + EOL
+ + " \"provider:network_type\" : \"providernetworktype\"," + EOL
+ + " \"provider:segmentation_id\" : 92" + EOL + " } ]," + EOL + " \"admin_state_up\" : false,"
+ + EOL + " \"tenant_id\" : \"tenantid\"," + EOL
+ + " \"provider:physical_network\" : \"providerphysicalnetwork\"," + EOL
+ + " \"provider:network_type\" : \"providernetworktype\"," + EOL
+ + " \"provider:segmentation_id\" : 92," + EOL + " \"router:external\" : true" + EOL + " } ]" + EOL
+ + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
Networks networks = objectMapper.readValue(JSON_FULL, Networks.class);
networks.toString();
-
+
List<Network> list = networks.getList();
Assert.assertNotNull(list);
Assert.assertEquals(2, list.size());
networks.setList(list);
-
+
int cnt = 0;
- for (@SuppressWarnings("unused") Network x : networks) {
+ for (@SuppressWarnings("unused")
+ Network x : networks) {
++cnt;
}
Assert.assertEquals(2, cnt);
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"NeutronError\" : {" + EOL
- + " \"type\" : \"type\"," + EOL
- + " \"message\" : \"message\"," + EOL
- + " \"detail\" : \"detail\"" + EOL
- + " }" + EOL
- + "}";
+ private static final String JSON_FULL = "{" + EOL + " \"NeutronError\" : {" + EOL + " \"type\" : \"type\","
+ + EOL + " \"message\" : \"message\"," + EOL + " \"detail\" : \"detail\"" + EOL + " }" + EOL + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(SerializationFeature.WRAP_ROOT_VALUE)
- .enable(DeserializationFeature.UNWRAP_ROOT_VALUE)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE)
+ .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
NeutronError neutronerror = objectMapper.readValue(JSON_FULL, NeutronError.class);
neutronerror.toString();
-
+
String detail = neutronerror.getDetail();
Assert.assertNotNull(detail);
-
+
String type = neutronerror.getType();
Assert.assertNotNull(type);
-
+
String message = neutronerror.getMessage();
Assert.assertNotNull(message);
}
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"start\" : \"start\"," + EOL
- + " \"end\" : \"end\"" + EOL
- + "}";
+ private static final String JSON_FULL =
+ "{" + EOL + " \"start\" : \"start\"," + EOL + " \"end\" : \"end\"" + EOL + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
Pool pool = objectMapper.readValue(JSON_FULL, Pool.class);
pool.toString();
-
+
String start = pool.getStart();
Assert.assertNotNull(start);
pool.setStart(start);
-
+
String end = pool.getEnd();
Assert.assertNotNull(end);
pool.setEnd(end);
import com.fasterxml.jackson.databind.SerializationFeature;
import com.woorea.openstack.quantum.model.Port.Binding;
import com.woorea.openstack.quantum.model.Port.Ip;
-
import java.util.List;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"port\" : {" + EOL
- + " \"name\" : \"name\"," + EOL
- + " \"binding:host_id\" : \"hostid\"," + EOL
- + " \"binding:vif_type\" : \"viftype\"," + EOL
- + " \"binding:vnic_type\" : \"vnictype\"," + EOL
- + " \"binding:vif_details\" : {" + EOL
- + " \"vifdetails-k1\" : \"vifdetails-v1\"," + EOL
- + " \"vifdetails-k2\" : \"vifdetails-v2\"" + EOL
- + " }," + EOL
- + " \"binding:profile\" : {" + EOL
- + " \"profile-k1\" : \"profile-v1\"," + EOL
- + " \"profile-k2\" : \"profile-v2\"" + EOL
- + " }," + EOL
- + " \"admin_state_up\" : false," + EOL
- + " \"device_id\" : \"deviceid\"," + EOL
- + " \"device_owner\" : \"deviceowner\"," + EOL
- + " \"fixed_ips\" : [ {" + EOL
- + " \"ip_address\" : \"address\"," + EOL
- + " \"subnet_id\" : \"subnetid\"" + EOL
- + " }, {" + EOL
- + " \"ip_address\" : \"address\"," + EOL
- + " \"subnet_id\" : \"subnetid\"" + EOL
- + " } ]," + EOL
- + " \"mac_address\" : \"macaddress\"," + EOL
- + " \"network_id\" : \"networkid\"," + EOL
- + " \"tenant_id\" : \"tenantid\"," + EOL
- + " \"security_groups\" : [ \"securitygroups-v1\", \"securitygroups-v2\" ]" + EOL
- + " }" + EOL
- + "}";
-
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(SerializationFeature.WRAP_ROOT_VALUE)
- .enable(DeserializationFeature.UNWRAP_ROOT_VALUE)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private static final String JSON_FULL = "{" + EOL + " \"port\" : {" + EOL + " \"name\" : \"name\"," + EOL
+ + " \"binding:host_id\" : \"hostid\"," + EOL + " \"binding:vif_type\" : \"viftype\"," + EOL
+ + " \"binding:vnic_type\" : \"vnictype\"," + EOL + " \"binding:vif_details\" : {" + EOL
+ + " \"vifdetails-k1\" : \"vifdetails-v1\"," + EOL + " \"vifdetails-k2\" : \"vifdetails-v2\"" + EOL
+ + " }," + EOL + " \"binding:profile\" : {" + EOL + " \"profile-k1\" : \"profile-v1\"," + EOL
+ + " \"profile-k2\" : \"profile-v2\"" + EOL + " }," + EOL + " \"admin_state_up\" : false," + EOL
+ + " \"device_id\" : \"deviceid\"," + EOL + " \"device_owner\" : \"deviceowner\"," + EOL
+ + " \"fixed_ips\" : [ {" + EOL + " \"ip_address\" : \"address\"," + EOL
+ + " \"subnet_id\" : \"subnetid\"" + EOL + " }, {" + EOL + " \"ip_address\" : \"address\","
+ + EOL + " \"subnet_id\" : \"subnetid\"" + EOL + " } ]," + EOL
+ + " \"mac_address\" : \"macaddress\"," + EOL + " \"network_id\" : \"networkid\"," + EOL
+ + " \"tenant_id\" : \"tenantid\"," + EOL
+ + " \"security_groups\" : [ \"securitygroups-v1\", \"securitygroups-v2\" ]" + EOL + " }" + EOL + "}";
+
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE)
+ .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
Port port = objectMapper.readValue(JSON_FULL, Port.class);
port.toString();
-
+
String deviceOwner = port.getDeviceOwner();
Assert.assertNotNull(deviceOwner);
port.setDeviceOwner(deviceOwner);
-
+
Boolean adminStateUp = port.getAdminStateUp();
Assert.assertNotNull(adminStateUp);
port.setAdminStateUp(adminStateUp);
-
+
String name = port.getName();
Assert.assertNotNull(name);
port.setName(name);
-
+
String tenantId = port.getTenantId();
Assert.assertNotNull(tenantId);
port.setTenantId(tenantId);
-
+
Binding binding = port.getBinding();
Assert.assertNotNull(binding);
port.setBinding(binding);
-
+
String macAddress = port.getMacAddress();
Assert.assertNotNull(macAddress);
port.setMacAddress(macAddress);
-
+
String networkId = port.getNetworkId();
Assert.assertNotNull(networkId);
port.setNetworkId(networkId);
-
+
List<Ip> list = port.getList();
Assert.assertNotNull(list);
Assert.assertEquals(2, list.size());
port.setList(list);
-
+
List<String> securityGroups = port.getSecurityGroups();
Assert.assertNotNull(securityGroups);
Assert.assertEquals(2, securityGroups.size());
port.setSecurityGroups(securityGroups);
-
+
String deviceId = port.getDeviceId();
Assert.assertNotNull(deviceId);
port.setDeviceId(deviceId);
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
-
import java.util.List;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"ports\" : [ {" + EOL
- + " \"name\" : \"name\"," + EOL
- + " \"binding:host_id\" : \"hostid\"," + EOL
- + " \"binding:vif_type\" : \"viftype\"," + EOL
- + " \"binding:vnic_type\" : \"vnictype\"," + EOL
- + " \"binding:vif_details\" : {" + EOL
- + " \"vifdetails-k1\" : \"vifdetails-v1\"," + EOL
- + " \"vifdetails-k2\" : \"vifdetails-v2\"" + EOL
- + " }," + EOL
- + " \"binding:profile\" : {" + EOL
- + " \"profile-k1\" : \"profile-v1\"," + EOL
- + " \"profile-k2\" : \"profile-v2\"" + EOL
- + " }," + EOL
- + " \"admin_state_up\" : false," + EOL
- + " \"device_id\" : \"deviceid\"," + EOL
- + " \"device_owner\" : \"deviceowner\"," + EOL
- + " \"fixed_ips\" : [ {" + EOL
- + " \"ip_address\" : \"address\"," + EOL
- + " \"subnet_id\" : \"subnetid\"" + EOL
- + " }, {" + EOL
- + " \"ip_address\" : \"address\"," + EOL
- + " \"subnet_id\" : \"subnetid\"" + EOL
- + " } ]," + EOL
- + " \"mac_address\" : \"macaddress\"," + EOL
- + " \"network_id\" : \"networkid\"," + EOL
- + " \"tenant_id\" : \"tenantid\"," + EOL
- + " \"security_groups\" : [ \"securitygroups-v1\", \"securitygroups-v2\" ]" + EOL
- + " }, {" + EOL
- + " \"name\" : \"name\"," + EOL
- + " \"binding:host_id\" : \"hostid\"," + EOL
- + " \"binding:vif_type\" : \"viftype\"," + EOL
- + " \"binding:vnic_type\" : \"vnictype\"," + EOL
- + " \"binding:vif_details\" : {" + EOL
- + " \"vifdetails-k1\" : \"vifdetails-v1\"," + EOL
- + " \"vifdetails-k2\" : \"vifdetails-v2\"" + EOL
- + " }," + EOL
- + " \"binding:profile\" : {" + EOL
- + " \"profile-k1\" : \"profile-v1\"," + EOL
- + " \"profile-k2\" : \"profile-v2\"" + EOL
- + " }," + EOL
- + " \"admin_state_up\" : false," + EOL
- + " \"device_id\" : \"deviceid\"," + EOL
- + " \"device_owner\" : \"deviceowner\"," + EOL
- + " \"fixed_ips\" : [ {" + EOL
- + " \"ip_address\" : \"address\"," + EOL
- + " \"subnet_id\" : \"subnetid\"" + EOL
- + " }, {" + EOL
- + " \"ip_address\" : \"address\"," + EOL
- + " \"subnet_id\" : \"subnetid\"" + EOL
- + " } ]," + EOL
- + " \"mac_address\" : \"macaddress\"," + EOL
- + " \"network_id\" : \"networkid\"," + EOL
- + " \"tenant_id\" : \"tenantid\"," + EOL
- + " \"security_groups\" : [ \"securitygroups-v1\", \"securitygroups-v2\" ]" + EOL
- + " } ]" + EOL
- + "}";
+ private static final String JSON_FULL = "{" + EOL + " \"ports\" : [ {" + EOL + " \"name\" : \"name\"," + EOL
+ + " \"binding:host_id\" : \"hostid\"," + EOL + " \"binding:vif_type\" : \"viftype\"," + EOL
+ + " \"binding:vnic_type\" : \"vnictype\"," + EOL + " \"binding:vif_details\" : {" + EOL
+ + " \"vifdetails-k1\" : \"vifdetails-v1\"," + EOL + " \"vifdetails-k2\" : \"vifdetails-v2\"" + EOL
+ + " }," + EOL + " \"binding:profile\" : {" + EOL + " \"profile-k1\" : \"profile-v1\"," + EOL
+ + " \"profile-k2\" : \"profile-v2\"" + EOL + " }," + EOL + " \"admin_state_up\" : false," + EOL
+ + " \"device_id\" : \"deviceid\"," + EOL + " \"device_owner\" : \"deviceowner\"," + EOL
+ + " \"fixed_ips\" : [ {" + EOL + " \"ip_address\" : \"address\"," + EOL
+ + " \"subnet_id\" : \"subnetid\"" + EOL + " }, {" + EOL + " \"ip_address\" : \"address\","
+ + EOL + " \"subnet_id\" : \"subnetid\"" + EOL + " } ]," + EOL
+ + " \"mac_address\" : \"macaddress\"," + EOL + " \"network_id\" : \"networkid\"," + EOL
+ + " \"tenant_id\" : \"tenantid\"," + EOL
+ + " \"security_groups\" : [ \"securitygroups-v1\", \"securitygroups-v2\" ]" + EOL + " }, {" + EOL
+ + " \"name\" : \"name\"," + EOL + " \"binding:host_id\" : \"hostid\"," + EOL
+ + " \"binding:vif_type\" : \"viftype\"," + EOL + " \"binding:vnic_type\" : \"vnictype\"," + EOL
+ + " \"binding:vif_details\" : {" + EOL + " \"vifdetails-k1\" : \"vifdetails-v1\"," + EOL
+ + " \"vifdetails-k2\" : \"vifdetails-v2\"" + EOL + " }," + EOL + " \"binding:profile\" : {" + EOL
+ + " \"profile-k1\" : \"profile-v1\"," + EOL + " \"profile-k2\" : \"profile-v2\"" + EOL + " },"
+ + EOL + " \"admin_state_up\" : false," + EOL + " \"device_id\" : \"deviceid\"," + EOL
+ + " \"device_owner\" : \"deviceowner\"," + EOL + " \"fixed_ips\" : [ {" + EOL
+ + " \"ip_address\" : \"address\"," + EOL + " \"subnet_id\" : \"subnetid\"" + EOL + " }, {"
+ + EOL + " \"ip_address\" : \"address\"," + EOL + " \"subnet_id\" : \"subnetid\"" + EOL
+ + " } ]," + EOL + " \"mac_address\" : \"macaddress\"," + EOL + " \"network_id\" : \"networkid\","
+ + EOL + " \"tenant_id\" : \"tenantid\"," + EOL
+ + " \"security_groups\" : [ \"securitygroups-v1\", \"securitygroups-v2\" ]" + EOL + " } ]" + EOL + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
Ports ports = objectMapper.readValue(JSON_FULL, Ports.class);
ports.toString();
-
+
List<Port> list = ports.getList();
Assert.assertNotNull(list);
Assert.assertEquals(2, list.size());
ports.setList(list);
-
+
int cnt = 0;
- for (@SuppressWarnings("unused") Port x : ports) {
+ for (@SuppressWarnings("unused")
+ Port x : ports) {
++cnt;
}
Assert.assertEquals(2, cnt);
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"routerId\" : \"routerid\"," + EOL
- + " \"subnet_id\" : \"subnetid\"" + EOL
- + "}";
+ private static final String JSON_FULL =
+ "{" + EOL + " \"routerId\" : \"routerid\"," + EOL + " \"subnet_id\" : \"subnetid\"" + EOL + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
RouterForAddInterface routerforaddinterface = objectMapper.readValue(JSON_FULL, RouterForAddInterface.class);
routerforaddinterface.toString();
-
+
String subnetId = routerforaddinterface.getSubnetId();
Assert.assertNotNull(subnetId);
routerforaddinterface.setSubnetId(subnetId);
-
+
String routerId = routerforaddinterface.getRouterId();
Assert.assertNotNull(routerId);
routerforaddinterface.setRouterId(routerId);
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
-
import java.util.List;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"router\" : {" + EOL
- + " \"name\" : \"name\"," + EOL
- + " \"routes\" : [ {" + EOL
- + " \"destination\" : \"destination\"," + EOL
- + " \"nexthop\" : \"nexthop\"" + EOL
- + " }, {" + EOL
- + " \"destination\" : \"destination\"," + EOL
- + " \"nexthop\" : \"nexthop\"" + EOL
- + " } ]," + EOL
- + " \"admin_state_up\" : \"admin_state_up\"," + EOL
- + " \"status\" : \"status\"," + EOL
- + " \"id\" : \"id\"," + EOL
- + " \"external_gateway_info\" : {" + EOL
- + " \"network_id\" : \"networkid\"" + EOL
- + " }," + EOL
- + " \"tenant_id\" : \"tenantid\"" + EOL
- + " }" + EOL
- + "}";
+ private static final String JSON_FULL = "{" + EOL + " \"router\" : {" + EOL + " \"name\" : \"name\"," + EOL
+ + " \"routes\" : [ {" + EOL + " \"destination\" : \"destination\"," + EOL
+ + " \"nexthop\" : \"nexthop\"" + EOL + " }, {" + EOL + " \"destination\" : \"destination\","
+ + EOL + " \"nexthop\" : \"nexthop\"" + EOL + " } ]," + EOL
+ + " \"admin_state_up\" : \"admin_state_up\"," + EOL + " \"status\" : \"status\"," + EOL
+ + " \"id\" : \"id\"," + EOL + " \"external_gateway_info\" : {" + EOL
+ + " \"network_id\" : \"networkid\"" + EOL + " }," + EOL + " \"tenant_id\" : \"tenantid\"" + EOL
+ + " }" + EOL + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(SerializationFeature.WRAP_ROOT_VALUE)
- .enable(DeserializationFeature.UNWRAP_ROOT_VALUE)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE)
+ .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
RouterForCreate routerforcreate = objectMapper.readValue(JSON_FULL, RouterForCreate.class);
routerforcreate.toString();
-
+
List<HostRoute> routes = routerforcreate.getRoutes();
Assert.assertNotNull(routes);
Assert.assertEquals(2, routes.size());
routerforcreate.setRoutes(routes);
-
+
String admin_state_up = routerforcreate.getAdminStateUp();
Assert.assertNotNull(admin_state_up);
routerforcreate.setAdminStateUp(admin_state_up);
-
+
String name = routerforcreate.getName();
Assert.assertNotNull(name);
routerforcreate.setName(name);
-
+
String tenantId = routerforcreate.getTenantId();
Assert.assertNotNull(tenantId);
routerforcreate.setTenantId(tenantId);
-
+
GatewayInfo externalGatewayInfo = routerforcreate.getExternalGatewayInfo();
Assert.assertNotNull(externalGatewayInfo);
routerforcreate.setExternalGatewayInfo(externalGatewayInfo);
-
+
String id = routerforcreate.getId();
Assert.assertNotNull(id);
routerforcreate.setId(id);
-
+
String status = routerforcreate.getStatus();
Assert.assertNotNull(status);
routerforcreate.setStatus(status);
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
-
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
import org.skyscreamer.jsonassert.JSONCompareMode;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"id\" : \"id\"," + EOL
- + " \"subnet_id\" : \"subnetid\"," + EOL
- + " \"port_id\" : \"portid\"," + EOL
- + " \"tenant_id\" : \"tenantid\"" + EOL
- + "}";
+ private static final String JSON_FULL = "{" + EOL + " \"id\" : \"id\"," + EOL + " \"subnet_id\" : \"subnetid\","
+ + EOL + " \"port_id\" : \"portid\"," + EOL + " \"tenant_id\" : \"tenantid\"" + EOL + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
-
import java.util.List;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"router\" : {" + EOL
- + " \"status\" : \"status\"," + EOL
- + " \"name\" : \"name\"," + EOL
- + " \"admin_state_up\" : \"admin_state_up\"," + EOL
- + " \"id\" : \"id\"," + EOL
- + " \"routes\" : [ {" + EOL
- + " \"destination\" : \"destination\"," + EOL
- + " \"nexthop\" : \"nexthop\"" + EOL
- + " }, {" + EOL
- + " \"destination\" : \"destination\"," + EOL
- + " \"nexthop\" : \"nexthop\"" + EOL
- + " } ]," + EOL
- + " \"external_gateway_info\" : {" + EOL
- + " \"network_id\" : \"networkid\"" + EOL
- + " }," + EOL
- + " \"tenant_id\" : \"tenantid\"" + EOL
- + " }" + EOL
- + "}";
+ private static final String JSON_FULL = "{" + EOL + " \"router\" : {" + EOL + " \"status\" : \"status\"," + EOL
+ + " \"name\" : \"name\"," + EOL + " \"admin_state_up\" : \"admin_state_up\"," + EOL
+ + " \"id\" : \"id\"," + EOL + " \"routes\" : [ {" + EOL + " \"destination\" : \"destination\","
+ + EOL + " \"nexthop\" : \"nexthop\"" + EOL + " }, {" + EOL
+ + " \"destination\" : \"destination\"," + EOL + " \"nexthop\" : \"nexthop\"" + EOL + " } ],"
+ + EOL + " \"external_gateway_info\" : {" + EOL + " \"network_id\" : \"networkid\"" + EOL + " },"
+ + EOL + " \"tenant_id\" : \"tenantid\"" + EOL + " }" + EOL + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(SerializationFeature.WRAP_ROOT_VALUE)
- .enable(DeserializationFeature.UNWRAP_ROOT_VALUE)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE)
+ .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
Router router = objectMapper.readValue(JSON_FULL, Router.class);
router.toString();
-
+
List<HostRoute> routes = router.getRoutes();
Assert.assertNotNull(routes);
Assert.assertEquals(2, routes.size());
router.setRoutes(routes);
-
+
String admin_state_up = router.getAdminStateUp();
Assert.assertNotNull(admin_state_up);
router.setAdminStateUp(admin_state_up);
-
+
String name = router.getName();
Assert.assertNotNull(name);
router.setName(name);
-
+
String tenantId = router.getTenantId();
Assert.assertNotNull(tenantId);
router.setTenantId(tenantId);
-
+
GatewayInfo externalGatewayInfo = router.getExternalGatewayInfo();
Assert.assertNotNull(externalGatewayInfo);
router.setExternalGatewayInfo(externalGatewayInfo);
-
+
String id = router.getId();
Assert.assertNotNull(id);
router.setId(id);
-
+
String status = router.getStatus();
Assert.assertNotNull(status);
router.setStatus(status);
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
-
import java.util.List;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"routers\" : [ {" + EOL
- + " \"status\" : \"status\"," + EOL
- + " \"name\" : \"name\"," + EOL
- + " \"admin_state_up\" : \"admin_state_up\"," + EOL
- + " \"id\" : \"id\"," + EOL
- + " \"routes\" : [ {" + EOL
- + " \"destination\" : \"destination\"," + EOL
- + " \"nexthop\" : \"nexthop\"" + EOL
- + " }, {" + EOL
- + " \"destination\" : \"destination\"," + EOL
- + " \"nexthop\" : \"nexthop\"" + EOL
- + " } ]," + EOL
- + " \"external_gateway_info\" : {" + EOL
- + " \"network_id\" : \"networkid\"" + EOL
- + " }," + EOL
- + " \"tenant_id\" : \"tenantid\"" + EOL
- + " }, {" + EOL
- + " \"status\" : \"status\"," + EOL
- + " \"name\" : \"name\"," + EOL
- + " \"admin_state_up\" : \"admin_state_up\"," + EOL
- + " \"id\" : \"id\"," + EOL
- + " \"routes\" : [ {" + EOL
- + " \"destination\" : \"destination\"," + EOL
- + " \"nexthop\" : \"nexthop\"" + EOL
- + " }, {" + EOL
- + " \"destination\" : \"destination\"," + EOL
- + " \"nexthop\" : \"nexthop\"" + EOL
- + " } ]," + EOL
- + " \"external_gateway_info\" : {" + EOL
- + " \"network_id\" : \"networkid\"" + EOL
- + " }," + EOL
- + " \"tenant_id\" : \"tenantid\"" + EOL
- + " } ]" + EOL
- + "}";
+ private static final String JSON_FULL = "{" + EOL + " \"routers\" : [ {" + EOL + " \"status\" : \"status\","
+ + EOL + " \"name\" : \"name\"," + EOL + " \"admin_state_up\" : \"admin_state_up\"," + EOL
+ + " \"id\" : \"id\"," + EOL + " \"routes\" : [ {" + EOL + " \"destination\" : \"destination\","
+ + EOL + " \"nexthop\" : \"nexthop\"" + EOL + " }, {" + EOL
+ + " \"destination\" : \"destination\"," + EOL + " \"nexthop\" : \"nexthop\"" + EOL + " } ],"
+ + EOL + " \"external_gateway_info\" : {" + EOL + " \"network_id\" : \"networkid\"" + EOL + " },"
+ + EOL + " \"tenant_id\" : \"tenantid\"" + EOL + " }, {" + EOL + " \"status\" : \"status\"," + EOL
+ + " \"name\" : \"name\"," + EOL + " \"admin_state_up\" : \"admin_state_up\"," + EOL
+ + " \"id\" : \"id\"," + EOL + " \"routes\" : [ {" + EOL + " \"destination\" : \"destination\","
+ + EOL + " \"nexthop\" : \"nexthop\"" + EOL + " }, {" + EOL
+ + " \"destination\" : \"destination\"," + EOL + " \"nexthop\" : \"nexthop\"" + EOL + " } ],"
+ + EOL + " \"external_gateway_info\" : {" + EOL + " \"network_id\" : \"networkid\"" + EOL + " },"
+ + EOL + " \"tenant_id\" : \"tenantid\"" + EOL + " } ]" + EOL + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
Routers routers = objectMapper.readValue(JSON_FULL, Routers.class);
routers.toString();
-
+
List<Router> list = routers.getList();
Assert.assertNotNull(list);
Assert.assertEquals(2, list.size());
routers.setList(list);
-
+
int cnt = 0;
- for (@SuppressWarnings("unused") Router x : routers) {
+ for (@SuppressWarnings("unused")
+ Router x : routers) {
++cnt;
}
Assert.assertEquals(2, cnt);
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"provider:physical_network\" : \"providerphysicalnetwork\"," + EOL
- + " \"provider:network_type\" : \"providernetworktype\"," + EOL
- + " \"provider:segmentation_id\" : 92" + EOL
- + "}";
+ private static final String JSON_FULL = "{" + EOL + " \"provider:physical_network\" : \"providerphysicalnetwork\","
+ + EOL + " \"provider:network_type\" : \"providernetworktype\"," + EOL
+ + " \"provider:segmentation_id\" : 92" + EOL + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
Segment segment = objectMapper.readValue(JSON_FULL, Segment.class);
segment.toString();
-
+
String providerNetworkType = segment.getProviderNetworkType();
Assert.assertNotNull(providerNetworkType);
segment.setProviderNetworkType(providerNetworkType);
-
+
Integer providerSegmentationId = segment.getProviderSegmentationId();
Assert.assertNotNull(providerSegmentationId);
segment.setProviderSegmentationId(providerSegmentationId);
-
+
String providerPhysicalNetwork = segment.getProviderPhysicalNetwork();
Assert.assertNotNull(providerPhysicalNetwork);
segment.setProviderPhysicalNetwork(providerPhysicalNetwork);
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.woorea.openstack.quantum.model.Subnet.IpVersion;
-
import java.util.List;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"subnet\" : {" + EOL
- + " \"name\" : \"name\"," + EOL
- + " \"cidr\" : \"cidr\"," + EOL
- + " \"enable_dhcp\" : true," + EOL
- + " \"network_id\" : \"networkid\"," + EOL
- + " \"tenant_id\" : \"tenantid\"," + EOL
- + " \"dns_nameservers\" : [ \"dnsnames-v1\", \"dnsnames-v2\" ]," + EOL
- + " \"allocation_pools\" : [ {" + EOL
- + " \"start\" : \"start\"," + EOL
- + " \"end\" : \"end\"" + EOL
- + " }, {" + EOL
- + " \"start\" : \"start\"," + EOL
- + " \"end\" : \"end\"" + EOL
- + " } ]," + EOL
- + " \"host_routes\" : [ \"hostroutes-v1\", \"hostroutes-v2\" ]," + EOL
- + " \"ip_version\" : 4," + EOL
- + " \"gateway_ip\" : \"gw\"" + EOL
- + " }" + EOL
- + "}";
-
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(SerializationFeature.WRAP_ROOT_VALUE)
- .enable(DeserializationFeature.UNWRAP_ROOT_VALUE)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private static final String JSON_FULL = "{" + EOL + " \"subnet\" : {" + EOL + " \"name\" : \"name\"," + EOL
+ + " \"cidr\" : \"cidr\"," + EOL + " \"enable_dhcp\" : true," + EOL
+ + " \"network_id\" : \"networkid\"," + EOL + " \"tenant_id\" : \"tenantid\"," + EOL
+ + " \"dns_nameservers\" : [ \"dnsnames-v1\", \"dnsnames-v2\" ]," + EOL + " \"allocation_pools\" : [ {"
+ + EOL + " \"start\" : \"start\"," + EOL + " \"end\" : \"end\"" + EOL + " }, {" + EOL
+ + " \"start\" : \"start\"," + EOL + " \"end\" : \"end\"" + EOL + " } ]," + EOL
+ + " \"host_routes\" : [ \"hostroutes-v1\", \"hostroutes-v2\" ]," + EOL + " \"ip_version\" : 4," + EOL
+ + " \"gateway_ip\" : \"gw\"" + EOL + " }" + EOL + "}";
+
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE)
+ .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
Subnet subnet = objectMapper.readValue(JSON_FULL, Subnet.class);
subnet.toString();
-
+
String gw = subnet.getGw();
Assert.assertNotNull(gw);
subnet.setGw(gw);
-
+
List<String> dnsNames = subnet.getDnsNames();
Assert.assertNotNull(dnsNames);
Assert.assertEquals(2, dnsNames.size());
subnet.setDnsNames(dnsNames);
-
+
List<String> hostRoutes = subnet.getHostRoutes();
Assert.assertNotNull(hostRoutes);
Assert.assertEquals(2, hostRoutes.size());
subnet.setHostRoutes(hostRoutes);
-
+
String name = subnet.getName();
Assert.assertNotNull(name);
subnet.setName(name);
-
+
String tenantId = subnet.getTenantId();
Assert.assertNotNull(tenantId);
subnet.setTenantId(tenantId);
-
+
String cidr = subnet.getCidr();
Assert.assertNotNull(cidr);
subnet.setCidr(cidr);
-
+
String networkId = subnet.getNetworkId();
Assert.assertNotNull(networkId);
subnet.setNetworkId(networkId);
-
+
Boolean enableDHCP = subnet.getEnableDHCP();
Assert.assertNotNull(enableDHCP);
subnet.setEnableDHCP(enableDHCP);
-
+
IpVersion ipversion = subnet.getIpversion();
Assert.assertNotNull(ipversion);
subnet.setIpversion(ipversion);
-
+
List<Pool> list = subnet.getList();
Assert.assertNotNull(list);
Assert.assertEquals(2, list.size());
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
-
import java.util.List;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"subnets\" : [ {" + EOL
- + " \"name\" : \"name\"," + EOL
- + " \"cidr\" : \"cidr\"," + EOL
- + " \"enable_dhcp\" : true," + EOL
- + " \"network_id\" : \"networkid\"," + EOL
- + " \"tenant_id\" : \"tenantid\"," + EOL
- + " \"dns_nameservers\" : [ \"dnsnames-v1\", \"dnsnames-v2\" ]," + EOL
- + " \"allocation_pools\" : [ {" + EOL
- + " \"start\" : \"start\"," + EOL
- + " \"end\" : \"end\"" + EOL
- + " }, {" + EOL
- + " \"start\" : \"start\"," + EOL
- + " \"end\" : \"end\"" + EOL
- + " } ]," + EOL
- + " \"host_routes\" : [ \"hostroutes-v1\", \"hostroutes-v2\" ]," + EOL
- + " \"ip_version\" : 4," + EOL
- + " \"gateway_ip\" : \"gw\"" + EOL
- + " }, {" + EOL
- + " \"name\" : \"name\"," + EOL
- + " \"cidr\" : \"cidr\"," + EOL
- + " \"enable_dhcp\" : true," + EOL
- + " \"network_id\" : \"networkid\"," + EOL
- + " \"tenant_id\" : \"tenantid\"," + EOL
- + " \"dns_nameservers\" : [ \"dnsnames-v1\", \"dnsnames-v2\" ]," + EOL
- + " \"allocation_pools\" : [ {" + EOL
- + " \"start\" : \"start\"," + EOL
- + " \"end\" : \"end\"" + EOL
- + " }, {" + EOL
- + " \"start\" : \"start\"," + EOL
- + " \"end\" : \"end\"" + EOL
- + " } ]," + EOL
- + " \"host_routes\" : [ \"hostroutes-v1\", \"hostroutes-v2\" ]," + EOL
- + " \"ip_version\" : 4," + EOL
- + " \"gateway_ip\" : \"gw\"" + EOL
- + " } ]" + EOL
- + "}";
+ private static final String JSON_FULL = "{" + EOL + " \"subnets\" : [ {" + EOL + " \"name\" : \"name\"," + EOL
+ + " \"cidr\" : \"cidr\"," + EOL + " \"enable_dhcp\" : true," + EOL
+ + " \"network_id\" : \"networkid\"," + EOL + " \"tenant_id\" : \"tenantid\"," + EOL
+ + " \"dns_nameservers\" : [ \"dnsnames-v1\", \"dnsnames-v2\" ]," + EOL + " \"allocation_pools\" : [ {"
+ + EOL + " \"start\" : \"start\"," + EOL + " \"end\" : \"end\"" + EOL + " }, {" + EOL
+ + " \"start\" : \"start\"," + EOL + " \"end\" : \"end\"" + EOL + " } ]," + EOL
+ + " \"host_routes\" : [ \"hostroutes-v1\", \"hostroutes-v2\" ]," + EOL + " \"ip_version\" : 4," + EOL
+ + " \"gateway_ip\" : \"gw\"" + EOL + " }, {" + EOL + " \"name\" : \"name\"," + EOL
+ + " \"cidr\" : \"cidr\"," + EOL + " \"enable_dhcp\" : true," + EOL
+ + " \"network_id\" : \"networkid\"," + EOL + " \"tenant_id\" : \"tenantid\"," + EOL
+ + " \"dns_nameservers\" : [ \"dnsnames-v1\", \"dnsnames-v2\" ]," + EOL + " \"allocation_pools\" : [ {"
+ + EOL + " \"start\" : \"start\"," + EOL + " \"end\" : \"end\"" + EOL + " }, {" + EOL
+ + " \"start\" : \"start\"," + EOL + " \"end\" : \"end\"" + EOL + " } ]," + EOL
+ + " \"host_routes\" : [ \"hostroutes-v1\", \"hostroutes-v2\" ]," + EOL + " \"ip_version\" : 4," + EOL
+ + " \"gateway_ip\" : \"gw\"" + EOL + " } ]" + EOL + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
Subnets subnets = objectMapper.readValue(JSON_FULL, Subnets.class);
subnets.toString();
-
+
List<Subnet> list = subnets.getList();
Assert.assertNotNull(list);
Assert.assertEquals(2, list.size());
subnets.setList(list);
-
+
int cnt = 0;
- for (@SuppressWarnings("unused") Subnet x : subnets) {
+ for (@SuppressWarnings("unused")
+ Subnet x : subnets) {
++cnt;
}
Assert.assertEquals(2, cnt);
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.onap.so.libs</groupId>
- <artifactId>openstack-java-sdk</artifactId>
- <version>1.4.0-SNAPSHOT</version>
- </parent>
- <groupId>org.onap.so.libs.openstack-java-sdk</groupId>
- <artifactId>swift-client</artifactId>
- <name>OpenStack Swift Client</name>
- <description>OpenStack Swift Client</description>
- <dependencies>
- <dependency>
- <groupId>org.onap.so.libs.openstack-java-sdk</groupId>
- <artifactId>openstack-client</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.onap.so.libs.openstack-java-sdk</groupId>
- <artifactId>swift-model</artifactId>
- <version>${project.version}</version>
- </dependency>
- </dependencies>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.onap.so.libs</groupId>
+ <artifactId>openstack-java-sdk</artifactId>
+ <version>1.4.0-SNAPSHOT</version>
+ </parent>
+ <groupId>org.onap.so.libs.openstack-java-sdk</groupId>
+ <artifactId>swift-client</artifactId>
+ <name>OpenStack Swift Client</name>
+ <description>OpenStack Swift Client</description>
+ <dependencies>
+ <dependency>
+ <groupId>org.onap.so.libs.openstack-java-sdk</groupId>
+ <artifactId>openstack-client</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.so.libs.openstack-java-sdk</groupId>
+ <artifactId>swift-model</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
</project>
import com.woorea.openstack.swift.api.ContainersResource;
public class Swift extends OpenStackClient {
-
+
private final AccountResource ACCOUNT;
-
+
private final ContainersResource CONTAINERS;
-
+
public Swift(String endpoint, OpenStackClientConnector connector) {
super(endpoint, connector);
CONTAINERS = new ContainersResource(this);
ACCOUNT = new AccountResource(this);
}
-
+
public Swift(String endpoint) {
this(endpoint, null);
}
-
+
public ContainersResource containers() {
return CONTAINERS;
}
-
+
public AccountResource account() {
return ACCOUNT;
}
import com.woorea.openstack.base.client.OpenStackRequest;
public class AccountResource {
-
+
private final OpenStackClient CLIENT;
-
+
public AccountResource(OpenStackClient client) {
CLIENT = client;
}
package com.woorea.openstack.swift.api;
import java.util.Map;
-
-
import com.woorea.openstack.base.client.OpenStackClient;
import com.woorea.openstack.base.client.OpenStackRequest;
import com.woorea.openstack.base.client.OpenStackResponse;
import com.woorea.openstack.swift.model.ObjectForUpload;
public class ContainerResource {
-
+
private final OpenStackClient CLIENT;
-
+
private String container;
-
+
public ContainerResource(OpenStackClient client, String container) {
CLIENT = client;
this.container = container;
}
-
+
public List list() {
return new List(container, null);
}
-
+
public CreateDirectory createDirectory(String path) {
return new CreateDirectory(container, path);
}
-
+
public Show show(String path) {
return new Show(container, path);
}
-
+
public Upload upload(ObjectForUpload objectForUpload) {
return new Upload(objectForUpload);
}
-
+
public Download download(String path) {
return new Download(container, path);
}
-
+
public Delete delete(String path) {
return new Delete(container, path);
}
-
+
public class List extends OpenStackRequest<java.util.List<Object>> {
private String containerName;
-
+
private Map<String, String> filters;
-
+
public List(String containerName, Map<String, String> filters) {
this.containerName = containerName;
this.filters = filters;
}
-
+
}
public class CreateDirectory extends OpenStackRequest<Void> {
private String container;
-
+
private String path;
-
+
public CreateDirectory(String container, String path) {
this.container = container;
this.path = path;
}
-
+
}
-
+
public class Show extends OpenStackRequest<Object> {
private String containerName;
-
+
private String objectName;
-
+
public Show(String containerName, String objectName) {
this.containerName = containerName;
this.objectName = objectName;
}
}
-
+
public class Upload extends OpenStackRequest<OpenStackResponse> {
private ObjectForUpload objectForUpload;
-
+
public Upload(ObjectForUpload objectForUpload) {
this.objectForUpload = objectForUpload;
}
}
-
+
public class Download extends OpenStackRequest<ObjectDownload> {
private String containerName;
-
+
private String objectName;
-
+
public Download(String containerName, String objectName) {
this.containerName = containerName;
this.objectName = objectName;
}
-
+
public class Delete extends OpenStackRequest<Void> {
private String containerName;
-
+
private String objectName;
-
+
public Delete(String containerName, String objectName) {
this.containerName = containerName;
this.objectName = objectName;
import com.woorea.openstack.swift.model.Container;
public class ContainersResource {
-
+
private final OpenStackClient CLIENT;
-
+
public ContainersResource(OpenStackClient client) {
CLIENT = client;
}
-
+
public List list() {
return new List();
}
-
+
public Create create(String name) {
return new Create(name);
}
-
+
public Show show(String name) {
return new Show(name);
}
-
+
public Delete delete(String name) {
return new Delete(name);
}
-
+
public ContainerResource container(String name) {
return new ContainerResource(CLIENT, name);
}
-
+
public class List extends OpenStackRequest<java.util.List<Container>> {
- public List() {
- }
+ public List() {}
}
public class Create extends OpenStackRequest<Container> {
-
+
public Create(String containerName) {
}
}
-
+
public class Show extends OpenStackRequest<Container> {
private String containerName;
-
+
public Show(String containerName) {
}
}
-
+
public class Delete extends OpenStackRequest<Void> {
private String containerName;
-
+
public Delete(String containerName) {
this.containerName = containerName;
}
}
-
+
}
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.onap.so.libs</groupId>
- <artifactId>openstack-java-sdk</artifactId>
- <version>1.4.0-SNAPSHOT</version>
- </parent>
- <groupId>org.onap.so.libs.openstack-java-sdk</groupId>
- <artifactId>swift-model</artifactId>
- <name>OpenStack Swift Model</name>
- <description>OpenStack Swift Model</description>
- <dependencies>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.skyscreamer</groupId>
- <artifactId>jsonassert</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.onap.so.libs</groupId>
+ <artifactId>openstack-java-sdk</artifactId>
+ <version>1.4.0-SNAPSHOT</version>
+ </parent>
+ <groupId>org.onap.so.libs.openstack-java-sdk</groupId>
+ <artifactId>swift-model</artifactId>
+ <name>OpenStack Swift Model</name>
+ <description>OpenStack Swift Model</description>
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.skyscreamer</groupId>
+ <artifactId>jsonassert</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
</project>
public class Account implements Serializable {
private Integer containerCount;
-
+
private Integer objectCount;
-
+
private Integer bytesUsed;
/**
this.bytesUsed = bytesUsed;
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
- return "Account [containerCount=" + containerCount + ", objectCount="
- + objectCount + ", bytesUsed=" + bytesUsed + "]";
+ return "Account [containerCount=" + containerCount + ", objectCount=" + objectCount + ", bytesUsed=" + bytesUsed
+ + "]";
}
-
+
}
package com.woorea.openstack.swift.model;
import java.io.Serializable;
-
import com.fasterxml.jackson.annotation.JsonProperty;
public class Container implements Serializable {
-
+
private String name;
-
+
@JsonProperty("count")
private Integer objectCount;
-
+
@JsonProperty("bytes")
private Long bytesUsed;
this.bytesUsed = bytesUsed;
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
- return "Container [name=" + name + ", objectCount=" + objectCount
- + ", bytesUsed=" + bytesUsed + "]";
+ return "Container [name=" + name + ", objectCount=" + objectCount + ", bytesUsed=" + bytesUsed + "]";
}
-
-
+
+
}
import java.io.Serializable;
import java.util.Calendar;
-
import com.fasterxml.jackson.annotation.JsonProperty;
public class Object implements Serializable {
-
+
private String subdir;
-
+
private String name;
-
+
private String hash;
-
+
private int bytes;
-
+
@JsonProperty("content_type")
private String contentType;
-
+
@JsonProperty("last_modified")
private Calendar lastModified;
public void setLastModified(Calendar lastModified) {
this.lastModified = lastModified;
}
-
+
}
public class ObjectDownload {
private Object object;
-
+
private InputStream inputStream;
/**
public class ObjectForUpload {
-
+
private String container;
-
+
private String name;
-
+
private Map<String, java.lang.Object> properties;
private InputStream inputStream;
* @return the properties
*/
public Map<String, java.lang.Object> getProperties() {
- if(properties == null) {
+ if (properties == null) {
properties = new HashMap<>();
}
return properties;
this.inputStream = inputStream;
}
-
+
}
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"name\" : \"name\"," + EOL
- + " \"count\" : 2," + EOL
- + " \"bytes\" : 84" + EOL
- + "}";
+ private static final String JSON_FULL =
+ "{" + EOL + " \"name\" : \"name\"," + EOL + " \"count\" : 2," + EOL + " \"bytes\" : 84" + EOL + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
public void testMethods() throws Exception {
Container container = objectMapper.readValue(JSON_FULL, Container.class);
container.toString();
-
+
Long bytesUsed = container.getBytesUsed();
Assert.assertNotNull(bytesUsed);
container.setBytesUsed(bytesUsed);
-
+
Integer objectCount = container.getObjectCount();
Assert.assertNotNull(objectCount);
container.setObjectCount(objectCount);
-
+
String name = container.getName();
Assert.assertNotNull(name);
container.setName(name);
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
-
import java.util.Calendar;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"subdir\" : \"subdir\"," + EOL
- + " \"name\" : \"name\"," + EOL
- + " \"hash\" : \"hash\"," + EOL
- + " \"bytes\" : 82," + EOL
- + " \"content_type\" : \"contenttype\"," + EOL
- + " \"last_modified\" : 1488715200000" + EOL
- + "}";
+ private static final String JSON_FULL = "{" + EOL + " \"subdir\" : \"subdir\"," + EOL + " \"name\" : \"name\","
+ + EOL + " \"hash\" : \"hash\"," + EOL + " \"bytes\" : 82," + EOL + " \"content_type\" : \"contenttype\","
+ + EOL + " \"last_modified\" : 1488715200000" + EOL + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
@Test
public void testMethods() throws Exception {
- com.woorea.openstack.swift.model.Object object = objectMapper.readValue(JSON_FULL, com.woorea.openstack.swift.model.Object.class);
+ com.woorea.openstack.swift.model.Object object =
+ objectMapper.readValue(JSON_FULL, com.woorea.openstack.swift.model.Object.class);
object.toString();
-
+
String subdir = object.getSubdir();
Assert.assertNotNull(subdir);
object.setSubdir(subdir);
-
+
Calendar lastModified = object.getLastModified();
Assert.assertNotNull(lastModified);
object.setLastModified(lastModified);
-
+
int bytes = object.getBytes();
Assert.assertNotNull(bytes);
object.setBytes(bytes);
-
+
String name = object.getName();
Assert.assertNotNull(name);
object.setName(name);
-
+
String hash = object.getHash();
Assert.assertNotNull(hash);
object.setHash(hash);
-
+
String contentType = object.getContentType();
Assert.assertNotNull(contentType);
object.setContentType(contentType);