/******************************************************************************************************************* * ******************************************************************************************************************/ @BeforeMethod public void setup() throws Exception { ContextManager.Locator.set(null); context = new ClassPathXmlApplicationContext("DefaultStructureExplorerPresentationControlTestBeans.xml"); underTest = context.getBean(DefaultStructureExplorerPresentationControl.class); presentation = context.getBean(StructureExplorerPresentation.class); messageBus = context.getBean(MessageBus.class); modelFactory = context.getBean(ModelFactory.class); openSiteEvent = mock(OpenSiteEvent.class); fileSystem = mock(ResourceFileSystem.class); root = mock(ResourceFile.class); node = mockWithAsSupport(SiteNode.class, (RoleFactory<SiteNode>)(n -> new SimpleCompositePresentable(n))); when(fileSystem.findFileByPath(eq(ROOT_SITE_NODE_PATH))).thenReturn(root); when(openSiteEvent.getFileSystem()).thenReturn(fileSystem); when(modelFactory.createSiteNode(any(Site.class), eq(root))).thenReturn(node); }
ContextManager.Locator.set(new DefaultContextManagerProvider()); // TODO: possibly drop this actions = new ArrayList<>();
ContextManager.Locator.set(new DefaultContextManagerProvider()); // TODO: possibly drop this actions = new ArrayList<>();
/******************************************************************************************************************* * ******************************************************************************************************************/ @BeforeMethod public void setup() { ContextManager.Locator.set(null); context = new ClassPathXmlApplicationContext("DefaultContentExplorerPresentationControlTestBeans.xml"); underTest = context.getBean(DefaultContentExplorerPresentationControl.class); presentation = context.getBean(ContentExplorerPresentation.class); messageBus = context.getBean(MessageBus.class); modelFactory = context.getBean(ModelFactory.class); openSiteEvent = mock(OpenSiteEvent.class); fileSystem = mock(ResourceFileSystem.class); root = mock(ResourceFile.class); content = mockWithAsSupport(Content.class, (RoleFactory<Content>)(c -> new SimpleCompositePresentable(c))); when(fileSystem.findFileByPath(eq(ROOT_DOCUMENT_PATH))).thenReturn(root); when(openSiteEvent.getFileSystem()).thenReturn(fileSystem); // FIXME: this is cumbersome // when(modelFactory.createContent(eq(root))).thenReturn(content); FIXME!!! final Content.Builder.CallBack callBack = mock(Content.Builder.CallBack.class); when(callBack.build(any(Content.Builder.class))).thenReturn(content); when(modelFactory.createContent()).thenReturn(new Content.Builder(modelFactory, callBack)); }
/******************************************************************************************************************* * ******************************************************************************************************************/ @BeforeMethod public void setup() { ContextManager.Locator.set(null); context = (ClassPathXmlApplicationContext)helper.createSpringContext(); underTest = context.getBean(DefaultContentEditorPresentationControl.class); embeddedServer = context.getBean(EmbeddedServer.class); presentation = context.getBean(ContentEditorPresentation.class); content = mock(Content.class); properties = mock(ResourceProperties.class); presentable = mock(Presentable.class); pm = mock(PresentationModel.class); propertyBinder = mock(PropertyBinder.class); when(embeddedServer.putDocument(anyString(), any(Document.class))).thenReturn(registeredUrl); when(content.getProperties()).thenReturn(properties); when(presentable.createPresentationModel(anyVararg())).thenReturn(pm); when(properties.as(eq(Presentable))).thenReturn(presentable); when(properties.as(eq(PropertyBinder))).thenReturn(propertyBinder); document = new Document().withContent("proxy for: full text") .withMimeType("text/html"); when(propertyBinder.createBoundDocument(any(Key.class), any(PropertyBinder.UpdateCallback.class))) .thenAnswer(invocation -> document); underTest.initialize(); }
/******************************************************************************************************************* * ******************************************************************************************************************/ @BeforeMethod public void setup() throws IOException { ContextManager.Locator.set(new DefaultContextManagerProvider()); modelFactory = new ModelFactorySupport() { @Override @Nonnull public ResourceProperties build (final @Nonnull ResourceProperties.Builder builder) { return new DefaultResourceProperties(builder); } }; properties = modelFactory.createProperties().build().withProperty(PROPERTY_1, ORIGINAL_PROPERTY_1_VALUE) .withProperty(PROPERTY_2, ORIGINAL_PROPERTY_2_VALUE); callback = mock(UpdateCallback.class); underTest = new ResourcePropertiesBinder(properties); }
/******************************************************************************************************************* * ******************************************************************************************************************/ @BeforeMethod public void setup() { ContextManager.Locator.set(null); context = new ClassPathXmlApplicationContext("DefaultStructureEditorPresentationControlTestBeans.xml"); underTest = context.getBean(DefaultStructureEditorPresentationControl.class); presentation = context.getBean(StructureEditorPresentation.class); siteNode = mock(SiteNode.class); properties = mock(ResourceProperties.class); presentable = mock(Presentable.class); pm = mock(PresentationModel.class); when(siteNode.getProperties()).thenReturn(properties); when(presentable.createPresentationModel(anyVararg())).thenReturn(pm); when(properties.as(eq(Presentable))).thenReturn(presentable); }
/******************************************************************************************************************* * ******************************************************************************************************************/ @BeforeMethod public void setup() { contextManager = mock(ContextManager.class); ContextManager.Locator.set(new ContextManagerProvider() { @Override public ContextManager getContextManager() { return contextManager; } }); }
/******************************************************************************************************************* * ******************************************************************************************************************/ @BeforeMethod public void setupFixture() { AsDelegateProvider.Locator.set(new EmptyAsDelegateProvider()); ContextManager.Locator.set(new DefaultContextManagerProvider()); fixture = new DefaultJavaFXBinder(Executors.newSingleThreadExecutor()); }
/******************************************************************************************************************* * * * ******************************************************************************************************************/ @BeforeMethod public void createFixture() { ContextManager.Locator.set(new DefaultContextManagerProvider()); // TODO: try to get rid of this underTest = new LayeredFileSystemProvider(); }
private void closeSpringContext() { log.info("Closing Spring context..."); context.close(); context = null; // don't keep in memory useless stuff ContextManager.Locator.set(null); } }
/******************************************************************************************************************* * ******************************************************************************************************************/ @BeforeMethod public void setupFixture() { AsDelegateProvider.Locator.set(new EmptyAsDelegateProvider()); ContextManager.Locator.set(new DefaultContextManagerProvider()); executor = Executors.newSingleThreadExecutor(); fixture = new TreeViewBindings(executor); }
/******************************************************************************************************************* * ******************************************************************************************************************/ @BeforeMethod public void setupFixture() { AsDelegateProvider.Locator.set(new EmptyAsDelegateProvider()); ContextManager.Locator.set(new DefaultContextManagerProvider()); fixture = new DefaultJavaFXBinder(Executors.newSingleThreadExecutor()); }
/******************************************************************************************************************* * ******************************************************************************************************************/ @BeforeMethod public void setup() { AsDelegateProvider.Locator.set(new EmptyAsDelegateProvider()); ContextManager.Locator.set(new DefaultContextManagerProvider()); }
/******************************************************************************************************************* * ******************************************************************************************************************/ @BeforeMethod public void setupFixture() { AsDelegateProvider.Locator.set(new EmptyAsDelegateProvider()); ContextManager.Locator.set(new DefaultContextManagerProvider()); executor = Executors.newSingleThreadExecutor(); final CellBinder cellBinder = new DefaultCellBinder(executor); fixture = new TreeViewBindings(executor, cellBinder); }
/******************************************************************************************************************* * ******************************************************************************************************************/ @BeforeMethod public void setupFixture() { contextManager = mock(ContextManager.class); ContextManager.Locator.set(new MockContextManagerProvider(contextManager)); }