Package org.springframework.yarn.am.grid.support

Examples of org.springframework.yarn.am.grid.support.ProjectionData


  public void testReleaseShouldReAllocate() throws Exception {
    TestContainerAllocator allocator = new TestContainerAllocator();
    TestContainerLauncher launcher = new TestContainerLauncher();
    TestManagedContainerClusterAppmaster appmaster = createTestAppmaster(allocator, launcher);
    appmaster.setStateMachineFactory(stateMachineFactory);
    ProjectionData projectionData = new ProjectionData(1, null, null, "any", 0);

    // create and start
    GridProjection projection = appmaster.createContainerCluster("foo", projectionData).getGridProjection();
    appmaster.startContainerCluster("foo");
    assertDoTask(appmaster, 1, 0, 0, 0, "foo");
View Full Code Here


  public void testCreateStartStopDestroyOneCluster() throws Exception {
    TestContainerAllocator allocator = new TestContainerAllocator();
    TestContainerLauncher launcher = new TestContainerLauncher();
    TestManagedContainerClusterAppmaster appmaster = createTestAppmaster(allocator, launcher);
    appmaster.setStateMachineFactory(stateMachineFactory);
    ProjectionData projectionData = new ProjectionData(1, null, null, "any", 0);
    appmaster.createContainerCluster("foo", projectionData);
    appmaster.startContainerCluster("foo");
    appmaster.stopContainerCluster("foo");
    assertDoTask(appmaster, 0, 0, 0, 0, "foo");
    appmaster.destroyContainerCluster("foo");
View Full Code Here

  public void testCreateStartStopStartOneCluster() throws Exception {
    TestContainerAllocator allocator = new TestContainerAllocator();
    TestContainerLauncher launcher = new TestContainerLauncher();
    TestManagedContainerClusterAppmaster appmaster = createTestAppmaster(allocator, launcher);
    appmaster.setStateMachineFactory(stateMachineFactory);
    ProjectionData projectionData = new ProjectionData(1, null, null, "any", 0);
    appmaster.createContainerCluster("foo", projectionData);
    appmaster.startContainerCluster("foo");
    assertThat(appmaster.getContainerClusters().get("foo").getStateMachine().getState().getId(), is(ClusterState.RUNNING));
    assertDoTask(appmaster, 1, 0, 0, 0, "foo");
    appmaster.stopContainerCluster("foo");
View Full Code Here

  public void testCreateDestroyOneCluster() throws Exception {
    TestContainerAllocator allocator = new TestContainerAllocator();
    TestContainerLauncher launcher = new TestContainerLauncher();
    TestManagedContainerClusterAppmaster appmaster = createTestAppmaster(allocator, launcher);
    appmaster.setStateMachineFactory(stateMachineFactory);
    ProjectionData projectionData = new ProjectionData(1, null, null, "any", 0);
    appmaster.createContainerCluster("foo", projectionData);
    assertThat(appmaster.getContainerClusters().size(), is(1));
    appmaster.destroyContainerCluster("foo");
    assertThat(appmaster.getContainerClusters().size(), is(0));
  }
View Full Code Here

    TestManagedContainerClusterAppmaster appmaster = createTestAppmaster(allocator, launcher);
    appmaster.setStateMachineFactory(stateMachineFactory);
    Map<String, Integer> hosts = new HashMap<String, Integer>();
    hosts.put("host1", 2);
    hosts.put("host2", 2);
    ProjectionData projectionData = new ProjectionData(0, hosts, null, "hosts", 0);

    // create
    GridProjection projection = appmaster.createContainerCluster("foo", projectionData).getGridProjection();
    assertDoTask(appmaster, null, null, null, null, "foo");

    // start
    appmaster.startContainerCluster("foo");
    assertDoTask(appmaster, 0, 2, 0, 0, "foo");

    // allocate container 1
    allocateContainer(appmaster, 1, "host1");
    assertThat(projection.getMembers().size(), is(1));

    // allocate container 2
    allocateContainer(appmaster, 2, "host1");
    assertThat(projection.getMembers().size(), is(2));

    // allocate container 3
    allocateContainer(appmaster, 3, "host2");
    assertThat(projection.getMembers().size(), is(3));

    // allocate container 4
    allocateContainer(appmaster, 4, "host2");
    assertThat(projection.getMembers().size(), is(4));

    assertDoTask(appmaster, null, null, null, null, "foo");

    // modify - set only host1
    hosts.clear();
    hosts.put("host1", 1);
    appmaster.modifyContainerCluster("foo", new ProjectionData(0,hosts,null));

    SatisfyStateData satisfyState = appmaster.getContainerClusters().get("foo").getGridProjection().getSatisfyState();
    assertThat(satisfyState.getRemoveData().size(), is(3));

//    Map<String, Integer> hostsfromprojection = appmaster.getContainerClusters().get("foo").getGridProjection().getProjectionData().getHosts();
View Full Code Here

  public void testCreateUndefinedCluster() throws Exception {
    TestContainerAllocator allocator = new TestContainerAllocator();
    TestContainerLauncher launcher = new TestContainerLauncher();
    TestManagedContainerClusterAppmaster appmaster = createTestAppmaster(allocator, launcher);
    appmaster.setStateMachineFactory(stateMachineFactory);
    ProjectionData projectionData = new ProjectionData(1, null, null, "doesnotexist", null);
    appmaster.createContainerCluster("doesnotexist", projectionData);
  }
View Full Code Here

    TestContainerLauncher launcher = new TestContainerLauncher();
    TestManagedContainerClusterAppmaster appmaster = createTestAppmaster(allocator, launcher);
    appmaster.setStateMachineFactory(stateMachineFactory);
    Map<String, Integer> hosts = new HashMap<String, Integer>();
    hosts.put("host1", 1);
    ProjectionData projectionData = new ProjectionData(0, hosts, null, "hosts", 0);

    GridProjection projection = appmaster.createContainerCluster("foo", projectionData).getGridProjection();
    assertDoTask(appmaster, null, null, null, null, "foo");

    // we hook into statemachine to listen its events
View Full Code Here

  public void testCreateTwoClusters() throws Exception {
    ManagedContainerClusterAppmaster appmaster = createManagedAppmaster();
    appmaster.setStateMachineFactory(stateMachineFactory);

    // cluster1
    ProjectionData projectionData1 = new ProjectionData(1, null, null, "any", 0);
    appmaster.createContainerCluster("cluster1", projectionData1);

    // cluster2
    ProjectionData projectionData2 = new ProjectionData(1, null, null, "any", 0);
    appmaster.createContainerCluster("cluster2", projectionData2);

//    assertSatisfyStateData(appmaster, 2, null, null, null);
  }
View Full Code Here

    TestContainerAllocator allocator = new TestContainerAllocator();
    TestContainerLauncher launcher = new TestContainerLauncher();
    TestManagedContainerClusterAppmaster appmaster = createTestAppmaster(allocator, launcher);
    appmaster.setStateMachineFactory(stateMachineFactory);

    ProjectionData projectionData1 = new ProjectionData(1, null, null, "any", 0);
    appmaster.createContainerCluster("cluster1", projectionData1);
    appmaster.startContainerCluster("cluster1");

    ProjectionData projectionData2 = new ProjectionData(1, null, null, "any", 0);
    appmaster.createContainerCluster("cluster2", projectionData2);
    appmaster.startContainerCluster("cluster2");


    // should get 1 any alloc and no container kills
View Full Code Here

    TestContainerLauncher launcher = new TestContainerLauncher();
    TestManagedContainerClusterAppmaster appmaster = createTestAppmaster(allocator, launcher);
    appmaster.setStateMachineFactory(stateMachineFactory);

    // cluster1
    ProjectionData projectionData1 = new ProjectionData(1, null, null, "any", 0);
    GridProjection projection1 = appmaster.createContainerCluster("cluster1", projectionData1).getGridProjection();

    // cluster2
    ProjectionData projectionData2 = new ProjectionData(1, null, null, "any", 0);
    GridProjection projection2 = appmaster.createContainerCluster("cluster2", projectionData2).getGridProjection();

    appmaster.startContainerCluster("cluster1");
    assertDoTask(appmaster, 1, 0, 0, 0, "cluster1");
    assertDoTask(appmaster, null, null, null, null, "cluster2");

    appmaster.startContainerCluster("cluster2");
    assertDoTask(appmaster, 1, 0, 0, 0, "cluster2");
    assertDoTask(appmaster, null, null, null, null, "cluster1");

    // allocate container 1
    allocateContainer(appmaster, 1);
    assertThat(projection1.getMembers().size() + projection2.getMembers().size(), is(1));
//    assertDoTask(appmaster, null, null, null, null, "cluster1");

    allocateContainer(appmaster, 2);
    assertThat(projection1.getMembers().size() + projection2.getMembers().size(), is(2));
//    assertDoTask(appmaster, null, null, null, null, "cluster1");

    allocateContainer(appmaster, 3);
    assertThat(projection1.getMembers().size(), is(1));
    assertThat(projection2.getMembers().size(), is(1));

    // modify - ramp up to 2
    appmaster.modifyContainerCluster("cluster1", new ProjectionData(2));
    assertDoTask(appmaster, 1, 0, 0, 0, "cluster1");


  }
View Full Code Here

TOP

Related Classes of org.springframework.yarn.am.grid.support.ProjectionData

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.