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

Examples of gov.nasa.arc.mct.services.internal.component.User


    @Mock private AbstractComponent rootComponent;
   
    @BeforeMethod
    protected void setup() {
        MockitoAnnotations.initMocks(this);
        GlobalContext.getGlobalContext().switchUser(new User() {

            @Override
            public String getUserId() {
                return "abc";
            }
View Full Code Here


  @Test
  public void testAddNewUser() {
    String userId = "testUser";
    String sandboxId = "mysandbox";
   
    User mockUser = Mockito.mock(User.class);
    AbstractComponent mockBoxes = createAbstractComponent("Drop Boxes", "dropboxes");
    Mockito.when(mockPlatform.getUserDropboxes()).thenReturn(mockBoxes);
    Mockito.when(mockPlatform.getCurrentUser()).thenReturn(mockUser);
    Mockito.when(mockUser.getUserId()).thenReturn(userId);
   
    em.getTransaction().begin();
    em.persist(createComponentSpec(
        "dropboxes", "xyz""123", "123", "xyz",
        new ArrayList<Tag>(), Collections.<String,String>emptyMap()));
View Full Code Here

    Assert.assertEquals(serviceImpl.getBootstrapComponents().get(0).getComponentId(), sandboxId);
  }
 
  @Test
  public void testFindComponentsByBaseDisplayedNamePattern() {
    User mockUser = Mockito.mock(User.class);
    Mockito.when(mockPlatform.getCurrentUser()).thenReturn(mockUser);
    Mockito.when(mockUser.getUserId()).thenReturn("testUser");
   
    String[] bdns = {
        "hit 0",
        "miss 0",
        "hit 1",
View Full Code Here

    private class MCCSimpleIDObserver implements IShiftChangeObserver {

        @Override
        public void shiftChangeEvent(String userID) {
            User newUser = GlobalContext.getGlobalContext().getUser().getValidUser(userID);
            if (newUser == null) {
                return;
            } else {
                Collection<MCTAbstractHousing> c = UserEnvironmentRegistry.getAllHousings();
                for (MCTAbstractHousing housing :c) {
View Full Code Here

           
            this.currentUser = username;
           
            // If a user was selected, initialize with group info as well from Persistence
            if (persistence != null && username != null) {
                User user = persistence.getUser(username);
                if (user != null) {       
                    this.currentGroup = user.getDisciplineId();
                }
            }
        }
    }
View Full Code Here

    private boolean loadUser() {
        // Get the current user name (may be null)
        final String whoami = GlobalContext.getGlobalContext().getIdManager().getCurrentUser();
       
        // Try to load the user from persistence, if username was non-null
        User currentUser = whoami != null ? PlatformAccess.getPlatform().getPersistenceProvider().getUser(whoami) : null;
       
        // If no user was found (either in DB or simply because mct.user was unspecified) consider creating one.
        if (currentUser == null) {
            final String ADD_USER_PROP = "automatically.add.user";
            final String DEFAULT_GROUP_PROP = "default.user.group";
            if (Boolean.parseBoolean(System.getProperty(ADD_USER_PROP, MCTProperties.DEFAULT_MCT_PROPERTIES.getProperty(ADD_USER_PROP, "false")))) {
                // Default to "testUser1" if no user name was ever specified
                String userId = whoami != null ? whoami : bundle.getString("DEFAULT_USER"); //NOI18N 
                Platform platform = PlatformAccess.getPlatform();
               
                // determine if the platform has been initialized
                if (platform.getBootstrapComponents().isEmpty()) {
                    GlobalContext.getGlobalContext().switchUser(new User() {
                        @Override
                        public String getDisciplineId() {
                            return ""//rather than null, we should return an empty string --Harleigh;Issue127
                        }
                       
View Full Code Here

     */
    public List<File> selectFiles(Component source){
      AbstractComponent targetComponent = currentContext.getSelectedManifestations()
                .iterator().next().getManifestedComponent();
      //Initialize the file chooser with the current user
      User user = PlatformAccess.getPlatform().getCurrentUser();
        final CustomFileChooser fileChooser = new CustomFileChooser();
       
        //add the list of owners and set selection to current owner
        fileChooser.addOwners(Arrays.asList(RoleAccess.getAllUsers()));
        fileChooser.setOwner(user.getUserId());
      
        fileChooser.setDialogTitle(bundle.getString("import_message")
        + targetComponent.getDisplayName());
        fileChooser.setApproveButtonText(bundle.getString("import_button"));
       
View Full Code Here

     */
    public List<File> selectFiles(Component source){
      AbstractComponent targetComponent = currentContext.getWindowManifestation()
          .getManifestedComponent();
      //Initialize the file chooser with the current user
      User user = PlatformAccess.getPlatform().getCurrentUser();
        final CustomFileChooser fileChooser = new CustomFileChooser();
       
        //add the list of owners and set selection to current owner
        fileChooser.addOwners(Arrays.asList(RoleAccess.getAllUsers()));
        fileChooser.setOwner(user.getUserId());
      
        fileChooser.setDialogTitle(bundle.getString("import_message")
        + targetComponent.getDisplayName());
        fileChooser.setApproveButtonText(bundle.getString("import_button"));
       
View Full Code Here

TOP

Related Classes of gov.nasa.arc.mct.services.internal.component.User

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.