Example usage for com.vaadin.server VaadinSession getConverterFactory

List of usage examples for com.vaadin.server VaadinSession getConverterFactory

Introduction

In this page you can find the example usage for com.vaadin.server VaadinSession getConverterFactory.

Prototype

@Deprecated
public Object getConverterFactory() 

Source Link

Document

Gets the ConverterFactory used to locate a suitable Converter for fields in the session.

Usage

From source file:info.magnolia.ui.form.field.factory.AbstractFieldFactoryTestCase.java

License:Open Source License

@Before
public void setUp() throws Exception {
    // Init Message & Providers

    i18NAuthoringSupport = mock(I18NAuthoringSupport.class);
    ComponentsTestUtil.setInstance(I18NAuthoringSupport.class, i18NAuthoringSupport);
    ComponentsTestUtil.setImplementation(TypeMapping.class, TypeMappingImpl.class);
    ComponentsTestUtil.setImplementation(Node2BeanTransformer.class, Node2BeanTransformerImpl.class);
    ComponentsTestUtil.setImplementation(Node2BeanProcessor.class, Node2BeanProcessorImpl.class);
    ComponentsTestUtil.setImplementation(MessagesManager.class, DefaultMessagesManager.class);

    SystemContext systemContext = mock(SystemContext.class);
    when(systemContext.getLocale()).thenReturn(DEFAULT_LOCALE);
    ComponentsTestUtil.setInstance(SystemContext.class, systemContext);

    VaadinSession vaadinSession = mock(VaadinSession.class);
    when(vaadinSession.getConverterFactory()).thenReturn(new DefaultConverterFactory());
    when(vaadinSession.getLocale()).thenReturn(DEFAULT_LOCALE);
    when(vaadinSession.hasLock()).thenReturn(true);
    ComponentsTestUtil.setInstance(VaadinSession.class, vaadinSession);

    // Init Session
    session = new MockSession(workspaceName);
    MockContext ctx = new MockContext();
    ctx.addSession(workspaceName, session);
    MgnlContext.setInstance(ctx);// w  w  w  . ja v a2 s.  co m

    // Create ConfiguredField POJO
    createConfiguredFieldDefinition();

    // Init Node and Item.
    Node rootNode = session.getRootNode();
    baseNode = rootNode.addNode(itemName);
    baseItem = new JcrNodeAdapter(baseNode);
    componentProvider = new MockComponentProvider();
    componentProvider.setInstance(I18NAuthoringSupport.class, mock(I18NAuthoringSupport.class));
    componentProvider.setInstance(UiContext.class, mock(UiContext.class));
}