Package com.netflix.priam.agent.tasks

Examples of com.netflix.priam.agent.tasks.ProcessTask


        MockStorage storage = new MockStorage();
        storage.setValue(configuration, ProcessTask.ROW_KEY, "localhost", commandTab.toString());

        MockNodeStatus nodeStatus = new MockNodeStatus();
        AgentProcessManager processManager = new AgentProcessManager(new AgentProcessMap(AgentProcessMap.buildDefaultMap()), configuration, nodeStatus);
        ProcessTask processTask = new ProcessTask(configuration, processManager, storage);
        processTask.execute();

        Assert.assertTrue(nodeStatus.getFlushLatch().await(5, TimeUnit.SECONDS));

        for ( int i = 0; i < 5; ++i )
        {
            Assert.assertEquals(nodeStatus.getOperations().size(), 1);
            Assert.assertEquals(nodeStatus.getOperations().get(0), "flush");
            TimeUnit.SECONDS.sleep(1);
        }

        commandObject = new JSONObject();
        commandObject.put(FIELD_COMMAND, COMMAND_STOP);
        commandObject.put(FIELD_ID, "1");
        commandTab = new JSONArray();
        commandTab.put(commandObject);
        storage.setValue(configuration, ProcessTask.ROW_KEY, "localhost", commandTab.toString());
        processTask.execute();

        Assert.assertTrue(processManager.closeAndWaitForCompletion(5, TimeUnit.SECONDS));
        Assert.assertEquals(processManager.getActiveProcesses().size(), 0);
    }
View Full Code Here


        MockStorage storage = new MockStorage();
        storage.setValue(configuration, ProcessTask.ROW_KEY, "localhost", commandTab.toString());

        MockNodeStatus nodeStatus = new MockNodeStatus();
        AgentProcessManager processManager = new AgentProcessManager(new AgentProcessMap(AgentProcessMap.buildDefaultMap()), configuration, nodeStatus);
        ProcessTask processTask = new ProcessTask(configuration, processManager, storage);
        processTask.execute();
        Assert.assertTrue(processManager.closeAndWaitForCompletion(5, TimeUnit.SECONDS));

        Assert.assertEquals(nodeStatus.getOperations().size(), 1);
        Assert.assertEquals(nodeStatus.getOperations().get(0), "compact");
View Full Code Here

TOP

Related Classes of com.netflix.priam.agent.tasks.ProcessTask

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.