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

Examples of gov.nasa.arc.mct.services.component.PolicyManager


       
        // 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);
        Mockito.when(mockPlatform.getPersistenceProvider()).thenReturn(mockPersistenceProvider);
        Mockito.when(mockPlatform.getPolicyManager()).thenReturn(mockPolicyManager);
        Mockito.when(mockPlatform.getComponentRegistry()).thenReturn(mockComponentRegistry);
        Mockito.when(mockPlatform.getWindowManager()).thenReturn(mockWindowManager);
        ExecutionResult mockResult = new ExecutionResult(new PolicyContext(), true, "");
        Mockito.when(mockpoPolicyManager.execute(Mockito.anyString(), Mockito.any(PolicyContext.class))).thenReturn(mockResult);
        Mockito.when(mockWindowManager.<Object>showInputDialog(
                Mockito.anyString(), Mockito.anyString(), Mockito.<Object[]>any(), Mockito.any(), Mockito.anyMap()))
                .thenAnswer(new Answer<Object>() {
                    @Override
                    public Object answer(InvocationOnMock invocation) throws Throwable {
View Full Code Here


       
        // 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);
        Mockito.when(mockPlatform.getPersistenceProvider()).thenReturn(mockPersistenceProvider);
        Mockito.when(mockPlatform.getPolicyManager()).thenReturn(mockPolicyManager);       
        ExecutionResult mockResult = new ExecutionResult(new PolicyContext(), true, "");
        Mockito.when(mockpoPolicyManager.execute(Mockito.anyString(), Mockito.any(PolicyContext.class))).thenReturn(mockResult);
        Mockito.when(mockPlatform.getComponentRegistry()).thenReturn(mockComponentRegistry);
        Mockito.when(mockPlatform.getWindowManager()).thenReturn(mockWindowManager);
        Mockito.when(mockWindowManager.<Object>showInputDialog(
                Mockito.anyString(), Mockito.anyString(), Mockito.<Object[]>any(), Mockito.any(), Mockito.anyMap()))
                .thenAnswer(new Answer<Object>() {
View Full Code Here

public class MockPlatform implements Platform {
 
  @Override
  public PolicyManager getPolicyManager() {
    return new PolicyManager() {
     
      @Override
      public ExecutionResult execute(String categoryKey, PolicyContext context) {
        return new ExecutionResult(context, true, "");
      }
View Full Code Here

            private boolean canComponentBeContained() {
                PolicyContext context = new PolicyContext();
                context.setProperty(PolicyContext.PropertyName.SOURCE_COMPONENTS.getName(),Collections.singleton(referencedComponent));
                String policyCategoryKey = PolicyInfo.CategoryType.CAN_OBJECT_BE_CONTAINED_CATEGORY.getKey();
                Platform platform = PlatformAccess.getPlatform();
                PolicyManager policyManager = platform.getPolicyManager();
                ExecutionResult result = policyManager.execute(policyCategoryKey, context);
                return result.getStatus();
            }
           
            @Override
            protected Transferable createTransferable(JComponent c) {
View Full Code Here

TOP

Related Classes of gov.nasa.arc.mct.services.component.PolicyManager

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.