Package gov.nasa.arc.mct.platform.spi

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


        oldPlatform = PlatformAccess.getPlatform();
    }
   
    @AfterClass
    public void teardown() {
        new PlatformAccess().setPlatform(oldPlatform);
    }
View Full Code Here


        }
        Set<String> userSet = new HashSet<String>();
        userSet.addAll(Arrays.<String>asList(users));       
        Mockito.when(mockPersistence.getAllUsers()).thenReturn(userSet);
       
        new PlatformAccess().setPlatform(mockPlatform);
    }
View Full Code Here

        Mockito.when(mockUser.getUserId()).thenReturn("");
        Mockito.when(mockRoleService.getAllUsers()).thenReturn(Collections.singleton(""));
        Mockito.when(mockPlatform.getBootstrapComponents()).thenReturn(Collections.<AbstractComponent>emptyList());
        GlobalContext.getGlobalContext().switchUser(mockUser, Mockito.mock(Runnable.class));
        new RoleAccess().addRoleService(mockRoleService);
        new PlatformAccess().setPlatform(mockPlatform);
    }
View Full Code Here

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

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

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

        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

        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

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

        };
       
        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

        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

TOP

Related Classes of gov.nasa.arc.mct.platform.spi.PlatformAccess

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.