package ch.ethz.inf.vs.californium.plugtests.tests;
import ch.ethz.inf.vs.californium.coap.CoAP.ResponseCode;
import ch.ethz.inf.vs.californium.coap.CoAP.Type;
import ch.ethz.inf.vs.californium.coap.Request;
import ch.ethz.inf.vs.californium.coap.Response;
import ch.ethz.inf.vs.californium.plugtests.PlugtestChecker.TestClientAbstract;
/**
* TD_COAP_CORE_06: Perform DELETE transaction (NON mode).
*
* @author Francesco Corazza and Matthias Kovatsch
*/
public class CC06 extends TestClientAbstract {
public static final String RESOURCE_URI = "/test";
public final ResponseCode EXPECTED_RESPONSE_CODE = ResponseCode.DELETED;
public CC06(String serverURI) {
super(CC06.class.getSimpleName());
// create the request
Request request = Request.newDelete();
request.setConfirmable(false);
// set the parameters and execute the request
executeRequest(request, serverURI, RESOURCE_URI);
}
protected boolean checkResponse(Request request, Response response) {
boolean success = true;
success &= checkType(Type.NON, response.getType());
success &= checkInt(EXPECTED_RESPONSE_CODE.value,
response.getCode().value, "code");
return success;
}
}