コード例 #1
0
        public virtual void testPluginRegistersJsonSerializerIfPresentInClasspath()
        {
            DataFormats.loadDataFormats(null);
            ProcessEngineConfigurationImpl mockConfig = Mockito.mock(typeof(ProcessEngineConfigurationImpl));

            Mockito.when(mockConfig.VariableSerializers).thenReturn(processEngineConfiguration.VariableSerializers);
            (new SpinProcessEnginePlugin()).registerSerializers(mockConfig);

            assertTrue(processEngineConfiguration.VariableSerializers.getSerializerByName(org.camunda.spin.plugin.variable.type.JsonValueType_Fields.TYPE_NAME) is JsonValueSerializer);
        }
コード例 #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void allocateReusableRecordsAndSwitchToDefaultWhenExhausted()
        public virtual void AllocateReusableRecordsAndSwitchToDefaultWhenExhausted()
        {
            DynamicRecord          dynamicRecord1  = new DynamicRecord(1);
            DynamicRecord          dynamicRecord2  = new DynamicRecord(2);
            DynamicRecordAllocator recordAllocator = mock(typeof(DynamicRecordAllocator));

            Mockito.when(recordAllocator.NextRecord()).thenReturn(dynamicRecord2);
            ReusableRecordsCompositeAllocator compositeAllocator = new ReusableRecordsCompositeAllocator(singletonList(dynamicRecord1), recordAllocator);

            assertSame("Same as pre allocated record.", dynamicRecord1, compositeAllocator.NextRecord());
            assertSame("Same as expected allocated record.", dynamicRecord2, compositeAllocator.NextRecord());
        }
コード例 #3
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void testPluginDoesNotRegisterJsonSerializerIfNotPresentInClasspath() throws java.io.IOException
        public virtual void testPluginDoesNotRegisterJsonSerializerIfNotPresentInClasspath()
        {
            ClassLoader mockClassloader = Mockito.mock(typeof(ClassLoader));

            Mockito.when(mockClassloader.getResources(Mockito.anyString())).thenReturn(Collections.enumeration(System.Linq.Enumerable.Empty <URL>()));
            DataFormats.loadDataFormats(mockClassloader);
            ProcessEngineConfigurationImpl mockConfig  = Mockito.mock(typeof(ProcessEngineConfigurationImpl));
            DefaultVariableSerializers     serializers = new DefaultVariableSerializers();

            Mockito.when(mockConfig.VariableSerializers).thenReturn(serializers);
            (new SpinProcessEnginePlugin()).registerSerializers(mockConfig);

            assertTrue(serializers.getSerializerByName(org.camunda.spin.plugin.variable.type.JsonValueType_Fields.TYPE_NAME) == null);
        }
コード例 #4
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldExcludeChannelsWithoutInstalledProtocol()
        public virtual void ShouldExcludeChannelsWithoutInstalledProtocol()
        {
            // given
            _reconnectingChannels.putIfAbsent(_to1, _channel1);
            _reconnectingChannels.putIfAbsent(_to2, _channel2);
            ProtocolStack protocolStack1 = new ProtocolStack(TestProtocols_TestApplicationProtocols.RAFT_3, emptyList());

            Mockito.when(_channel1.installedProtocolStack()).thenReturn(protocolStack1);
            Mockito.when(_channel2.installedProtocolStack()).thenReturn(null);

            // when
            Stream <Pair <AdvertisedSocketAddress, ProtocolStack> > installedProtocols = _reconnectingChannels.installedProtocols();

            // then
            assertThat(installedProtocols, contains(Pair.of(_to1, protocolStack1)));
        }
コード例 #5
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldReturnStreamOfInstalledProtocolsForChannelsThatHaveCompletedHandshake()
        public virtual void ShouldReturnStreamOfInstalledProtocolsForChannelsThatHaveCompletedHandshake()
        {
            // given
            _reconnectingChannels.putIfAbsent(_to1, _channel1);
            _reconnectingChannels.putIfAbsent(_to2, _channel2);
            ProtocolStack protocolStack1 = new ProtocolStack(TestProtocols_TestApplicationProtocols.RAFT_3, emptyList());
            ProtocolStack protocolStack2 = new ProtocolStack(TestProtocols_TestApplicationProtocols.RAFT_2, emptyList());

            Mockito.when(_channel1.installedProtocolStack()).thenReturn(protocolStack1);
            Mockito.when(_channel2.installedProtocolStack()).thenReturn(protocolStack2);

            // when
            Stream <Pair <AdvertisedSocketAddress, ProtocolStack> > installedProtocols = _reconnectingChannels.installedProtocols();

            // then
            Stream <Pair <AdvertisedSocketAddress, ProtocolStack> > sorted = installedProtocols.sorted(System.Collections.IComparer.comparing(p => p.first().Hostname));

            assertThat(sorted, contains(Pair.of(_to1, protocolStack1), Pair.of(_to2, protocolStack2)));
        }