OpenStack Cinder general cleanup. Prefer ByteSourcePayload.

This commit is contained in:
Jeremy Daggett 2014-08-06 11:44:13 -07:00 committed by Jeremy Daggett
parent 59462747e7
commit 23d5290526
15 changed files with 63 additions and 25 deletions

View File

@ -1 +1,18 @@
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You 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.
#
org.jclouds.openstack.cinder.v1.CinderApiMetadata

View File

@ -17,8 +17,8 @@
package org.jclouds.openstack.cinder.v1.features;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertNull;
import static org.testng.Assert.assertFalse;
import static org.testng.Assert.assertNull;
import static org.testng.Assert.assertTrue;
import java.net.URI;
@ -29,6 +29,7 @@ import javax.ws.rs.core.MediaType;
import org.jclouds.date.DateService;
import org.jclouds.date.internal.SimpleDateFormatDateService;
import org.jclouds.http.HttpResponse;
import org.jclouds.io.Payloads;
import org.jclouds.openstack.cinder.v1.domain.Snapshot;
import org.jclouds.openstack.cinder.v1.domain.Volume;
import org.jclouds.openstack.cinder.v1.internal.BaseCinderApiExpectTest;
@ -39,6 +40,7 @@ import org.testng.annotations.Test;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Iterables;
import com.google.common.io.ByteSource;
/**
* Tests SnapshotApi Guice wiring and parsing
@ -187,7 +189,9 @@ public class SnapshotApiExpectTest extends BaseCinderApiExpectTest {
.build(),
HttpResponse.builder()
.statusCode(400)
.payload("{\"badRequest\": {\"message\": \"Invalid volume: must be available\", \"code\": 400}}")
.payload(Payloads.newByteSourcePayload(ByteSource
.wrap("{\"badRequest\": {\"message\": \"Invalid volume: must be available\", \"code\": 400}}"
.getBytes())))
.build()
).getSnapshotApiForZone("RegionOne");
@ -266,7 +270,9 @@ public class SnapshotApiExpectTest extends BaseCinderApiExpectTest {
authenticatedGET().endpoint(endpoint).method("DELETE").build(),
HttpResponse.builder()
.statusCode(400)
.payload("{\"badRequest\": {\"message\": \"Invalid volume: Volume Snapshot status must be available or error\", \"code\": 400}}")
.payload(Payloads.newByteSourcePayload(ByteSource
.wrap("{\"badRequest\": {\"message\": \"Invalid volume: Volume Snapshot status must be available or error\", \"code\": 400}}"
.getBytes())))
.build()
).getSnapshotApiForZone("RegionOne");

View File

@ -1,6 +1,8 @@
{"quota_set": {
{
"quota_set": {
"gigabytes": 1000,
"volumes": 10,
"snapshots": 20,
"id": "demo"
}}
}
}

View File

@ -1 +1,8 @@
{"snapshot":{"display_name":"jclouds-test-snapshot","volume_id":"ea6f70ef-2784-40b9-9d14-d7f33c507c3f","display_description":"jclouds test snapshot","force":"true"}}
{
"snapshot": {
"display_name": "jclouds-test-snapshot",
"volume_id": "ea6f70ef-2784-40b9-9d14-d7f33c507c3f",
"display_description": "jclouds test snapshot",
"force": "true"
}
}

View File

@ -1 +1,7 @@
{"volume":{"display_name":"jclouds-test-volume","display_description":"description of test volume","size":1}}
{
"volume": {
"display_name": "jclouds-test-volume",
"display_description": "description of test volume",
"size": 1
}
}