Package io.fabric8.api

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


    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

                    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

        // 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

       
        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

    public void createProfileWithPush() throws Exception {
       
        String versionId = "1.0";
        Assert.assertFalse(profileRegistry.hasProfile(versionId, "prfA"));
       
        ProfileBuilder pbuilder = ProfileBuilder.Factory.create(versionId, "prfA");
        profileRegistry.createProfile(pbuilder.addAttribute("foo", "aaa").getProfile());
        Profile profile = profileRegistry.getRequiredProfile(versionId, "prfA");
        Assert.assertEquals("aaa", profile.getAttributes().get("foo"));

        Assert.assertTrue(remoteProfileExists(versionId, "prfA"));
       
View Full Code Here

        Assert.assertFalse(profileRegistry.hasProfile(versionId, "prfC"));
        Assert.assertFalse(profileRegistry.hasProfile(versionId, "prfD"));
       
        createProfileRemote(versionId, "prfC", null);
       
        ProfileBuilder pbuilder = ProfileBuilder.Factory.create(versionId, "prfD");
        try {
            profileRegistry.createProfile(pbuilder.getProfile());
            Assert.fail("IllegalStateException expected");
        } catch (IllegalStateException ex) {
            Assert.assertTrue(ex.getMessage(), ex.getMessage().startsWith("Push rejected"));
        }
        Assert.assertFalse(profileRegistry.hasProfile(versionId, "prfD"));
View Full Code Here

        Assert.assertFalse(profileRegistry.hasProfile(versionId, "prfF"));
       
        checkoutRequiredBranch(versionId);
        RevCommit head = CommitUtils.getHead(git.getRepository());
       
        ProfileBuilder pbuilder = ProfileBuilder.Factory.create(versionId, "prfE");
        profileRegistry.createProfile(pbuilder.getProfile());
        Assert.assertTrue(remoteProfileExists("1.0", "prfE"));

        // Remove the last commit from the remote repository
        git.reset().setMode(ResetType.HARD).setRef(head.getName()).call();
        Assert.assertFalse(remoteProfileExists("1.0", "prfE"));
View Full Code Here

        Assert.assertFalse(profileRegistry.hasProfile(versionId, "prfG"));
       
        checkoutRequiredBranch(versionId);
        RevCommit head = CommitUtils.getHead(git.getRepository());
       
        ProfileBuilder pbuilder = ProfileBuilder.Factory.create(versionId, "prfG");
        profileRegistry.createProfile(pbuilder.addAttribute("foo", "aaa").getProfile());
        Profile profile = profileRegistry.getRequiredProfile(versionId, "prfG");
        Assert.assertEquals("aaa", profile.getAttributes().get("foo"));

        // Remove the last commit from the remote repository
        git.reset().setMode(ResetType.HARD).setRef(head.getName()).call();
View Full Code Here

    int bounds = 100;
    int column = 0;
    Function1 function = new Function1() {
      @Override
      public Object apply(Object element) {
        ProfileStatus status = asProfileStatus(element);
        if (status != null) {
          return status.getProfile();
        }
        return null;
      }
    };
    column = addColumnFunction(250, column, function, "Profile");
    function = new FunctionInteger() {
      @Override
      public Integer apply(Object element) {
        ProfileStatus status = asProfileStatus(element);
        if (status != null) {
          return status.getCount();
        }
        return null;
      }
    };
    column = addColumnFunction(bounds, column, function, "Count");
    function = new FunctionInteger() {
      @Override
      public Integer apply(Object element) {
        ProfileStatus status = asProfileStatus(element);
        if (status != null) {
          return status.getMinimumInstances();
        }
        return null;
      }
    };
    column = addColumnFunction(bounds, column, function, "Minumum");
    function = new FunctionInteger() {
      @Override
      public Integer apply(Object element) {
        ProfileStatus status = asProfileStatus(element);
        if (status != null) {
          return status.getMaximumInstances();
        }
        return null;
      }
    };
    column = addColumnFunction(bounds, column, function, "Maximum");
    function = new Function1() {
      @Override
      public Object apply(Object element) {
        ProfileStatus status = asProfileStatus(element);
        if (status != null) {
          return toHealth(status);
        }
        return null;
      }
    };
    column = addColumnFunction(bounds, column, function, "Status",
        new HealthLabelProvider(function));
    function = new Function1() {
      @Override
      public Double apply(Object element) {
        ProfileStatus status = asProfileStatus(element);
        if (status != null) {
          return status.getHealth(status.getCount());
        }
        return null;
      }
    };
    column = addColumnFunction(bounds, column, function, "Health",
        new PercentFunctionLabelProvider(function));
    function = new Function1() {
      @Override
      public Object apply(Object element) {
        ProfileStatus status = asProfileStatus(element);
        if (status != null) {
          return status.getDependentProfiles();
        }
        return null;
      }
    };
    column = addColumnFunction(250, column, function, "Dependencies");
View Full Code Here

TOP

Related Classes of io.fabric8.api.ProfileBuilder

Copyright © 2018 www.massapicom. 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.