Search in sources :

Example 6 with RejectedThread

use of com.sequenceiq.periscope.model.RejectedThread in project cloudbreak by hortonworks.

the class RejectedThreadServiceTest method testCreateWhenAutoscaleStackResponseAndRemove.

@Test
public void testCreateWhenAutoscaleStackResponseAndRemove() {
    AutoscaleStackV4Response response = new AutoscaleStackV4Response();
    response.setStackId(1L);
    EvaluatorExecutor task = new TestEvaluatorExecutor(getContext(response));
    underTest.create(task);
    List<RejectedThread> allRejectedCluster = underTest.getAllRejectedCluster();
    Assert.assertFalse(allRejectedCluster.isEmpty());
    Assert.assertEquals(1L, allRejectedCluster.get(0).getId());
    underTest.remove(response);
    allRejectedCluster = underTest.getAllRejectedCluster();
    Assert.assertTrue(allRejectedCluster.isEmpty());
}
Also used : RejectedThread(com.sequenceiq.periscope.model.RejectedThread) AutoscaleStackV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.AutoscaleStackV4Response) EvaluatorExecutor(com.sequenceiq.periscope.monitor.evaluator.EvaluatorExecutor) Test(org.junit.Test)

Example 7 with RejectedThread

use of com.sequenceiq.periscope.model.RejectedThread in project cloudbreak by hortonworks.

the class RejectedThreadServiceTest method testCreateWhenAutoscaleStackResponseCountEqualsTwo.

@Test
public void testCreateWhenAutoscaleStackResponseCountEqualsTwo() {
    AutoscaleStackV4Response response = new AutoscaleStackV4Response();
    response.setStackId(1L);
    EvaluatorExecutor task = new TestEvaluatorExecutor(getContext(response));
    underTest.create(task);
    underTest.create(task);
    List<RejectedThread> allRejectedCluster = underTest.getAllRejectedCluster();
    Assert.assertFalse(allRejectedCluster.isEmpty());
    Assert.assertEquals(1L, allRejectedCluster.get(0).getId());
    Assert.assertEquals(2L, allRejectedCluster.get(0).getRejectedCount());
}
Also used : RejectedThread(com.sequenceiq.periscope.model.RejectedThread) AutoscaleStackV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.AutoscaleStackV4Response) EvaluatorExecutor(com.sequenceiq.periscope.monitor.evaluator.EvaluatorExecutor) Test(org.junit.Test)

Example 8 with RejectedThread

use of com.sequenceiq.periscope.model.RejectedThread in project cloudbreak by hortonworks.

the class RejectedThreadServiceTest method testCreateWhenClusterIdAndRemove.

@Test
public void testCreateWhenClusterIdAndRemove() {
    Long data = 1L;
    EvaluatorExecutor task = new TestEvaluatorExecutor(getContext(data));
    underTest.create(task);
    List<RejectedThread> allRejectedCluster = underTest.getAllRejectedCluster();
    Assert.assertFalse(allRejectedCluster.isEmpty());
    Assert.assertEquals(1L, allRejectedCluster.get(0).getId());
    underTest.remove(data);
    allRejectedCluster = underTest.getAllRejectedCluster();
    Assert.assertTrue(allRejectedCluster.isEmpty());
}
Also used : RejectedThread(com.sequenceiq.periscope.model.RejectedThread) EvaluatorExecutor(com.sequenceiq.periscope.monitor.evaluator.EvaluatorExecutor) Test(org.junit.Test)

Example 9 with RejectedThread

use of com.sequenceiq.periscope.model.RejectedThread in project cloudbreak by hortonworks.

the class RejectedThreadMonitorTest method rejectedThread.

private RejectedThread rejectedThread(long count) {
    RejectedThread rejectedThread = new RejectedThread();
    rejectedThread.setRejectedCount(count);
    return rejectedThread;
}
Also used : RejectedThread(com.sequenceiq.periscope.model.RejectedThread)

Aggregations

RejectedThread (com.sequenceiq.periscope.model.RejectedThread)9 EvaluatorExecutor (com.sequenceiq.periscope.monitor.evaluator.EvaluatorExecutor)6 Test (org.junit.Test)6 AutoscaleStackV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.AutoscaleStackV4Response)4