Package org.candlepin.model

Examples of org.candlepin.model.Environment


        assertEquals(1, envs.size());
        assertEquals(envs.get(0), environment);
    }

    @Test public void listForOwnerByName() {
        Environment e = envCurator.create(new Environment("env2", "Another Env", owner));

        List<Environment> envs = envCurator.listForOwnerByName(owner, "Another Env");
        assertEquals(1, envs.size());
        assertEquals(e, envs.get(0));
    }
View Full Code Here


        assertEquals(e, envs.get(0));
    }

    @Test
    public void listWithContent() {
        envCurator.create(new Environment("env2", "Another Env", owner));

        final String contentId = "contentId";
        envContentCurator.create(
            new EnvironmentContent(environment, contentId, true));
View Full Code Here

    @Test
    public void testContentExtentionIncludesPromotedContent()
        throws CertificateSizeException {

        // Environment, with promoted content:
        Environment e = new Environment("env1", "Env 1", owner);
        e.getEnvironmentContent().add(new EnvironmentContent(e, content.getId(), true));
        when(entitlement.getConsumer().getEnvironment()).thenReturn(e);

        Map<String, EnvironmentContent> promotedContent =
            new HashMap<String, EnvironmentContent>();
        promotedContent.put(content.getId(), e.getEnvironmentContent().iterator().next());
        Set<X509ExtensionWrapper> contentExtensions = extensionUtil
            .contentExtensions(product.getProductContent(), null,
                promotedContent, entitlement.getConsumer());
        Map<String, X509ExtensionWrapper> encodedContent = getEncodedContent(
            contentExtensions);
View Full Code Here

    @Test
    public void testPrefixExpandsEnvIfConsumerHasOne() throws Exception {
        owner.setContentPrefix("/someorg/$env/");

        // Setup an environment for the consumer:
        Environment e = new Environment("env1", "Awesome Environment #1", owner);
        e.getEnvironmentContent().add(new EnvironmentContent(e, content.getId(), true));
        when(entitlement.getConsumer().getEnvironment()).thenReturn(e);

        certServiceAdapter.createX509Certificate(entitlement,
            product, new HashSet<Product>(), new BigInteger("1234"), keyPair(), true);
View Full Code Here

    @Test
    public void testURLEncoding() throws Exception {
        owner.setContentPrefix("/some org/$env/");

        // Setup an environment for the consumer:
        Environment e = new Environment("env1", "Awesome Environment #1", owner);
        e.getEnvironmentContent().add(new EnvironmentContent(e, content.getId(), true));
        when(entitlement.getConsumer().getEnvironment()).thenReturn(e);

        certServiceAdapter.createX509Certificate(entitlement,
            product, new HashSet<Product>(), new BigInteger("1234"), keyPair(), true);
View Full Code Here

            extensionUtil.filterProductContent(modProduct, entitlement, entCurator,
                new HashMap<String, EnvironmentContent>(), false)
                .size());

        // Make sure that we filter by environment when asked.
        Environment environment = new Environment();
        when(consumer.getEnvironment()).thenReturn(environment);

        Map<String, EnvironmentContent> promotedContent =
            new HashMap<String, EnvironmentContent>();
        promotedContent.put(normalContent.getId(), new EnvironmentContent(environment,
View Full Code Here

        assertTrue(existing.getGuestIds().contains(expectedGuestId));
    }

    @Test
    public void canUpdateConsumerEnvironment() {
        Environment changedEnvironment = new Environment("42", "environment", null);

        Consumer existing = getFakeConsumer();

        Consumer updated = new Consumer();
        updated.setEnvironment(changedEnvironment);

        when(environmentCurator.find(changedEnvironment.getId())).thenReturn(
                changedEnvironment);

        resource.updateConsumer(existing.getUuid(), updated);

        verify(poolManager, atMost(1)).regenerateEntitlementCertificates(existing, true);
View Full Code Here

    }

    @Test(expected = NotFoundException.class)
    public void throwsAnExceptionWhenEnvironmentNotFound() {
        String uuid = "A Consumer";
        Environment changedEnvironment = new Environment("42", "environment", null);

        Consumer updated = new Consumer();
        updated.setUuid(uuid);
        updated.setEnvironment(changedEnvironment);

        Consumer existing = new Consumer();
        existing.setUuid(updated.getUuid());

        when(consumerCurator.verifyAndLookupConsumer(
            existing.getUuid())).thenReturn(existing);
        when(environmentCurator.find(changedEnvironment.getId())).thenReturn(null);

        resource.updateConsumer(existing.getUuid(), updated);
    }
View Full Code Here

    @Before
    public void setUp() {
        owner = createOwner();
        ownerCurator.create(owner);

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

        consumer = createConsumer(owner);
        consumer.setEnvironment(environment);
        consumerCurator.create(consumer);
View Full Code Here

        String environmentId =
            updated.getEnvironment() == null ? null : updated.getEnvironment().getId();
        if (environmentId != null && (toUpdate.getEnvironment() == null ||
                    !toUpdate.getEnvironment().getId().equals(environmentId))) {
            Environment e = environmentCurator.find(environmentId);
            if (e == null) {
                throw new NotFoundException(i18n.tr(
                    "Environment with ID ''{0}'' could not be found.", environmentId));
            }
            toUpdate.setEnvironment(e);
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.