private SiddhiManager createMockSiddhiManager(
      String[] inputStreamDefinitions, String executionPlan) throws SiddhiParserException {
    SiddhiConfiguration siddhiConfig = new SiddhiConfiguration();
    siddhiConfig.setSiddhiExtensions(SiddhiExtensionLoader.loadSiddhiExtensions());
    SiddhiManager siddhiManager = new SiddhiManager(siddhiConfig);
    try {
      int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
      if (tenantId > -1) {
        DataSourceManager.getInstance().initTenant(tenantId);
      }
      List<CarbonDataSource> dataSources =
          EventProcessorValueHolder.getDataSourceService().getAllDataSources();
      for (CarbonDataSource cds : dataSources) {
        try {
          if (cds.getDSObject() instanceof DataSource) {
            siddhiManager
                .getSiddhiContext()
                .addDataSource(cds.getDSMInfo().getName(), (DataSource) cds.getDSObject());
          }
        } catch (Exception e) {
          log.error("Unable to add the datasource" + cds.getDSMInfo().getName(), e);
        }
      }
    } catch (DataSourceException e) {
      log.error("Unable to access the datasource service", e);
    }

    for (String streamDefinition : inputStreamDefinitions) {
      if (streamDefinition.trim().length() > 0) {
        siddhiManager.defineStream(streamDefinition);
      }
    }
    siddhiManager.addExecutionPlan(executionPlan);
    return siddhiManager;
  }
  private SiddhiConfiguration getSiddhiConfigurationFor(
      ExecutionPlanConfiguration executionPlanConfiguration, int tenantId)
      throws ServiceDependencyValidationException {
    SiddhiConfiguration siddhiConfig = new SiddhiConfiguration();
    siddhiConfig.setAsyncProcessing(false);
    siddhiConfig.setInstanceIdentifier(
        "org.wso2.siddhi.instance-" + tenantId + "-" + UUID.randomUUID().toString());

    String isDistributedProcessingEnabledString =
        executionPlanConfiguration
            .getSiddhiConfigurationProperties()
            .get(EventProcessorConstants.SIDDHI_DISTRIBUTED_PROCESSING);
    if (isDistributedProcessingEnabledString != null
        && (isDistributedProcessingEnabledString.equalsIgnoreCase("DistributedCache")
            || isDistributedProcessingEnabledString.equalsIgnoreCase("true"))) {
      siddhiConfig.setDistributedProcessing(true);
      if (EventProcessorValueHolder.getHazelcastInstance() != null) {
        siddhiConfig.setInstanceIdentifier(
            EventProcessorValueHolder.getHazelcastInstance().getName());
      } else {
        throw new ServiceDependencyValidationException(
            EventProcessorConstants.HAZELCAST_INSTANCE, "Hazelcast instance is not initialized.");
      }
    } else if (isDistributedProcessingEnabledString != null
        && isDistributedProcessingEnabledString.equalsIgnoreCase("RedundantNode")) {
      siddhiConfig.setDistributedProcessing(false);
      if (EventProcessorValueHolder.getHazelcastInstance() != null) {
        siddhiConfig.setInstanceIdentifier(
            EventProcessorValueHolder.getHazelcastInstance().getName());
      } else {
        throw new ServiceDependencyValidationException(
            EventProcessorConstants.HAZELCAST_INSTANCE, "Hazelcast instance is not initialized.");
      }
    } else {
      siddhiConfig.setDistributedProcessing(false);
    }

    siddhiConfig.setQueryPlanIdentifier(
        "org.wso2.siddhi-" + tenantId + "-" + executionPlanConfiguration.getName());
    siddhiConfig.setSiddhiExtensions(SiddhiExtensionLoader.loadSiddhiExtensions());
    return siddhiConfig;
  }