Examples of ConsumerResource


Examples of org.candlepin.resource.ConsumerResource

    }

    @Test(expected = BadRequestException.class)
    public void testBindMultipleParams() throws Exception {
        ConsumerCurator consumerCurator = mock(ConsumerCurator.class);
        ConsumerResource consumerResource = new ConsumerResource(consumerCurator, null,
            null, null, null, null, null, i18n, null, null, null,
            null, null, null, null, null, null, null, null, null, null, null,
            null, new CandlepinCommonTestConfig(), null, null, null, consumerBindUtil);

        consumerResource.bind("fake uuid", "fake pool uuid",
            new String[]{"12232"}, 1, null, null, false, null, null);
    }
View Full Code Here

Examples of org.candlepin.resource.ConsumerResource

    @Test(expected = NotFoundException.class)
    public void testBindByPoolBadConsumerUuid() throws Exception {
        ConsumerCurator consumerCurator = mock(ConsumerCurator.class);
        when(consumerCurator.verifyAndLookupConsumer(any(String.class)))
            .thenThrow(new NotFoundException(""));
        ConsumerResource consumerResource = new ConsumerResource(consumerCurator, null,
            null, null, null, null, null, i18n, null, null, null,
            null, null, null, null, null, null, null, null, null, null, null,
            null, new CandlepinCommonTestConfig(), null, null, null, consumerBindUtil);

        consumerResource.bind("notarealuuid", "fake pool uuid", null, null, null,
            null, false, null, null);
    }
View Full Code Here

Examples of org.candlepin.resource.ConsumerResource

    @Test(expected = NotFoundException.class)
    public void testRegenerateEntitlementCertificatesWithInvalidConsumerId() {
        ConsumerCurator consumerCurator = mock(ConsumerCurator.class);
        when(consumerCurator.verifyAndLookupConsumer(any(String.class)))
            .thenThrow(new NotFoundException(""));
        ConsumerResource consumerResource = new ConsumerResource(consumerCurator, null,
            null, null, null, null, null, i18n, null, null, null,
            null, null, null, null, null, null, null, null, null, null, null,
            null, new CandlepinCommonTestConfig(), null, null, null, consumerBindUtil);

        consumerResource.regenerateEntitlementCertificates("xyz", null, true);
    }
View Full Code Here

Examples of org.candlepin.resource.ConsumerResource

        when(ctc.lookupByLabel(eq("person"))).thenReturn(cType);
        when(up.canAccess(eq(o), eq(SubResource.CONSUMERS), eq(Access.CREATE))).
            thenReturn(true);
        // usa.findByLogin() will return null by default no need for a when

        ConsumerResource cr = new ConsumerResource(null, ctc,
            null, null, null, null, null, i18n, null, null, null, null,
            usa, null, null,  null, oc, null, null, null, null, null,
            null, new CandlepinCommonTestConfig(), null, null, null, consumerBindUtil);
        cr.create(c, up, null, "testOwner", null);
    }
View Full Code Here

Examples of org.candlepin.resource.ConsumerResource

        ComplianceStatus status = new ComplianceStatus();
        when(mockedComplianceRules.getStatus(any(Consumer.class), any(Date.class)))
            .thenReturn(status);

        ConsumerResource cr = new ConsumerResource(mockedConsumerCurator, null,
            null, null, null, null, null, i18n, null, null, null,
            null, null, null, null, null, null, null, null, mockedComplianceRules,
            null, null, null, new CandlepinCommonTestConfig(), null, null, null,
            consumerBindUtil);

        Map<String, ComplianceStatus> results = cr.getComplianceStatusList(uuids);
        assertEquals(2, results.size());
        assertTrue(results.containsKey("1"));
        assertTrue(results.containsKey("2"));
    }
View Full Code Here

Examples of org.candlepin.resource.ConsumerResource

    }

    @Test
    public void testConsumerExistsYes() {
        when(mockedConsumerCurator.doesConsumerExist(any(String.class))).thenReturn(true);
        ConsumerResource cr = new ConsumerResource(mockedConsumerCurator, null,
            null, null, null, null, null, i18n, null, null, null,
            null, null, null, null, null, null, null, null, mockedComplianceRules,
            null, null, null, new CandlepinCommonTestConfig(),
            null, null, null, consumerBindUtil);
        cr.consumerExists("uuid");
    }
View Full Code Here

Examples of org.candlepin.resource.ConsumerResource

    }

    @Test (expected = NotFoundException.class)
    public void testConsumerExistsNo() {
        when(mockedConsumerCurator.doesConsumerExist(any(String.class))).thenReturn(false);
        ConsumerResource cr = new ConsumerResource(mockedConsumerCurator, null,
            null, null, null, null, null, i18n, null, null, null,
            null, null, null, null, null, null, null, null, mockedComplianceRules,
            null, null, null, new CandlepinCommonTestConfig(),
            null, null, null, consumerBindUtil);
        cr.consumerExists("uuid");
    }
View Full Code Here

Examples of org.candlepin.resource.ConsumerResource

     * Test verifies that list of certs changes after regeneration
     */
    @SuppressWarnings("unchecked")
    @Test
    public void testRegenerateEntitlementCertificateWithValidConsumerByEntitlement() {
        ConsumerResource cr = new ConsumerResource(this.consumerCurator, null,
                null, null, this.entitlementCurator, null, null, null, null, null,
                null, null, null, null, this.poolManager, null, null, null,
                null, null, null, null, null, new CandlepinCommonTestConfig(), null,
                null, null, mock(ConsumerBindUtil.class));

        Response rsp = consumerResource.bind(
            consumer.getUuid(), pool.getId().toString(), null, 1, null,
            null, false, null, null);

        List<Entitlement> resultList = (List<Entitlement>) rsp.getEntity();
        Entitlement ent = resultList.get(0);
        Set<EntitlementCertificate> entCertsBefore = ent.getCertificates();

        cr.regenerateEntitlementCertificates(this.consumer.getUuid(),
            ent.getId(), true);
        Set<EntitlementCertificate> entCertsAfter = ent.getCertificates();

        assertFalse(entCertsBefore.equals(entCertsAfter));
    }
View Full Code Here

Examples of org.candlepin.resource.ConsumerResource

    @Test
    public void ensureUpdatedDateChangesOnUpdate() throws Exception {
        Date beforeUpdateDate = consumer.getUpdated();

        ConsumerResource consumerResource = injector.getInstance(ConsumerResource.class);

        // Create a new consumer, can't re-use reference to the old:
        Consumer newConsumer = new Consumer();
        newConsumer.setUuid(consumer.getUuid());
        newConsumer.setFact("FACT", "FACT_VALUE");

        consumerResource.updateConsumer(consumer.getUuid(), newConsumer);

        Consumer lookedUp = consumerCurator.find(consumer.getId());
        Date lookedUpDate = lookedUp.getUpdated();
        assertEquals("FACT_VALUE", lookedUp.getFact("FACT"));
View Full Code Here

Examples of org.candlepin.resource.ConsumerResource

    @Before
    public void init() throws Exception {
        this.i18n = I18nFactory.getI18n(getClass(), Locale.US, I18nFactory.FALLBACK);

        this.resource = new ConsumerResource(this.consumerCurator,
            this.consumerTypeCurator, null, this.subscriptionService, null,
            this.idCertService, null, this.i18n, this.sink, this.eventFactory, null, null,
            this.userService, null, poolManager, null, null,
            this.activationKeyCurator, this.entitler, this.complianceRules,
            this.deletedConsumerCurator, this.environmentCurator, null,
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.