@Test
  public void testInitializeAtGLUSTERFSCluster() throws AmbariException {

    StackId stackId = new StackId("HDP", "2.0.6");
    ClusterImpl cluster = createMock(ClusterImpl.class);
    Service service = createMock(Service.class);
    expect(service.getDesiredStackId()).andReturn(stackId);
    expect(cluster.getClusterId()).andReturn(1L);
    expect(cluster.getService("GLUSTERFS")).andReturn(service);
    expect(cluster.getService("HDFS")).andReturn(null);
    expect(cluster.getService("YARN")).andReturn(null);

    expect(cluster.getServices()).andReturn(ImmutableMap.<String, Service>builder()
        .put("GLUSTERFS", service)
        .build()).atLeastOnce();

    replay(cluster, service);

    RoleCommandOrder rco = roleCommandOrderProvider.getRoleCommandOrder(cluster);

    Map<RoleCommandPair, Set<RoleCommandPair>> deps = rco.getDependencies();
    assertTrue("Dependencies are loaded after initialization", deps.size() > 0);
    verify(cluster, service);
	// Check that HDFS components are not present in dependencies
    // Checking blocked roles
    assertFalse(dependenciesContainBlockedRole(deps, Role.DATANODE));
    assertFalse(dependenciesContainBlockedRole(deps, Role.NAMENODE));
    assertFalse(dependenciesContainBlockedRole(deps, Role.SECONDARY_NAMENODE));
    assertFalse(dependenciesContainBlockedRole(deps, Role.JOURNALNODE));
    assertFalse(dependenciesContainBlockedRole(deps, Role.NAMENODE_SERVICE_CHECK));
    assertFalse(dependenciesContainBlockedRole(deps, Role.HDFS_SERVICE_CHECK));
    assertFalse(dependenciesContainBlockedRole(deps, Role.HDFS_CLIENT));
    // Checking blocker roles
    assertFalse(dependenciesContainBlockerRole(deps, Role.SECONDARY_NAMENODE));
    assertFalse(dependenciesContainBlockerRole(deps, Role.JOURNALNODE));
    assertFalse(dependenciesContainBlockerRole(deps, Role.NAMENODE_SERVICE_CHECK));
    assertFalse(dependenciesContainBlockerRole(deps, Role.HDFS_SERVICE_CHECK));
    assertFalse(dependenciesContainBlockerRole(deps, Role.HDFS_CLIENT));

    // And that some GLUSTERFS components are present (section has been loaded)
    assertTrue(dependenciesContainBlockerRole(deps, Role.PEERSTATUS));

  }
Tests building dependencies in GLUSTERFS cluster. Uses real dependency mapping
file (role_command_order.json)
ambari-server/src/test/java/org/apache/ambari/server/metadata/RoleCommandOrderTest.java