Search in sources :

Example 1 with DefaultVariableSerializers

use of org.camunda.bpm.engine.impl.variable.serializer.DefaultVariableSerializers in project camunda-bpm-platform by camunda.

the class SpinBpmPlatformPlugin method initializeVariableSerializers.

protected void initializeVariableSerializers(AbstractProcessApplication abstractProcessApplication) {
    VariableSerializers paVariableSerializers = abstractProcessApplication.getVariableSerializers();
    if (paVariableSerializers == null) {
        paVariableSerializers = new DefaultVariableSerializers();
        abstractProcessApplication.setVariableSerializers(paVariableSerializers);
    }
    for (TypedValueSerializer<?> serializer : lookupSpinSerializers(abstractProcessApplication.getProcessApplicationClassloader())) {
        paVariableSerializers.addSerializer(serializer);
    }
}
Also used : DefaultVariableSerializers(org.camunda.bpm.engine.impl.variable.serializer.DefaultVariableSerializers) VariableSerializers(org.camunda.bpm.engine.impl.variable.serializer.VariableSerializers) DefaultVariableSerializers(org.camunda.bpm.engine.impl.variable.serializer.DefaultVariableSerializers)

Example 2 with DefaultVariableSerializers

use of org.camunda.bpm.engine.impl.variable.serializer.DefaultVariableSerializers in project camunda-bpm-platform by camunda.

the class SpinProcessEnginePluginTest method testPluginDoesNotRegisterXmlSerializerIfNotPresentInClasspath.

public void testPluginDoesNotRegisterXmlSerializerIfNotPresentInClasspath() throws IOException {
    ClassLoader mockClassloader = Mockito.mock(ClassLoader.class);
    Mockito.when(mockClassloader.getResources(Mockito.anyString())).thenReturn(Collections.enumeration(Collections.<URL>emptyList()));
    DataFormats.loadDataFormats(mockClassloader);
    ProcessEngineConfigurationImpl mockConfig = Mockito.mock(ProcessEngineConfigurationImpl.class);
    DefaultVariableSerializers serializers = new DefaultVariableSerializers();
    Mockito.when(mockConfig.getVariableSerializers()).thenReturn(serializers);
    new SpinProcessEnginePlugin().registerSerializers(mockConfig);
    assertTrue(serializers.getSerializerByName(XmlValueType.TYPE_NAME) == null);
}
Also used : DefaultVariableSerializers(org.camunda.bpm.engine.impl.variable.serializer.DefaultVariableSerializers) ProcessEngineConfigurationImpl(org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl) URL(java.net.URL)

Example 3 with DefaultVariableSerializers

use of org.camunda.bpm.engine.impl.variable.serializer.DefaultVariableSerializers in project camunda-bpm-platform by camunda.

the class SpinProcessEnginePluginTest method testPluginDoesNotRegisterJsonSerializerIfNotPresentInClasspath.

public void testPluginDoesNotRegisterJsonSerializerIfNotPresentInClasspath() throws IOException {
    ClassLoader mockClassloader = Mockito.mock(ClassLoader.class);
    Mockito.when(mockClassloader.getResources(Mockito.anyString())).thenReturn(Collections.enumeration(Collections.<URL>emptyList()));
    DataFormats.loadDataFormats(mockClassloader);
    ProcessEngineConfigurationImpl mockConfig = Mockito.mock(ProcessEngineConfigurationImpl.class);
    DefaultVariableSerializers serializers = new DefaultVariableSerializers();
    Mockito.when(mockConfig.getVariableSerializers()).thenReturn(serializers);
    new SpinProcessEnginePlugin().registerSerializers(mockConfig);
    assertTrue(serializers.getSerializerByName(JsonValueType.TYPE_NAME) == null);
}
Also used : DefaultVariableSerializers(org.camunda.bpm.engine.impl.variable.serializer.DefaultVariableSerializers) ProcessEngineConfigurationImpl(org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl) URL(java.net.URL)

Example 4 with DefaultVariableSerializers

use of org.camunda.bpm.engine.impl.variable.serializer.DefaultVariableSerializers in project camunda-bpm-platform by camunda.

the class ProcessEngineConfigurationImpl method initSerialization.

protected void initSerialization() {
    if (variableSerializers == null) {
        variableSerializers = new DefaultVariableSerializers();
        if (customPreVariableSerializers != null) {
            for (TypedValueSerializer<?> customVariableType : customPreVariableSerializers) {
                variableSerializers.addSerializer(customVariableType);
            }
        }
        // register built-in serializers
        variableSerializers.addSerializer(new NullValueSerializer());
        variableSerializers.addSerializer(new StringValueSerializer());
        variableSerializers.addSerializer(new BooleanValueSerializer());
        variableSerializers.addSerializer(new ShortValueSerializer());
        variableSerializers.addSerializer(new IntegerValueSerializer());
        variableSerializers.addSerializer(new LongValueSerlializer());
        variableSerializers.addSerializer(new DateValueSerializer());
        variableSerializers.addSerializer(new DoubleValueSerializer());
        variableSerializers.addSerializer(new ByteArrayValueSerializer());
        variableSerializers.addSerializer(new JavaObjectSerializer());
        variableSerializers.addSerializer(new FileValueSerializer());
        if (customPostVariableSerializers != null) {
            for (TypedValueSerializer<?> customVariableType : customPostVariableSerializers) {
                variableSerializers.addSerializer(customVariableType);
            }
        }
    }
}
Also used : LongValueSerlializer(org.camunda.bpm.engine.impl.variable.serializer.LongValueSerlializer) FileValueSerializer(org.camunda.bpm.engine.impl.variable.serializer.FileValueSerializer) DefaultVariableSerializers(org.camunda.bpm.engine.impl.variable.serializer.DefaultVariableSerializers) DoubleValueSerializer(org.camunda.bpm.engine.impl.variable.serializer.DoubleValueSerializer) BooleanValueSerializer(org.camunda.bpm.engine.impl.variable.serializer.BooleanValueSerializer) ShortValueSerializer(org.camunda.bpm.engine.impl.variable.serializer.ShortValueSerializer) JavaObjectSerializer(org.camunda.bpm.engine.impl.variable.serializer.JavaObjectSerializer) IntegerValueSerializer(org.camunda.bpm.engine.impl.variable.serializer.IntegerValueSerializer) ByteArrayValueSerializer(org.camunda.bpm.engine.impl.variable.serializer.ByteArrayValueSerializer) DateValueSerializer(org.camunda.bpm.engine.impl.variable.serializer.DateValueSerializer) NullValueSerializer(org.camunda.bpm.engine.impl.variable.serializer.NullValueSerializer) StringValueSerializer(org.camunda.bpm.engine.impl.variable.serializer.StringValueSerializer)

Aggregations

DefaultVariableSerializers (org.camunda.bpm.engine.impl.variable.serializer.DefaultVariableSerializers)4 URL (java.net.URL)2 ProcessEngineConfigurationImpl (org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl)2 BooleanValueSerializer (org.camunda.bpm.engine.impl.variable.serializer.BooleanValueSerializer)1 ByteArrayValueSerializer (org.camunda.bpm.engine.impl.variable.serializer.ByteArrayValueSerializer)1 DateValueSerializer (org.camunda.bpm.engine.impl.variable.serializer.DateValueSerializer)1 DoubleValueSerializer (org.camunda.bpm.engine.impl.variable.serializer.DoubleValueSerializer)1 FileValueSerializer (org.camunda.bpm.engine.impl.variable.serializer.FileValueSerializer)1 IntegerValueSerializer (org.camunda.bpm.engine.impl.variable.serializer.IntegerValueSerializer)1 JavaObjectSerializer (org.camunda.bpm.engine.impl.variable.serializer.JavaObjectSerializer)1 LongValueSerlializer (org.camunda.bpm.engine.impl.variable.serializer.LongValueSerlializer)1 NullValueSerializer (org.camunda.bpm.engine.impl.variable.serializer.NullValueSerializer)1 ShortValueSerializer (org.camunda.bpm.engine.impl.variable.serializer.ShortValueSerializer)1 StringValueSerializer (org.camunda.bpm.engine.impl.variable.serializer.StringValueSerializer)1 VariableSerializers (org.camunda.bpm.engine.impl.variable.serializer.VariableSerializers)1