Fix template equals assertion to consider location scope

This commit is contained in:
Reijhanniel Jearl Campos 2015-06-25 19:30:03 +08:00 committed by Ignasi Barrera
parent b7f27e7f76
commit 107c9d0d55
1 changed files with 10 additions and 2 deletions

View File

@ -18,6 +18,7 @@ package org.jclouds.compute.internal;
import static org.jclouds.compute.util.ComputeServiceUtils.getCores;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertTrue;
import java.io.IOException;
import java.util.Properties;
@ -156,7 +157,7 @@ public abstract class BaseTemplateBuilderLiveTest extends BaseComputeServiceCont
context = createView(overrides, setupModules());
assertEquals(context.getComputeService().templateBuilder().build().toString(), defaultTemplate.toString());
assertEqualsTemplate(context.getComputeService().templateBuilder().build(), defaultTemplate);
} finally {
if (context != null)
context.close();
@ -169,7 +170,7 @@ public abstract class BaseTemplateBuilderLiveTest extends BaseComputeServiceCont
context = createView(overrides, setupModules());
assertEquals(context.getComputeService().templateBuilder().build().toString(), defaultTemplate.toString());
assertEqualsTemplate(context.getComputeService().templateBuilder().build(), defaultTemplate);
} finally {
if (context != null)
context.close();
@ -214,5 +215,12 @@ public abstract class BaseTemplateBuilderLiveTest extends BaseComputeServiceCont
assertEquals(provider.getParent(), null);
assertEquals(provider.getIso3166Codes(), getIso3166Codes());
}
static void assertEqualsTemplate(Template actual, Template expected){
assertEquals(actual.getImage(), expected.getImage());
assertEquals(actual.getHardware(), expected.getHardware());
assertEquals(actual.getOptions(), expected.getOptions());
assertTrue(actual.getLocation().getScope().compareTo(expected.getLocation().getScope()) <= 0);
}
}