Examples of ProfileBuilder


Examples of io.fabric8.api.ProfileBuilder

    }

    @Override
    public void setProfileFeatures(String versionId, String profileId, List<String> features) {
        Profile profile = profileService.getRequiredProfile(versionId, profileId);
        ProfileBuilder builder = ProfileBuilder.Factory.createFrom(profile);
        builder.setFeatures(features);
        profileService.updateProfile(builder.getProfile());
    }
View Full Code Here

Examples of io.fabric8.api.ProfileBuilder

                        break;
                    }
                }
                if (profile == null) {
                    String versionId = version.getId();
                    ProfileBuilder builder = ProfileBuilder.Factory.create(versionId, profileId);
                    builder.setOverrides(descriptor.getBundles());
                    profile = profileService.createProfile(builder.getProfile());
                    Profile defaultProfile = version.getRequiredProfile("default");
                    List<String> parentIds = defaultProfile.getParentIds();
                    if (!parentIds.contains(profile.getId())) {
                        parentIds.add(profile.getId());
                        builder = ProfileBuilder.Factory.createFrom(defaultProfile);
                        builder.setParents(parentIds);
                        profileService.updateProfile(builder.getProfile());
                    }
                } else {
                    LOGGER.info("The patch {} has already been applied to version {}, ignoring.", descriptor.getId(), version.getId());
                }
            }
View Full Code Here

Examples of io.fabric8.api.ProfileBuilder

        Version version = fabricService.getRequiredDefaultVersion();
        Profile hadoop = version.getRequiredProfile("hadoop");
        Map<String, Map<String, String>> configs;

        String versionId = version.getId();
        ProfileBuilder builder = ProfileBuilder.Factory.create(versionId, "hadoop-" + name);
        builder.addParent(hadoop.getId());
        configs = new HashMap<String, Map<String, String>>();
        configs.put("io.fabric8.hadoop", new HashMap<String, String>());
        configs.get("io.fabric8.hadoop").put("fs.default.name", "hdfs://${zk:" + nameNode + "/ip}:9000");
        configs.get("io.fabric8.hadoop").put("dfs.http.address", "hdfs://${zk:" + nameNode + "/ip}:9002");
        Profile cluster = profileService.createProfile(builder.setConfigurations(configs).getProfile());

        builder = ProfileBuilder.Factory.create(versionId, "hadoop-" + name + "-namenode");
        builder.addParent(cluster.getId());
        configs = new HashMap<String, Map<String, String>>();
        configs.put("io.fabric8.hadoop", new HashMap<String, String>());
        configs.get("io.fabric8.hadoop").put("nameNode", "true");
        Profile nameNodeProfile = profileService.createProfile(builder.setConfigurations(configs).getProfile());

        builder = ProfileBuilder.Factory.create(versionId, "hadoop-" + name + "-secondary-namenode");
        builder.addParent(cluster.getId());
        configs = new HashMap<String, Map<String, String>>();
        configs.put("io.fabric8.hadoop", new HashMap<String, String>());
        configs.get("io.fabric8.hadoop").put("secondaryNameNode", "true");
        Profile secondaryNameNodeProfile = profileService.createProfile(builder.setConfigurations(configs).getProfile());

        builder = ProfileBuilder.Factory.create(versionId, "hadoop-" + name + "-datanode");
        builder.addParent(cluster.getId());
        configs = new HashMap<String, Map<String, String>>();
        configs.put("io.fabric8.hadoop", new HashMap<String, String>());
        configs.get("io.fabric8.hadoop").put("dataNode", "true");
        Profile dataNodeProfile = profileService.createProfile(builder.setConfigurations(configs).getProfile());

        builder = ProfileBuilder.Factory.create(versionId, "hadoop-" + name + "-job-tracker");
        builder.addParent(cluster.getId());
        configs = new HashMap<String, Map<String, String>>();
        configs.put("io.fabric8.hadoop", new HashMap<String, String>());
        configs.get("io.fabric8.hadoop").put("jobTracker", "true");
        Profile jobTrackerProfile = profileService.createProfile(builder.setConfigurations(configs).getProfile());

        builder = ProfileBuilder.Factory.create(versionId, "hadoop-" + name + "-task-tracker");
        builder.addParent(cluster.getId());
        configs = new HashMap<String, Map<String, String>>();
        configs.put("io.fabric8.hadoop", new HashMap<String, String>());
        configs.get("io.fabric8.hadoop").put("taskTracker", "true");
        Profile taskTrackerProfile = profileService.createProfile(builder.setConfigurations(configs).getProfile());

        builder = ProfileBuilder.Factory.create(versionId, "insight-hdfs-" + name);
        builder.addParent(version.getRequiredProfile("insight-hdfs").getId());
        configs = new HashMap<String, Map<String, String>>();
        configs.put("io.fabric8.insight.elasticsearch-default", new HashMap<String, String>());
        configs.get("io.fabric8.insight.elasticsearch-default").put("gateway.hdfs.uri", "hdfs://${zk:" + nameNode + "/ip}:9000");
        Profile insightProfile = profileService.createProfile(builder.setConfigurations(configs).getProfile());

        // Name node
        Container nameNodeContainer = findContainer(containers, nameNode);
        if (nameNodeContainer == null && createChildren) {
            nameNodeContainer = createChild(nameNode);
View Full Code Here

Examples of io.fabric8.api.ProfileBuilder

    public void testProfileManager() throws Exception {
       
        ProfileManager profileManager = ProfileManagerLocator.getProfileManager();
       
        // fabric:profile-create prfA
        ProfileBuilder pbA10 = ProfileBuilder.Factory.create("1.0", "prfA")
                .addConfiguration("pidA", Collections.singletonMap("keyA", "valA"));
        Profile prfA10 = profileManager.createProfile(pbA10.getProfile());
        Assert.assertEquals("1.0", prfA10.getVersion());
        Assert.assertEquals("prfA", prfA10.getId());
        Assert.assertEquals("valA", prfA10.getConfiguration("pidA").get("keyA"));
       
        // Verify access to original profile
        profileManager.getRequiredVersion("1.0").getRequiredProfile("prfA");
       
        // fabric:version-create --parent 1.0 1.1
        Version v11 = profileManager.createVersionFrom("1.0", "1.1", null);
        Profile prfA11a = v11.getRequiredProfile("prfA");
        Assert.assertEquals("1.1", prfA11a.getVersion());
        Assert.assertEquals("prfA", prfA11a.getId());
        Assert.assertEquals("valA", prfA11a.getConfiguration("pidA").get("keyA"));
       
        // Verify access to original profile
        profileManager.getRequiredVersion("1.0").getRequiredProfile("prfA");
        profileManager.getRequiredVersion("1.1").getRequiredProfile("prfA");
       
        ProfileBuilder pbA11 = ProfileBuilder.Factory.createFrom(prfA11a)
                .addConfiguration("pidA", Collections.singletonMap("keyB", "valB"));
        Profile prfA11b = profileManager.updateProfile(pbA11.getProfile());
        Assert.assertEquals("1.1", prfA11b.getVersion());
        Assert.assertEquals("prfA", prfA11b.getId());
        Assert.assertEquals("valB", prfA11b.getConfiguration("pidA").get("keyB"));
       
        Assert.assertNotEquals(prfA11a, prfA11b);
View Full Code Here

Examples of io.fabric8.api.ProfileBuilder

    public void createProfile() {
       
        String versionId = "1.0";
        Assert.assertFalse(profileRegistry.hasProfile(versionId, "prfA"));
       
        ProfileBuilder pbuilder = ProfileBuilder.Factory.create(versionId, "prfA");
        String profileId = profileRegistry.createProfile(pbuilder.getProfile());
       
        // Profile already exists
        try {
            profileRegistry.createProfile(pbuilder.getProfile());
            Assert.fail("IllegalStateException expected");
        } catch (IllegalStateException ex) {
            Assert.assertTrue(ex.getMessage(), ex.getMessage().contains("Profile already exists: prfA"));
        }
       
View Full Code Here

Examples of io.fabric8.api.ProfileBuilder

                    // lets default to the environment from the current active
                    // set of profiles (e.g. docker or openshift)
                    environment = System.getProperty(SystemProperties.FABRIC_PROFILE_ENVIRONMENT);
                }
                Version version = getRequiredVersion(profile.getVersion());
                ProfileBuilder builder = ProfileBuilder.Factory.create(profile.getVersion(), profileId);
                builder.addOptions(new OverlayOptionsProvider(version, profile, environment));
                overlayProfile = builder.getProfile();

                // Log the overlay profile difference
                if (LOGGER.isInfoEnabled()) {
                    OverlayAudit audit = getOverlayAudit();
                    synchronized (audit) {
View Full Code Here

Examples of io.fabric8.api.ProfileBuilder

    private final Profile delegate;
   
    @ConstructorProperties({"version", "id", "fileConfigurations", "profileHash", "overlay"})
    public ProfileState(String versionId, String profileId, Map<String, Byte[]> fileConfigs, String lastModified, boolean isOverlay) {
        ProfileBuilder builder = ProfileBuilder.Factory.create(versionId, profileId);
        builder.setLastModified(lastModified).setOverlay(isOverlay);
        if (fileConfigs != null) {
            for (Entry<String, Byte[]> entry : fileConfigs.entrySet()) {
                builder.addFileConfiguration(entry.getKey(), toPrimitiveArray(entry.getValue()));
            }
        }
        delegate = builder.getProfile();
    }
View Full Code Here

Examples of io.fabric8.api.ProfileBuilder

                    profile = p;
                    break;
                }
            }
            if (profile == null) {
                ProfileBuilder builder = ProfileBuilder.Factory.create(version.getId(), profileId);
                ProfileService profileService = fabricService.adapt(ProfileService.class);
                profile = profileService.createProfile(builder.getProfile());
            }
            profiles.add(profile);
        }
        return profiles.toArray(new Profile[profiles.size()]);
    }
View Full Code Here

Examples of io.fabric8.api.ProfileBuilder

        // lets override whatever the version is set to
        profileDTO.setVersion(versionId);

        // create the profile
        ProfileBuilder builder = ProfileBuilder.Factory.create(versionId, id);
        profileDTO.populateBuilder(fabricService, profileService, builder);
        Profile profile = builder.getProfile();
        profileService.createProfile(profile);
        return Response.created(location).build();
    }
View Full Code Here

Examples of io.fabric8.api.ProfileBuilder

       
        String versionId = "1.0";
        Assert.assertFalse(profileRegistry.hasProfile(versionId, "prfA"));

        // Profile does not exist
        ProfileBuilder pbuilder = ProfileBuilder.Factory.create(versionId, "prfA");
        try {
            profileRegistry.updateProfile(pbuilder.getProfile());
            Assert.fail("IllegalStateException expected");
        } catch (IllegalStateException ex) {
            Assert.assertTrue(ex.getMessage(), ex.getMessage().contains("Profile does not exist: 1.0/prfA"));
        }
       
        String profileId = profileRegistry.createProfile(pbuilder.getProfile());
        Profile prfA = profileRegistry.getRequiredProfile(versionId, profileId);
        Assert.assertTrue(prfA.getAttributes().isEmpty());
       
        pbuilder = ProfileBuilder.Factory.createFrom(prfA).addAttribute("foo", "bar");
        profileId = profileRegistry.updateProfile(pbuilder.getProfile());
        prfA = profileRegistry.getRequiredProfile(versionId, profileId);
        Assert.assertEquals("bar", prfA.getAttributes().get("foo"));
       
        // Delete the profile again
        profileRegistry.deleteProfile(versionId, profileId);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.