Package com.groupon.odo.client.models

Examples of com.groupon.odo.client.models.ServerGroup


        return redirect;
    }


    protected ServerGroup getServerGroupFromJSON(JSONObject jsonServerGroup) {
        ServerGroup group = new ServerGroup();
        try {
            if (jsonServerGroup == null) {
                return null;
            }

            if (!jsonServerGroup.isNull("id"))
                group.setId(jsonServerGroup.getInt("id"));
            if (!jsonServerGroup.isNull("name"))
                group.setName(jsonServerGroup.getString("name"));
            if (!jsonServerGroup.isNull("profileId"))
                group.setProfileId(jsonServerGroup.getInt("profileId"));
        } catch (JSONException e) {
            e.printStackTrace();
            return null;
        }
View Full Code Here


     *
     * @param groupName
     * @return
     */
    public ServerGroup addServerGroup(String groupName) {
        ServerGroup group = new ServerGroup();

        BasicNameValuePair[] params = {
                new BasicNameValuePair("name", groupName),
                new BasicNameValuePair("profileIdentifier", this._profileName)
        };
View Full Code Here

        ArrayList<ServerGroup> groups = new ArrayList<ServerGroup>();
        try {
            JSONArray serverArray = new JSONArray(doDelete(BASE_SERVERGROUP + "/" + serverGroupId, null));
            for (int i = 0; i < serverArray.length(); i++) {
                JSONObject jsonServerGroup = serverArray.getJSONObject(i);
                ServerGroup group = getServerGroupFromJSON(jsonServerGroup);
                groups.add(group);
            }
        } catch (Exception e) {
            e.printStackTrace();
            return null;
View Full Code Here

            JSONObject response = new JSONObject(doGet(BASE_SERVERGROUP, null));
            JSONArray serverArray = response.getJSONArray("servergroups");

            for (int i = 0; i < serverArray.length(); i++) {
                JSONObject jsonServerGroup = serverArray.getJSONObject(i);
                ServerGroup group = getServerGroupFromJSON(jsonServerGroup);
                groups.add(group);
            }
        } catch (Exception e) {
            e.printStackTrace();
            return null;
View Full Code Here

    @Test
    public void deleteServerGroup() throws Exception {
        String groupName = "testDeleteGroup";

        ServerGroup addedGroup = client.addServerGroup(groupName);
        List<ServerGroup> originalGroups = client.getServerGroups();
        List<ServerGroup> newGroups = client.deleteServerGroup(addedGroup.getId());

        assertTrue(originalGroups.size() - 1 == newGroups.size());

        Boolean found = false;
        for (ServerGroup s : newGroups) {
View Full Code Here

     * @param serverGroupId
     * @param name
     * @return
     */
    public ServerGroup updateServerGroupName(int serverGroupId, String name) {
        ServerGroup serverGroup = null;
        BasicNameValuePair[] params = {
                new BasicNameValuePair("name", name),
                new BasicNameValuePair("profileIdentifier", this._profileName)
        };
        try {
View Full Code Here

     *
     * @param serverGroupId
     * @return
     */
    public ServerGroup activateServerGroup(int serverGroupId) {
        ServerGroup serverGroup = null;
        BasicNameValuePair[] params = {
                new BasicNameValuePair("activate", String.valueOf(true)),
                new BasicNameValuePair("profileIdentifier", this._profileName)
        };
        try {
View Full Code Here

    public void updateServerGroup() throws Exception {

        String groupName = "testUpdateGroup";
        String updatedGroupName = "testUpdatedGroup";

        ServerGroup addedGroup = client.addServerGroup(groupName);

        client.updateServerGroupName(addedGroup.getId(), updatedGroupName);
        List<ServerGroup> newGroups = client.getServerGroups();

        Boolean found = false;
        for (ServerGroup s : newGroups) {
            if (s.getId() == addedGroup.getId()) {
                found = true;
                assertTrue(s.getName().compareTo(updatedGroupName) == 0);
            }
        }
        assertTrue(found);
View Full Code Here

     *
     * @param groupName
     * @return
     */
    public ServerGroup activateServerGroup(String groupName) {
        ServerGroup serverGroup = null;
        BasicNameValuePair[] params = {
                new BasicNameValuePair("activate", String.valueOf(true)),
                new BasicNameValuePair("profileIdentifier", this._profileName)
        };

View Full Code Here

        String groupName = "addedGroup";
        String groupName2 = "secondGroup";

        client.addServerGroup(groupName);
        client.addServerGroup(groupName2);
        ServerGroup activeGroup = client.activateServerGroup(groupName2);
        assertTrue(activeGroup.getName().compareTo(groupName2) == 0);
    }
View Full Code Here

TOP

Related Classes of com.groupon.odo.client.models.ServerGroup

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.