Search in sources :

Example 1 with ThreadCommunicator

use of cl.utfsm.samplingSystemUI.core.ThreadCommunicator in project ACS by ACS-Community.

the class ThreadCommunicatorTest method testConsistency.

public void testConsistency() throws Exception {
    ThreadCommunicator tc1 = ThreadCommunicator.getInstance();
    LinkedBlockingQueue tvn = tc1.createChannel("TVN");
    LinkedBlockingQueue chv = tc1.createChannel("CHV");
    assertEquals(tvn, tc1.getChannel("TVN"));
    assertEquals(chv, tc1.getChannel("CHV"));
    assertNotSame(tvn, chv);
}
Also used : ThreadCommunicator(cl.utfsm.samplingSystemUI.core.ThreadCommunicator) LinkedBlockingQueue(java.util.concurrent.LinkedBlockingQueue)

Example 2 with ThreadCommunicator

use of cl.utfsm.samplingSystemUI.core.ThreadCommunicator in project ACS by ACS-Community.

the class ThreadCommunicatorTest method testDeletion.

/* public void testDuplicate(){
		ThreadCommunicator tc1= ThreadCommunicator.getInstance();
		tc1.removeChannel("TVN");
               	LinkedBlockingQueue tvn = tc1.createChannel("TVN");
		try {
			LinkedBlockingQueue chv = tc1.createChannel("TVN");
			fail("Duplicate channel must be avoided");

		}
		catch(IllegalArgumentException e){
			assertTrue("Duplicate channel launched exception",true);
			return;
		}
	}*/
public void testDeletion() throws Exception {
    ThreadCommunicator tc1 = ThreadCommunicator.getInstance();
    tc1.removeChannel("TVN");
    tc1.createChannel("TVN");
    tc1.removeChannel("TVN");
    assertNull(tc1.getChannel("TVN"));
}
Also used : ThreadCommunicator(cl.utfsm.samplingSystemUI.core.ThreadCommunicator)

Example 3 with ThreadCommunicator

use of cl.utfsm.samplingSystemUI.core.ThreadCommunicator in project ACS by ACS-Community.

the class ThreadCommunicatorTest method testSingleton.

public void testSingleton() throws Exception {
    ThreadCommunicator tc1 = null;
    ThreadCommunicator tc2 = null;
    tc1 = ThreadCommunicator.getInstance();
    tc2 = ThreadCommunicator.getInstance();
    assertNotNull(tc1);
    assertNotNull(tc2);
    assertEquals(tc1, tc2);
}
Also used : ThreadCommunicator(cl.utfsm.samplingSystemUI.core.ThreadCommunicator)

Aggregations

ThreadCommunicator (cl.utfsm.samplingSystemUI.core.ThreadCommunicator)3 LinkedBlockingQueue (java.util.concurrent.LinkedBlockingQueue)1