Package org.candlepin.model

Examples of org.candlepin.model.Owner


        verify(subAdapter, times(1)).getSubscriptions(product);
    }

    @Test
    public void testPoolOnlyExaminedOnceProductAndOwner() {
        Owner owner = mock(Owner.class);
        Product product = mock(Product.class);

        when(product.getId()).thenReturn("product id");

        Pool pool = new Pool();
View Full Code Here


    @Before
    public void setUp() {
        prod = new Product("1", "2");
        productCurator.create(prod);

        owner = new Owner("test-owner", "Test Owner");
        owner = ownerCurator.create(owner);
        ct = new ConsumerType(ConsumerTypeEnum.SYSTEM);
        ct = consumerTypeCurator.create(ct);

        consumer = new Consumer("a consumer", "username", owner, ct);
View Full Code Here

            "http://localhost:8080/candlepin/");
        ClientResponse<Owner> resp = client.replicateOwner("admin");

        assertNotNull(resp);
        assertEquals(200, resp.getStatus());
        Owner o = resp.getEntity();
        assertNotNull(o);
        System.out.println(o);
    }
View Full Code Here

            }
        });
        when(complianceRules.getStatus(any(Consumer.class), any(Date.class), any(Boolean.class)))
            .thenReturn(new ComplianceStatus(new Date()));

        when(ownerCurator.lookupByKey(any(String.class))).thenReturn(new Owner());
        when(eventFactory.getEventBuilder(any(Target.class), any(Type.class)))
            .thenReturn(consumerEventBuilder);
        when(consumerEventBuilder.setNewEntity(any(Consumer.class)))
            .thenReturn(consumerEventBuilder);
        when(consumerEventBuilder.setOldEntity(any(Consumer.class)))
View Full Code Here

            .thenReturn(consumerEventBuilder);
    }

    @Test
    public void hypervisorCheckInCreatesNewConsumer() throws Exception {
        Owner owner = new Owner("admin");

        Map<String, List<GuestId>> hostGuestMap = new HashMap<String, List<GuestId>>();
        hostGuestMap.put("test-host", Arrays.asList(new GuestId("GUEST_A"),
            new GuestId("GUEST_B")));

        when(ownerCurator.lookupByKey(eq(owner.getKey()))).thenReturn(owner);
        when(consumerCurator.getHypervisor(eq("test-host"), eq(owner))).thenReturn(null);
        when(ownerCurator.lookupByKey(eq(owner.getKey()))).thenReturn(owner);
        when(principal.canAccess(eq(owner), eq(SubResource.CONSUMERS), eq(Access.CREATE))).
            thenReturn(true);
        when(consumerTypeCurator.lookupByLabel(
            eq(ConsumerTypeEnum.HYPERVISOR.getLabel()))).thenReturn(hypervisorType);
        when(idCertService.generateIdentityCert(any(Consumer.class)))
            .thenReturn(new IdentityCertificate());

        HypervisorCheckInResult result = hypervisorResource.hypervisorCheckIn(hostGuestMap,
            principal, owner.getKey(), true);

        Set<Consumer> created = result.getCreated();
        assertEquals(1, created.size());

        Consumer c1 = created.iterator().next();
View Full Code Here

            TestDateUtil.date(2010, 1, 1));

        JsRunner jsRules = new JsRunnerProvider(rulesCurator).get();
        autobindRules = new AutobindRules(jsRules, productCache);

        owner = new Owner();
        consumer = new Consumer("test consumer", "test user", owner,
            new ConsumerType(ConsumerTypeEnum.SYSTEM));
        compliance = new ComplianceStatus();
        activeGuestAttrs = new HashMap<String, String>();
        activeGuestAttrs.put("virtWhoType", "libvirt");
View Full Code Here

        standardSystemType = consumerTypeCurator.create(new ConsumerType(
            "standard-system"));

        personType = consumerTypeCurator.create(new ConsumerType(
            ConsumerTypeEnum.PERSON));
        owner = ownerCurator.create(new Owner("test-owner"));
        owner.setDefaultServiceLevel(DEFAULT_SERVICE_LEVEL);
        ownerCurator.create(owner);

        someuser = userCurator.create(new User(USER_NAME, "dontcare"));
View Full Code Here

    public void testCannotGetAnotherOwnersConsumersCerts() {
        Consumer evilConsumer = TestUtil.createConsumer(standardSystemType,
            owner);
        consumerCurator.create(evilConsumer);

        Owner evilOwner = ownerCurator.create(new Owner("another-owner"));
        ownerCurator.create(evilOwner);

        setupPrincipal(evilOwner, Access.ALL);
        securityInterceptor.enable();
View Full Code Here

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

        Owner evilOwner = ownerCurator.create(new Owner("another-owner"));
        ownerCurator.create(evilOwner);

        securityInterceptor.enable();
        setupPrincipal(evilOwner, Access.ALL);
View Full Code Here

    public void testGuestIdCreation() throws Exception {
        // this test is testing bz 786730, to ensure
        // the virt-who error does not occur
        Consumer consumer = mock(Consumer.class);
        GuestId guestId = mock(GuestId.class);
        Owner owner = mock(Owner.class);

        when(guestId.getConsumer()).thenReturn(consumer);
        when(guestId.getGuestId()).thenReturn("guest-id");
        when(guestId.getId()).thenReturn("test");
        when(consumer.getOwner()).thenReturn(owner);
        when(consumer.getId()).thenReturn("consumer-id");
        when(owner.getId()).thenReturn("owner-id");

        Event event = eventFactory.guestIdCreated(guestId);
        assertNotNull(event.getEntityId());
    }
View Full Code Here

TOP

Related Classes of org.candlepin.model.Owner

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.