Search in sources :

Example 1 with DefaultLayout

use of org.opennms.features.topology.app.internal.DefaultLayout in project opennms by OpenNMS.

the class HierarchyLayoutAlgorithmTest method buildLayout.

private void buildLayout() {
    // Mock ALL the things
    final GraphContainer mockGraphContainer = Mockito.mock(GraphContainer.class);
    layout = new DefaultLayout();
    final TestGraph testGraph = new TestGraph(layout, vertices, edges);
    Mockito.when(mockGraphContainer.getGraph()).thenReturn(testGraph);
    // Update layouts and ensure no exception is thrown
    new HierarchyLayoutAlgorithm().updateLayout(testGraph);
}
Also used : GraphContainer(org.opennms.features.topology.api.GraphContainer) DefaultLayout(org.opennms.features.topology.app.internal.DefaultLayout) TestGraph(org.opennms.features.topology.app.internal.TestGraph)

Example 2 with DefaultLayout

use of org.opennms.features.topology.app.internal.DefaultLayout in project opennms by OpenNMS.

the class BundleContextHistoryManagerTest method setUp.

@Before
public void setUp() {
    if (new File(DATA_FILE_NAME).exists()) {
        new File(DATA_FILE_NAME).delete();
    }
    serviceLocatorMock = Mockito.mock(ServiceLocator.class);
    bundleContextMock = Mockito.mock(BundleContext.class);
    graphContainerMock = Mockito.mock(GraphContainer.class);
    ;
    graphMock = Mockito.mock(Graph.class);
    startingSearchResults = new HashMap<>();
    startingProviders = new HashMap<>();
    startingCriteria = new HashMap<>();
    this.capturedCriteria = new ArrayList<>();
    displayableVertices = new ArrayList<>();
    selectedLayout = new DefaultLayout();
    historyManager = new BundleContextHistoryManager(bundleContextMock, serviceLocatorMock);
    historyManager.onBind(new CircleLayoutOperation());
    historyManager.onBind(new ManualLayoutOperation(null));
    historyManager.onBind(new FRLayoutOperation());
    historyManager.onBind(new SimpleLayoutOperation());
    historyManager.onBind(new ISOMLayoutOperation());
    historyManager.onBind(new SpringLayoutOperation());
    historyManager.onBind(new RealUltimateLayoutOperation());
    historyManager.onBind(new KKLayoutOperation());
    historyManager.onBind(new AutoRefreshToggleOperation());
    initProvidersAndCriteria();
    setBehaviour(bundleContextMock);
    setBehaviour(graphContainerMock);
    setBehaviour(graphMock);
    setBehaviour(serviceLocatorMock);
}
Also used : SimpleLayoutOperation(org.opennms.features.topology.app.internal.operations.SimpleLayoutOperation) DefaultLayout(org.opennms.features.topology.app.internal.DefaultLayout) KKLayoutOperation(org.opennms.features.topology.app.internal.operations.KKLayoutOperation) CircleLayoutOperation(org.opennms.features.topology.app.internal.operations.CircleLayoutOperation) ManualLayoutOperation(org.opennms.features.topology.app.internal.operations.ManualLayoutOperation) ServiceLocator(org.opennms.features.topology.api.support.ServiceLocator) GraphContainer(org.opennms.features.topology.api.GraphContainer) Graph(org.opennms.features.topology.api.Graph) SpringLayoutOperation(org.opennms.features.topology.app.internal.operations.SpringLayoutOperation) FRLayoutOperation(org.opennms.features.topology.app.internal.operations.FRLayoutOperation) AutoRefreshToggleOperation(org.opennms.features.topology.app.internal.operations.AutoRefreshToggleOperation) ISOMLayoutOperation(org.opennms.features.topology.app.internal.operations.ISOMLayoutOperation) File(java.io.File) RealUltimateLayoutOperation(org.opennms.features.topology.app.internal.operations.RealUltimateLayoutOperation) BundleContext(org.osgi.framework.BundleContext) Before(org.junit.Before)

Aggregations

GraphContainer (org.opennms.features.topology.api.GraphContainer)2 DefaultLayout (org.opennms.features.topology.app.internal.DefaultLayout)2 File (java.io.File)1 Before (org.junit.Before)1 Graph (org.opennms.features.topology.api.Graph)1 ServiceLocator (org.opennms.features.topology.api.support.ServiceLocator)1 TestGraph (org.opennms.features.topology.app.internal.TestGraph)1 AutoRefreshToggleOperation (org.opennms.features.topology.app.internal.operations.AutoRefreshToggleOperation)1 CircleLayoutOperation (org.opennms.features.topology.app.internal.operations.CircleLayoutOperation)1 FRLayoutOperation (org.opennms.features.topology.app.internal.operations.FRLayoutOperation)1 ISOMLayoutOperation (org.opennms.features.topology.app.internal.operations.ISOMLayoutOperation)1 KKLayoutOperation (org.opennms.features.topology.app.internal.operations.KKLayoutOperation)1 ManualLayoutOperation (org.opennms.features.topology.app.internal.operations.ManualLayoutOperation)1 RealUltimateLayoutOperation (org.opennms.features.topology.app.internal.operations.RealUltimateLayoutOperation)1 SimpleLayoutOperation (org.opennms.features.topology.app.internal.operations.SimpleLayoutOperation)1 SpringLayoutOperation (org.opennms.features.topology.app.internal.operations.SpringLayoutOperation)1 BundleContext (org.osgi.framework.BundleContext)1