@Test
  public void testCreateServiceComponentMultiple() throws Exception, AuthorizationException {
    String cluster1 = getUniqueName();
    String cluster2 = getUniqueName();

    clusters.addCluster(cluster1, new StackId("HDP-0.2"));
    clusters.addCluster(cluster2, new StackId("HDP-0.2"));

    Cluster c1 = clusters.getCluster(cluster1);
    StackId stackId = new StackId("HDP-0.2");

    RepositoryVersionEntity repositoryVersion = helper.getOrCreateRepositoryVersion(stackId, stackId.getStackVersion());

    Service s1 = serviceFactory.createNew(c1, "HDFS", repositoryVersion);
    Service s2 = serviceFactory.createNew(c1, "MAPREDUCE", repositoryVersion);
    c1.addService(s1);
    c1.addService(s2);

    Set<ServiceComponentRequest> set1 = new HashSet<>();
    ServiceComponentRequest valid1 =
        new ServiceComponentRequest(cluster1, "HDFS", "NAMENODE", null);
    ServiceComponentRequest valid2 =
        new ServiceComponentRequest(cluster1, "MAPREDUCE", "JOBTRACKER", null);
    ServiceComponentRequest valid3 =
        new ServiceComponentRequest(cluster1, "MAPREDUCE", "TASKTRACKER", null);
    set1.add(valid1);
    set1.add(valid2);
    set1.add(valid3);
    ComponentResourceProviderTest.createComponents(controller, set1);

    Assert.assertEquals(1, c1.getService("HDFS").getServiceComponents().size());
    Assert.assertEquals(2, c1.getService("MAPREDUCE").getServiceComponents().size());
    Assert.assertNotNull(c1.getService("HDFS")
        .getServiceComponent("NAMENODE"));
    Assert.assertNotNull(c1.getService("MAPREDUCE")
        .getServiceComponent("JOBTRACKER"));
    Assert.assertNotNull(c1.getService("MAPREDUCE")
        .getServiceComponent("TASKTRACKER"));
  }
Allows to set maintenanceStateHelper. For use when there is anything to test
with maintenance mode.
ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java