Java源码示例:org.camunda.spin.plugin.impl.SpinProcessEnginePlugin

示例1
@Test
public void ensureSpinProcessEnginePluginIsCorrectlyLoaded() {
  // given
  List<ProcessEnginePlugin> plugins = processEngineConfiguration.getProcessEnginePlugins();
  List<TypedValueSerializer<?>> serializers = processEngineConfiguration.getVariableSerializers().getSerializers();

  if (plugins.get(0) instanceof CompositeProcessEnginePlugin) {
    plugins = ((CompositeProcessEnginePlugin) plugins.get(0)).getPlugins();
  }

  boolean isJacksonJsonDataFormat = serializers.stream().anyMatch(s ->
      s instanceof SpinObjectValueSerializer
      && s.getSerializationDataformat().equals("application/json"));

  // then
  assertThat(plugins.stream().anyMatch(plugin -> plugin instanceof SpinProcessEnginePlugin)).isTrue();
  assertThat(isJacksonJsonDataFormat).isTrue();
}
 
示例2
public static void main(String[] args) {

    // start process engine
    StandaloneInMemProcessEngineConfiguration processEngineConfiguration = new StandaloneInMemProcessEngineConfiguration();
    processEngineConfiguration.setProcessEngineName(ProcessEngines.NAME_DEFAULT);

    // add plugins
    List<ProcessEnginePlugin> processEnginePlugins = processEngineConfiguration.getProcessEnginePlugins();
    processEnginePlugins.add(new DebuggerPlugin());
    processEnginePlugins.add(new SpinProcessEnginePlugin());
    processEnginePlugins.add(new ConnectProcessEnginePlugin());

    processEngineConfiguration.buildProcessEngine();

    DebugSessionFactory.getInstance().setSuspend(false);

    // start debug server
    DebugWebsocket debugWebsocket = null;
    try {

      // configure & start the server
      debugWebsocket = new DebugWebsocketConfiguration()
        .port(9090)
        .startServer();

      // block
      debugWebsocket.waitForShutdown();

    } finally {
      if(debugWebsocket != null) {
        debugWebsocket.shutdown();
      }
    }

  }
 
示例3
@Test
public void ensureSpinProcessEnginePluginIsCorrectlyLoaded() {
  // given
  List<ProcessEnginePlugin> plugins = processEngineConfiguration.getProcessEnginePlugins();
  List<TypedValueSerializer<?>> serializers = processEngineConfiguration.getVariableSerializers().getSerializers();

  if (plugins.get(0) instanceof CompositeProcessEnginePlugin) {
    plugins = ((CompositeProcessEnginePlugin) plugins.get(0)).getPlugins();
  }

  boolean isJacksonJsonDataFormat = serializers.stream().anyMatch(s ->
      s instanceof SpinObjectValueSerializer
      && s.getSerializationDataformat().equals("application/json"));

  // then
  assertThat(plugins.stream().anyMatch(plugin -> plugin instanceof SpinProcessEnginePlugin)).isTrue();
  assertThat(isJacksonJsonDataFormat).isTrue();
}
 
示例4
@Bean(name = "spinProcessEnginePlugin")
public ProcessEnginePlugin spinProcessEnginePlugin() {
  return new SpinProcessEnginePlugin() {

    // When testing the NoJpaAutoConfigurationIT test, ensure that no Custom DataFormat
    // Serializers are loaded, otherwise the test's assumption will fail
    @Override
    public void postInit(ProcessEngineConfigurationImpl processEngineConfiguration) {
      registerFunctionMapper(processEngineConfiguration);
      registerScriptResolver(processEngineConfiguration);
      registerValueTypes(processEngineConfiguration);
      registerFallbackSerializer(processEngineConfiguration);
    }
  };
}
 
示例5
@Bean(name = "spinProcessEnginePlugin")
public ProcessEnginePlugin spinProcessEnginePlugin() {
  return new SpinProcessEnginePlugin() {

    // When testing the NoJpaAutoConfigurationIT test, ensure that no Custom DataFormat
    // Serializers are loaded, otherwise the test's assumption will fail
    @Override
    public void postInit(ProcessEngineConfigurationImpl processEngineConfiguration) {
      registerFunctionMapper(processEngineConfiguration);
      registerScriptResolver(processEngineConfiguration);
      registerValueTypes(processEngineConfiguration);
      registerFallbackSerializer(processEngineConfiguration);
    }
  };
}