mirror of https://github.com/apache/jclouds.git
Fix template equals assertion to consider location scope
This commit is contained in:
parent
b7f27e7f76
commit
107c9d0d55
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue