Search in sources :

Example 1 with VersionState

use of io.fabric8.api.mxbean.VersionState in project fabric8 by jboss-fuse.

the class AbstractProfileManagementTest method testGetVersion.

@Test
public void testGetVersion() throws Exception {
    VersionState v10 = getProxy().getVersion("1.0");
    Assert.assertEquals("1.0", v10.getId());
    Assert.assertTrue("Expected empty, but was" + v10.getAttributes(), v10.getAttributes().isEmpty());
    List<String> profiles = v10.getProfiles();
    Assert.assertTrue(profiles.contains("default"));
    Assert.assertTrue(profiles.contains("fabric"));
}
Also used : VersionState(io.fabric8.api.mxbean.VersionState) Test(org.junit.Test)

Example 2 with VersionState

use of io.fabric8.api.mxbean.VersionState in project fabric8 by jboss-fuse.

the class AbstractProfileManagementTest method testCreateVersionFrom.

@Test
public void testCreateVersionFrom() throws Exception {
    // [FABRIC-1169] Profile version attributes leak to other versions
    // VersionState v12 = getProxy().createVersion("1.0", "1.2", Collections.singletonMap("keyA", "valA"));
    VersionState v12 = getProxy().createVersionFrom("1.0", "1.2", null);
    try {
        Assert.assertEquals("1.2", v12.getId());
        // Assert.assertEquals("valA", v12.getAttributes().get("keyA"));
        List<String> profiles = v12.getProfiles();
        Assert.assertTrue(profiles.contains("default"));
        Assert.assertTrue(profiles.contains("fabric"));
    } finally {
        getProxy().deleteVersion("1.2");
    }
}
Also used : VersionState(io.fabric8.api.mxbean.VersionState) Test(org.junit.Test)

Example 3 with VersionState

use of io.fabric8.api.mxbean.VersionState in project fabric8 by jboss-fuse.

the class AbstractProfileManagementTest method testCreateVersion.

@Test
public void testCreateVersion() throws Exception {
    ProfileBuilder pbDefault = ProfileBuilder.Factory.create("1.1", "default");
    Profile prfDefault = pbDefault.addConfiguration("pidA", Collections.singletonMap("keyA", "valA")).getProfile();
    ProfileBuilder pbA11 = ProfileBuilder.Factory.create("1.1", "prfA");
    Profile prfA = pbA11.addConfiguration("pidA", Collections.singletonMap("keyA", "valA")).getProfile();
    VersionBuilder vb11 = VersionBuilder.Factory.create("1.1").addProfile(prfDefault).addProfile(prfA);
    try {
        VersionState v11 = getProxy().createVersion(new VersionState(vb11.getVersion()));
        Assert.assertEquals("1.1", v11.getId());
        Assert.assertTrue(v11.getAttributes().isEmpty());
        Assert.assertEquals("valA", v11.getProfileState("prfA").getConfiguration("pidA").get("keyA"));
    } finally {
        getProxy().deleteVersion("1.1");
    }
}
Also used : VersionBuilder(io.fabric8.api.VersionBuilder) ProfileBuilder(io.fabric8.api.ProfileBuilder) Profile(io.fabric8.api.Profile) VersionState(io.fabric8.api.mxbean.VersionState) Test(org.junit.Test)

Aggregations

VersionState (io.fabric8.api.mxbean.VersionState)3 Test (org.junit.Test)3 Profile (io.fabric8.api.Profile)1 ProfileBuilder (io.fabric8.api.ProfileBuilder)1 VersionBuilder (io.fabric8.api.VersionBuilder)1