Package gov.nasa.arc.mct.policy

Examples of gov.nasa.arc.mct.policy.ExecutionResult


        Mockito.when(mockPlatform.getPolicyManager()).thenReturn(mockPolicy);
        Mockito.when(mockComponent.getViewInfos(Mockito.<ViewType>any())).thenReturn(Collections.singleton(mockInfo));
        Mockito.when(mockInfo.createView(mockComponent)).thenReturn(pseudoView);
        Mockito.when(mockContent.getHousedViewManifestation()).thenReturn(pseudoView);
        Mockito.when(mockPolicy.execute(Mockito.anyString(), Mockito.<PolicyContext>any()))
            .thenReturn(new ExecutionResult(null,true,""));
       
        new PlatformAccess().setPlatform(mockPlatform);
    }
View Full Code Here


    Field f = PersistenceServiceImpl.class.getDeclaredField("entityManagerFactory");
    f.setAccessible(true);
    factory = (EntityManagerFactory) f.get(serviceImpl);
    em = factory.createEntityManager();
    Mockito.when(mockPlatform.getPolicyManager()).thenReturn(mockPolicyManager);
    Mockito.when(mockPolicyManager.execute(Mockito.anyString(), Mockito.any(PolicyContext.class))).thenReturn(new ExecutionResult(null,true,""));
    (new PlatformAccess()).setPlatform(mockPlatform);
    Mockito.when(mockPlatform.getPersistenceProvider()).thenReturn(serviceImpl);
  }
View Full Code Here

                    toBeComposed.add(actualComponent);
            }
           
            // Check if allows adding/removing children from current component.
            if (!toBeComposed.isEmpty()) {
              ExecutionResult result = checkPolicyForDrops(canvasComponent, toBeComposed, canvasManifestation);
                  if (!result.getStatus()) {
                      showCompositionErrorMessage(result.getMessage());
                  return;
              }
            }
           
            if (!toBeComposed.isEmpty()) {
View Full Code Here

                            .setProperty(PolicyContext.PropertyName.ACTION.getName(), Character
                                            .valueOf('w'));
            context.setProperty(PolicyContext.PropertyName.VIEW_MANIFESTATION_PROVIDER.getName(),
                            canvasManifestation);
            String policyCategoryKey = PolicyInfo.CategoryType.COMPOSITION_POLICY_CATEGORY.getKey();
            ExecutionResult result = PolicyManagerAccess.getPolicyManager().execute(
                            policyCategoryKey, context);
            return result;
        }
View Full Code Here

        MockitoAnnotations.initMocks(this);
        dir = new MCTDirectoryArea();
        handler = new StubbedHandler(dir, tree, model);
        (new PlatformAccess()).setPlatform(mockPlatform);
        when(mockPlatform.getPolicyManager()).thenReturn(mockPolicyManager);
        ExecutionResult result = new ExecutionResult(new PolicyContext(), true, "mock");
        when(mockPolicyManager.execute(Mockito.anyString(), Mockito.any(PolicyContext.class))).thenReturn(result);
     }
View Full Code Here

        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
View Full Code Here

        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()))
View Full Code Here

             .thenReturn(true);
      when(mockPlatform.getPersistenceProvider()).thenReturn(persistenceProvider);
      when(mockPlatform.getPolicyManager()).thenReturn(mockPolicyManager);
      when(mockPolicyManager
                  .execute(Mockito.anyString(), Mockito.any(PolicyContext.class)))
             .thenReturn(new ExecutionResult(null,true,""));
     
      access.setRegistry(mockRegistry);
     
     
      // For importer
View Full Code Here

    Assert.assertTrue(importAction.canHandle(mockContext));   

    // Check isEnabled - should depend on policy
    for (boolean truth : new boolean[] {true, false}) {
      Mockito.when(mockPolicy.execute(Mockito.anyString(), Mockito.<PolicyContext>any()))
        .thenReturn(new ExecutionResult(null, truth, ""));
      Assert.assertEquals(importAction.isEnabled(), truth);
      Assert.assertEquals(importThisAction.isEnabled(), truth);
    }
   
  }
View Full Code Here

           .thenReturn(mockPersistenceProvider);
    (new PlatformAccess()).setPlatform(mockPlatform);
   
    Mockito.when(mockPolicyManager.execute(Mockito.anyString(),
                   Mockito.any(PolicyContext.class)))
             .thenReturn(new ExecutionResult(null,true,""));
   
    access.setRegistry(mockRegistry);
    count++;
  }
View Full Code Here

TOP

Related Classes of gov.nasa.arc.mct.policy.ExecutionResult

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.