Search in sources :

Example 1 with JobsLogs

use of io.crate.operation.collect.stats.JobsLogs in project crate by crate.

the class ConnectionContextTest method setUp.

@Before
public void setUp() throws Exception {
    JobsLogs jobsLogs = new JobsLogs(() -> true);
    sqlOperations = new SQLOperations(e.analyzer, e.planner, () -> mock(Executor.class), jobsLogs, Settings.EMPTY, clusterService) {

        @Override
        public Session createSession(@Nullable String defaultSchema, Set<Option> options, int defaultLimit) {
            Session session = super.createSession(defaultSchema, options, defaultLimit);
            sessions.add(session);
            return session;
        }
    };
}
Also used : Option(io.crate.action.sql.Option) JobsLogs(io.crate.operation.collect.stats.JobsLogs) SQLOperations(io.crate.action.sql.SQLOperations) Before(org.junit.Before)

Example 2 with JobsLogs

use of io.crate.operation.collect.stats.JobsLogs in project crate by crate.

the class JobExecutionContextTest method testErrorMessageIsIncludedInStatsTableOnFailure.

@Test
public void testErrorMessageIsIncludedInStatsTableOnFailure() throws Exception {
    JobsLogs jobsLogs = mock(JobsLogs.class);
    JobExecutionContext.Builder builder = new JobExecutionContext.Builder(UUID.randomUUID(), coordinatorNode, Collections.emptyList(), jobsLogs);
    ExecutionSubContext executionSubContext = new AbstractExecutionSubContext(0, logger) {

        @Override
        public String name() {
            return "dummy";
        }
    };
    builder.addSubContext(executionSubContext);
    builder.build();
    executionSubContext.kill(new IllegalStateException("dummy"));
    verify(jobsLogs).operationFinished(anyInt(), any(UUID.class), eq("dummy"), anyLong());
}
Also used : JobsLogs(io.crate.operation.collect.stats.JobsLogs) UUID(java.util.UUID) Test(org.junit.Test) CrateUnitTest(io.crate.test.integration.CrateUnitTest)

Example 3 with JobsLogs

use of io.crate.operation.collect.stats.JobsLogs in project crate by crate.

the class DecommissioningServiceTest method setUp.

@Before
public void setUp() throws Exception {
    NodeSettingsService settingsService = new NodeSettingsService(Settings.EMPTY);
    threadPool = mock(ThreadPool.class, Answers.RETURNS_MOCKS.get());
    jobsLogs = new JobsLogs(() -> true);
    sqlOperations = mock(SQLOperations.class, Answers.RETURNS_MOCKS.get());
    decommissioningService = new TestableDecommissioningService(Settings.EMPTY, new NoopClusterService(), jobsLogs, threadPool, settingsService, sqlOperations, mock(TransportClusterHealthAction.class), mock(TransportClusterUpdateSettingsAction.class));
}
Also used : ThreadPool(org.elasticsearch.threadpool.ThreadPool) JobsLogs(io.crate.operation.collect.stats.JobsLogs) NodeSettingsService(org.elasticsearch.node.settings.NodeSettingsService) SQLOperations(io.crate.action.sql.SQLOperations) NoopClusterService(org.elasticsearch.test.cluster.NoopClusterService) Before(org.junit.Before)

Example 4 with JobsLogs

use of io.crate.operation.collect.stats.JobsLogs in project crate by crate.

the class RemoteCollectorTest method setUp.

@Before
public void setUp() throws Exception {
    MockitoAnnotations.initMocks(this);
    UUID jobId = UUID.randomUUID();
    RoutedCollectPhase collectPhase = new RoutedCollectPhase(jobId, 0, "remoteCollect", new Routing(ImmutableMap.<String, Map<String, List<Integer>>>of("remoteNode", ImmutableMap.of("dummyTable", Collections.singletonList(1)))), RowGranularity.DOC, Collections.<Symbol>singletonList(createReference("name", DataTypes.STRING)), Collections.<Projection>emptyList(), WhereClause.MATCH_ALL, DistributionInfo.DEFAULT_BROADCAST);
    transportJobAction = mock(TransportJobAction.class);
    transportKillJobsNodeAction = mock(TransportKillJobsNodeAction.class);
    consumer = new TestingBatchConsumer();
    JobsLogs jobsLogs = new JobsLogs(() -> true);
    JobContextService jobContextService = new JobContextService(Settings.EMPTY, new NoopClusterService(), jobsLogs);
    remoteCollector = new RemoteCollector(jobId, "localNode", "remoteNode", transportJobAction, transportKillJobsNodeAction, jobContextService, mock(RamAccountingContext.class), consumer, collectPhase);
}
Also used : TransportJobAction(io.crate.action.job.TransportJobAction) TransportKillJobsNodeAction(io.crate.executor.transport.kill.TransportKillJobsNodeAction) Routing(io.crate.metadata.Routing) TestingBatchConsumer(io.crate.testing.TestingBatchConsumer) JobsLogs(io.crate.operation.collect.stats.JobsLogs) UUID(java.util.UUID) Map(java.util.Map) ImmutableMap(com.google.common.collect.ImmutableMap) NoopClusterService(org.elasticsearch.test.cluster.NoopClusterService) RoutedCollectPhase(io.crate.planner.node.dql.RoutedCollectPhase) JobContextService(io.crate.jobs.JobContextService) Before(org.junit.Before)

Example 5 with JobsLogs

use of io.crate.operation.collect.stats.JobsLogs in project crate by crate.

the class JobContextServiceTest method prepare.

@Before
public void prepare() throws Exception {
    JobsLogs jobsLogs = new JobsLogs(() -> true);
    jobContextService = new JobContextService(Settings.EMPTY, new NoopClusterService(), jobsLogs);
}
Also used : JobsLogs(io.crate.operation.collect.stats.JobsLogs) NoopClusterService(org.elasticsearch.test.cluster.NoopClusterService) Before(org.junit.Before)

Aggregations

JobsLogs (io.crate.operation.collect.stats.JobsLogs)5 Before (org.junit.Before)4 NoopClusterService (org.elasticsearch.test.cluster.NoopClusterService)3 SQLOperations (io.crate.action.sql.SQLOperations)2 UUID (java.util.UUID)2 ImmutableMap (com.google.common.collect.ImmutableMap)1 TransportJobAction (io.crate.action.job.TransportJobAction)1 Option (io.crate.action.sql.Option)1 TransportKillJobsNodeAction (io.crate.executor.transport.kill.TransportKillJobsNodeAction)1 JobContextService (io.crate.jobs.JobContextService)1 Routing (io.crate.metadata.Routing)1 RoutedCollectPhase (io.crate.planner.node.dql.RoutedCollectPhase)1 CrateUnitTest (io.crate.test.integration.CrateUnitTest)1 TestingBatchConsumer (io.crate.testing.TestingBatchConsumer)1 Map (java.util.Map)1 NodeSettingsService (org.elasticsearch.node.settings.NodeSettingsService)1 ThreadPool (org.elasticsearch.threadpool.ThreadPool)1 Test (org.junit.Test)1