Search in sources :

Example 71 with Operation

use of org.wso2.ballerinalang.compiler.semantics.model.iterable.Operation in project product-iots by wso2.

the class AndroidOperation method testUnLock.

@Test(groups = { Constants.AndroidOperations.OPERATIONS_GROUP }, description = "Test Android device un-lock " + "operation.")
public void testUnLock() throws MalformedURLException, AutomationFrameworkException {
    HttpResponse response = client.post(Constants.AndroidOperations.OPERATION_ENDPOINT + Constants.AndroidOperations.UNLOCK_ENDPOINT, Constants.AndroidOperations.UNLOCK_OPERATION_PAYLOAD);
    Assert.assertEquals(HttpStatus.SC_CREATED, response.getResponseCode());
}
Also used : HttpResponse(org.wso2.carbon.automation.test.utils.http.client.HttpResponse) Test(org.testng.annotations.Test)

Example 72 with Operation

use of org.wso2.ballerinalang.compiler.semantics.model.iterable.Operation in project product-iots by wso2.

the class AndroidOperation method testCamera.

@Test(groups = { Constants.AndroidOperations.OPERATIONS_GROUP }, description = "Test Android device camera " + "operation.")
public void testCamera() throws Exception {
    HttpResponse response = client.post(Constants.AndroidOperations.OPERATION_ENDPOINT + Constants.AndroidOperations.CAMERA_OPERATION, Constants.AndroidOperations.CAMERA_OPERATION_PAYLOAD);
    Assert.assertEquals(HttpStatus.SC_CREATED, response.getResponseCode());
}
Also used : HttpResponse(org.wso2.carbon.automation.test.utils.http.client.HttpResponse) Test(org.testng.annotations.Test)

Example 73 with Operation

use of org.wso2.ballerinalang.compiler.semantics.model.iterable.Operation in project product-iots by wso2.

the class AndroidOperation method testMute.

@Test(groups = { Constants.AndroidOperations.OPERATIONS_GROUP }, description = "Test Android mute operation.")
public void testMute() throws Exception {
    HttpResponse response = client.post(Constants.AndroidOperations.OPERATION_ENDPOINT + Constants.AndroidOperations.MUTE_ENDPOINT, Constants.AndroidOperations.MUTE_PAYLOAD);
    Assert.assertEquals(HttpStatus.SC_CREATED, response.getResponseCode());
}
Also used : HttpResponse(org.wso2.carbon.automation.test.utils.http.client.HttpResponse) Test(org.testng.annotations.Test)

Example 74 with Operation

use of org.wso2.ballerinalang.compiler.semantics.model.iterable.Operation in project carbon-apimgt by wso2.

the class WSDL11ProcessorImpl method getOperation.

/**
 * Retrieves WSDL operation given the binding operation and http verb
 *
 * @param bindingOperation {@link BindingOperation} object
 * @param verb             HTTP verb
 * @return WSDL operation for the given binding operation and http verb
 */
private WSDLOperation getOperation(BindingOperation bindingOperation, String verb) {
    WSDLOperation wsdlOperation = null;
    for (Object boExtElement : bindingOperation.getExtensibilityElements()) {
        if (boExtElement instanceof HTTPOperation) {
            HTTPOperation httpOperation = (HTTPOperation) boExtElement;
            if (!StringUtils.isBlank(httpOperation.getLocationURI())) {
                wsdlOperation = new WSDLOperation();
                wsdlOperation.setVerb(verb);
                wsdlOperation.setURI(APIMWSDLUtils.replaceParentheses(httpOperation.getLocationURI()));
                if (log.isDebugEnabled()) {
                    log.debug("Found HTTP Binding operation; name: " + bindingOperation.getName() + " [" + wsdlOperation.getVerb() + " " + wsdlOperation.getURI() + "]");
                }
                if (APIMWSDLUtils.canContainBody(verb)) {
                    String boContentType = getContentType(bindingOperation.getBindingInput());
                    wsdlOperation.setContentType(boContentType != null ? boContentType : TEXT_XML_MEDIA_TYPE);
                }
                List<WSDLOperationParam> paramList = getParameters(bindingOperation, verb, wsdlOperation.getContentType());
                wsdlOperation.setParameters(paramList);
            }
        }
    }
    return wsdlOperation;
}
Also used : HTTPOperation(javax.wsdl.extensions.http.HTTPOperation) WSDLOperationParam(org.wso2.carbon.apimgt.core.models.WSDLOperationParam) WSDLOperation(org.wso2.carbon.apimgt.core.models.WSDLOperation)

Example 75 with Operation

use of org.wso2.ballerinalang.compiler.semantics.model.iterable.Operation in project carbon-apimgt by wso2.

the class DynamicHtmlGenTestCase method testFromOperation.

@Test
public void testFromOperation() throws Exception {
    Operation operation = new Operation();
    final String summary = "Sample operation summary";
    final String description = "Sample operation description";
    operation.setDescription(description);
    operation.setSummary(summary);
    DynamicHtmlGen htmlGen = new DynamicHtmlGen();
    CodegenOperation modified = htmlGen.fromOperation("/apis", "GET", operation, null, null);
    Assert.assertEquals(modified.summary, summary);
    Assert.assertEquals(modified.notes, description);
}
Also used : CodegenOperation(io.swagger.codegen.CodegenOperation) DynamicHtmlGen(org.wso2.carbon.apimgt.rest.api.common.codegen.DynamicHtmlGen) CodegenOperation(io.swagger.codegen.CodegenOperation) Operation(io.swagger.models.Operation) Test(org.testng.annotations.Test)

Aggregations

Test (org.testng.annotations.Test)34 HttpResponse (org.wso2.carbon.automation.test.utils.http.client.HttpResponse)29 HashMap (java.util.HashMap)19 ArrayList (java.util.ArrayList)16 BadRequestException (org.wso2.charon3.core.exceptions.BadRequestException)15 HumanTaskRuntimeException (org.wso2.carbon.humantask.core.engine.runtime.api.HumanTaskRuntimeException)12 QueryVariable (org.wso2.carbon.bpmn.rest.engine.variable.QueryVariable)11 List (java.util.List)10 RestResponseFactory (org.wso2.carbon.bpmn.rest.common.RestResponseFactory)10 DiagnosticPos (org.wso2.ballerinalang.compiler.util.diagnotic.DiagnosticPos)9 Map (java.util.Map)8 ActivitiIllegalArgumentException (org.activiti.engine.ActivitiIllegalArgumentException)8 Operation (io.swagger.models.Operation)7 Attribute (org.wso2.charon3.core.attributes.Attribute)7 ComplexAttribute (org.wso2.charon3.core.attributes.ComplexAttribute)7 MultiValuedAttribute (org.wso2.charon3.core.attributes.MultiValuedAttribute)7 SimpleAttribute (org.wso2.charon3.core.attributes.SimpleAttribute)7 Operation (org.wso2.ballerinalang.compiler.semantics.model.iterable.Operation)6 APIManagementException (org.wso2.carbon.apimgt.core.exception.APIManagementException)6 AttributeSchema (org.wso2.charon3.core.schema.AttributeSchema)6