Package org.candlepin.audit

Examples of org.candlepin.audit.Event


                updatedPool.getBrandingChanged()) {
                List<String> entitlements = poolCurator
                    .retrieveFreeEntitlementIdsOfPool(existingPool, true);
                entitlementsToRegen.addAll(entitlements);
            }
            Event event = poolEvents.get(existingPool.getId())
                    .setNewEntity(existingPool)
                    .buildEvent();
            sink.queueEvent(event);
        }
View Full Code Here


        }

        pool.getEntitlements().remove(entitlement);
        poolCurator.merge(pool);
        entitlementCurator.delete(entitlement);
        Event event = eventFactory.entitlementDeleted(entitlement);

        // The quantity is calculated at fetch time. We update it here
        // To reflect what we just removed from the db.
        pool.setConsumed(pool.getConsumed() - entitlement.getQuantity());
        if (consumer.getType().isManifest()) {
View Full Code Here

     * @param pool
     */
    @Override
    @Transactional
    public void deletePool(Pool pool) {
        Event event = eventFactory.poolDeleted(pool);

        // Must do a full revoke for all entitlements:
        for (Entitlement e : poolCurator.entitlementsIn(pool)) {
            revokeEntitlement(e);
        }
View Full Code Here

    public void events() {
        List<Entitlement> ents = new ArrayList<Entitlement>();
        ents.add(mock(Entitlement.class));
        ents.add(mock(Entitlement.class));

        Event evt1 = mock(Event.class);
        Event evt2 = mock(Event.class);
        when(ef.entitlementCreated(any(Entitlement.class)))
            .thenReturn(evt1)
            .thenReturn(evt2);
        entitler.sendEvents(ents);
View Full Code Here

        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

        consumerTypeCurator.create(newConsumer.getType());
        consumerCurator.create(newConsumer);

        setupPrincipal(owner, Access.ALL);
        EventFactory eventFactory = injector.getInstance(EventFactory.class);
        Event event = eventFactory.consumerCreated(newConsumer);
        eventCurator.create(event);

        Event lookedUp = eventCurator.find(event.getId());
        assertNull(lookedUp.getOldEntity());
        assertEquals(Type.CREATED, lookedUp.getType());
        assertNotNull(lookedUp.getId());
    }
View Full Code Here

        // Force all events to have exact same timestamp:
        Date forcedDate = new Date();

        EventBuilder builder = eventFactory.getEventBuilder(Event.Target.RULES,
                Event.Type.DELETED);
        Event rulesDeletedEvent = builder.setOldEntity(new Rules()).buildEvent();
        rulesDeletedEvent.setTimestamp(forcedDate);

        builder = eventFactory.getEventBuilder(Event.Target.CONSUMER,
                Event.Type.CREATED);
        Event consumerCreatedEvent = builder.setNewEntity(newConsumer).buildEvent();
        consumerCreatedEvent.setTimestamp(forcedDate);

        builder = eventFactory.getEventBuilder(Event.Target.CONSUMER,
                Event.Type.MODIFIED);
        Event consumerModifiedEvent = builder.setNewEntity(newConsumer).
                setOldEntity(newConsumer).buildEvent();
        consumerModifiedEvent.setTimestamp(forcedDate);

        eventCurator.create(rulesDeletedEvent);
        eventCurator.create(consumerCreatedEvent);
        eventCurator.create(consumerModifiedEvent);

        List<Event> mostRecent = eventCurator.listMostRecent(3);
        assertEquals(3, mostRecent.size());

        // We should see this sorted by timestamp (all the same), then entity, then type:
        assertEquals(consumerCreatedEvent.getId(), mostRecent.get(0).getId());
        assertEquals(consumerModifiedEvent.getId(), mostRecent.get(1).getId());
        assertEquals(rulesDeletedEvent.getId(), mostRecent.get(2).getId());
    }
View Full Code Here

     */
    @GET
    @Path("{uuid}")
    @Produces(MediaType.APPLICATION_JSON)
    public Event getEvent(@PathParam("uuid") String uuid) {
        Event toReturn = eventCurator.find(uuid);
        if (toReturn != null) {
            ArrayList<Event> events = new ArrayList<Event>();
            events.add(toReturn);
            eventAdapter.addMessageText(events);
            return toReturn;
View Full Code Here

    private void deleteRemainingLocalSubscriptions(
        Map<String, Map<String, Subscription>> existingSubsByUpstreamPool) {
        for (Map<String, Subscription> map : existingSubsByUpstreamPool.values()) {
            for (Subscription subscription : map.values()) {
                Event e = sink.createSubscriptionDeleted(subscription);
                subscriptionCurator.delete(subscription);
                sink.queueEvent(e);
                log.info("Delete subscription with entitlement id [" +
                    subscription.getUpstreamEntitlementId() +
                    "]");
View Full Code Here

        // events in the db:
        setupPrincipal(o, Access.ALL);
        Consumer consumer = TestUtil.createConsumer(o);
        consumerTypeCurator.create(consumer.getType());
        consumerCurator.create(consumer);
        Event e1 = eventFactory.consumerCreated(consumer);
        eventCurator.create(e1);
        return e1;
    }
View Full Code Here

TOP

Related Classes of org.candlepin.audit.Event

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.