Skip to content

Commit

Permalink
[HHQ-4149] First pass at getting WADL tests passing again.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryan Morgan committed Aug 18, 2010
1 parent da37640 commit 865c79a
Show file tree
Hide file tree
Showing 18 changed files with 156 additions and 133 deletions.
Expand Up @@ -6,9 +6,9 @@ public class WADLAgent_test extends WADLTestBase {

public void testAgent() throws Exception {

Endpoint.AgentGetHqu agentGet = new Endpoint.AgentGetHqu();
Endpoint.AgentListHqu agentList = new Endpoint.AgentListHqu();
Endpoint.AgentPingHqu agentPing = new Endpoint.AgentPingHqu();
HttpLocalhost8080HquHqapi1.AgentGetHqu agentGet = new HttpLocalhost8080HquHqapi1.AgentGetHqu();
HttpLocalhost8080HquHqapi1.AgentListHqu agentList = new HttpLocalhost8080HquHqapi1.AgentListHqu();
HttpLocalhost8080HquHqapi1.AgentPingHqu agentPing = new HttpLocalhost8080HquHqapi1.AgentPingHqu();

AgentsResponse agents = agentList.getAsAgentsResponse();
hqAssertSuccess(agents);
Expand Down
Expand Up @@ -8,45 +8,45 @@
public class WADLAlertDefinition_test extends WADLTestBase {

public void testListDefinitions() throws Exception {
Endpoint.AlertdefinitionListDefinitionsHqu adList =
new Endpoint.AlertdefinitionListDefinitionsHqu();
HttpLocalhost8080HquHqapi1.AlertdefinitionListDefinitionsHqu adList =
new HttpLocalhost8080HquHqapi1.AlertdefinitionListDefinitionsHqu();

AlertDefinitionsResponse response = adList.getAsAlertDefinitionsResponse();
hqAssertSuccess(response);
}

public void testListDefinitionsByResources() throws Exception {
Endpoint.AlertdefinitionListDefinitionsByResourcesHqu adList =
new Endpoint.AlertdefinitionListDefinitionsByResourcesHqu();
HttpLocalhost8080HquHqapi1.AlertdefinitionListDefinitionsByResourcesHqu adList =
new HttpLocalhost8080HquHqapi1.AlertdefinitionListDefinitionsByResourcesHqu();
List<Resource> resources = new ArrayList<Resource>();
ResourcesRequest request = new ResourcesRequest();
request.getResource().addAll(resources);
AlertDefinitionsResponse response = adList.postAsAlertDefinitionsResponse(request);
AlertDefinitionsResponse response = adList.postApplicationXmlAsAlertDefinitionsResponse(request);
hqAssertSuccess(response);
}

public void testListTypeDefinitions() throws Exception {
Endpoint.AlertdefinitionListTypeDefinitionsHqu adTypeList =
new Endpoint.AlertdefinitionListTypeDefinitionsHqu();
HttpLocalhost8080HquHqapi1.AlertdefinitionListTypeDefinitionsHqu adTypeList =
new HttpLocalhost8080HquHqapi1.AlertdefinitionListTypeDefinitionsHqu();

AlertDefinitionsResponse response = adTypeList.getAsAlertDefinitionsResponse();
hqAssertSuccess(response);
}

public void testDelete() throws Exception {
Endpoint.AlertdefinitionDeleteHqu adDelete =
new Endpoint.AlertdefinitionDeleteHqu();
HttpLocalhost8080HquHqapi1.AlertdefinitionDeleteHqu adDelete =
new HttpLocalhost8080HquHqapi1.AlertdefinitionDeleteHqu();

StatusResponse response = adDelete.getAsStatusResponse(Integer.MAX_VALUE);
hqAssertFailure(response); // Won't exist.
}

public void testSync() throws Exception {
Endpoint.AlertdefinitionSyncHqu adSync =
new Endpoint.AlertdefinitionSyncHqu();
HttpLocalhost8080HquHqapi1.AlertdefinitionSyncHqu adSync =
new HttpLocalhost8080HquHqapi1.AlertdefinitionSyncHqu();
AlertDefinitionsRequest request = new AlertDefinitionsRequest();

AlertDefinitionsResponse response = adSync.postAsAlertDefinitionsResponse(request);
AlertDefinitionsResponse response = adSync.postApplicationXmlAsAlertDefinitionsResponse(request);
hqAssertSuccess(response);
}
}
Expand Up @@ -5,15 +5,15 @@
public class WADLAlert_test extends WADLTestBase {

public void testFind() throws Exception {
Endpoint.AlertFindHqu find = new Endpoint.AlertFindHqu();
HttpLocalhost8080HquHqapi1.AlertFindHqu find = new HttpLocalhost8080HquHqapi1.AlertFindHqu();

AlertsResponse response = find.getAsAlertsResponse(0l, System.currentTimeMillis(),
10, 1);
hqAssertSuccess(response);
}

public void testFindByResource() throws Exception {
Endpoint.AlertFindByResourceHqu find = new Endpoint.AlertFindByResourceHqu();
HttpLocalhost8080HquHqapi1.AlertFindByResourceHqu find = new HttpLocalhost8080HquHqapi1.AlertFindByResourceHqu();

AlertsResponse response = find.getAsAlertsResponse(Integer.MAX_VALUE,
0l, System.currentTimeMillis(),
Expand All @@ -22,21 +22,21 @@ public void testFindByResource() throws Exception {
}

public void testAck() throws Exception {
Endpoint.AlertAckHqu ack = new Endpoint.AlertAckHqu();
HttpLocalhost8080HquHqapi1.AlertAckHqu ack = new HttpLocalhost8080HquHqapi1.AlertAckHqu();

AlertsResponse response = ack.getAsAlertsResponse(Integer.MAX_VALUE, "Test ack");
hqAssertFailure(response); // Alert will not exist
}

public void testFix() throws Exception {
Endpoint.AlertFixHqu fix = new Endpoint.AlertFixHqu();
HttpLocalhost8080HquHqapi1.AlertFixHqu fix = new HttpLocalhost8080HquHqapi1.AlertFixHqu();

AlertsResponse response = fix.getAsAlertsResponse(Integer.MAX_VALUE);
hqAssertFailure(response); // Alert will not exist
}

public void testDelete() throws Exception {
Endpoint.AlertDeleteHqu delete = new Endpoint.AlertDeleteHqu();
HttpLocalhost8080HquHqapi1.AlertDeleteHqu delete = new HttpLocalhost8080HquHqapi1.AlertDeleteHqu();

StatusResponse response = delete.getAsStatusResponse(Integer.MAX_VALUE);
hqAssertFailure(response);
Expand Down
@@ -1,6 +1,6 @@
package org.hyperic.hq.hqapi1.test;

import org.hyperic.hq.hqapi1.wadl.Endpoint;
import org.hyperic.hq.hqapi1.wadl.HttpLocalhost8080HquHqapi1;
import org.hyperic.hq.hqapi1.wadl.*;

import java.util.Random;
Expand Down Expand Up @@ -32,66 +32,66 @@ protected Application generateTestApplication()
}

public void testList() throws Exception {
Endpoint.ApplicationListHqu list =
new Endpoint.ApplicationListHqu();
HttpLocalhost8080HquHqapi1.ApplicationListHqu list =
new HttpLocalhost8080HquHqapi1.ApplicationListHqu();

ApplicationsResponse response = list.getAsApplicationsResponse();
hqAssertSuccess(response);
}

public void testCreate() throws Exception {
Endpoint.ApplicationCreateHqu create =
new Endpoint.ApplicationCreateHqu();
HttpLocalhost8080HquHqapi1.ApplicationCreateHqu create =
new HttpLocalhost8080HquHqapi1.ApplicationCreateHqu();

Application a = generateTestApplication();
ApplicationRequest req = new ApplicationRequest();
req.setApplication(a);

ApplicationResponse response =
create.postAsApplicationResponse(req);
create.postApplicationXmlAsApplicationResponse(req);
hqAssertSuccess(response);

Endpoint.ApplicationDeleteHqu delete =
new Endpoint.ApplicationDeleteHqu();
HttpLocalhost8080HquHqapi1.ApplicationDeleteHqu delete =
new HttpLocalhost8080HquHqapi1.ApplicationDeleteHqu();
StatusResponse deleteResponse =
delete.getAsStatusResponse(response.getApplication().getId());
hqAssertSuccess(deleteResponse);
}

public void testUpdate() throws Exception {
Endpoint.ApplicationUpdateHqu update =
new Endpoint.ApplicationUpdateHqu();
HttpLocalhost8080HquHqapi1.ApplicationUpdateHqu update =
new HttpLocalhost8080HquHqapi1.ApplicationUpdateHqu();

Application a = generateTestApplication();
ApplicationRequest req = new ApplicationRequest();
req.setApplication(a);

ApplicationResponse resp = update.postAsApplicationResponse(req);
ApplicationResponse resp = update.postApplicationXmlAsApplicationResponse(req);
hqAssertFailure(resp);
}

public void testSync() throws Exception {
Endpoint.ApplicationSyncHqu sync =
new Endpoint.ApplicationSyncHqu();
HttpLocalhost8080HquHqapi1.ApplicationSyncHqu sync =
new HttpLocalhost8080HquHqapi1.ApplicationSyncHqu();

Application a = generateTestApplication();
ApplicationsRequest req = new ApplicationsRequest();
req.getApplication().add(a);

ApplicationsResponse response = sync.postAsApplicationsResponse(req);
ApplicationsResponse response = sync.postApplicationXmlAsApplicationsResponse(req);
hqAssertSuccess(response);

Endpoint.ApplicationDeleteHqu delete =
new Endpoint.ApplicationDeleteHqu();
HttpLocalhost8080HquHqapi1.ApplicationDeleteHqu delete =
new HttpLocalhost8080HquHqapi1.ApplicationDeleteHqu();
for (Application app : response.getApplication()) {
StatusResponse deleteResponse = delete.getAsStatusResponse(app.getId());
hqAssertSuccess(deleteResponse);
}
}

public void testDelete() throws Exception {
Endpoint.ApplicationDeleteHqu delete =
new Endpoint.ApplicationDeleteHqu();
HttpLocalhost8080HquHqapi1.ApplicationDeleteHqu delete =
new HttpLocalhost8080HquHqapi1.ApplicationDeleteHqu();

StatusResponse deleteResponse = delete.getAsStatusResponse(Integer.MAX_VALUE);
hqAssertFailure(deleteResponse);
Expand Down
Expand Up @@ -6,17 +6,17 @@ public class WADLAutodiscovery_test extends WADLTestBase {

public void testGetQueue() throws Exception {

Endpoint.AutodiscoveryGetQueueHqu adGetQueue =
new Endpoint.AutodiscoveryGetQueueHqu();
HttpLocalhost8080HquHqapi1.AutodiscoveryGetQueueHqu adGetQueue =
new HttpLocalhost8080HquHqapi1.AutodiscoveryGetQueueHqu();

QueueResponse queue = adGetQueue.getAsQueueResponse();
hqAssertSuccess(queue);
}

public void testApprove() throws Exception {

Endpoint.AutodiscoveryApproveHqu adApprove =
new Endpoint.AutodiscoveryApproveHqu();
HttpLocalhost8080HquHqapi1.AutodiscoveryApproveHqu adApprove =
new HttpLocalhost8080HquHqapi1.AutodiscoveryApproveHqu();

StatusResponse approve = adApprove.getAsStatusResponse(Integer.MAX_VALUE);
hqAssertFailure(approve); // That id won't exist, just testing endpoints.
Expand Down
Expand Up @@ -32,26 +32,26 @@
public class WADLControl_test extends WADLTestBase {

public void testActions() throws Exception {
Endpoint.ControlActionsHqu actions =
new Endpoint.ControlActionsHqu();
HttpLocalhost8080HquHqapi1.ControlActionsHqu actions =
new HttpLocalhost8080HquHqapi1.ControlActionsHqu();

ControlActionResponse response =
actions.getAsControlActionResponse(Integer.MAX_VALUE);
hqAssertFailure(response); // Id won't exist
}

public void testHistory() throws Exception {
Endpoint.ControlHistoryHqu history =
new Endpoint.ControlHistoryHqu();
HttpLocalhost8080HquHqapi1.ControlHistoryHqu history =
new HttpLocalhost8080HquHqapi1.ControlHistoryHqu();

ControlHistoryResponse response =
history.getAsControlHistoryResponse(Integer.MAX_VALUE);
hqAssertFailure(response); // Id won't exist
}

public void testExecute() throws Exception {
Endpoint.ControlExecuteHqu execute =
new Endpoint.ControlExecuteHqu();
HttpLocalhost8080HquHqapi1.ControlExecuteHqu execute =
new HttpLocalhost8080HquHqapi1.ControlExecuteHqu();

StatusResponse response =
execute.getAsStatusResponse(Integer.MAX_VALUE, "none",
Expand Down
Expand Up @@ -5,34 +5,34 @@
public class WADLEscalation_test extends WADLTestBase {

public void testEscalationGet() throws Exception {
Endpoint.EscalationGetHqu escGet = new Endpoint.EscalationGetHqu();
HttpLocalhost8080HquHqapi1.EscalationGetHqu escGet = new HttpLocalhost8080HquHqapi1.EscalationGetHqu();

EscalationResponse response = escGet.getAsEscalationResponse("Some Esc");
hqAssertFailure(response); // Won't exist
}

public void testEscalationList() throws Exception {
Endpoint.EscalationListHqu escList = new Endpoint.EscalationListHqu();
HttpLocalhost8080HquHqapi1.EscalationListHqu escList = new HttpLocalhost8080HquHqapi1.EscalationListHqu();

EscalationsResponse response = escList.getAsEscalationsResponse();
hqAssertSuccess(response);
}

public void testEscalationDelete() throws Exception {
Endpoint.EscalationDeleteHqu escDelete =
new Endpoint.EscalationDeleteHqu();
HttpLocalhost8080HquHqapi1.EscalationDeleteHqu escDelete =
new HttpLocalhost8080HquHqapi1.EscalationDeleteHqu();

StatusResponse response = escDelete.getAsStatusResponse(Integer.MAX_VALUE);
hqAssertFailure(response); // Won't exist
}

public void testEscalationSync() throws Exception {
Endpoint.EscalationSyncHqu escSync =
new Endpoint.EscalationSyncHqu();
HttpLocalhost8080HquHqapi1.EscalationSyncHqu escSync =
new HttpLocalhost8080HquHqapi1.EscalationSyncHqu();

EscalationsRequest request = new EscalationsRequest();

StatusResponse response = escSync.postAsStatusResponse(request);
StatusResponse response = escSync.postApplicationXmlAsStatusResponse(request);
hqAssertSuccess(response);
}
}
Expand Up @@ -5,15 +5,15 @@
public class WADLEvent_test extends WADLTestBase {

public void testFind() throws Exception {
Endpoint.EventFindHqu find = new Endpoint.EventFindHqu();
HttpLocalhost8080HquHqapi1.EventFindHqu find = new HttpLocalhost8080HquHqapi1.EventFindHqu();

EventsResponse response = find.getAsEventsResponse(0l, System.currentTimeMillis(),
100);
hqAssertSuccess(response);
}

public void testFindByResource() throws Exception {
Endpoint.EventFindByResourceHqu find = new Endpoint.EventFindByResourceHqu();
HttpLocalhost8080HquHqapi1.EventFindByResourceHqu find = new HttpLocalhost8080HquHqapi1.EventFindByResourceHqu();

EventsResponse response = find.getAsEventsResponse(Integer.MAX_VALUE,
0l,
Expand Down
Expand Up @@ -5,31 +5,31 @@
public class WADLGroup_test extends WADLTestBase {

public void testGroupList() throws Exception {
Endpoint.GroupListHqu groupList = new Endpoint.GroupListHqu();
HttpLocalhost8080HquHqapi1.GroupListHqu groupList = new HttpLocalhost8080HquHqapi1.GroupListHqu();

GroupsResponse response = groupList.getAsGroupsResponse();
hqAssertSuccess(response);
}

public void testGroupGet() throws Exception {
Endpoint.GroupGetHqu groupGet = new Endpoint.GroupGetHqu();
HttpLocalhost8080HquHqapi1.GroupGetHqu groupGet = new HttpLocalhost8080HquHqapi1.GroupGetHqu();

GroupResponse response = groupGet.getAsGroupResponse("Some group");
hqAssertFailure(response);
}

public void testGroupDelete() throws Exception {
Endpoint.GroupDeleteHqu groupDelete = new Endpoint.GroupDeleteHqu();
HttpLocalhost8080HquHqapi1.GroupDeleteHqu groupDelete = new HttpLocalhost8080HquHqapi1.GroupDeleteHqu();

StatusResponse response = groupDelete.getAsStatusResponse(Integer.MAX_VALUE);
hqAssertFailure(response);
}

public void testGroupSync() throws Exception {
Endpoint.GroupSyncHqu groupSync = new Endpoint.GroupSyncHqu();
HttpLocalhost8080HquHqapi1.GroupSyncHqu groupSync = new HttpLocalhost8080HquHqapi1.GroupSyncHqu();
GroupsRequest request = new GroupsRequest();

GroupsResponse response = groupSync.postAsGroupsResponse(request);
GroupsResponse response = groupSync.postApplicationXmlAsGroupsResponse(request);
hqAssertSuccess(response);
}
}
Expand Up @@ -5,15 +5,15 @@
public class WADLMaintenance_test extends WADLTestBase {

public void testGet() throws Exception {
Endpoint.MaintenanceGetHqu maintGet = new Endpoint.MaintenanceGetHqu();
HttpLocalhost8080HquHqapi1.MaintenanceGetHqu maintGet = new HttpLocalhost8080HquHqapi1.MaintenanceGetHqu();

MaintenanceResponse response = maintGet.getAsMaintenanceResponse(Integer.MAX_VALUE);
hqAssertFailure(response);
}

public void testSchedule() throws Exception {
Endpoint.MaintenanceScheduleHqu maintSchedule =
new Endpoint.MaintenanceScheduleHqu();
HttpLocalhost8080HquHqapi1.MaintenanceScheduleHqu maintSchedule =
new HttpLocalhost8080HquHqapi1.MaintenanceScheduleHqu();

MaintenanceResponse response =
maintSchedule.getAsMaintenanceResponse(Integer.MAX_VALUE,
Expand All @@ -23,8 +23,8 @@ public void testSchedule() throws Exception {
}

public void testUnschedule() throws Exception {
Endpoint.MaintenanceUnscheduleHqu maintUnschedule =
new Endpoint.MaintenanceUnscheduleHqu();
HttpLocalhost8080HquHqapi1.MaintenanceUnscheduleHqu maintUnschedule =
new HttpLocalhost8080HquHqapi1.MaintenanceUnscheduleHqu();

StatusResponse response =
maintUnschedule.getAsStatusResponse(Integer.MAX_VALUE);
Expand Down

0 comments on commit 865c79a

Please sign in to comment.