@Test public void testFeedComponent() { context.setProperty(PolicyContext.PropertyName.TARGET_COMPONENT.getName(), feedComponent); context.setProperty(PolicyContext.PropertyName.TARGET_VIEW_INFO.getName(), graphicalViewInfo); Assert.assertTrue(testPolicy.execute(context).getStatus()); }
@Override public ExecutionResult execute(PolicyContext context) { boolean result = true; ViewInfo viewInfo = context.getProperty(PolicyContext.PropertyName.TARGET_VIEW_INFO.getName(), ViewInfo.class); if (GraphicalManifestation.class.equals(viewInfo.getViewClass())) { AbstractComponent targetComponent = context.getProperty(PolicyContext.PropertyName.TARGET_COMPONENT.getName(), AbstractComponent.class); result = hasFeed(targetComponent); } else if (StaticGraphicalView.class.equals(viewInfo.getViewClass())) { AbstractComponent targetComponent = context.getProperty(PolicyContext.PropertyName.TARGET_COMPONENT.getName(), AbstractComponent.class); result = GraphicalComponent.class.isAssignableFrom(targetComponent.getClass()); } return new ExecutionResult(context, result, null); }
GraphicalViewPolicy implements Policy { @Override public ExecutionResult execute(PolicyContext context) { boolean result = true; ViewInfo viewInfo = context.getProperty(PolicyContext.PropertyName.TARGET_VIEW_INFO.getName(), ViewInfo.class); if (GraphicalManifestation.class.equals(viewInfo.getViewClass())) { AbstractComponent targetComponent = context.getProperty(PolicyContext.PropertyName.TARGET_COMPONENT.getName(), AbstractComponent.class); result = hasFeed(targetComponent); } else if (StaticGraphicalView.class.equals(viewInfo.getViewClass())) { AbstractComponent targetComponent = context.getProperty(PolicyContext.PropertyName.TARGET_COMPONENT.getName(), AbstractComponent.class); result = GraphicalComponent.class.isAssignableFrom(targetComponent.getClass()); } return new ExecutionResult(context, result, null); } }
GraphicalViewPolicy implements Policy { @Override public ExecutionResult execute(PolicyContext context) { boolean result = true; ViewInfo viewInfo = context.getProperty(PolicyContext.PropertyName.TARGET_VIEW_INFO.getName(), ViewInfo.class); if (GraphicalManifestation.class.equals(viewInfo.getViewClass())) { AbstractComponent targetComponent = context.getProperty(PolicyContext.PropertyName.TARGET_COMPONENT.getName(), AbstractComponent.class); result = hasFeed(targetComponent); } else if (StaticGraphicalView.class.equals(viewInfo.getViewClass())) { AbstractComponent targetComponent = context.getProperty(PolicyContext.PropertyName.TARGET_COMPONENT.getName(), AbstractComponent.class); result = GraphicalComponent.class.isAssignableFrom(targetComponent.getClass()); } return new ExecutionResult(context, result, null); } GraphicalViewPolicy(); }
GraphicalViewPolicy implements Policy { @Override public ExecutionResult execute(PolicyContext context) { boolean result = true; ViewInfo viewInfo = context.getProperty(PolicyContext.PropertyName.TARGET_VIEW_INFO.getName(), ViewInfo.class); if (GraphicalManifestation.class.equals(viewInfo.getViewClass())) { AbstractComponent targetComponent = context.getProperty(PolicyContext.PropertyName.TARGET_COMPONENT.getName(), AbstractComponent.class); result = hasFeed(targetComponent); } else if (StaticGraphicalView.class.equals(viewInfo.getViewClass())) { AbstractComponent targetComponent = context.getProperty(PolicyContext.PropertyName.TARGET_COMPONENT.getName(), AbstractComponent.class); result = GraphicalComponent.class.isAssignableFrom(targetComponent.getClass()); } return new ExecutionResult(context, result, null); } GraphicalViewPolicy(); @Override ExecutionResult execute(PolicyContext context); }
GraphicalViewPolicy implements Policy { @Override public ExecutionResult execute(PolicyContext context) { boolean result = true; ViewInfo viewInfo = context.getProperty(PolicyContext.PropertyName.TARGET_VIEW_INFO.getName(), ViewInfo.class); if (GraphicalManifestation.class.equals(viewInfo.getViewClass())) { AbstractComponent targetComponent = context.getProperty(PolicyContext.PropertyName.TARGET_COMPONENT.getName(), AbstractComponent.class); result = hasFeed(targetComponent); } else if (StaticGraphicalView.class.equals(viewInfo.getViewClass())) { AbstractComponent targetComponent = context.getProperty(PolicyContext.PropertyName.TARGET_COMPONENT.getName(), AbstractComponent.class); result = GraphicalComponent.class.isAssignableFrom(targetComponent.getClass()); } return new ExecutionResult(context, result, null); } GraphicalViewPolicy(); @Override ExecutionResult execute(PolicyContext context);  }