Package gov.nasa.arc.mct.components

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


        Mockito.when(mockPlatform.getWindowManager())
            .thenReturn(mockWindowing);
   
        // Setup selected nodes, including a parent       
        selectedTreePaths = new TreePath[selected.size()];
        AbstractComponent mockParent = mockComponent(false, true);
        MCTMutableTreeNode mockParentNode = Mockito.mock(MCTMutableTreeNode.class);
        View mockParentView = mockView(mockParent, ViewType.NODE);
        Mockito.when(mockParentNode.getUserObject()).thenReturn(mockParentView);

        int i = 0;
View Full Code Here


                {false, false}
        };
        boolean[] truths = { true, false };
       
        // Some other parent, somewhere
        AbstractComponent mockParent = mockComponent(false, true);
       
        for (boolean last : truths) { // Whether or not comps are the last manifestations
            for (boolean[] group : groups) {
                // Assemble object graphs
                Collection<AbstractComponent> selected = new ArrayList<AbstractComponent>();
                Collection<AbstractComponent> toDelete = new HashSet<AbstractComponent>();
                for (int i = 0; i < group.length; i++) {
                    AbstractComponent mockComponent = mockComponent(true, true);
                    Mockito.when(mockComponent.getReferencingComponents())
                        .thenReturn(Arrays.asList(mockParent));
                    toDelete.add(mockComponent);
                    selected.add(mockComponent);
                   
                    List<AbstractComponent> children = new ArrayList<AbstractComponent>();
                    for (int j = 0; j < group.length ; j++){
                        AbstractComponent mockChild = mockComponent(group[j], true);                   
                        children.add(mockChild);
                        if (group[j]) {
                            toDelete.add(mockChild);
                        }
                       
                        List<AbstractComponent> grandchildren = new ArrayList<AbstractComponent>();   
                        for (int k = 0; k < group.length; k++) {
                            AbstractComponent mockGrandchild = mockComponent(group[k], true);                     
                            grandchildren.add(mockGrandchild);
                            if (group[j] && group[k]) {
                                toDelete.add(mockGrandchild);
                            }
                            Mockito.when(mockGrandchild.getReferencingComponents())
                                .thenReturn(last ?
                                        Arrays.asList(mockChild) :
                                        Arrays.asList(mockParent, mockChild));   
                        }
                        Mockito.when(mockChild.getComponents())
View Full Code Here

        return result;
    }  
   
    private static int counter = 0;   
    private AbstractComponent mockComponent(boolean canBeDeleted, boolean canBeComposed) {       
        final AbstractComponent mockComponent =
                Mockito.mock(AbstractComponent.class);
        Mockito.when(mockComponent.getComponents())
                .thenReturn(Collections.<AbstractComponent>emptyList());
        Mockito.when(mockComponent.getComponentId())
                .thenReturn("mock" + counter++);
        if (canBeDeleted) {
            canDelete.add(mockComponent);
        }
        if (canBeComposed) {
View Full Code Here

        // Verify precondition (ensure UserEnvironmentRegistry is appropriately clear)
        Assert.assertEquals(UserEnvironmentRegistry.getHousingCount(), 0);
       
        for (MCTAbstractHousing h : mockHousings) {
            // UserEnvironmentRegistry keys on component id, so provide one
            AbstractComponent mockComp = Mockito.mock(AbstractComponent.class);
            Mockito.when(mockComp.getId()).thenReturn("component");
            Mockito.when(h.getWindowComponent()).thenReturn(mockComp);
           
            // Also,
            Mockito.doAnswer(new Answer<Object>() {
                @Override
View Full Code Here

    @Override
    public AbstractComponent createComp(ComponentRegistry comp,
        AbstractComponent targetComponent) {
      String displayName = baseDisplayName.getText().trim();
      String execCmd = execCommand.getText().trim();
          AbstractComponent component = null;
                 
          component = comp.newInstance(ExecutableButtonComponent.class, targetComponent);
         
          ExecutableButtonModel execButtonModel = ExecutableButtonComponent.class.cast(component).getModel();
          execButtonModel.getData().setExecCmd(execCmd);
          component.setDisplayName(displayName);
      component.save();
         
          return component;
    }
View Full Code Here

      FeedProvider fp = Mockito.mock(FeedProvider.class);
      Mockito.when(fp.getTimeService()).thenReturn(ts);     
      fps.add(fp);
    }
   
    AbstractComponent fpMockComponent = Mockito.mock(AbstractComponent.class);
    Mockito.when(fpMockComponent.getCapabilities(FeedProvider.class)).thenReturn(fps);
    Mockito.when(fpMockComponent.getCapability(FeedProvider.class)).thenReturn(null);
    FeedProvider fp = manifestation.getFeedProvider(fpMockComponent);
   
    if (setting.startsWith("SYS")) { // One of the expected test time systems
      Assert.assertEquals(fp.getTimeService().getTimeSystemId(), setting);
    } else { // One of the time systems that should fail.
View Full Code Here

   * Returns the current MCT time
   * @return
   */
  public long getCurrentMCTTime() {     
    long cachedTime = System.currentTimeMillis()
    AbstractComponent manifestedComponent = getManifestedComponent();
    if (manifestedComponent!=null) {
      Collection<FeedProvider> feedproviders = getVisibleFeedProviders();
      if (!feedproviders.isEmpty()) {
         
          /* We want to get our "current time" from the feeds we're plotting */
 
View Full Code Here

    evaluatorMap.put(NO_EVALUATOR, NO_EVALUATOR);
   
    enumerationMap = new HashMap<Object, List<String>>();
    enumerationMap.put(NO_EVALUATOR, Collections.<String> emptyList());
   
    AbstractComponent component = manifestation.getManifestedComponent();
   
    addEvaluator(component);
 
    for (AbstractComponent parent : component.getReferencingComponents()) {
      addEvaluator(parent);
   
  }
View Full Code Here

            independent = id;
          } else {
            id = independent + PlotConstants.NON_TIME_FEED_SEPARATOR + id;
          }
          if (count < PlotConstants.MAX_NUMBER_OF_DATA_ITEMS_ON_A_PLOT) {
            AbstractComponent comp = components.get(fp);
            AbstractLegendEntry legendEntry = (AbstractLegendEntry) LegendEntryView.VIEW_INFO.createView(comp);
            plot.addDataSet(0, id, legendEntry);
            count++;
          }
        }
View Full Code Here

  }

  @Override
  public boolean canHandle(ActionContext context) {
    actionContext = (ActionContextImpl) context;
    AbstractComponent targetComponent = actionContext.getTargetComponent();
    if (targetComponent == null)
        putValue(Action.SELECTED_KEY, false);
    else
            putValue(Action.SELECTED_KEY, "My Model A".equals(targetComponent.getDisplayName()));
    return true;
  }
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.