fetch(remotesArray.getJSONObject(1).getString(ProtocolConstants.KEY_LOCATION));
// secondary
request = getGetRequest(remotesArray.getJSONObject(1).getString(ProtocolConstants.KEY_LOCATION));
response = webConversation.getResponse(request);
ServerStatus status = waitForTask(response);
assertTrue(status.toString(), status.isOK());
JSONObject remote = status.getJsonData();
// checkout remote branch: secondary/branch
String remoteBranchName = remote.getJSONArray(ProtocolConstants.KEY_CHILDREN).getJSONObject(0).getString(ProtocolConstants.KEY_NAME);
if (!remoteBranchName.equals("secondary/branch"))
remoteBranchName = remote.getJSONArray(ProtocolConstants.KEY_CHILDREN).getJSONObject(1).getString(ProtocolConstants.KEY_NAME);
assertEquals("secondary/branch", remoteBranchName);
response = branch(branchesLocation, "branch", remoteBranchName);
JSONObject branch = new JSONObject(response.getText());
JSONArray remoteBranchLocations = branch.getJSONArray(GitConstants.KEY_REMOTE);
assertEquals(1, remoteBranchLocations.length());
assertEquals("secondary", remoteBranchLocations.getJSONObject(0).getString(ProtocolConstants.KEY_NAME));
assertEquals("secondary/branch", remoteBranchLocations.getJSONObject(0).getJSONArray(ProtocolConstants.KEY_CHILDREN).getJSONObject(0).getString(ProtocolConstants.KEY_NAME));
// origin
request = getGetRequest(remotesArray.getJSONObject(0).getString(ProtocolConstants.KEY_LOCATION));
response = webConversation.getResponse(request);
status = waitForTask(response);
assertTrue(status.toString(), status.isOK());
remote = status.getJsonData();
// checkout remote branch: origin/test
JSONArray remoteChildren = remote.getJSONArray(ProtocolConstants.KEY_CHILDREN);
assertEquals(2, remoteChildren.length());
remoteBranchName = remoteChildren.getJSONObject(0).getString(ProtocolConstants.KEY_NAME);