summaryrefslogtreecommitdiffstats
path: root/swift-model
diff options
context:
space:
mode:
Diffstat (limited to 'swift-model')
-rw-r--r--swift-model/pom.xml47
-rw-r--r--swift-model/src/main/java/com/woorea/openstack/swift/model/Account.java14
-rw-r--r--swift-model/src/main/java/com/woorea/openstack/swift/model/Container.java18
-rw-r--r--swift-model/src/main/java/com/woorea/openstack/swift/model/Object.java15
-rw-r--r--swift-model/src/main/java/com/woorea/openstack/swift/model/ObjectDownload.java2
-rw-r--r--swift-model/src/main/java/com/woorea/openstack/swift/model/ObjectForUpload.java10
-rw-r--r--swift-model/src/test/java/com/woorea/openstack/swift/model/ContainerTest.java22
-rw-r--r--swift-model/src/test/java/com/woorea/openstack/swift/model/ObjectTest.java36
8 files changed, 76 insertions, 88 deletions
diff --git a/swift-model/pom.xml b/swift-model/pom.xml
index 0229890..38708cf 100644
--- a/swift-model/pom.xml
+++ b/swift-model/pom.xml
@@ -1,24 +1,25 @@
-<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>
diff --git a/swift-model/src/main/java/com/woorea/openstack/swift/model/Account.java b/swift-model/src/main/java/com/woorea/openstack/swift/model/Account.java
index 008574e..64bc2bf 100644
--- a/swift-model/src/main/java/com/woorea/openstack/swift/model/Account.java
+++ b/swift-model/src/main/java/com/woorea/openstack/swift/model/Account.java
@@ -21,9 +21,9 @@ import java.io.Serializable;
public class Account implements Serializable {
private Integer containerCount;
-
+
private Integer objectCount;
-
+
private Integer bytesUsed;
/**
@@ -68,13 +68,15 @@ public class Account implements Serializable {
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
+ + "]";
}
-
+
}
diff --git a/swift-model/src/main/java/com/woorea/openstack/swift/model/Container.java b/swift-model/src/main/java/com/woorea/openstack/swift/model/Container.java
index 5efe9a7..5299a5f 100644
--- a/swift-model/src/main/java/com/woorea/openstack/swift/model/Container.java
+++ b/swift-model/src/main/java/com/woorea/openstack/swift/model/Container.java
@@ -17,16 +17,15 @@
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;
@@ -72,15 +71,16 @@ public class Container implements Serializable {
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 + "]";
}
-
-
+
+
}
diff --git a/swift-model/src/main/java/com/woorea/openstack/swift/model/Object.java b/swift-model/src/main/java/com/woorea/openstack/swift/model/Object.java
index cfc3eba..36d56fe 100644
--- a/swift-model/src/main/java/com/woorea/openstack/swift/model/Object.java
+++ b/swift-model/src/main/java/com/woorea/openstack/swift/model/Object.java
@@ -18,22 +18,21 @@ package com.woorea.openstack.swift.model;
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;
@@ -120,5 +119,5 @@ public class Object implements Serializable {
public void setLastModified(Calendar lastModified) {
this.lastModified = lastModified;
}
-
+
}
diff --git a/swift-model/src/main/java/com/woorea/openstack/swift/model/ObjectDownload.java b/swift-model/src/main/java/com/woorea/openstack/swift/model/ObjectDownload.java
index 269532e..f75f27e 100644
--- a/swift-model/src/main/java/com/woorea/openstack/swift/model/ObjectDownload.java
+++ b/swift-model/src/main/java/com/woorea/openstack/swift/model/ObjectDownload.java
@@ -23,7 +23,7 @@ import java.io.InputStream;
public class ObjectDownload {
private Object object;
-
+
private InputStream inputStream;
/**
diff --git a/swift-model/src/main/java/com/woorea/openstack/swift/model/ObjectForUpload.java b/swift-model/src/main/java/com/woorea/openstack/swift/model/ObjectForUpload.java
index 93c8c72..b35d14f 100644
--- a/swift-model/src/main/java/com/woorea/openstack/swift/model/ObjectForUpload.java
+++ b/swift-model/src/main/java/com/woorea/openstack/swift/model/ObjectForUpload.java
@@ -22,11 +22,11 @@ import java.util.Map;
public class ObjectForUpload {
-
+
private String container;
-
+
private String name;
-
+
private Map<String, java.lang.Object> properties;
private InputStream inputStream;
@@ -63,7 +63,7 @@ public class ObjectForUpload {
* @return the properties
*/
public Map<String, java.lang.Object> getProperties() {
- if(properties == null) {
+ if (properties == null) {
properties = new HashMap<>();
}
return properties;
@@ -83,6 +83,6 @@ public class ObjectForUpload {
this.inputStream = inputStream;
}
-
+
}
diff --git a/swift-model/src/test/java/com/woorea/openstack/swift/model/ContainerTest.java b/swift-model/src/test/java/com/woorea/openstack/swift/model/ContainerTest.java
index 41d7f6e..d75d4ea 100644
--- a/swift-model/src/test/java/com/woorea/openstack/swift/model/ContainerTest.java
+++ b/swift-model/src/test/java/com/woorea/openstack/swift/model/ContainerTest.java
@@ -24,7 +24,6 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include;
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;
@@ -34,17 +33,12 @@ public class ContainerTest {
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 {
@@ -60,15 +54,15 @@ public class ContainerTest {
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);
diff --git a/swift-model/src/test/java/com/woorea/openstack/swift/model/ObjectTest.java b/swift-model/src/test/java/com/woorea/openstack/swift/model/ObjectTest.java
index 28d909a..b3a72ca 100644
--- a/swift-model/src/test/java/com/woorea/openstack/swift/model/ObjectTest.java
+++ b/swift-model/src/test/java/com/woorea/openstack/swift/model/ObjectTest.java
@@ -24,9 +24,7 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include;
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;
@@ -36,20 +34,13 @@ public class ObjectTest {
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 {
@@ -63,29 +54,30 @@ public class ObjectTest {
@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);