Search in sources :

Example 1 with Dependency

use of com.sequenceiq.cloudbreak.orchestrator.yarn.model.core.Dependency in project cloudbreak by hortonworks.

the class CreateApplicationToJsonConverterTest method testConvert.

@Test
public void testConvert() throws Exception {
    // CreateApplicationRequest object
    CreateApplicationRequest createApplicationRequest = new CreateApplicationRequest();
    createApplicationRequest.setName(NAME);
    createApplicationRequest.setLifetime(LIFETIME);
    createApplicationRequest.setComponents(COMPONENTS);
    // Create a component
    YarnComponent component = new YarnComponent();
    // Create the Dependency
    Dependency dependency = new Dependency();
    dependency.setItem(DEPENDENCY_ITEM);
    DEPENDENCIES.add(dependency);
    // Create the Artifact
    Artifact artifact = new Artifact();
    artifact.setId(ARTIFACT_ID);
    artifact.setType(ARTIFACT_TYPE);
    // Create the Resource
    Resource resource = new Resource();
    resource.setCpus(RESOURCE_CPUS);
    resource.setMemory(RESOURCE_MEMORY);
    // Populate the component
    component.setName(COMPONENT_NAME);
    component.setDependencies(DEPENDENCIES);
    component.setNumberOfContainers(NUM_OF_CONTAINTERS);
    component.setArtifact(artifact);
    component.setLaunchCommand(LAUNCH_COMMAND);
    component.setResource(resource);
    // Add the component to the Create Application Request
    COMPONENTS.add(component);
    CreateApplicationRequestToJsonConverter createApplicationRequestToJsonConverter = new CreateApplicationRequestToJsonConverter();
    String jsonResult = createApplicationRequestToJsonConverter.convert(createApplicationRequest);
    LOGGER.info(jsonResult);
}
Also used : CreateApplicationRequest(com.sequenceiq.cloudbreak.orchestrator.yarn.model.request.CreateApplicationRequest) Resource(com.sequenceiq.cloudbreak.orchestrator.yarn.model.core.Resource) Dependency(com.sequenceiq.cloudbreak.orchestrator.yarn.model.core.Dependency) CreateApplicationRequestToJsonConverter(com.sequenceiq.cloudbreak.orchestrator.yarn.converter.request.CreateApplicationRequestToJsonConverter) YarnComponent(com.sequenceiq.cloudbreak.orchestrator.yarn.model.core.YarnComponent) Artifact(com.sequenceiq.cloudbreak.orchestrator.yarn.model.core.Artifact) Test(org.junit.Test)

Example 2 with Dependency

use of com.sequenceiq.cloudbreak.orchestrator.yarn.model.core.Dependency in project cloudbreak by hortonworks.

the class ComponentTest method testDependencies.

@Test
public void testDependencies() {
    Dependency dependency = new Dependency();
    YarnComponent component = new YarnComponent();
    List<Dependency> dependencies = new ArrayList<>();
    dependencies.add(dependency);
    component.setDependencies(dependencies);
    assertEquals(1, component.getDependencies().size());
}
Also used : ArrayList(java.util.ArrayList) Dependency(com.sequenceiq.cloudbreak.orchestrator.yarn.model.core.Dependency) YarnComponent(com.sequenceiq.cloudbreak.orchestrator.yarn.model.core.YarnComponent) Test(org.junit.Test)

Example 3 with Dependency

use of com.sequenceiq.cloudbreak.orchestrator.yarn.model.core.Dependency in project cloudbreak by hortonworks.

the class DependencyTest method testItem.

@Test
public void testItem() throws Exception {
    Dependency dependency = new Dependency();
    dependency.setItem(ITEM);
    assertEquals(ITEM, dependency.getItem());
}
Also used : Dependency(com.sequenceiq.cloudbreak.orchestrator.yarn.model.core.Dependency) Test(org.junit.Test)

Aggregations

Dependency (com.sequenceiq.cloudbreak.orchestrator.yarn.model.core.Dependency)3 Test (org.junit.Test)3 YarnComponent (com.sequenceiq.cloudbreak.orchestrator.yarn.model.core.YarnComponent)2 CreateApplicationRequestToJsonConverter (com.sequenceiq.cloudbreak.orchestrator.yarn.converter.request.CreateApplicationRequestToJsonConverter)1 Artifact (com.sequenceiq.cloudbreak.orchestrator.yarn.model.core.Artifact)1 Resource (com.sequenceiq.cloudbreak.orchestrator.yarn.model.core.Resource)1 CreateApplicationRequest (com.sequenceiq.cloudbreak.orchestrator.yarn.model.request.CreateApplicationRequest)1 ArrayList (java.util.ArrayList)1