Search in sources :

Example 1 with QueueStatusResource

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();
    }
}
Also used : QueueStatusResource(org.apache.airavata.registry.core.experiment.catalog.resources.QueueStatusResource) RegistryException(org.apache.airavata.registry.cpi.RegistryException) ExperimentCatResource(org.apache.airavata.registry.core.experiment.catalog.ExperimentCatResource) Test(org.junit.Test)

Aggregations

ExperimentCatResource (org.apache.airavata.registry.core.experiment.catalog.ExperimentCatResource)1 QueueStatusResource (org.apache.airavata.registry.core.experiment.catalog.resources.QueueStatusResource)1 RegistryException (org.apache.airavata.registry.cpi.RegistryException)1 Test (org.junit.Test)1