Package org.candlepin.model

Examples of org.candlepin.model.ConsumerType


    public void testDeserialize() throws IOException {
        String consumerTypeString = "{\"id\":15, \"label\":\"prosumer\"}";

        Reader reader = new StringReader(consumerTypeString);

        ConsumerType consumerType = new ConsumerTypeImporter(null).createObject(
            SyncUtils.getObjectMapper(config), reader);

        assertEquals("prosumer", consumerType.getLabel());
    }
View Full Code Here


    public void testDeserializeIdIsNull() throws IOException {
        String consumerTypeString = "{\"id\":15, \"label\":\"prosumer\"}";

        Reader reader = new StringReader(consumerTypeString);

        ConsumerType consumerType = new ConsumerTypeImporter(null).createObject(
            SyncUtils.getObjectMapper(config), reader);

        assertEquals(null, consumerType.getId());
    }
View Full Code Here

        assertEquals(null, consumerType.getId());
    }

    @Test
    public void testSingleConsumerTypeInDbAndListCausesNoChange() {
        final ConsumerType testType = new ConsumerType();
        testType.setLabel("prosumer");

        ConsumerTypeCurator curator = mock(ConsumerTypeCurator.class);

        when(curator.lookupByLabel("prosumer")).thenReturn(testType);
View Full Code Here

        verify(curator, never()).merge(testType);
    }

    @Test
    public void testSingleConsumerTypeInListEmptyDbCausesInsert() {
        final ConsumerType testType = new ConsumerType();
        testType.setLabel("prosumer");

        ConsumerTypeCurator curator = mock(ConsumerTypeCurator.class);

        when(curator.lookupByLabel("prosumer")).thenReturn(null);
View Full Code Here

* CONSUMER_SYSTEM_NAME_PATTERN, this will need different tests.
*/
public class PersonConsumerResourceCreationTest extends
    ConsumerResourceCreationTest {
    public ConsumerType initSystem() {
        ConsumerType systemtype = new ConsumerType(
            ConsumerType.ConsumerTypeEnum.PERSON);
        // create an owner, a ownerperm, and roles for the user we prodive
        // as coming from userService
        owner = new Owner("test_owner");
        PermissionBlueprint p = new PermissionBlueprint(PermissionType.OWNER, owner,
View Full Code Here

    }

    @Test
    public void testCRUD() {
        String type = "JarJar-" + System.currentTimeMillis();
        ConsumerType consumerType = new ConsumerType();
        consumerType.setLabel(type);
        assertEquals("the label getter works", type, consumerType.getLabel());
        // Ensure it is not there
        assertTrue("The type already exists", !this.typeExists(type));
        // Create it
        consumerType = consumerTypeResource.create(consumerType);

        // Make sure it is there
        assertTrue("The type was not found", this.typeExists(type));

        // Find it by ID
        ConsumerType consumerType2 = consumerTypeResource
            .getConsumerType(consumerType.getId());
        assertNotNull("The type was not found by ID", consumerType2);

        // Update it
        String type2 = "JarJar2-" + System.currentTimeMillis();
View Full Code Here

    @Before
    public void setUp() {
        consumerResource = injector.getInstance(ConsumerResource.class);

        standardSystemType = consumerTypeCurator.create(
                new ConsumerType("standard-system"));
        owner = ownerCurator.create(new Owner("test-owner"));
        ownerCurator.create(owner);

        consumer = TestUtil.createConsumer(standardSystemType, owner);
        consumerCurator.create(consumer);
View Full Code Here

        ownerCurator.create(owner);
        productCurator.create(rhel);
        productCurator.create(jboss);

        consumerType = new ConsumerType(CONSUMER_TYPE_NAME);
        consumerTypeCurator.create(consumerType);
        consumer = new Consumer(CONSUMER_NAME, USER_NAME, owner, consumerType);
        consumer.setFact("foo", "bar");
        consumer.setFact("foo1", "bar1");
View Full Code Here

        // Need to make sure another consumer already exists, different type:
        Consumer existing = new Consumer("existing consumer", newUsername, owner,
            consumerType);
        consumerCurator.create(existing);

        ConsumerType personType = new ConsumerType(ConsumerTypeEnum.PERSON);
        consumerTypeCurator.create(personType);

        User user = new User(newUsername, "password");
        userCurator.create(user);
View Full Code Here

    public void init() {
        super.init();
        this.curator = this.injector.getInstance(GuestIdCurator.class);
        owner = new Owner("test-owner", "Test Owner");
        owner = ownerCurator.create(owner);
        ct = new ConsumerType(ConsumerTypeEnum.SYSTEM);
        ct = consumerTypeCurator.create(ct);
    }
View Full Code Here

TOP

Related Classes of org.candlepin.model.ConsumerType

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.