Package gov.nasa.arc.mct.components

Examples of gov.nasa.arc.mct.components.AbstractComponent


   
    private SameComponentsCannotBeLinkedPolicy policy = new SameComponentsCannotBeLinkedPolicy();
   
    @Test
    public void test() {
        AbstractComponent componentA = Mockito.mock(AbstractComponent.class);
        AbstractComponent componentB = Mockito.mock(AbstractComponent.class);
       
        Mockito.when(componentA.getId()).thenReturn("A");
        Mockito.when(componentB.getId()).thenReturn("B");
       
        PolicyContext context = new PolicyContext();
        context.setProperty(PolicyContext.PropertyName.ACTION.getName(), 'w');
        context.setProperty(PolicyContext.PropertyName.TARGET_COMPONENT.getName(), componentA);
        context.setProperty(PolicyContext.PropertyName.SOURCE_COMPONENTS.getName(), Collections.singletonList(componentB));
View Full Code Here


            final boolean hasGroupCapability,
            boolean expectedResult) {
        PolicyContext context = new PolicyContext();
       
        // getCapability is final, so we can't just mock....
        pseudoComponent = new AbstractComponent() {
            public String getOwner() {
                return compOwner;
            }
           
            public <T> T handleGetCapability(Class<T> capability) {
View Full Code Here

    @Test
    public void testUsesRoleService() {
        RoleService mockRoleService = Mockito.mock(RoleService.class);
        new RoleAccess().addRoleService(mockRoleService);
       
        AbstractComponent mockComponent = Mockito.mock(AbstractComponent.class);
       
        Mockito.when(mockPlatform.getCurrentUser()).thenReturn(mockUser);
        Mockito.when(mockUser.getUserId()).thenReturn("testUser1");
        Mockito.when(mockUser.getDisciplineId()).thenReturn("testGroup1");
        Mockito.when(mockComponent.getOwner()).thenReturn("testRole1");
       
        Mockito.verifyZeroInteractions(mockRoleService);
               
        PolicyContext context = new PolicyContext();
        context.setProperty(PolicyContext.PropertyName.TARGET_COMPONENT.getName(), pseudoComponent);
View Full Code Here

public class TestDefaultViewForTaxonomy {
   
    @DataProvider(name="policies")
    Object[][] generateData() {
        AbstractComponent[] components = new AbstractComponent[] {
                new AbstractComponent() {
                },
                new TelemetryDataTaxonomyComponent()
        };
       
        ViewInfo[] infos = new ViewInfo[] {
View Full Code Here

            }
            if (visibleChildComponents.size() == node.getChildCount()) {
                boolean changed = false; // Same number of children - but have any changed or moved?
                for (int index = 0; index < visibleChildComponents.size(); index++) {
                    MCTMutableTreeNode treeNode = (MCTMutableTreeNode) node.getChildAt(index);
                    AbstractComponent nodeComponent = ((View) treeNode.getUserObject()).getManifestedComponent();
                    if (!nodeComponent.getComponentId().equals(visibleChildComponents.get(index).getComponentId())) {
                        changed = true;
                        break;
                    }
                }
                if (!changed) return; // Don't continue with refresh if children are unchanged.
View Full Code Here

    }

    @Override
    public void updateMonitoredGUI(AddChildEvent event) {
        if (node != null) {
            AbstractComponent parentComponent = ((View) node.getUserObject()).getManifestedComponent();
            PolicyContext context = new PolicyContext();
            context.setProperty(PolicyContext.PropertyName.TARGET_COMPONENT.getName(), parentComponent);
            context.setProperty(PolicyContext.PropertyName.ACTION.getName(), 'w');
            PolicyManager policyManager = PlatformAccess.getPlatform().getPolicyManager();
            if (!policyManager.execute(PolicyInfo.CategoryType.OBJECT_INSPECTION_POLICY_CATEGORY.getKey(), context).getStatus())
                return;

            AbstractComponent childComponent = event.getChildComponent();
            Set<ViewInfo> viewInfos = childComponent.getViewInfos(ViewType.NODE);

            if (!node.isProxy()) {
                MCTMutableTreeNode childNode = GUIUtil.cloneTreeNode(childComponent, viewInfos.iterator()
                        .next());
                node.addChild(event.getChildIndex(), childNode, objectStaleListener);
View Full Code Here

    }

    @Override
    public void updateMonitoredGUI(RemoveChildEvent event) {
        if (node != null && !node.isProxy()) {
            AbstractComponent targetChildComponent = event.getChildComponent();
            for (int i = 0; i < node.getChildCount(); i++) {
                MCTMutableTreeNode childNode = (MCTMutableTreeNode) node.getChildAt(i);
                AbstractComponent childComponent = ((View) childNode.getUserObject()).getManifestedComponent();
                if (targetChildComponent.equals(childComponent)) {
                    node.removeChild(childNode, objectStaleListener);
                }
            }
        }
View Full Code Here

        DefaultTreeModel treeModel = (DefaultTreeModel) tree.getModel();
        List<TreePath> treePaths = new ArrayList<TreePath>();
        for (int i = 0; i < node.getChildCount(); i++) {
            MCTMutableTreeNode childNode = (MCTMutableTreeNode) node.getChildAt(i);
            View childGUIComponent = (View) childNode.getUserObject();
            AbstractComponent childComponent = childGUIComponent.getManifestedComponent();
            for (AbstractComponent focusComponent : event.getFocusComponents()) {
                if (focusComponent.getComponentId().equals(childComponent.getComponentId())) {
                    treePaths.add(new TreePath(treeModel.getPathToRoot(childNode)));
                }
            }
        }
        if (treePaths.size() > 0) {
View Full Code Here

        Assert.assertFalse(action.canHandle(context));
    }
   
    @Test
    public void testIsEnabled() throws Exception {
        AbstractComponent componentWithExternalKey = Mockito.mock(AbstractComponent.class);
        Mockito.when(componentWithExternalKey.getExternalKey()).thenReturn("key");
        AbstractComponent componentWithoutExternalKey = Mockito.mock(AbstractComponent.class);
       
        Field f = DuplicateAction.class.getDeclaredField("actionContext");
        f.setAccessible(true);
        ActionContextImpl actionContext = new ActionContextImpl();
        f.set(action, actionContext);
View Full Code Here

        PolicyManagerImpl.getInstance().refreshExtendedPolicies(Collections.<ExtendedComponentProvider>singletonList(new ExtendedComponentProviderTest()));
        MCTHousing housing = Mockito.mock(MCTHousing.class);
        MCTDirectoryArea directoryArea = Mockito.mock(MCTDirectoryArea.class);
        MCTMutableTreeNode selectedNode = Mockito.mock(MCTMutableTreeNode.class);
        MCTMutableTreeNode parentNode = Mockito.mock(MCTMutableTreeNode.class);
        AbstractComponent ac = Mockito.mock(AbstractComponent.class);
        AbstractComponent parent = Mockito.mock(AbstractComponent.class);
        JTree tree = Mockito.mock(JTree.class);
        TreePath treePath = Mockito.mock(TreePath.class);
       
        ActionContextImpl actionContext = Mockito.mock(ActionContextImpl.class);
        NodeViewManifestation selectedNodeView = Mockito.mock(NodeViewManifestation.class);       
View Full Code Here

TOP

Related Classes of gov.nasa.arc.mct.components.AbstractComponent

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.