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

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


        Mockito.when(vi.getViewName()).thenReturn("testView");
        Mockito.when(vi.createView(Mockito.any(AbstractComponent.class))).thenReturn(v);
        vrs.add(vi);
        when(mockComponent.getViewInfos(ViewType.CENTER)).thenReturn(vrs);

        PersistenceProvider mockPersistenceProvider = Mockito.mock(PersistenceProvider.class);
        when(mockPersistenceProvider.getComponent(Mockito.anyString())).thenReturn(mockComponent);
        when(mockPlatform.getPersistenceProvider()).thenReturn(mockPersistenceProvider);
        contentArea = new MCTContentArea(mockHousing, mockComponent);
    }
View Full Code Here


    testMenu.fireMenuSelected();
    Assert.assertEquals(testMenu.getMenuComponentCount(), 4);
   
    PlatformAccess access = new PlatformAccess();
    Platform mockPlatform = Mockito.mock(Platform.class);
    PersistenceProvider mockPersistenceProvider = Mockito.mock(PersistenceProvider.class);
    access.setPlatform(mockPlatform);
    Mockito.when(mockPlatform.getPersistenceProvider()).thenReturn(mockPersistenceProvider);

    JMenuItem menuItem = (JMenuItem) testMenu.getMenuComponent(3);
    JCheckBoxMenuItem checkBoxMenuItem = (JCheckBoxMenuItem) menuItem;
View Full Code Here

            }
        };
       
        PlatformAccess access = new PlatformAccess();
        Platform mockPlatform = Mockito.mock(Platform.class);
        PersistenceProvider mockPersistenceProvider = Mockito.mock(PersistenceProvider.class);
        access.setPlatform(mockPlatform);
        Mockito.when(mockPlatform.getPersistenceProvider()).thenReturn(mockPersistenceProvider);
        Mockito.when(mockPersistenceProvider.getComponent(component.getComponentId())).thenReturn(component);
        MCTViewManifestationInfo manifInfo = Mockito.mock(MCTViewManifestationInfo.class);       
        View view = CanvasViewStrategy.CANVAS_OWNED.createViewFromManifestInfo(viewInfo, component, canvasComponent, manifInfo);
        Assert.assertEquals(view.getManifestedComponent().getComponentId(), canvasComponent.getComponentId());
    }   
View Full Code Here

        when(transferable.getTransferData(eq(GOOD_FLAVOR))).thenReturn(new View[]{mockView});
       
        // Mock persistence provider, policy manager, and platform
        PlatformAccess access = new PlatformAccess();
        Platform mockPlatform = Mockito.mock(Platform.class);
        PersistenceProvider mockPersistenceProvider = Mockito.mock(PersistenceProvider.class);
        PolicyManager mockpoPolicyManager = Mockito.mock(PolicyManager.class);      
        CoreComponentRegistry mockComponentRegistry = Mockito.mock(CoreComponentRegistry.class);
        WindowManager mockWindowManager = Mockito.mock(WindowManager.class);
       
        access.setPlatform(mockPlatform);
View Full Code Here

        when(transferable.getTransferData(eq(GOOD_FLAVOR))).thenReturn(new View[]{sourceView});
       
        // Mock persistence provider, policy manager, and platform.
        PlatformAccess access = new PlatformAccess();
        Platform mockPlatform = Mockito.mock(Platform.class);
        PersistenceProvider mockPersistenceProvider = Mockito.mock(PersistenceProvider.class);
        PolicyManager mockpoPolicyManager = Mockito.mock(PolicyManager.class);      
        CoreComponentRegistry mockComponentRegistry = Mockito.mock(CoreComponentRegistry.class);
        WindowManager mockWindowManager = Mockito.mock(WindowManager.class);
       
        access.setPlatform(mockPlatform);
View Full Code Here

    private void ensureInitialized() {
        if (!initialized) {
            String username = this.currentUser;
            // If PersistenceProvider & WindowManager are available, we can create a dialog with available users
            Platform platform = PlatformAccess.getPlatform();
            PersistenceProvider persistence = platform != null ? platform.getPersistenceProvider() : null;
            WindowManager windowing = platform != null ? platform.getWindowManager() : null;
           
            if (username == null && persistence != null && windowing != null) {
                Object[] users = persistence.getAllUsers().toArray();
                if (users.length > 1) {
                    Arrays.sort(users);
                    username = (String) windowing.showInputDialog(bundle.getString("TITLE"), bundle.getString("QUESTION"), users, users[0], null); //NOI18N
                } else if (users.length == 1) {
                    username = users[0].toString();
                }
            }       
           
            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

  @Override
  public Void doInBackground() {
    setProgress(0);
   
    // Ensure unit of work is done in a single database transaction
    PersistenceProvider provider =
                    PlatformAccess.getPlatform().getPersistenceProvider();
    provider.startRelatedOperations();
    boolean completed = false;
    try {
        importComponents();
        completed = true;
    } finally {
      provider.completeRelatedOperations(completed);
    }
   
    return null;
  }
View Full Code Here

TOP

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

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.