Package org.apache.ambari.scom

Examples of org.apache.ambari.scom.TestClusterDefinitionProvider


    types.add(Resource.Type.Task);
  }

  @Test
  public void testGetResourceProvider() throws Exception {
    ClusterDefinition clusterDefinition = new ClusterDefinition(new TestStateProvider(), new TestClusterDefinitionProvider(), new TestHostInfoProvider());
    clusterDefinition.setServiceState("HDFS", "INSTALLED");

    for (Resource.Type type : types) {
      ResourceProvider provider = AbstractResourceProvider.getResourceProvider(type, clusterDefinition);
      Set<Resource> resources = provider.getResources(PropertyHelper.getReadRequest(), null);
View Full Code Here


*/
public class ClusterDefinitionTest {
  @Test
  public void testGetServices() throws Exception {

    ClusterDefinition clusterDefinition = new ClusterDefinition(new TestStateProvider(), new TestClusterDefinitionProvider(), new TestHostInfoProvider());

    Set<String> services = clusterDefinition.getServices();

    Assert.assertTrue(services.contains("HDFS"));
    Assert.assertTrue(services.contains("FLUME"));
View Full Code Here

    Assert.assertTrue(services.contains("WEBHCAT"));
  }

  @Test
  public void testGetHosts() throws Exception {
    ClusterDefinition clusterDefinition = new ClusterDefinition(new TestStateProvider(), new TestClusterDefinitionProvider(), new TestHostInfoProvider());

    Set<String> hosts = clusterDefinition.getHosts();

    Assert.assertTrue(hosts.contains("NAMENODE_MASTER.acme.com"));
    Assert.assertTrue(hosts.contains("SECONDARY_NAMENODE_MASTER.acme.com"));
View Full Code Here

    Assert.assertTrue(hosts.contains("WEBHCAT_MASTER.acme.com"));
  }

  @Test
  public void testGetComponents() throws Exception {
    ClusterDefinition clusterDefinition = new ClusterDefinition(new TestStateProvider(), new TestClusterDefinitionProvider(), new TestHostInfoProvider());

    Set<String> components = clusterDefinition.getComponents("HDFS");
    Assert.assertTrue(components.contains("NAMENODE"));
    Assert.assertTrue(components.contains("SECONDARY_NAMENODE"));
    Assert.assertTrue(components.contains("DATANODE"));
View Full Code Here

    Assert.assertTrue(components.contains("HIVE_SERVER"));
  }

  @Test
  public void testGetHostComponents() throws Exception {
    ClusterDefinition clusterDefinition = new ClusterDefinition(new TestStateProvider(), new TestClusterDefinitionProvider(), new TestHostInfoProvider());

    Set<String> hostComponents = clusterDefinition.getHostComponents("HDFS", "NAMENODE_MASTER.acme.com");

    Assert.assertTrue(hostComponents.contains("NAMENODE"));
View Full Code Here

  public void testSetServiceState_IfStateAlreadySetToDesired() {
    StateProvider mockStateProvider = createStrictMock(StateProvider.class);
    ClusterDefinitionProvider mockClusterDefinitionProvider = createStrictMock(ClusterDefinitionProvider.class);
    HostInfoProvider mockHostInfoProvider = createStrictMock(HostInfoProvider.class);

    TestClusterDefinitionProvider testClusterDefinitionProvider = new TestClusterDefinitionProvider();

    expect(mockClusterDefinitionProvider.getClusterName()).andDelegateTo(testClusterDefinitionProvider);
    expect(mockClusterDefinitionProvider.getVersionId()).andDelegateTo(testClusterDefinitionProvider);
    expect(mockClusterDefinitionProvider.getInputStream()).andDelegateTo(testClusterDefinitionProvider);
    expect(mockStateProvider.getRunningState(anyObject(String.class), anyObject(String.class))).andReturn(StateProvider.State.Running).times(5);
View Full Code Here

  public void testSetServiceState_IfStateUnknown() {
    StateProvider mockStateProvider = createStrictMock(StateProvider.class);
    ClusterDefinitionProvider mockClusterDefinitionProvider = createStrictMock(ClusterDefinitionProvider.class);
    HostInfoProvider mockHostInfoProvider = createStrictMock(HostInfoProvider.class);

    TestClusterDefinitionProvider testClusterDefinitionProvider = new TestClusterDefinitionProvider();

    expect(mockClusterDefinitionProvider.getClusterName()).andDelegateTo(testClusterDefinitionProvider);
    expect(mockClusterDefinitionProvider.getVersionId()).andDelegateTo(testClusterDefinitionProvider);
    expect(mockClusterDefinitionProvider.getInputStream()).andDelegateTo(testClusterDefinitionProvider);
View Full Code Here

  public void testSetServiceState_FromInstalledToStarted() {
    StateProvider mockStateProvider = createStrictMock(StateProvider.class);
    ClusterDefinitionProvider mockClusterDefinitionProvider = createStrictMock(ClusterDefinitionProvider.class);
    HostInfoProvider mockHostInfoProvider = createStrictMock(HostInfoProvider.class);

    TestClusterDefinitionProvider testClusterDefinitionProvider = new TestClusterDefinitionProvider();

    expect(mockClusterDefinitionProvider.getClusterName()).andDelegateTo(testClusterDefinitionProvider);
    expect(mockClusterDefinitionProvider.getVersionId()).andDelegateTo(testClusterDefinitionProvider);
    expect(mockClusterDefinitionProvider.getInputStream()).andDelegateTo(testClusterDefinitionProvider);
    //checking if a service state already set
View Full Code Here

  public void testSetServiceStateFromInstalledToStartedWhenOneOfTheComponentsAlreadyStarted() {
    StateProvider mockStateProvider = createStrictMock(StateProvider.class);
    ClusterDefinitionProvider mockClusterDefinitionProvider = createStrictMock(ClusterDefinitionProvider.class);
    HostInfoProvider mockHostInfoProvider = createStrictMock(HostInfoProvider.class);

    TestClusterDefinitionProvider testClusterDefinitionProvider = new TestClusterDefinitionProvider();

    expect(mockClusterDefinitionProvider.getClusterName()).andDelegateTo(testClusterDefinitionProvider);
    expect(mockClusterDefinitionProvider.getVersionId()).andDelegateTo(testClusterDefinitionProvider);
    expect(mockClusterDefinitionProvider.getInputStream()).andDelegateTo(testClusterDefinitionProvider);
    //checking if a service state already set
View Full Code Here

  public void testSetHostComponentState_IfStateUnknown() {
    StateProvider mockStateProvider = createStrictMock(StateProvider.class);
    ClusterDefinitionProvider mockClusterDefinitionProvider = createStrictMock(ClusterDefinitionProvider.class);
    HostInfoProvider mockHostInfoProvider = createStrictMock(HostInfoProvider.class);

    TestClusterDefinitionProvider testClusterDefinitionProvider = new TestClusterDefinitionProvider();

    expect(mockClusterDefinitionProvider.getClusterName()).andDelegateTo(testClusterDefinitionProvider);
    expect(mockClusterDefinitionProvider.getVersionId()).andDelegateTo(testClusterDefinitionProvider);
    expect(mockClusterDefinitionProvider.getInputStream()).andDelegateTo(testClusterDefinitionProvider);
View Full Code Here

TOP

Related Classes of org.apache.ambari.scom.TestClusterDefinitionProvider

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.