Search in sources :

Example 1 with MockProvisionerWithCpus

use of io.cdap.cdap.internal.provision.MockProvisionerWithCpus in project cdap by caskdata.

the class ProvisionerHttpHandlerTest method testListAndGetProvisioners.

@Test
public void testListAndGetProvisioners() throws Exception {
    // in unit test, we have the mock provisioners currently
    ProvisionerSpecification spec = new MockProvisioner().getSpec();
    ProvisionerDetail expected = new ProvisionerDetail(spec.getName(), spec.getLabel(), spec.getDescription(), new ArrayList<>(), null, null, false);
    ProvisionerSpecification specWithCpus = new MockProvisionerWithCpus().getSpec();
    ProvisionerDetail expectedWithCpus = new ProvisionerDetail(specWithCpus.getName(), specWithCpus.getLabel(), specWithCpus.getDescription(), new ArrayList<>(), null, null, false);
    List<ProvisionerDetail> details = listProvisioners();
    Assert.assertEquals(ImmutableList.of(expected, expectedWithCpus), details);
    // get a non-existing provisioner should get a 404
    getProvisioner("nonExisting", 404);
    // get the mock provisioner
    Assert.assertEquals(expected, getProvisioner(MockProvisioner.NAME, 200));
}
Also used : MockProvisionerWithCpus(io.cdap.cdap.internal.provision.MockProvisionerWithCpus) ProvisionerSpecification(io.cdap.cdap.runtime.spi.provisioner.ProvisionerSpecification) MockProvisioner(io.cdap.cdap.internal.provision.MockProvisioner) ProvisionerDetail(io.cdap.cdap.proto.provisioner.ProvisionerDetail) Test(org.junit.Test)

Aggregations

MockProvisioner (io.cdap.cdap.internal.provision.MockProvisioner)1 MockProvisionerWithCpus (io.cdap.cdap.internal.provision.MockProvisionerWithCpus)1 ProvisionerDetail (io.cdap.cdap.proto.provisioner.ProvisionerDetail)1 ProvisionerSpecification (io.cdap.cdap.runtime.spi.provisioner.ProvisionerSpecification)1 Test (org.junit.Test)1