Search in sources :

Example 1 with MyMTClass

use of org.exoplatform.container.TestExoContainer.MyMTClass in project kernel by exoplatform.

the class TestExoContainerThreadSafety method getComponentInstance.

@Test
@PerfTest(invocations = TOTAL_THREADS, threads = TOTAL_THREADS)
public void getComponentInstance() throws InterruptedException, BrokenBarrierException {
    // Needed to make sure that all threads start at the same time
    startSignal.await();
    MyMTClass value = (MyMTClass) container.getComponentInstance(MyMTClass.class);
    currentMyClass.compareAndSet(null, value);
    assertEquals(currentMyClass.get(), container.getComponentInstance(MyMTClass.class));
}
Also used : MyMTClass(org.exoplatform.container.TestExoContainer.MyMTClass) PerfTest(org.databene.contiperf.PerfTest) Test(org.junit.Test) PerfTest(org.databene.contiperf.PerfTest)

Example 2 with MyMTClass

use of org.exoplatform.container.TestExoContainer.MyMTClass in project kernel by exoplatform.

the class TestExoContainerThreadSafety method getComponentInstanceOfType.

@Test
@PerfTest(invocations = TOTAL_THREADS, threads = TOTAL_THREADS)
public void getComponentInstanceOfType() throws InterruptedException, BrokenBarrierException {
    // Needed to make sure that all threads start at the same time
    startSignal.await();
    MyMTClass value = (MyMTClass) container.getComponentInstanceOfType(MyMTClass.class);
    currentMyClass.compareAndSet(null, value);
    assertEquals(currentMyClass.get(), container.getComponentInstanceOfType(MyMTClass.class));
}
Also used : MyMTClass(org.exoplatform.container.TestExoContainer.MyMTClass) PerfTest(org.databene.contiperf.PerfTest) Test(org.junit.Test) PerfTest(org.databene.contiperf.PerfTest)

Aggregations

PerfTest (org.databene.contiperf.PerfTest)2 MyMTClass (org.exoplatform.container.TestExoContainer.MyMTClass)2 Test (org.junit.Test)2