Package org.candlepin.model

Examples of org.candlepin.model.Environment


    @GET
    @Path("/{env_id}")
    @Produces(MediaType.APPLICATION_JSON)
    public Environment getEnv(
        @PathParam("env_id") @Verify(Environment.class) String envId) {
        Environment e = envCurator.find(envId);
        if (e == null) {
            throw new NotFoundException(i18n.tr("No such environment: {0}", envId));
        }
        return e;
    }
View Full Code Here


     * @httpcode 200
     */
    @DELETE
    @Path("/{env_id}")
    public void deleteEnv(@PathParam("env_id") @Verify(Environment.class) String envId) {
        Environment e = envCurator.find(envId);
        if (e == null) {
            throw new NotFoundException(i18n.tr("No such environment: {0}", envId));
        }

        // Cleanup all consumers and their entitlements:
        for (Consumer c : e.getConsumers()) {
            poolManager.revokeAllEntitlements(c);
            consumerCurator.delete(c);
        }

        envCurator.delete(e);
View Full Code Here

    public JobDetail promoteContent(
            @PathParam("env_id") @Verify(Environment.class) String envId,
            List<EnvironmentContent> contentToPromote,
            @QueryParam("lazy_regen") @DefaultValue("true") Boolean lazyRegen) {

        Environment env = lookupEnvironment(envId);

        Set<String> contentIds = new HashSet<String>();
        for (EnvironmentContent promoteMe : contentToPromote) {
            // Make sure the content exists:
            promoteMe.setContentId(promoteMe.getContentId());
            promoteMe.setEnvironment(env);
            envContentCurator.create(promoteMe);
            env.getEnvironmentContent().add(promoteMe);
            contentIds.add(promoteMe.getContentId());
        }

        JobDataMap map = new JobDataMap();
        map.put(RegenEnvEntitlementCertsJob.ENV, env);
View Full Code Here

    public JobDetail demoteContent(
        @PathParam("env_id") @Verify(Environment.class) String envId,
        @QueryParam("content") String[] contentIds,
        @QueryParam("lazy_regen") @DefaultValue("true") Boolean lazyRegen) {

        Environment e = lookupEnvironment(envId);
        Set<String> demotedContentIds = new HashSet<String>();
        for (String contentId : contentIds) {
            EnvironmentContent envContent =
                envContentCurator.lookupByEnvironmentAndContent(e, contentId);
            envContentCurator.delete(envContent);
View Full Code Here

        return detail;

    }

    private Environment lookupEnvironment(String envId) {
        Environment e = envCurator.find(envId);
        if (e == null) {
            throw new NotFoundException(i18n.tr(
                "No such environment: {0}", envId));
        }
        return e;
View Full Code Here

        @Context Principal principal, @QueryParam("username") String userName,
        @QueryParam("owner") String ownerKey,
        @QueryParam("activation_keys") String activationKeys)
        throws BadRequestException {

        Environment e = lookupEnvironment(envId);
        consumer.setEnvironment(e);
        return this.consumerResource.create(consumer, principal, userName,
            e.getOwner().getKey(), activationKeys);
    }
View Full Code Here

    private String getContentPrefix(Entitlement ent, boolean useContentPrefix)
        throws IOException {
        String contentPrefix = null;
        if (useContentPrefix) {
            contentPrefix = ent.getOwner().getContentPrefix();
            Environment env = ent.getConsumer().getEnvironment();
            if (contentPrefix != null && !contentPrefix.equals("")) {
                if (env != null) {
                    contentPrefix = contentPrefix.replaceAll("\\$env", env.getName());
                }
                contentPrefix = this.cleanUpPrefix(contentPrefix);
            }
        }
        return contentPrefix;
View Full Code Here

    @Before
    public void setUp() {
        owner = new Owner("test-owner", "Test Owner");
        owner = ownerCurator.create(owner);

        e = new Environment("env1", "Env 1", owner);
        envCurator.create(e);

        p = TestUtil.createProduct();
        c = new Content("testcontent", "contentId1", "testcontent", "yum",
            "red hat", "http://example.com", "http://example.com/gpg.key",
View Full Code Here

    private Environment environment;

    @Before
    public void setUp() {
        owner = ownerCurator.create(new Owner("test-owner", "Test Owner"));
        environment = envCurator.create(new Environment("env1", "Env 1", owner));
    }
View Full Code Here

    }

    @Test
    public void create() {
        assertEquals(1, envCurator.listAll().size());
        Environment e = envCurator.find("env1");
        assertEquals(owner, e.getOwner());
    }
View Full Code Here

TOP

Related Classes of org.candlepin.model.Environment

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.