Examples of PlatformAccess


Examples of gov.nasa.arc.mct.platform.spi.PlatformAccess

        new PlatformAccess().setPlatform(mockPlatform);
    }
   
    @AfterMethod
    public void teardown() {
        new PlatformAccess().setPlatform(oldPlatform);
    }
View Full Code Here

Examples of gov.nasa.arc.mct.platform.spi.PlatformAccess

   
    @BeforeMethod
    public void setup() {
        MockitoAnnotations.initMocks(this);

        (new PlatformAccess()).setPlatform(mockPlatform);
        IdGenerator.reset();
    }
View Full Code Here

Examples of gov.nasa.arc.mct.platform.spi.PlatformAccess

        DefaultTreeModel mockModel = Mockito.mock(DefaultTreeModel.class);
       
        Mockito.when(mockTreeNode.getParentTree()).thenReturn(mockTree);
        Mockito.when(mockTree.getModel()).thenReturn(mockModel);
        Mockito.when(mockComponent.getComponents()).thenReturn(Collections.<AbstractComponent>emptyList());
        PlatformAccess access = new PlatformAccess();
        access.setPlatform(new MockPlatform());
       
        nodeViewManifestation.addMonitoredGUI(mockTreeNode);
        nodeViewManifestation.updateMonitoredGUI();
        Assert.assertTrue(label.getText().equals(mockComponent.getExtendedDisplayName()));
    }
View Full Code Here

Examples of gov.nasa.arc.mct.platform.spi.PlatformAccess

        Assert.assertTrue(label.getText().equals(fixedString));
    }

    @Test
    public void testUpdateMonitoredGUI_Reload() {
        PlatformAccess access = new PlatformAccess();
        access.setPlatform(new MockPlatform());
       
        ReloadEvent event = new ReloadEvent(mockComponent);
        Assert.assertFalse(rootNode.isProxy());
        nodeViewManifestation.addMonitoredGUI(rootNode);
        nodeViewManifestation.updateMonitoredGUI(event);
View Full Code Here

Examples of gov.nasa.arc.mct.platform.spi.PlatformAccess

 
  @BeforeMethod
  public void testSetup() {
    provider = new ExecutableButtonComponentProvider();
    MockitoAnnotations.initMocks(this);
    (new PlatformAccess()).setPlatform(mockPlatform);
    Mockito.when(mockPlatform.getCurrentUser()).thenReturn(user);
  }
View Full Code Here

Examples of gov.nasa.arc.mct.platform.spi.PlatformAccess

        };
       
        mockPlatform = Mockito.mock(Platform.class);
        mockPolicyManager = Mockito.mock(PolicyManager.class);
        mockPersistence = Mockito.mock(PersistenceProvider.class);
        (new PlatformAccess()).setPlatform(mockPlatform);
        Mockito.when(mockPlatform.getPolicyManager()).thenReturn(mockPolicyManager);
        Mockito.when(mockPlatform.getPersistenceProvider()).thenReturn(mockPersistence);
        Mockito.when(mockPlatform.getMySandbox()).thenReturn(mySandbox);
        ExecutionResult er = new ExecutionResult(null, true, null);
        Mockito.when(mockPolicyManager.execute(Mockito.anyString(), Mockito.any(PolicyContext.class))).thenReturn(er);
View Full Code Here

Examples of gov.nasa.arc.mct.platform.spi.PlatformAccess

        Mockito.when(mockPlatform.getMySandbox()).thenReturn(mockSandbox);
       
        MockComponentRegistry registry = new MockComponentRegistry();
       
        // Set the platform SPI
        PlatformAccess platformAccess = new PlatformAccess();
        platformAccess.setPlatform(mockPlatform);
       
        // Case #1: test returned collection when adding selectedComponents to the new collection is successful
       
        // Setup
        TestBaseComponent collection = Mockito.mock(TestBaseComponent.class);               
        registry.setDefaultCollection(collection);
        List<AbstractComponent> selectedComponents = Collections.singletonList(Mockito.mock(AbstractComponent.class));
        registry.setExpectedResultForAddComponents(true);

        // The test
        AbstractComponent newCollection = registry.newCollection(selectedComponents);
        Assert.assertSame(newCollection, collection);
       
        // Case #2: test returned collection when adding selectedComponents to the new collection fails
       
        // Setup
        registry.clearRegistry();
        registry.setDefaultCollection(collection);
        registry.setExpectedResultForAddComponents(true);
       
        // The test
        newCollection = registry.newCollection(selectedComponents);
        Assert.assertNotNull(newCollection);

        // Tear down
        platformAccess.setPlatform(null);
    }
View Full Code Here

Examples of gov.nasa.arc.mct.platform.spi.PlatformAccess

    @Mock private PolicyManager mockPolicyManager;
   
    @BeforeMethod
    protected void postSetup() {
        MockitoAnnotations.initMocks(this);
        (new PlatformAccess()).setPlatform(mockPlatform);
        Mockito.when(mockPlatform.getPolicyManager()).thenReturn(mockPolicyManager);
        Mockito.when(mockPolicyManager.execute(Mockito.anyString(), Mockito.any(PolicyContext.class))).thenReturn(new ExecutionResult(null,true,""));
        Mockito.when(mockComponent.getComponentId()).thenReturn("abc");
    }
View Full Code Here

Examples of gov.nasa.arc.mct.platform.spi.PlatformAccess

        Mockito.when(mockComponent.getComponentId()).thenReturn("abc");
    }
   
    @AfterMethod
    protected void tearDown() {
        (new PlatformAccess()).setPlatform(null);
    }
View Full Code Here

Examples of gov.nasa.arc.mct.platform.spi.PlatformAccess

        // Verify that deprecated methods are redirected to getAsset
        Platform oldPlatform = PlatformAccess.getPlatform();
        Platform mockPlatform = Mockito.mock(Platform.class);
        CoreComponentRegistry mockRegistry = Mockito.mock(CoreComponentRegistry.class);
        Mockito.when(mockPlatform.getComponentRegistry()).thenReturn(mockRegistry);
        new PlatformAccess().setPlatform(mockPlatform);
       
        ComponentTypeInfo info;
        info = new ComponentTypeInfo("","",AbstractComponent.class);
        info.getIcon();
        Mockito.verify(mockRegistry).getAsset(info, javax.swing.ImageIcon.class);
       
        info = new ComponentTypeInfo("","",AbstractComponent.class);
        info.getWizardUI();
        Mockito.verify(mockRegistry).getAsset(info, CreateWizardUI.class);
       
       
        new PlatformAccess().setPlatform(oldPlatform);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.