Example usage for org.apache.commons.httpclient HttpStatus SC_CREATED

List of usage examples for org.apache.commons.httpclient HttpStatus SC_CREATED

Introduction

In this page you can find the example usage for org.apache.commons.httpclient HttpStatus SC_CREATED.

Prototype

int SC_CREATED

To view the source code for org.apache.commons.httpclient HttpStatus SC_CREATED.

Click Source Link

Document

<tt>201 Created</tt> (HTTP/1.0 - RFC 1945)

Usage

From source file:org.wso2.mdm.integration.device.operation.AndroidOperation.java

@Test(groups = Constants.AndroidOperations.OPERATIONS_GROUP, description = "Test Android notification operation.")
public void testNotification() throws Exception {
    JsonObject operationData = PayloadGenerator.getJsonPayload(
            Constants.AndroidOperations.OPERATION_PAYLOAD_FILE_NAME,
            Constants.AndroidOperations.NOTIFICATION_OPERATION);
    JsonArray deviceIds = new JsonArray();
    JsonPrimitive deviceID = new JsonPrimitive(Constants.DEVICE_ID);
    deviceIds.add(deviceID);/*from w ww  .  java 2s  . c  o m*/
    operationData.add(Constants.DEVICE_IDENTIFIERS_KEY, deviceIds);
    HttpResponse response = client.post(Constants.AndroidOperations.NOTIFICATION_ENDPOINT,
            operationData.toString());
    Assert.assertEquals(HttpStatus.SC_CREATED, response.getResponseCode());
}

From source file:org.wso2.mdm.integration.device.operation.AndroidOperation.java

@Test(groups = Constants.AndroidOperations.OPERATIONS_GROUP, description = "Test Android WiFi operation.")
public void testWiFi() throws Exception {
    JsonObject operationData = PayloadGenerator.getJsonPayload(
            Constants.AndroidOperations.OPERATION_PAYLOAD_FILE_NAME,
            Constants.AndroidOperations.WIFI_OPERATION);
    JsonArray deviceIds = new JsonArray();
    JsonPrimitive deviceID = new JsonPrimitive(Constants.DEVICE_ID);
    deviceIds.add(deviceID);//  w w  w .j a  v  a  2 s.  c  o  m
    operationData.add(Constants.DEVICE_IDENTIFIERS_KEY, deviceIds);
    HttpResponse response = client.post(Constants.AndroidOperations.WIFI_ENDPOINT, operationData.toString());
    Assert.assertEquals(HttpStatus.SC_CREATED, response.getResponseCode());
}

From source file:org.wso2.mdm.integration.device.operation.AndroidOperation.java

@Test(groups = Constants.AndroidOperations.OPERATIONS_GROUP, description = "Test Android encrypt operation.")
public void testEncrypt() throws Exception {
    JsonObject operationData = PayloadGenerator.getJsonPayload(
            Constants.AndroidOperations.OPERATION_PAYLOAD_FILE_NAME,
            Constants.AndroidOperations.ENCRYPT_OPERATION);
    JsonArray deviceIds = new JsonArray();
    JsonPrimitive deviceID = new JsonPrimitive(Constants.DEVICE_ID);
    deviceIds.add(deviceID);// ww w. ja v a  2 s.co m
    operationData.add(Constants.DEVICE_IDENTIFIERS_KEY, deviceIds);
    HttpResponse response = client.post(Constants.AndroidOperations.ENCRYPT_ENDPOINT, operationData.toString());
    Assert.assertEquals(HttpStatus.SC_CREATED, response.getResponseCode());
}

From source file:org.wso2.mdm.integration.device.operation.AndroidOperation.java

@Test(groups = Constants.AndroidOperations.OPERATIONS_GROUP, description = "Test Android change lock operation.")
public void testChangeLock() throws Exception {
    JsonObject operationData = PayloadGenerator.getJsonPayload(
            Constants.AndroidOperations.OPERATION_PAYLOAD_FILE_NAME,
            Constants.AndroidOperations.CHANGE_LOCK_OPERATION);
    JsonArray deviceIds = new JsonArray();
    JsonPrimitive deviceID = new JsonPrimitive(Constants.DEVICE_ID);
    deviceIds.add(deviceID);/*from w  w w . j a  va2s  .c  om*/
    operationData.add(Constants.DEVICE_IDENTIFIERS_KEY, deviceIds);
    HttpResponse response = client.post(Constants.AndroidOperations.CHANGE_LOCK_ENDPOINT,
            operationData.toString());
    Assert.assertEquals(HttpStatus.SC_CREATED, response.getResponseCode());
}

From source file:org.wso2.mdm.integration.device.operation.AndroidOperation.java

@Test(groups = Constants.AndroidOperations.OPERATIONS_GROUP, description = "Test Android password policy operation.")
public void testPasswordPolicy() throws Exception {
    JsonObject operationData = PayloadGenerator.getJsonPayload(
            Constants.AndroidOperations.OPERATION_PAYLOAD_FILE_NAME,
            Constants.AndroidOperations.PASSWORD_POLICY_OPERATION);
    JsonArray deviceIds = new JsonArray();
    JsonPrimitive deviceID = new JsonPrimitive(Constants.DEVICE_ID);
    deviceIds.add(deviceID);// ww w.  j  ava2 s .  c  o m
    operationData.add(Constants.DEVICE_IDENTIFIERS_KEY, deviceIds);
    HttpResponse response = client.post(Constants.AndroidOperations.PASSWORD_POLICY_ENDPOINT,
            operationData.toString());
    Assert.assertEquals(HttpStatus.SC_CREATED, response.getResponseCode());
}

From source file:org.wso2.mdm.integration.device.operation.AndroidOperation.java

@Test(groups = Constants.AndroidOperations.OPERATIONS_GROUP, description = "Test Android web clip operation.")
public void testWebClip() throws Exception {
    JsonObject operationData = PayloadGenerator.getJsonPayload(
            Constants.AndroidOperations.OPERATION_PAYLOAD_FILE_NAME,
            Constants.AndroidOperations.WEB_CLIP_OPERATION);
    JsonArray deviceIds = new JsonArray();
    JsonPrimitive deviceID = new JsonPrimitive(Constants.DEVICE_ID);
    deviceIds.add(deviceID);//from   ww  w. j  av  a 2  s.  co m
    operationData.add(Constants.DEVICE_IDENTIFIERS_KEY, deviceIds);
    HttpResponse response = client.post(Constants.AndroidOperations.WEB_CLIP_ENDPOINT,
            operationData.toString());
    Assert.assertEquals(HttpStatus.SC_CREATED, response.getResponseCode());
}

From source file:org.wso2.mdm.integration.operation.OracleOperationManagement.java

@Test(dependsOnMethods = { "enrollAndroidDevice" }, description = "Install an app to enrolled android device")
public void testInstallApps() throws Exception {
    JsonObject operationData = PayloadGenerator.getJsonPayload(
            Constants.AndroidOperations.OPERATION_PAYLOAD_FILE_NAME,
            Constants.AndroidOperations.INSTALL_APPS_OPERATION);
    JsonArray deviceIds = new JsonArray();
    JsonPrimitive deviceID = new JsonPrimitive(Constants.DEVICE_ID);
    deviceIds.add(deviceID);/*from w  ww.  ja  va  2 s.c om*/
    operationData.add(Constants.DEVICE_IDENTIFIERS_KEY, deviceIds);
    HttpResponse response = rclient.post(Constants.AndroidOperations.INSTALL_APPS_ENDPOINT,
            operationData.toString());
    Assert.assertEquals(HttpStatus.SC_CREATED, response.getResponseCode());
}

From source file:org.wso2.mdm.integration.role.RoleManagement.java

@Test(description = "Test add role.")
public void testAddRole() throws Exception {
    MDMResponse response = client.post(Constants.RoleManagement.ADD_ROLE_ENDPOINT,
            PayloadGenerator/*from  w w  w.jav a  2 s .  com*/
                    .getJsonPayload(Constants.RoleManagement.ROLE_PAYLOAD_FILE_NAME, Constants.HTTP_METHOD_POST)
                    .toString());
    Assert.assertEquals(HttpStatus.SC_CREATED, response.getStatus());
}

From source file:org.wso2.mdm.integration.search.AddDeviceInfoOperation.java

@Test(groups = Constants.AndroidOperations.OPERATIONS_GROUP, description = "Test Android device information "
        + "operation.")
public void testDeviceInfo() throws Exception {

    HttpResponse response = client.post(Constants.AndroidOperations.DEVICE_INFO_ENDPOINT,
            Constants.AndroidOperations.COMMAND_OPERATION_PAYLOAD);
    Assert.assertEquals(HttpStatus.SC_CREATED, response.getResponseCode());
}

From source file:org.wso2.mdm.integration.user.UserManagement.java

@Test(description = "Test add user.")
public void testAddUser() throws Exception {
    HttpResponse response = client.post(Constants.UserManagement.USER_ENDPOINT,
            PayloadGenerator//from   w  w w .j ava  2 s .com
                    .getJsonPayload(Constants.UserManagement.USER_PAYLOAD_FILE_NAME, Constants.HTTP_METHOD_POST)
                    .toString());
    Assert.assertEquals(HttpStatus.SC_CREATED, response.getResponseCode());
    AssertUtil.jsonPayloadCompare(
            PayloadGenerator.getJsonPayload(Constants.UserManagement.USER_RESPONSE_PAYLOAD_FILE_NAME,
                    Constants.HTTP_METHOD_POST).toString(),
            response.getData().toString(), true);
}