Package org.candlepin.gutterball.model

Examples of org.candlepin.gutterball.model.ConsumerState


    }

    @Test
    public void testSetConsumerDeleted() {
        String uuid = TestUtils.randomString("test-consumer-uuid");
        ConsumerState state = new ConsumerState(uuid, "test-owner", new Date());
        consumerStateCurator.create(state);

        Date deletedOn = new Date();
        consumerStateCurator.setConsumerDeleted(state.getUuid(), deletedOn);

        ConsumerState found = consumerStateCurator.findByUuid(uuid);
        assertEquals(deletedOn, found.getDeleted());
    }
View Full Code Here


    @Test
    public void testUuidIncludedWhenNotDeletedAndWasCreatedOnTargetDate() {
        Calendar cal = getPrimedCalendar();
        String uuid = TestUtils.randomString("test-consumer-uuid");
        ConsumerState state = new ConsumerState(uuid, "test-owner", cal.getTime());
        consumerStateCurator.create(state);

        List<String> uuids = consumerStateCurator.getConsumerUuidsOnDate(cal.getTime(), null, null);
        assertEquals(1, uuids.size());
        assertTrue(uuids.contains(state.getUuid()));
    }
View Full Code Here

            .uniqueResult();
    }

    @Transactional
    public void setConsumerDeleted(String uuid, Date deletedOn) {
        ConsumerState consumer = this.findByUuid(uuid);
        if (consumer == null) {
            // If consumer state didn't exist, we don't care.
            // The consumer may have already existed before
            // we started collecting data.
            return;
        }

        consumer.setDeleted(deletedOn);
        save(consumer);
    }
View Full Code Here

    @Test
    public void testUuidIncludedWhenNotDeletedAndWasCreatedBeforeTargetDate() {
        Calendar cal = getPrimedCalendar();
        String uuid = TestUtils.randomString("test-consumer-uuid");
        ConsumerState state = new ConsumerState(uuid, "test-owner", cal.getTime());
        consumerStateCurator.create(state);

        cal.add(Calendar.DAY_OF_MONTH, 1);
        List<String> uuids = consumerStateCurator.getConsumerUuidsOnDate(cal.getTime(), null, null);
        assertEquals(1, uuids.size());
        assertTrue(uuids.contains(state.getUuid()));
    }
View Full Code Here

    @Test
    public void testUuidNotIncludedWhenDeletedBeforeTargetDate() {
        Calendar cal = getPrimedCalendar();
        String uuid = TestUtils.randomString("test-consumer-uuid");
        ConsumerState state = new ConsumerState(uuid, "test-owner", cal.getTime());
        consumerStateCurator.create(state);

        cal.add(Calendar.DAY_OF_MONTH, 1);
        consumerStateCurator.setConsumerDeleted(uuid, cal.getTime());
        assertTrue(consumerStateCurator.getConsumerUuidsOnDate(cal.getTime(), null, null).isEmpty());
View Full Code Here

TOP

Related Classes of org.candlepin.gutterball.model.ConsumerState

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.