added exact matching to templateBuilderImpl. changed some test logic for gogrid compute service.

This commit is contained in:
Alex Yarmula 2010-03-11 12:10:53 -08:00
parent a4ba069ad7
commit 265218e82f
2 changed files with 8 additions and 11 deletions

View File

@ -128,11 +128,8 @@ public class TemplateBuilderImpl implements TemplateBuilder {
if (input.getOsDescription() == null)
returnVal = false;
else
returnVal = input.getOsDescription().contains(osDescription)
|| input.getOsDescription().matches(osDescription); /*
* note: matches()
* expects a regex!
*/
returnVal = input.getOsDescription().contains(osDescription) ||
input.getOsDescription().matches(osDescription); /* note: matches() expects a regex!*/
}
return returnVal;
}
@ -145,7 +142,8 @@ public class TemplateBuilderImpl implements TemplateBuilder {
if (input.getVersion() == null)
returnVal = false;
else
returnVal = input.getVersion().matches(imageVersion);
returnVal = input.getVersion().contains(imageVersion) ||
input.getVersion().matches(imageVersion); /* note: matches() expects a regex!*/
}
return returnVal;
}
@ -158,7 +156,8 @@ public class TemplateBuilderImpl implements TemplateBuilder {
if (input.getName() == null)
returnVal = false;
else
returnVal = input.getName().matches(imageName);
returnVal = input.getName().contains(imageName) ||
input.getName().matches(imageName); /* note: matches() expects a regex!*/
}
return returnVal;
}
@ -171,7 +170,8 @@ public class TemplateBuilderImpl implements TemplateBuilder {
if (input.getName() == null)
returnVal = false;
else
returnVal = input.getName().matches(imageDescription);
returnVal = input.getName().contains(imageDescription) ||
input.getName().matches(imageDescription); /* note: matches() expects a regex!*/
}
return returnVal;
}

View File

@ -90,13 +90,10 @@ public class GoGridComputeServiceLiveTest extends BaseComputeServiceLiveTest {
ComputeService service = context.getComputeService();
Template t = service.templateBuilder().minRam(1024).imageId("1532").build();
int originalSize = service.getNodes().size();
assertEquals(t.getImage().getId(), "1532");
service.runNodesWithTag(this.service, 1, t);
Map<String, ? extends ComputeMetadata> nodes = service.getNodes();
assertEquals(nodes.size(), originalSize + 1, "size should've been larger by 1");
ComputeMetadata node = Iterables.find(nodes.values(), new Predicate<ComputeMetadata>() {
@Override