use of io.fabric8.api.mxbean.ProfileState in project fabric8 by jboss-fuse.
the class AbstractProfileManagementTest method testCreateUpdateDeleteProfile.
@Test
public void testCreateUpdateDeleteProfile() throws Exception {
ProfileBuilder pbA10 = ProfileBuilder.Factory.create("1.0", "prfA");
pbA10.addConfiguration("pidA", Collections.singletonMap("keyA", "valA"));
ProfileState prfA = getProxy().createProfile(new ProfileState(pbA10.getProfile()));
try {
Assert.assertEquals("prfA", prfA.getId());
Assert.assertEquals("1.0", prfA.getVersion());
Assert.assertTrue(prfA.getAttributes().isEmpty());
Assert.assertEquals("valA", prfA.getConfiguration("pidA").get("keyA"));
// getProfile
Assert.assertEquals(prfA.toString(), getProxy().getProfile("1.0", "prfA").toString());
// updateProfile
prfA = getProxy().getProfile("1.0", "prfA");
pbA10 = ProfileBuilder.Factory.createFrom(prfA.toProfile());
pbA10.addConfiguration("pidB", "keyB", "valB");
prfA = getProxy().updateProfile(new ProfileState(pbA10.getProfile()));
Assert.assertEquals("prfA", prfA.getId());
Assert.assertEquals("1.0", prfA.getVersion());
Assert.assertTrue(prfA.getAttributes().isEmpty());
Assert.assertEquals("valA", prfA.getConfiguration("pidA").get("keyA"));
Assert.assertEquals("valB", prfA.getConfiguration("pidB").get("keyB"));
} finally {
getProxy().deleteProfile("1.0", "prfA", false);
}
}
Aggregations