Version defaultVersion = profileRegistry.getRequiredVersion("1.0");
Assert.assertNotNull(defaultVersion);
// Version already exists
VersionBuilder vbuilder = VersionBuilder.Factory.create("1.0");
try {
profileRegistry.createVersion(vbuilder.getVersion());
Assert.fail("IllegalStateException expected");
} catch (IllegalStateException ex) {
Assert.assertTrue(ex.getMessage(), ex.getMessage().contains("Version already exists: 1.0"));
}
Assert.assertFalse(profileRegistry.hasVersion("1.1"));
Assert.assertNull(profileRegistry.getVersion("1.1"));
vbuilder = VersionBuilder.Factory.create("1.1").addAttribute("foo", "bar");
vbuilder.addProfile(ProfileBuilder.Factory.create("1.1", "prfA").getProfile());
String versionId = profileRegistry.createVersion(vbuilder.getVersion());
Assert.assertTrue(profileRegistry.hasVersion(versionId));
Assert.assertEquals("1.1", versionId);
Version version = profileRegistry.getRequiredVersion(versionId);
Assert.assertEquals("bar", version.getAttributes().get("foo"));