Search in sources :

Example 1 with NoOpIgniteSecurityProcessor

use of org.apache.ignite.internal.processors.security.NoOpIgniteSecurityProcessor in project ignite by apache.

the class GridManagerStopSelfTest method beforeTest.

/**
 * {@inheritDoc}
 */
@Override
protected void beforeTest() throws Exception {
    ctx = newContext();
    ctx.config().setPeerClassLoadingEnabled(true);
    ctx.config().setMBeanServer(ManagementFactory.getPlatformMBeanServer());
    ctx.add(new PoolProcessor(ctx));
    ctx.add(new NoOpIgniteSecurityProcessor(ctx));
    ctx.add(new GridResourceProcessor(ctx));
    ctx.add(new GridSystemViewManager(ctx));
    ctx.start();
}
Also used : GridSystemViewManager(org.apache.ignite.internal.managers.systemview.GridSystemViewManager) GridResourceProcessor(org.apache.ignite.internal.processors.resource.GridResourceProcessor) PoolProcessor(org.apache.ignite.internal.processors.pool.PoolProcessor) NoOpIgniteSecurityProcessor(org.apache.ignite.internal.processors.security.NoOpIgniteSecurityProcessor)

Example 2 with NoOpIgniteSecurityProcessor

use of org.apache.ignite.internal.processors.security.NoOpIgniteSecurityProcessor in project ignite by apache.

the class GridFutureAdapterSelfTest method testListenNotify.

/**
 * @throws Exception If failed.
 */
@Test
public void testListenNotify() throws Exception {
    GridTestKernalContext ctx = new GridTestKernalContext(log);
    ctx.add(new NoOpIgniteSecurityProcessor(ctx));
    ctx.add(new PoolProcessor(ctx) {

        final ExecutorService execSvc = Executors.newSingleThreadExecutor(new IgniteThreadFactory("testscope", "exec-svc"));

        final ExecutorService sysExecSvc = Executors.newSingleThreadExecutor(new IgniteThreadFactory("testscope", "system-exec"));

        @Override
        public ExecutorService getSystemExecutorService() {
            return sysExecSvc;
        }

        @Override
        public ExecutorService getExecutorService() {
            return execSvc;
        }
    });
    ctx.add(new GridClosureProcessor(ctx));
    ctx.start();
    try {
        GridFutureAdapter<String> fut = new GridFutureAdapter<>();
        int lsnrCnt = 10;
        final CountDownLatch latch = new CountDownLatch(lsnrCnt);
        final Thread runThread = Thread.currentThread();
        for (int i = 0; i < lsnrCnt; i++) {
            fut.listen(new CI1<IgniteInternalFuture<String>>() {

                @Override
                public void apply(IgniteInternalFuture<String> t) {
                    assert Thread.currentThread() == runThread;
                    latch.countDown();
                }
            });
        }
        fut.onDone();
        latch.await();
        final CountDownLatch doneLatch = new CountDownLatch(1);
        fut.listen(new CI1<IgniteInternalFuture<String>>() {

            @Override
            public void apply(IgniteInternalFuture<String> t) {
                assert Thread.currentThread() == runThread;
                doneLatch.countDown();
            }
        });
        assert doneLatch.getCount() == 0;
        doneLatch.await();
    } finally {
        ctx.stop(false);
    }
}
Also used : GridTestKernalContext(org.apache.ignite.testframework.junits.GridTestKernalContext) CountDownLatch(java.util.concurrent.CountDownLatch) IgniteInternalFuture(org.apache.ignite.internal.IgniteInternalFuture) NoOpIgniteSecurityProcessor(org.apache.ignite.internal.processors.security.NoOpIgniteSecurityProcessor) IgniteThreadFactory(org.apache.ignite.thread.IgniteThreadFactory) GridClosureProcessor(org.apache.ignite.internal.processors.closure.GridClosureProcessor) ExecutorService(java.util.concurrent.ExecutorService) PoolProcessor(org.apache.ignite.internal.processors.pool.PoolProcessor) GridCommonAbstractTest(org.apache.ignite.testframework.junits.common.GridCommonAbstractTest) Test(org.junit.Test)

Aggregations

PoolProcessor (org.apache.ignite.internal.processors.pool.PoolProcessor)2 NoOpIgniteSecurityProcessor (org.apache.ignite.internal.processors.security.NoOpIgniteSecurityProcessor)2 CountDownLatch (java.util.concurrent.CountDownLatch)1 ExecutorService (java.util.concurrent.ExecutorService)1 IgniteInternalFuture (org.apache.ignite.internal.IgniteInternalFuture)1 GridSystemViewManager (org.apache.ignite.internal.managers.systemview.GridSystemViewManager)1 GridClosureProcessor (org.apache.ignite.internal.processors.closure.GridClosureProcessor)1 GridResourceProcessor (org.apache.ignite.internal.processors.resource.GridResourceProcessor)1 GridTestKernalContext (org.apache.ignite.testframework.junits.GridTestKernalContext)1 GridCommonAbstractTest (org.apache.ignite.testframework.junits.common.GridCommonAbstractTest)1 IgniteThreadFactory (org.apache.ignite.thread.IgniteThreadFactory)1 Test (org.junit.Test)1