use of org.apache.airavata.registry.core.experiment.catalog.resources.QueueStatusResource in project airavata by apache.
the class QueueStatusResourceTest method test.
@Test
public void test() {
QueueStatusResource queueStatusResource1 = new QueueStatusResource();
queueStatusResource1.setHostName("bigred2.uits.iu.edu");
queueStatusResource1.setQueueName("cpu");
queueStatusResource1.setTime((long) 1 + System.currentTimeMillis());
queueStatusResource1.setQueueUp(true);
queueStatusResource1.setRunningJobs(3);
queueStatusResource1.setQueuedJobs(4);
try {
queueStatusResource1.save();
} catch (RegistryException e) {
e.printStackTrace();
Assert.fail();
}
QueueStatusResource queueStatusResource2 = new QueueStatusResource();
queueStatusResource2.setHostName("bigred2.uits.iu.edu");
queueStatusResource2.setQueueName("cpu");
queueStatusResource2.setTime((long) 2 + System.currentTimeMillis());
queueStatusResource2.setQueueUp(true);
queueStatusResource2.setRunningJobs(33);
queueStatusResource2.setQueuedJobs(44);
try {
queueStatusResource2.save();
} catch (RegistryException e) {
e.printStackTrace();
Assert.fail();
}
try {
List<ExperimentCatResource> experimentCatResources = queueStatusResource1.get(ResourceType.QUEUE_STATUS);
Assert.assertTrue(experimentCatResources.size() == 1);
QueueStatusResource queueStatusResource = (QueueStatusResource) experimentCatResources.get(0);
Assert.assertEquals(queueStatusResource2.getTime(), queueStatusResource.getTime());
} catch (RegistryException e) {
e.printStackTrace();
Assert.fail();
}
}
Aggregations