Search in sources :

Example 51 with FabricService

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

the class FabricResource method setRequirements.

@POST
@Path("requirements")
public void setRequirements(FabricRequirements requirements) throws IOException {
    Objects.notNull(requirements, "requirements");
    FabricService service = getFabricService();
    Objects.notNull(service, "FabricService");
    service.setRequirements(requirements);
}
Also used : FabricService(io.fabric8.api.FabricService) Path(javax.ws.rs.Path) POST(javax.ws.rs.POST)

Example 52 with FabricService

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

the class ProfileResource method deleteProfile.

@DELETE
public void deleteProfile() {
    FabricService fabricService = getFabricService();
    Objects.notNull(fabricService, "fabricService");
    ProfileService profileService = getProfileService();
    Objects.notNull(profileService, "profileService");
    profileService.deleteProfile(fabricService, profile.getVersion(), profile.getId(), true);
}
Also used : ProfileService(io.fabric8.api.ProfileService) FabricService(io.fabric8.api.FabricService) DELETE(javax.ws.rs.DELETE)

Example 53 with FabricService

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

the class ResourceSupport method getProfileService.

protected ProfileService getProfileService() {
    FabricService fabricService = getFabricService();
    ProfileService profileService = null;
    if (fabricService != null) {
        profileService = fabricService.adapt(ProfileService.class);
    }
    return profileService;
}
Also used : ProfileService(io.fabric8.api.ProfileService) FabricService(io.fabric8.api.FabricService)

Example 54 with FabricService

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

the class CamelProfileScriptTest method testFeatures.

@Test
public void testFeatures() throws Exception {
    System.out.println(executeCommand("fabric:create -n --wait-for-provisioning"));
    // System.out.println(executeCommand("shell:info"));
    // System.out.println(executeCommand("fabric:info"));
    // System.out.println(executeCommand("fabric:profile-list"));
    ServiceProxy<FabricService> fabricProxy = ServiceProxy.createServiceProxy(bundleContext, FabricService.class);
    try {
        FabricService fabricService = fabricProxy.getService();
        Set<ContainerProxy> containers = ContainerBuilder.create(fabricProxy).withName("feature-camel").withProfiles("feature-camel").assertProvisioningResult().build();
        try {
            CuratorFramework curator = fabricService.adapt(CuratorFramework.class);
            assertProvisionedFeature(fabricService, curator, containers, "camel-script-javascript", "feature-camel", "scriptengines-javascript");
        } finally {
            ContainerBuilder.destroy(containers);
        }
    } finally {
        fabricProxy.close();
    }
}
Also used : CuratorFramework(org.apache.curator.framework.CuratorFramework) FabricService(io.fabric8.api.FabricService) ContainerProxy(io.fabric8.itests.paxexam.support.ContainerProxy) Test(org.junit.Test) FabricFeaturesTest(io.fabric8.itests.paxexam.support.FabricFeaturesTest)

Example 55 with FabricService

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

the class CamelProfileTest method testFeatures.

@Test
public void testFeatures() throws Exception {
    System.out.println(executeCommand("fabric:create -n --wait-for-provisioning"));
    // System.out.println(executeCommand("shell:info"));
    // System.out.println(executeCommand("fabric:info"));
    // System.out.println(executeCommand("fabric:profile-list"));
    ServiceProxy<FabricService> fabricProxy = ServiceProxy.createServiceProxy(bundleContext, FabricService.class);
    try {
        FabricService fabricService = fabricProxy.getService();
        Set<ContainerProxy> containers = ContainerBuilder.create(fabricProxy).withName("feature-camel").withProfiles("feature-camel").assertProvisioningResult().build();
        try {
            CuratorFramework curator = fabricService.adapt(CuratorFramework.class);
            assertProvisionedFeature(fabricService, curator, containers, "camel-http", "feature-camel", "camel-http");
            assertProvisionedFeature(fabricService, curator, containers, "camel-jetty", "feature-camel", "camel-jetty");
            assertProvisionedFeature(fabricService, curator, containers, "camel-jms", "feature-camel", "camel-jms");
            assertProvisionedFeature(fabricService, curator, containers, "camel-ftp", "feature-camel", "camel-ftp");
            assertProvisionedFeature(fabricService, curator, containers, "camel-quartz", "feature-camel", "camel-quartz");
        } finally {
            ContainerBuilder.destroy(containers);
        }
    } finally {
        fabricProxy.close();
    }
}
Also used : CuratorFramework(org.apache.curator.framework.CuratorFramework) FabricService(io.fabric8.api.FabricService) ContainerProxy(io.fabric8.itests.paxexam.support.ContainerProxy) Test(org.junit.Test) FabricFeaturesTest(io.fabric8.itests.paxexam.support.FabricFeaturesTest)

Aggregations

FabricService (io.fabric8.api.FabricService)80 Container (io.fabric8.api.Container)76 Test (org.junit.Test)52 Profile (io.fabric8.api.Profile)50 BundleContext (org.osgi.framework.BundleContext)29 Version (io.fabric8.api.Version)24 ArrayList (java.util.ArrayList)21 ProfileService (io.fabric8.api.ProfileService)19 HashMap (java.util.HashMap)16 CuratorFramework (org.apache.curator.framework.CuratorFramework)16 HashSet (java.util.HashSet)14 Map (java.util.Map)13 FabricException (io.fabric8.api.FabricException)12 IOException (java.io.IOException)12 ContainerProxy (io.fabric8.itests.paxexam.support.ContainerProxy)11 Ignore (org.junit.Ignore)10 File (java.io.File)9 LinkedList (java.util.LinkedList)9 Path (javax.ws.rs.Path)8 FabricRequirements (io.fabric8.api.FabricRequirements)7