AbstractMuleClient extends AbstractClient { protected Organization buildOrganization(JsonObject userInfoJson) { Map<String, Organization> organizationsIds = new HashMap<>(); Map<String, List<String>> organizationChildren = new HashMap<>(); buildOrganizationsMap(userInfoJson, organizationsIds, organizationChildren); String root = getRootOrganization(userInfoJson); return recurse(root, organizationsIds, organizationChildren); } AbstractMuleClient(AnypointDeployment anypointDeployment, DeployerLog log);  AbstractMuleClient(DeployerLog log); void init(); UserInfo getMe(); String getOrgId(); String getEnvId(); Environment findEnvironmentByName(String name); String getBusinessGroupIdByBusinessGroupPath(); void renewToken(); Environments getEnvironments(); Set<String> getSuborganizationIds(JsonObject organizationJson); static final String DEFAULT_BASE_URL; static final String ORGANIZATION; static final String SUB_ORGANIZATION_IDS; static final String NAME; static final String USER; static final String ID; static final String CLIENT; static final String UNAUTHORIZED; }
@Test public void buildOrganization() { Organization o = client.buildOrganization((JsonObject) new JsonParser().parse(userInfoJson)); System.out.println(o.toString()); assertThat("Master organization should be MuleSoft", o.name, equalTo("MuleSoft")); Organization test1 = o.subOrganizations.get(0); assertThat("Suborganization should be test1", test1.name, equalTo("test1")); assertThat("Suborganization should be max-the-mule-broker", o.subOrganizations.get(1).name, equalTo("max-the-mule-broker")); Organization test2 = test1.subOrganizations.get(0); assertThat("Suborganization should be test2", test2.name, equalTo("test2")); Organization myapp = test2.subOrganizations.get(0); assertThat("Suborganization should be myapp", myapp.name, equalTo("myapp")); Organization tests = myapp.subOrganizations.get(0); assertThat("Suborganization should be tests", tests.name, equalTo("tests")); }