Package org.osgi.service.coordinator

Examples of org.osgi.service.coordinator.Coordination.end()


        assertNull(coordinator.peek());

        assertFalse(c2.fail(new Exception()));
        try
        {
            c2.end();
            fail("Expected CoordinationException.ALREADY_ENDED on second end()");
        }
        catch (CoordinationException ce)
        {
            // expected already terminated
View Full Code Here


        assertNull(coordinator.peek());
        c1.push();
        assertEquals(c1, coordinator.peek());

        c1.end();
        assertNull(coordinator.peek());

        final Coordination c2 = coordinator.begin(name, 0);
        assertNotNull(c2);
        assertEquals(name, c2.getName());
View Full Code Here

        assertEquals(name, c2.getName());
        assertEquals(c2, coordinator.peek());
        c2.fail(new Exception());
        assertNotNull(coordinator.peek());
        try {
            c2.end();
            fail("Exception should be thrown");
        } catch (CoordinationException ce) {
            // ignore
        }
        assertNull(coordinator.peek());
View Full Code Here

        final Coordination c2 = coordinator.begin(name, 0);
        assertNotNull(c2);
        assertEquals(name, c2.getName());
        assertEquals(c2, coordinator.peek());

        c2.end();
        assertEquals(c1, coordinator.peek());

        c1.end();
        assertNull(coordinator.peek());
    }
View Full Code Here

        c1.end();
        assertNull(coordinator.peek());

        try
        {
            c2.end();
            fail("c2 is already terminated");
        }
        catch (CoordinationException ce)
        {
            assertEquals(CoordinationException.ALREADY_ENDED, ce.getType());
View Full Code Here

        final MockParticipant p1 = new MockParticipant();
        c1.addParticipant(p1);
        assertTrue(c1.getParticipants().contains(p1));
        assertEquals(1, c1.getParticipants().size());

        c1.end();
        assertTrue(p1.ended);
        assertFalse(p1.failed);
        assertEquals(c1, p1.c);

        // assert order of call
View Full Code Here

        c2.addParticipant(p22);
        assertTrue(c2.getParticipants().contains(p21));
        assertTrue(c2.getParticipants().contains(p22));
        assertEquals(2, c2.getParticipants().size());

        c2.end();
        assertTrue(p21.ended);
        assertEquals(c2, p21.c);
        assertTrue(p22.ended);
        assertEquals(c2, p22.c);
        assertTrue("p22 must be called before p21", p22.time < p21.time);
View Full Code Here

        c3.addParticipant(p31); // should be "ignored"
        assertTrue(c3.getParticipants().contains(p31));
        assertTrue(c3.getParticipants().contains(p32));
        assertEquals(2, c3.getParticipants().size());

        c3.end();
        assertTrue(p31.ended);
        assertEquals(c3, p31.c);
        assertTrue(p32.ended);
        assertEquals(c3, p32.c);
        assertTrue("p32 must be called before p31", p32.time < p31.time);
View Full Code Here

                {
                    p1.addParticipantFailure(t);
                }
                finally
                {
                    c2.end();
                }
            }
        };
        c2Thread.start();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.