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

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


        platformAccess.setPlatform(null);
    }
   
    @Test
    public void testGetComponentInfos() {
        ComponentTypeInfo info = new ComponentTypeInfo("displayName", "desc", TestBaseComponent.class);
        ExtendedComponentProvider provider = createProvider(Collections.singletonList(info), null);
        registry.refreshComponents(Collections.singletonList(provider));
        Assert.assertEquals(Collections.singleton(info), registry.getComponentInfos(),"component infos must be the same");
    }
View Full Code Here


        Assert.assertTrue(registry.getComponentInfos().isEmpty());
    }
   
    @Test
    public void testMultipleReturnsFromGetInfos() {
        ComponentTypeInfo info = new ComponentTypeInfo("displayName", "desc", TestBaseComponent.class);
        ViewInfo providerViewInfo = new ViewInfo(TestingView.class,"", ViewType.CENTER);
        ViewInfo defaultViewInfo = new ViewInfo(OtherTestingView.class,"", ViewType.CENTER);
        ExtendedComponentProvider cp = createProvider(Collections.singleton(info), Collections.<ViewInfo>singleton(providerViewInfo));
        registry.refreshComponents(Collections.singletonList(cp));
       
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

    @SuppressWarnings("deprecation") // getIcon deprecated but may still be used, so test
    @Test
    public void testCreateManifestation() {
        ImageIcon icon = new ImageIcon();
        ExtendedComponentProvider extendedProvider = new ExtendedComponentProvider(mockProvider, "mock bundle");
        ComponentTypeInfo info = new ComponentTypeInfo("displayname", "desc", MockComponent.class, null, icon);
        Mockito.when(mockProvider.getComponentTypes()).thenReturn(Collections.singleton(info));       
        ExternalComponentRegistryImpl.getInstance().refreshComponents(Collections.singletonList(extendedProvider));       
        Assert.assertSame(component.getIcon(), info.getIcon());
        ExternalComponentRegistryImpl.getInstance().refreshComponents(Collections.<ExtendedComponentProvider>emptyList());
    }
View Full Code Here

  public Object[][] assetTestCases() {
    List<Object[]> cases = new ArrayList<Object[]>();
    // Consider all view types
    for (ViewType type : ViewType.values()) {
      TypeInfo<?> view = new ViewInfo(ExecutableButtonManifestation.class, ExecutableButtonManifestation.VIEW_NAME, ExecutableButtonManifestation.class.getName(), type);
      TypeInfo<?> comp = new ComponentTypeInfo("","",ExecutableButtonComponent.class);
      for (TypeInfo<?> vi : new TypeInfo<?>[]{view, comp}) {
        // Executable buttons have no view or component icons currently
        cases.add(new Object[] { new ExecutableButtonComponentProvider(), vi, ImageIcon.class, false});
        // As above
        cases.add(new Object[] { new ExecutableButtonComponentProvider(), vi, Icon.class, false});
View Full Code Here

        // Verify provider is giving default icons
        DefaultViewProvider provider = new DefaultViewProvider();
        TypeInfo<?> info;
       
        // Should give icons for any kind of type info (esp components and views)
        info = new ComponentTypeInfo("","",AbstractComponent.class);
        Assert.assertNotNull(provider.getAsset(info, Icon.class));       

        info = new ViewInfo(View.class,"",ViewType.OBJECT);
        Assert.assertNotNull(provider.getAsset(info, Icon.class));       
       
View Full Code Here

    }
   
    @Test
    public void testGetComponentType() {
        Assert.assertNull(registry.getComponentType("someType"), "components should be empty prior to populating registry");
        ComponentTypeInfo info = new ComponentTypeInfo("displayName", "desc", TestBaseComponent.class);
        ExtendedComponentProvider provider = createProvider(Collections.singletonList(info), null);
        registry.refreshComponents(Collections.singletonList(provider));
        Assert.assertEquals(TestBaseComponent.class, registry.getComponentType(TestBaseComponent.class.getName()),"supplied info must be equal");
        registry.refreshComponents(Collections.<ExtendedComponentProvider>emptyList());
        Assert.assertNull(registry.getComponentType(TestBaseComponent.class.getName()),"removing provider must also remove component types");
View Full Code Here

       
    }
   
    @Test
    public void testDefaultViews() {
        ExtendedComponentProvider provider = createProvider(Collections.<ComponentTypeInfo>singleton(new ComponentTypeInfo("displayName", "desc", TestBaseComponent.class)), Collections.<ViewInfo>emptyList());
        registry.refreshComponents(Collections.singletonList(provider));
        Assert.assertTrue(registry.getViewInfos("someType", ViewType.CENTER).isEmpty(), "views should be empty prior to populating registry");
        ExtendedComponentProvider defaultProvider = createProvider(Collections.<ComponentTypeInfo>emptyList(), Collections.<ViewInfo>singleton(new ViewInfo(TestingView.class,"",ViewType.CENTER)));
        registry.setDefaultViewProvider(defaultProvider);
        Assert.assertEquals(Collections.singletonList(new ViewInfo(TestingView.class,"", ViewType.CENTER)), registry.getViewInfos(TestBaseComponent.class.getName(), ViewType.CENTER), "default test view should be provided");
View Full Code Here

    }
   
   
    @Test
    public void testNewInstance() throws Exception {
        ComponentTypeInfo info = new ComponentTypeInfo("displayName", "desc", TestBaseComponent.class);
        ExtendedComponentProvider provider = createProvider(Collections.singletonList(info), null);
        registry.refreshComponents(Collections.singletonList(provider));
        TestBaseComponent newComponent = registry.newInstance(TestBaseComponent.class,null);
       
        Assert.assertTrue(newComponent.getClass().equals(TestBaseComponent.class));
View Full Code Here

  }
 
    @Override
  public Collection<ComponentTypeInfo> getComponentTypes() {
    return Collections.singleton(
        new ComponentTypeInfo(bundle.getString("Component_Name"),
            bundle.getString("Component_Description"),
            GraphicalComponent.class));
  }
View Full Code Here

TOP

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

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.