URI is used to calculate the server image and hardware

test fixes
This commit is contained in:
Dmitri Babaev 2011-04-17 04:25:07 +04:00 committed by Dmitri Babaev
parent 3ce5c9fe2c
commit cf82aab594
4 changed files with 22 additions and 22 deletions

View File

@ -76,7 +76,7 @@ public class ServerToNodeMetadata implements Function<Server, NodeMetadata> {
@Override
public boolean apply(Image input) {
return input.getProviderId().equals(instance.getImageRef() + "");
return input.getUri().toString().equals(instance.getImageRef() + "");
}
}
@ -89,7 +89,7 @@ public class ServerToNodeMetadata implements Function<Server, NodeMetadata> {
@Override
public boolean apply(Hardware input) {
return input.getProviderId().equals(instance.getFlavorRef() + "");
return input.getUri().toString().equals(instance.getFlavorRef() + "");
}
}

View File

@ -47,6 +47,8 @@ public class _NovaClient {
} catch (RunNodesException e) {
e.printStackTrace();
}*/
//cs.destroyNode("64");
context.close();
}

View File

@ -19,6 +19,7 @@
package org.jclouds.openstack.nova.functions;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Iterables;
import com.google.inject.Guice;
import com.google.inject.Injector;
import com.google.inject.Key;
@ -27,6 +28,7 @@ import org.jclouds.http.HttpResponse;
import org.jclouds.http.functions.UnwrapOnlyJsonValue;
import org.jclouds.io.Payloads;
import org.jclouds.json.config.GsonModule;
import org.jclouds.openstack.nova.domain.Address;
import org.jclouds.openstack.nova.domain.Addresses;
import org.testng.annotations.Test;
@ -53,9 +55,13 @@ public class ParseAddressesFromJsonResponseTest {
}));
Addresses response = parser.apply(new HttpResponse(200, "ok", Payloads.newInputStreamPayload(is)));
List<String> publicAddresses = ImmutableList.of("67.23.10.132", "::babe:67.23.10.132", "67.23.10.131", "::babe:4317:0A83");
List<Address> publicAddresses = ImmutableList.copyOf(
Iterables.transform(ImmutableList.of("67.23.10.132", "::babe:67.23.10.132", "67.23.10.131", "::babe:4317:0A83"),
Address.newString2AddressFunction()));
List<String> privateAddresses = ImmutableList.of("10.176.42.16", "::babe:10.176.42.16");
List<Address> privateAddresses = ImmutableList.copyOf(
Iterables.transform(ImmutableList.of("10.176.42.16", "::babe:10.176.42.16"),
Address.newString2AddressFunction()));
assertEquals(response.getPublicAddresses(), publicAddresses);
assertEquals(response.getPrivateAddresses(), privateAddresses);

View File

@ -1,23 +1,15 @@
{
"addresses" : {
"values" : [
{
"id" : "public",
"values" : [
{"version" : 4, "addr" : "67.23.10.132"},
{"version" : 6, "addr" : "::babe:67.23.10.132"},
{"version" : 4, "addr" : "67.23.10.131"},
{"version" : 6, "addr" : "::babe:4317:0A83"}
]
},
{
"id" : "private",
"values" : [
{"version" : 4, "addr" : "10.176.42.16"},
{"version" : 6, "addr" : "::babe:10.176.42.16"}
]
}
"public" : [
{"version" : 4, "addr" : "67.23.10.132"},
{"version" : 6, "addr" : "::babe:67.23.10.132"},
{"version" : 4, "addr" : "67.23.10.131"},
{"version" : 6, "addr" : "::babe:4317:0A83"}
],
"private" : [
{"version" : 4, "addr" : "10.176.42.16"},
{"version" : 6, "addr" : "::babe:10.176.42.16"}
]
}
}
}