Package com.sonymobile.tools.gerrit.gerritevents.dto.events

Examples of com.sonymobile.tools.gerrit.gerritevents.dto.events.RefReplicated


     * Test that it should return cached event.
     */
    @Test
    public void shouldReturnCachedEvent() {
        ReplicationCache replicationCache = ReplicationCache.Factory.createCache();
        RefReplicated refReplicated = Setup.createRefReplicatedEvent("someProject", "refs/changes/1/1/1", "someServer",
            "someSlave", null);
        replicationCache.put(refReplicated);

        assertEquals(refReplicated,
            replicationCache.getIfPresent("someServer", "someProject", "refs/changes/1/1/1", "someSlave"));
View Full Code Here


     * @throws InterruptedException if something goes wrong
     */
    @Test
    public void shouldEvictExpiredEvent() throws InterruptedException {
        ReplicationCache replicationCache = ReplicationCache.Factory.createCache(100, TimeUnit.MILLISECONDS);
        RefReplicated refReplicated = Setup.createRefReplicatedEvent("someProject", "refs/changes/1/1/1", "someServer",
            "someSlave", null);
        replicationCache.put(refReplicated);

        // event is in the cache
        assertEquals(refReplicated,
View Full Code Here

        dispatcher.gerritEvent(Setup.createRefReplicatedEvent("someProject", "refs/changes/1/1/1", "someGerritServer",
                "slaveB", RefReplicated.SUCCEEDED_STATUS));
        assertNotNull("the item should be blocked", dispatcher.canRun(item));

        //send a malformed replication event (missing provider)
        RefReplicated refReplicated = Setup.createRefReplicatedEvent("someProject", "refs/changes/1/1/1",
                "someGerritServer", "slaveB", RefReplicated.SUCCEEDED_STATUS);
        refReplicated.setProvider(null);
        dispatcher.gerritEvent(refReplicated);
        assertNotNull("the item should be blocked", dispatcher.canRun(item));

        //send the proper replication event
        dispatcher.gerritEvent(Setup.createRefReplicatedEvent("someProject", "refs/changes/1/1/1", "someGerritServer",
View Full Code Here

     * @param status hte status
     * @return a RefReplicated event
     */
    public static RefReplicated createRefReplicatedEvent(String project, String ref, String server, String slave,
            String status) {
        RefReplicated refReplicated = new RefReplicated();
        refReplicated.setProject(project);
        refReplicated.setProvider(new Provider(server, null, null, null, null, null));
        refReplicated.setRef(ref);
        refReplicated.setTargetNode(slave);
        refReplicated.setStatus(status);
        return refReplicated;
    }
View Full Code Here

     * @param blockedItem The blocked item to update
     */
    private void updateFromReplicationCache(BlockedItem blockedItem) {
        Iterator<GerritSlave> it = blockedItem.slavesWaitingFor.values().iterator();
        while (it.hasNext()) {
            RefReplicated refReplicated = replicationCache.getIfPresent(blockedItem.gerritServer,
                    blockedItem.gerritProject, blockedItem.ref, it.next().getHost());
            if (refReplicated != null) {
                blockedItem.processRefReplicatedEvent(refReplicated);
                logger.trace("processed a replication event from the cache, remaining number of events waiting for: {}"
                        , blockedItem.slavesWaitingFor.size());
View Full Code Here

TOP

Related Classes of com.sonymobile.tools.gerrit.gerritevents.dto.events.RefReplicated

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.