Search in sources :

Example 26 with Converters

use of com.canoo.dp.impl.remoting.Converters in project dolphin-platform by canoo.

the class ConverterTest method testStringConversions.

@Test
public void testStringConversions() {
    Converters converters = new Converters(null);
    Converter converter = converters.getConverter(String.class);
    checkConversion(converter, "");
    checkConversion(converter, null);
    checkConversion(converter, "Hello");
}
Also used : Converters(com.canoo.dp.impl.remoting.Converters) Converter(com.canoo.platform.remoting.spi.converter.Converter) Test(org.testng.annotations.Test)

Example 27 with Converters

use of com.canoo.dp.impl.remoting.Converters in project dolphin-platform by canoo.

the class AbstractDolphinBasedTest method createBeanManager.

protected BeanManager createBeanManager(ServerModelStore serverModelStore, BeanRepository beanRepository, EventDispatcher dispatcher) {
    final Converters converters = new Converters(beanRepository);
    final PresentationModelBuilderFactory builderFactory = new ServerPresentationModelBuilderFactory(serverModelStore);
    final ClassRepository classRepository = new ClassRepositoryImpl(serverModelStore, converters, builderFactory);
    final ListMapper listMapper = new ListMapperImpl(serverModelStore, classRepository, beanRepository, builderFactory, dispatcher);
    final RemotingConfiguration configurationForGc = new RemotingConfiguration();
    final GarbageCollector garbageCollector = new GarbageCollector(configurationForGc, new GarbageCollectionCallback() {

        @Override
        public void onReject(Set<Instance> instances) {
        }
    });
    final BeanBuilder beanBuilder = new ServerBeanBuilderImpl(classRepository, beanRepository, listMapper, builderFactory, dispatcher, garbageCollector);
    return new BeanManagerImpl(beanRepository, beanBuilder);
}
Also used : Instance(com.canoo.dp.impl.server.gc.Instance) ClassRepository(com.canoo.dp.impl.remoting.ClassRepository) Converters(com.canoo.dp.impl.remoting.Converters) BeanBuilder(com.canoo.dp.impl.remoting.BeanBuilder) ServerPresentationModelBuilderFactory(com.canoo.dp.impl.server.model.ServerPresentationModelBuilderFactory) PresentationModelBuilderFactory(com.canoo.dp.impl.remoting.PresentationModelBuilderFactory) RemotingConfiguration(com.canoo.dp.impl.server.config.RemotingConfiguration) ServerPresentationModelBuilderFactory(com.canoo.dp.impl.server.model.ServerPresentationModelBuilderFactory) GarbageCollectionCallback(com.canoo.dp.impl.server.gc.GarbageCollectionCallback) ServerBeanBuilderImpl(com.canoo.dp.impl.server.model.ServerBeanBuilderImpl) BeanManagerImpl(com.canoo.dp.impl.remoting.BeanManagerImpl) ListMapper(com.canoo.dp.impl.remoting.ListMapper) ListMapperImpl(com.canoo.dp.impl.remoting.collections.ListMapperImpl) ClassRepositoryImpl(com.canoo.dp.impl.remoting.ClassRepositoryImpl) GarbageCollector(com.canoo.dp.impl.server.gc.GarbageCollector)

Example 28 with Converters

use of com.canoo.dp.impl.remoting.Converters in project dolphin-platform by canoo.

the class AbstractDolphinBasedTest method createBeanManager.

protected BeanManager createBeanManager(ServerModelStore serverModelStore) {
    final EventDispatcher dispatcher = new ServerEventDispatcher(serverModelStore);
    final BeanRepositoryImpl beanRepository = new BeanRepositoryImpl(serverModelStore, dispatcher);
    final Converters converters = new Converters(beanRepository);
    final PresentationModelBuilderFactory builderFactory = new ServerPresentationModelBuilderFactory(serverModelStore);
    final ClassRepository classRepository = new ClassRepositoryImpl(serverModelStore, converters, builderFactory);
    final ListMapper listMapper = new ListMapperImpl(serverModelStore, classRepository, beanRepository, builderFactory, dispatcher);
    final RemotingConfiguration configurationForGc = new RemotingConfiguration();
    final GarbageCollector garbageCollector = new GarbageCollector(configurationForGc, new GarbageCollectionCallback() {

        @Override
        public void onReject(Set<Instance> instances) {
        }
    });
    final BeanBuilder beanBuilder = new ServerBeanBuilderImpl(classRepository, beanRepository, listMapper, builderFactory, dispatcher, garbageCollector);
    return new BeanManagerImpl(beanRepository, beanBuilder);
}
Also used : ServerEventDispatcher(com.canoo.dp.impl.server.model.ServerEventDispatcher) Instance(com.canoo.dp.impl.server.gc.Instance) ClassRepository(com.canoo.dp.impl.remoting.ClassRepository) Converters(com.canoo.dp.impl.remoting.Converters) BeanBuilder(com.canoo.dp.impl.remoting.BeanBuilder) BeanRepositoryImpl(com.canoo.dp.impl.remoting.BeanRepositoryImpl) ServerPresentationModelBuilderFactory(com.canoo.dp.impl.server.model.ServerPresentationModelBuilderFactory) PresentationModelBuilderFactory(com.canoo.dp.impl.remoting.PresentationModelBuilderFactory) ServerEventDispatcher(com.canoo.dp.impl.server.model.ServerEventDispatcher) EventDispatcher(com.canoo.dp.impl.remoting.EventDispatcher) RemotingConfiguration(com.canoo.dp.impl.server.config.RemotingConfiguration) ServerPresentationModelBuilderFactory(com.canoo.dp.impl.server.model.ServerPresentationModelBuilderFactory) GarbageCollectionCallback(com.canoo.dp.impl.server.gc.GarbageCollectionCallback) ServerBeanBuilderImpl(com.canoo.dp.impl.server.model.ServerBeanBuilderImpl) BeanManagerImpl(com.canoo.dp.impl.remoting.BeanManagerImpl) ListMapper(com.canoo.dp.impl.remoting.ListMapper) ListMapperImpl(com.canoo.dp.impl.remoting.collections.ListMapperImpl) ClassRepositoryImpl(com.canoo.dp.impl.remoting.ClassRepositoryImpl) GarbageCollector(com.canoo.dp.impl.server.gc.GarbageCollector)

Example 29 with Converters

use of com.canoo.dp.impl.remoting.Converters in project dolphin-platform by canoo.

the class DurationConverterFactoryTest method testBasicConversions.

@Test
public void testBasicConversions(@Mocked BeanRepository beanRepository) {
    // Given
    Converters converters = new Converters(beanRepository);
    // When
    Converter converter = converters.getConverter(Duration.class);
    // Then
    testReconversion(converter, Duration.ZERO);
    testReconversion(converter, Duration.ofDays(7));
    testReconversion(converter, Duration.ofMillis(10));
    testReconversion(converter, Duration.ofDays(10_000_000));
}
Also used : Converters(com.canoo.dp.impl.remoting.Converters) Converter(com.canoo.platform.remoting.spi.converter.Converter) Test(org.testng.annotations.Test)

Example 30 with Converters

use of com.canoo.dp.impl.remoting.Converters in project dolphin-platform by canoo.

the class DurationConverterFactoryTest method testConverterCreation.

@Test
public void testConverterCreation(@Mocked BeanRepository beanRepository) {
    // Given
    Converters converters = new Converters(beanRepository);
    // When
    Converter converter = converters.getConverter(Duration.class);
    // Then
    assertNotNull(converter);
}
Also used : Converters(com.canoo.dp.impl.remoting.Converters) Converter(com.canoo.platform.remoting.spi.converter.Converter) Test(org.testng.annotations.Test)

Aggregations

Converters (com.canoo.dp.impl.remoting.Converters)36 Test (org.testng.annotations.Test)33 Converter (com.canoo.platform.remoting.spi.converter.Converter)28 ValueConverterException (com.canoo.platform.remoting.spi.converter.ValueConverterException)5 BeanBuilder (com.canoo.dp.impl.remoting.BeanBuilder)3 BeanManagerImpl (com.canoo.dp.impl.remoting.BeanManagerImpl)3 ClassRepository (com.canoo.dp.impl.remoting.ClassRepository)3 ClassRepositoryImpl (com.canoo.dp.impl.remoting.ClassRepositoryImpl)3 ListMapper (com.canoo.dp.impl.remoting.ListMapper)3 PresentationModelBuilderFactory (com.canoo.dp.impl.remoting.PresentationModelBuilderFactory)3 ListMapperImpl (com.canoo.dp.impl.remoting.collections.ListMapperImpl)3 RemotingConfiguration (com.canoo.dp.impl.server.config.RemotingConfiguration)2 GarbageCollectionCallback (com.canoo.dp.impl.server.gc.GarbageCollectionCallback)2 GarbageCollector (com.canoo.dp.impl.server.gc.GarbageCollector)2 Instance (com.canoo.dp.impl.server.gc.Instance)2 ServerBeanBuilderImpl (com.canoo.dp.impl.server.model.ServerBeanBuilderImpl)2 ServerPresentationModelBuilderFactory (com.canoo.dp.impl.server.model.ServerPresentationModelBuilderFactory)2 ClientBeanBuilderImpl (com.canoo.dp.impl.client.ClientBeanBuilderImpl)1 ClientPresentationModelBuilderFactory (com.canoo.dp.impl.client.ClientPresentationModelBuilderFactory)1 BeanRepositoryImpl (com.canoo.dp.impl.remoting.BeanRepositoryImpl)1