Package org.candlepin.audit

Examples of org.candlepin.audit.Event


    @Test
    public void ownersAtomFeed() {
        Owner owner2 = new Owner("anotherOwner");
        ownerCurator.create(owner2);

        Event e1 = createConsumerCreatedEvent(owner);
        // Make an event from another owner:
        createConsumerCreatedEvent(owner2);

        // Make sure we're acting as the correct owner admin:
        setupPrincipal(owner, Access.ALL);

        securityInterceptor.enable();

        Feed feed = ownerResource.getOwnerAtomFeed(owner.getKey());
        assertEquals(1, feed.getEntries().size());
        Entry entry = feed.getEntries().get(0);
        assertEquals(e1.getTimestamp(), entry.getPublished());
    }
View Full Code Here


        );
    }

    @Test
    public void getevent() {
        Event e = getEvent();
        when(ec.find(eq("8aba"))).thenReturn(e);
        EventResource er = new EventResource(ec, null,
            injector.getInstance(EventAdapter.class));
        assertEquals(e, er.getEvent("8aba"));
    }
View Full Code Here

        when(ec.listAll()).thenReturn(events);
        assertEquals(events, er.listEvents());
    }

    protected Event getEvent() {
        Event e = new Event();
        e.setTarget(Event.Target.CONSUMER);
        e.setType(Event.Type.CREATED);
        e.setPrincipal(new PrincipalData());
        return e;
    }
View Full Code Here

        when(this.consumerCurator.verifyAndLookupConsumer(uuid)).thenReturn(existing);

        // Create a consumer with 1 new guest.
        Consumer updated = createConsumerWithGuests("Guest 1");

        Event expectedEvent = new Event();
        when(this.eventFactory.guestIdCreated(updated.getGuestIds().get(0)))
            .thenReturn(expectedEvent);

        this.resource.updateConsumer(existing.getUuid(), updated);
        verify(sink).queueEvent(eq(expectedEvent));
View Full Code Here

        when(this.consumerCurator.verifyAndLookupConsumer(uuid)).thenReturn(existing);

        // Create a consumer with one less guest id.
        Consumer updated = createConsumerWithGuests("Guest 2");

        Event expectedEvent = new Event();
        when(this.eventFactory.guestIdDeleted(existing.getGuestIds().get(0)))
            .thenReturn(expectedEvent);

        this.resource.updateConsumer(existing.getUuid(), updated);
        verify(sink).queueEvent(eq(expectedEvent));
View Full Code Here

        Consumer updated = createConsumerWithGuests("Guest 1", "Guest 2");
        updated.setUuid(uuid);

        // Has to be mocked even though we don't intend to send:
        Event event = new Event();
        when(this.eventFactory.consumerModified(existing, updated)).thenReturn(event);

        this.resource.updateConsumer(existing.getUuid(), updated);
        verify(sink, never()).queueEvent(any(Event.class));
    }
View Full Code Here

        // flip case on one ID, should be treated as no change
        Consumer updated = createConsumerWithGuests("aaa123", "BBB123");
        updated.setUuid(uuid);

        // Has to be mocked even though we don't intend to send:
        Event event = new Event();
        when(this.eventFactory.consumerModified(existing, updated)).thenReturn(event);

        this.resource.updateConsumer(existing.getUuid(), updated);
        verify(sink, never()).queueEvent(any(Event.class));
    }
View Full Code Here

    private List<Event> getEvents(int count) {
        List<Event> list = new ArrayList<Event>(count);
        Target[] targets = Target.values();
        Type[] types = Type.values();
        for (int i = 0; i < count; i++) {
            Event e = new Event();
            e.setTarget(targets[i % targets.length]);
            e.setType(types[i % types.length]);
            e.setTimestamp(new Date());
            e.setPrincipal(new PrincipalData());
            list.add(e);
        }
        return list;
    }
View Full Code Here

    @Path("/{owner_key}")
    @Produces(MediaType.APPLICATION_JSON)
    public void deleteOwner(@PathParam("owner_key") String ownerKey,
        @QueryParam("revoke") @DefaultValue("true") boolean revoke) {
        Owner owner = findOwner(ownerKey);
        Event e = eventFactory.ownerDeleted(owner);

        cleanupAndDelete(owner, revoke);

        sink.queueEvent(e);
    }
View Full Code Here

                toUpdate.setDefaultServiceLevel(owner.getDefaultServiceLevel());
            }
        }

        ownerCurator.merge(toUpdate);
        Event e = eventBuilder.setNewEntity(toUpdate).buildEvent();
        sink.queueEvent(e);
        return toUpdate;
    }
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.