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

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


        AbstractBuild r = Setup.createBuild(project, taskListener, env);
        env.put("BUILD_URL", hudson.getRootUrl() + r.getUrl());

        when(r.getResult()).thenReturn(Result.FAILURE);

        PatchsetCreated event = Setup.createPatchsetCreated();

        MemoryImprint memoryImprint = mock(MemoryImprint.class);
        when(memoryImprint.getEvent()).thenReturn(event);

        when(memoryImprint.wereAllBuildsSuccessful()).thenReturn(true);
View Full Code Here


     * will get called one last time on buildable item before they can leave the queue but we do not
     * want ReplicationQueueTaskDispatcher to block them at that point.
     */
    @Test
    public void shouldNotBlockBuildableItem() {
        PatchsetCreated patchsetCreated = Setup.createPatchsetCreated("someGerritServer", "someProject",
                "refs/changes/1/1/1");
        Item item = createItem(patchsetCreated, new String[] {"slaveA", "slaveB", "slaveC"});

        CauseOfBlockage cause = dispatcher.canRun(new Queue.BuildableItem((WaitingItem)item));
        assertNull("Build should not be blocked", cause);
View Full Code Here

     *
     * For this test case, item is configured with only one slave.
     */
    @Test
    public void shouldBlockedItemUntilPatchsetIsReplicatedToSlave() {
        PatchsetCreated patchsetCreated = Setup.createPatchsetCreated("someGerritServer", "someProject",
                "refs/changes/1/1/1");
        Item item = createItem(patchsetCreated, new String[] {"slaveA"});

        //item is blocked
        CauseOfBlockage cause = dispatcher.canRun(item);
View Full Code Here

     *
     * For this test case, item is configured with more than one slave(3).
     */
    @Test
    public void shouldBlockItemUntilPatchsetIsReplicatedToAllSlaves() {
        PatchsetCreated patchsetCreated = Setup.createPatchsetCreated("someGerritServer", "someProject",
                "refs/changes/1/1/1");
        Item item = createItem(patchsetCreated, new String[] {"slaveA", "slaveB", "slaveC"});

        //item is blocked
        CauseOfBlockage cause = dispatcher.canRun(item);
View Full Code Here

     * Test that it should block item until slave replication timeout is reached.
     * @throws InterruptedException if test fails
     */
    @Test
    public void shouldBlockItemUntilSlaveReplicationTimeoutIsReached() throws InterruptedException {
        PatchsetCreated patchsetCreated = Setup.createPatchsetCreated("someGerritServer", "someProject",
                "refs/changes/1/1/1");
        Item item = createItem(patchsetCreated, null);
        //setup slaves to have one with timeout
        List<GerritSlave> gerritSlaves = new ArrayList<GerritSlave>();
        gerritSlaves.add(new GerritSlave("slave1", "host1", 0));
View Full Code Here

    /**
     * Test that it should block item until replication fails.
     */
    @Test
    public void shouldBlockItemUntilReplicationSucceeds() {
        PatchsetCreated patchsetCreated = Setup.createPatchsetCreated("someGerritServer", "someProject",
                "refs/changes/1/1/1");
        Item item = createItem(patchsetCreated, new String[] {"slaveA", "slaveB", "slaveC"});

        //item is blocked
        CauseOfBlockage cause = dispatcher.canRun(item);
View Full Code Here

     * This scenario is very likely if another QueueTaskDispatcher is registered, gets called before our and block the
     * build for sometime(e.g. ThrottleConcurrentBuild plugin).
     */
    @Test
    public void shouldNotBlockItemWhenReplicationIsCompletedBeforeDispatcherIsCalled() {
        PatchsetCreated patchsetCreated = Setup.createPatchsetCreated("someGerritServer", "someProject",
                "refs/changes/1/1/1");
        Item item = createItem(patchsetCreated, new String[] {"slaveA", "slaveB"});

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

     * QueueTaskDispatcher for 7 hours and this dispatcher gets called after, we assume that we received the
     * replication event. We cannot cache the events forever otherwise will end up with serious memory issue.
     */
    @Test
    public void shouldNotBlockItemWhenElapsedTimeIsGreaterThenCacheExpirationTime() {
        PatchsetCreated patchsetCreated = Setup.createPatchsetCreated("someGerritServer", "someProject",
                "refs/heads/master");
        patchsetCreated.setReceivedOn(System.currentTimeMillis()
                - TimeUnit.MINUTES.toMillis(ReplicationCache.DEFAULT_EXPIRATION_IN_MINUTES));
        Item item = createItem(patchsetCreated, new String[] {"slaveA", "slaveB"});
        assertNull("Item should not be blocked", dispatcher.canRun(item));
        verify(queueMock, times(0)).maintain();
    }
View Full Code Here

     * If more than one item is unblocked by a replication event, the dispatcher should update all the blocked
     * item before calling the maintenance of the queue.
     */
    @Test
    public void shouldFireQueueMaintenanceMaximumOneTimePerReplicationEventReceived() {
        PatchsetCreated patchsetCreated = Setup.createPatchsetCreated("someGerritServer", "someProject",
                "refs/changes/1/1/1");
        Item item1 = createItem(patchsetCreated, new String[] {"slaveA"});
        Item item2 = createItem(patchsetCreated, new String[] {"slaveA"});

        //items are blocked
View Full Code Here

        GerritTrigger trigger = mock(GerritTrigger.class);
        when(trigger.getGerritBuildSuccessfulCodeReviewValue()).thenReturn(null);
        when(trigger.getGerritBuildSuccessfulVerifiedValue()).thenReturn(null);
        when(project.getTrigger(GerritTrigger.class)).thenReturn(trigger);

        PatchsetCreated event = Setup.createPatchsetCreated();

        BuildMemory memory = new BuildMemory();
        memory.completed(event, build);

        IGerritHudsonTriggerConfig config = mock(IGerritHudsonTriggerConfig.class);
View Full Code Here

TOP

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

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.