Package gov.nasa.arc.mct.services.component

Examples of gov.nasa.arc.mct.services.component.ComponentProvider


    private PersistenceProvider mockPersistence;
    private AbstractComponent mySandbox = new AbstractComponent() {
    };
   
    private ExtendedComponentProvider createProvider(final Collection<ComponentTypeInfo> infos, final Collection<ViewInfo> viewInfos) {
        ComponentProvider provider = new TestComponentProvider(infos, viewInfos);
       
        return new ExtendedComponentProvider(provider, "test");
    }
View Full Code Here


   
    @Test
    public void testExceptionWhileInvokingGetInfo() {
        ComponentTypeInfo info = new ComponentTypeInfo("displayName", "desc", TestBaseComponent.class);
        ExtendedComponentProvider goodProvider = createProvider(Collections.singletonList(info), null);
        ComponentProvider exceptionProvider = new TestComponentProvider(null, null) {
            @Override
            public Collection<ComponentTypeInfo> getComponentTypes() {
                throw new ClassCastException();
            }
        };
View Full Code Here

    }
   
    @Test (dataProvider="assetTestCases")
    public <T> void testGetAsset(int count, int found, T asset, Class<T> clazz) {
        // Setup some mock providers to look at for assets
        ComponentProvider mockDefaultProvider = Mockito.mock(ComponentProvider.class);
        ExtendedComponentProvider mockProviders[] = new ExtendedComponentProvider[count];
        TypeInfo<?> mockTypeInfo = Mockito.mock(TypeInfo.class);
        for (int i = 0; i < count; i++) {
            mockProviders[i] = Mockito.mock(ExtendedComponentProvider.class, "provider" + i);
        }       
        // Find the expected item in provider "found" (with default provider at end)
        if (found < count) {
            Mockito.when(mockProviders[found].getAsset(mockTypeInfo, clazz)).thenReturn(asset);
        } else if (found == count) {
            Mockito.when(mockDefaultProvider.getAsset(mockTypeInfo, clazz)).thenReturn(asset);
        }
        registry.setDefaultViewProvider(mockDefaultProvider);
        registry.refreshComponents(Arrays.asList(mockProviders));
       
        // Should find the object, unless found > count
View Full Code Here

                    infos.add(info);
                }
            }
        }
       
        ComponentProvider defaultProvider = defaultViewProvider.get();
        if (defaultProvider != null && (infos.isEmpty() || (ALLOWS_MULTIPLE_DEFAULT_VIEWS.contains(type)))) {
            for (ViewInfo view : defaultProvider.getViews(componentTypeId)) {
                if (type == view.getViewType()) {
                    infos.add(view);
                }
            }
        }
View Full Code Here

        f.setContentPane(new JPanel());
        f.getContentPane().add(new JButton("press me"));
        f.pack();
        f.setVisible(true);
       
        @SuppressWarnings("unchecked")
        ComponentProvider provider = new MockComponentProvider(Collections
                .EMPTY_LIST, Collections.EMPTY_LIST, Collections.EMPTY_LIST,
                Arrays.asList(
                        new ViewInfo(NodeViewManifestation.class, "test", ViewType.NODE)));
       
View Full Code Here

    }
   
    private synchronized void notifyPlatformServicesChanged() {
        List<ExtendedComponentProvider> providers = new ArrayList<ExtendedComponentProvider>(allProviders.size());
        for (ServiceReference sr:allProviders) {
            ComponentProvider cp = (ComponentProvider) sr.getBundle().getBundleContext().getService(sr);
            providers.add(new ExtendedComponentProvider(cp, sr.getBundle().getSymbolicName()));
        }

        ExternalComponentRegistryImpl.getInstance().refreshComponents(providers);
        MenuExtensionManager.getInstance().refreshExtendedMenus(providers);
View Full Code Here

TOP

Related Classes of gov.nasa.arc.mct.services.component.ComponentProvider

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.