Examples of ProjectRequirements


Examples of io.fabric8.deployer.dto.ProjectRequirements

        String groupId = "foo";
        String artifactId = "bar";
        String expectedProfileId = groupId + "-" + artifactId;
        String versionId = "1.0";

        ProjectRequirements requirements = new ProjectRequirements();
        DependencyDTO rootDependency = new DependencyDTO();
        requirements.setRootDependency(rootDependency);
        rootDependency.setGroupId(groupId);
        rootDependency.setArtifactId(artifactId);
        rootDependency.setVersion("1.0.0");
        List<String> parentProfileIds = Arrays.asList("karaf");
        List<String> features = Arrays.asList("cxf", "war");
        requirements.setParentProfiles(parentProfileIds);
        requirements.setFeatures(features);
        projectDeployer.deployProject(requirements);


        // now we should have a profile created
        Profile profile = assertProfileInFabric(expectedProfileId, versionId);
        assertBundleCount(profile, 1);
        assertEquals("parent ids", parentProfileIds, profile.getParentIds());
        assertFeatures(profile, features);

        String requirementsFileName = "dependencies/" + groupId + "/" + artifactId + "-requirements.json";
        byte[] jsonData = profile.getFileConfiguration(requirementsFileName);
        assertNotNull("should have found some JSON for: " + requirementsFileName, jsonData);
        String json = new String(jsonData);
        LOG.info("Got JSON: " + json);

        // lets replace the version, parent, features
        rootDependency.setVersion("1.0.1");
        projectDeployer.deployProject(requirements);
        profile = assertProfileInFabric(expectedProfileId, versionId);
        assertBundleCount(profile, 1);


        // now lets make a new version
        expectedProfileId = "cheese";
        versionId = "1.2";
        requirements.setVersion(versionId);
        requirements.setProfileId(expectedProfileId);

        parentProfileIds = Arrays.asList("default");
        features = Arrays.asList("camel", "war");
        requirements.setParentProfiles(parentProfileIds);
        requirements.setFeatures(features);
        projectDeployer.deployProject(requirements);

        profile = assertProfileInFabric(expectedProfileId, versionId);
        assertBundleCount(profile, 1);
        assertEquals("parent ids", parentProfileIds, profile.getParentIds());
View Full Code Here

Examples of io.fabric8.deployer.dto.ProjectRequirements

        deactivateComponent();
    }

    @Override
    public DeployResults deployProjectJson(String requirementsJson) throws Exception {
        ProjectRequirements requirements = DtoHelper.getMapper().readValue(requirementsJson, ProjectRequirements.class);
        Objects.notNull(requirements, "ProjectRequirements");
        return deployProject(requirements);
    }
View Full Code Here

Examples of io.fabric8.deployer.dto.ProjectRequirements

        Profile profile = getOrCreateProfile(version, requirements);
        boolean isAbstract = requirements.isAbstractProfile();
        ProfileBuilder builder = ProfileBuilder.Factory.createFrom(profile);
        builder.addAttribute(Profile.ABSTRACT, "" + isAbstract);

        ProjectRequirements oldRequirements = writeRequirementsJson(requirements, profile, builder);
        updateProfileConfiguration(version, profile, requirements, oldRequirements, builder);

        return resolveProfileDeployments(requirements, fabricService.get(), profile, builder);
    }
View Full Code Here

Examples of io.fabric8.deployer.dto.ProjectRequirements

        Set<String> configurationFileNames = profile.getConfigurationFileNames();
        for (String configurationFileName : configurationFileNames) {
            if (configurationFileName.startsWith("dependencies/") && configurationFileName.endsWith("-requirements.json")) {
                byte[] data = profile.getFileConfiguration(configurationFileName);
                try {
                    ProjectRequirements requirements = DtoHelper.getMapper().readValue(data, ProjectRequirements.class);
                    if (requirements != null) {
                        DependencyDTO rootDependency = requirements.getRootDependency();
                        if (rootDependency != null) {
                            addMavenDependencies(artifacts, rootDependency);
                        }
                    }
View Full Code Here

Examples of io.fabric8.deployer.dto.ProjectRequirements

    private void handleDeploy(HttpServletRequest req, UploadContext result) throws Exception {
        String profile = req.getParameter("profile");
        String version = req.getParameter("version");
        if (profile != null && version != null) {
            ProjectRequirements requirements = toProjectRequirements(result);
            requirements.setProfileId(profile);
            requirements.setVersion(version);

            DeployResults deployResults = addToProfile(requirements);
            LOGGER.info(String.format("Deployed artifact %s to profile: %s", result.toArtifact(), deployResults));
        }
    }
View Full Code Here

Examples of io.fabric8.deployer.dto.ProjectRequirements

            }
        }
    }

    protected ProjectRequirements toProjectRequirements(UploadContext context) {
        ProjectRequirements requirements = new ProjectRequirements();

        requirements.setParentProfiles(Collections.<String>emptyList());

        DependencyDTO rootDependency = new DependencyDTO();
        rootDependency.setGroupId(context.getGroupId());
        rootDependency.setArtifactId(context.getArtifactId());
        rootDependency.setVersion(context.getVersion());
        rootDependency.setType(context.getType());
        requirements.setRootDependency(rootDependency);

        return requirements;
    }
View Full Code Here

Examples of io.fabric8.deployer.dto.ProjectRequirements

        }
    }

    protected void generateZip() throws DependencyTreeBuilderException, MojoExecutionException, IOException,
            MojoFailureException {
        ProjectRequirements requirements = new ProjectRequirements();

        DependencyDTO rootDependency = null;
        if (isIncludeArtifact()) {
            rootDependency = loadRootDependency();
            requirements.setRootDependency(rootDependency);
        }
        configureRequirements(requirements);
        if (isIncludeArtifact()) {
            addProjectArtifactBundle(requirements);
        }

        File profileBuildDir = createProfileBuildDir(requirements.getProfileId());

        boolean hasConfigDir = profileConfigDir.isDirectory();
        if (hasConfigDir) {
            copyProfileConfigFiles(profileBuildDir, profileConfigDir);
        } else {
            getLog().info("The profile configuration files directory " + profileConfigDir + " doesn't exist, so not copying any additional project documentation or configuration files");
        }

        // lets only generate a profile zip if we have a requirement (e.g. we're not a parent pom packaging project) and
        // we have defined some configuration files or dependencies
        // to avoid generating dummy profiles for parent poms
        if (hasConfigDir || rootDependency != null ||
                notEmpty(requirements.getBundles()) || notEmpty(requirements.getFeatures()) || notEmpty(requirements.getFeatureRepositories())) {

            if (includeReadMe) {
                copyReadMe(project.getFile().getParentFile(), profileBuildDir);
            }
View Full Code Here

Examples of io.fabric8.deployer.dto.ProjectRequirements

    @Override
    public void execute() throws MojoExecutionException, MojoFailureException {
        if (isIgnoreProject()) return;

        try {
            ProjectRequirements requirements = new ProjectRequirements();
            if (isIncludeArtifact()) {
                DependencyDTO rootDependency = loadRootDependency();
                requirements.setRootDependency(rootDependency);
            }
            configureRequirements(requirements);

            // validate requirements
            if (requirements.getProfileId() != null) {
                // make sure the profile id is a valid name
                FabricValidations.validateProfileName(requirements.getProfileId());
            }

            boolean newUserAdded = false;

            fabricServer = mavenSettings.getServer(serverId);
View Full Code Here

Examples of io.fabric8.deployer.dto.ProjectRequirements

    @Override
    public void execute() throws MojoExecutionException, MojoFailureException {
        try {
            DependencyDTO rootDependency = loadRootDependency();

            ProjectRequirements requirements = new ProjectRequirements();
            requirements.setRootDependency(rootDependency);
            configureRequirements(requirements);
            addProjectArtifactBundle(requirements);

            generateScript(requirements, outputFile);
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.