Search in sources :

Example 6 with Script

use of org.wso2.siddhi.core.function.Script in project product-iots by wso2.

the class DeviceTypeManagementJMeterTestCase method DeviceTypeManagementTest.

@Test(description = "This test case tests the Device Type/Device Management/Device Agent APIs")
public void DeviceTypeManagementTest() throws AutomationFrameworkException {
    URL url = Thread.currentThread().getContextClassLoader().getResource("jmeter-scripts" + File.separator + "DeviceTypeManagementAPI.jmx");
    JMeterTest script = new JMeterTest(new File(url.getPath()));
    JMeterTestManager manager = new JMeterTestManager();
    log.info("Running Device Type/Device Management/Device Agent management api test cases using jmeter scripts");
    manager.runTest(script);
    log.info("Completed DeviceType API service test using jmeter scripts");
}
Also used : JMeterTest(org.wso2.carbon.automation.extensions.jmeter.JMeterTest) File(java.io.File) URL(java.net.URL) JMeterTestManager(org.wso2.carbon.automation.extensions.jmeter.JMeterTestManager) Test(org.testng.annotations.Test) JMeterTest(org.wso2.carbon.automation.extensions.jmeter.JMeterTest)

Example 7 with Script

use of org.wso2.siddhi.core.function.Script in project product-iots by wso2.

the class NotificationManagementAPIJMeterTestCase method NotificationManagementTest.

@Test(description = "This test case tests the Notification Management APIs")
public void NotificationManagementTest() throws AutomationFrameworkException {
    URL url = Thread.currentThread().getContextClassLoader().getResource("jmeter-scripts" + File.separator + "NotificationManagementAPI.jmx");
    JMeterTest script = new JMeterTest(new File(url.getPath()));
    JMeterTestManager manager = new JMeterTestManager();
    log.info("Running notification management api test cases using jmeter scripts");
    manager.runTest(script);
}
Also used : JMeterTest(org.wso2.carbon.automation.extensions.jmeter.JMeterTest) File(java.io.File) URL(java.net.URL) JMeterTestManager(org.wso2.carbon.automation.extensions.jmeter.JMeterTestManager) JMeterTest(org.wso2.carbon.automation.extensions.jmeter.JMeterTest) Test(org.testng.annotations.Test)

Example 8 with Script

use of org.wso2.siddhi.core.function.Script in project siddhi by wso2.

the class DefinitionParserHelper method addFunction.

public static void addFunction(SiddhiAppContext siddhiAppContext, final FunctionDefinition functionDefinition) {
    Extension extension = new Extension() {

        @Override
        public String getNamespace() {
            return "script";
        }

        @Override
        public String getName() {
            return functionDefinition.getLanguage().toLowerCase();
        }
    };
    try {
        Script script = (Script) SiddhiClassLoader.loadExtensionImplementation(extension, ScriptExtensionHolder.getInstance(siddhiAppContext));
        ConfigReader configReader = siddhiAppContext.getSiddhiContext().getConfigManager().generateConfigReader(extension.getNamespace(), extension.getName());
        script.setReturnType(functionDefinition.getReturnType());
        script.init(functionDefinition.getId(), functionDefinition.getBody(), configReader);
        siddhiAppContext.getScriptFunctionMap().put(functionDefinition.getId(), script);
    } catch (Throwable t) {
        ExceptionUtil.populateQueryContext(t, functionDefinition, siddhiAppContext);
        throw t;
    }
}
Also used : Extension(org.wso2.siddhi.query.api.extension.Extension) Script(org.wso2.siddhi.core.function.Script) ConfigReader(org.wso2.siddhi.core.util.config.ConfigReader)

Example 9 with Script

use of org.wso2.siddhi.core.function.Script in project carbon-business-process by wso2.

the class ActivitiEngineBuilder method buildEngine.

/* Instantiates the engine. Builds the state of the engine
	 *
	 * @return  ProcessEngineImpl object
	 * @throws BPSFault  Throws in the event of failure of ProcessEngine
	 */
public ProcessEngine buildEngine() throws BPSFault {
    try {
        String carbonConfigDirPath = CarbonUtils.getCarbonConfigDirPath();
        String activitiConfigPath = carbonConfigDirPath + File.separator + BPMNConstants.ACTIVITI_CONFIGURATION_FILE_NAME;
        File activitiConfigFile = new File(activitiConfigPath);
        ProcessEngineConfigurationImpl processEngineConfigurationImpl = (ProcessEngineConfigurationImpl) ProcessEngineConfiguration.createProcessEngineConfigurationFromInputStream(new FileInputStream(activitiConfigFile));
        // Add script engine resolvers
        setResolverFactories(processEngineConfigurationImpl);
        // Add supported variable types
        setSupportedVariableTypes(processEngineConfigurationImpl);
        // we have to build the process engine first to initialize session factories.
        processEngine = processEngineConfigurationImpl.buildProcessEngine();
        processEngineConfigurationImpl.getSessionFactories().put(UserIdentityManager.class, new BPSUserManagerFactory());
        processEngineConfigurationImpl.getSessionFactories().put(GroupIdentityManager.class, new BPSGroupManagerFactory());
        dataSourceJndiName = processEngineConfigurationImpl.getProcessEngineConfiguration().getDataSourceJndiName();
    } catch (FileNotFoundException e) {
        String msg = "Failed to create an Activiti engine. Activiti configuration file not found";
        throw new BPSFault(msg, e);
    }
    return processEngine;
}
Also used : BPSGroupManagerFactory(org.wso2.carbon.bpmn.core.integration.BPSGroupManagerFactory) BPSUserManagerFactory(org.wso2.carbon.bpmn.core.integration.BPSUserManagerFactory) FileNotFoundException(java.io.FileNotFoundException) File(java.io.File) ProcessEngineConfigurationImpl(org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl) FileInputStream(java.io.FileInputStream)

Example 10 with Script

use of org.wso2.siddhi.core.function.Script in project product-iots by wso2.

the class AndroidDeviceManagementAPIJmeterTestCase method listServices.

@Test(description = "Testing the basic android device management API calls", dependsOnMethods = { "permutationTest" })
public void listServices() throws AutomationFrameworkException {
    URL url = Thread.currentThread().getContextClassLoader().getResource("jmeter-scripts" + File.separator + "NewAndroidDeviceManagementAPI.jmx");
    JMeterTest script = new JMeterTest(new File(url.getPath()));
    JMeterTestManager manager = new JMeterTestManager();
    log.info("Running API service test using jmeter scripts");
    manager.runTest(script);
}
Also used : JMeterTest(org.wso2.carbon.automation.extensions.jmeter.JMeterTest) File(java.io.File) URL(java.net.URL) JMeterTestManager(org.wso2.carbon.automation.extensions.jmeter.JMeterTestManager) JMeterTest(org.wso2.carbon.automation.extensions.jmeter.JMeterTest) Test(org.testng.annotations.Test)

Aggregations

Test (org.testng.annotations.Test)11 File (java.io.File)9 URL (java.net.URL)8 JMeterTest (org.wso2.carbon.automation.extensions.jmeter.JMeterTest)8 JMeterTestManager (org.wso2.carbon.automation.extensions.jmeter.JMeterTestManager)8 HttpResponse (org.wso2.carbon.automation.test.utils.http.client.HttpResponse)3 FileInputStream (java.io.FileInputStream)1 FileNotFoundException (java.io.FileNotFoundException)1 ArrayList (java.util.ArrayList)1 ProcessEngineConfigurationImpl (org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl)1 BeansResolverFactory (org.activiti.engine.impl.scripting.BeansResolverFactory)1 ResolverFactory (org.activiti.engine.impl.scripting.ResolverFactory)1 VariableScopeResolverFactory (org.activiti.engine.impl.scripting.VariableScopeResolverFactory)1 BPSGroupManagerFactory (org.wso2.carbon.bpmn.core.integration.BPSGroupManagerFactory)1 BPSUserManagerFactory (org.wso2.carbon.bpmn.core.integration.BPSUserManagerFactory)1 JsonAPIResolverFactory (org.wso2.carbon.bpmn.core.types.datatypes.json.JsonAPIResolverFactory)1 XmlAPIResolverFactory (org.wso2.carbon.bpmn.core.types.datatypes.xml.XmlAPIResolverFactory)1 SSOAgentConfig (org.wso2.carbon.identity.sso.agent.bean.SSOAgentConfig)1 RestClient (org.wso2.iot.integration.common.RestClient)1 Script (org.wso2.siddhi.core.function.Script)1