@Test public void testGetValidatorsWithParentCdForRenderer() { List<SupportedParameterValues> srcPortParam = ImmutableList.of(new SupportedParameterValuesBuilder() .setParameterName(new ParameterName(L4ClassifierDefinition.SRC_PORT_PARAM)).build()); SupportedClassifierDefinition supportedL4SrcPort = new SupportedClassifierDefinitionBuilder().setClassifierDefinitionId(L4ClassifierDefinition.ID) .setParentClassifierDefinitionId(IpProtoClassifierDefinition.ID) .setSupportedParameterValues(srcPortParam) .build(); RendererName rendererFoo = new RendererName("Foo"); ClassifierInstanceValidator rendererFooL4SrcPortValidator = new ClassifierInstanceValidator(supportedL4SrcPort, rendererFoo); listener.validatorByRendererAndCd.put(rendererFoo, supportedL4SrcPort.getClassifierDefinitionId(), rendererFooL4SrcPortValidator); List<SupportedParameterValues> dstPortParam = ImmutableList.of(new SupportedParameterValuesBuilder() .setParameterName(new ParameterName(L4ClassifierDefinition.DST_PORT_PARAM)).build()); SupportedClassifierDefinition supportedL4DstPort = new SupportedClassifierDefinitionBuilder().setClassifierDefinitionId(L4ClassifierDefinition.ID) .setParentClassifierDefinitionId(IpProtoClassifierDefinition.ID) .setSupportedParameterValues(dstPortParam) .build(); RendererName rendererBar = new RendererName("Bar"); ClassifierInstanceValidator rendererBarL4DstPortValidator = new ClassifierInstanceValidator(supportedL4DstPort, rendererBar); listener.validatorByRendererAndCd.put(rendererBar, supportedL4DstPort.getClassifierDefinitionId(), rendererBarL4DstPortValidator); Collection<ClassifierInstanceValidator> validatorsWithParentIpProtoCdForRendererFoo = listener.getValidatorsWithParentCdForRenderer(IpProtoClassifierDefinition.ID, rendererFoo); Assert.assertNotNull(validatorsWithParentIpProtoCdForRendererFoo); Assert.assertEquals(validatorsWithParentIpProtoCdForRendererFoo.size(), 1); Assert.assertTrue(validatorsWithParentIpProtoCdForRendererFoo.contains(rendererFooL4SrcPortValidator)); }
@VisibleForTesting Collection<ClassifierInstanceValidator> getValidatorsWithParentCdForRenderer( final ClassifierDefinitionId parentCdId, RendererName renderer) { return Collections2.filter(validatorByRendererAndCd.row(renderer).values(), new Predicate<ClassifierInstanceValidator>() { @Override public boolean apply(ClassifierInstanceValidator ciValidator) { if (parentCdId.equals(ciValidator.getParentClassifierDefinitionId())) { return true; } return false; } }); }
SupportedClassifierDefinitionListener extends DataTreeChangeHandler<SupportedClassifierDefinition> { @VisibleForTesting Collection<ClassifierInstanceValidator> getValidatorsWithParentCdForRenderer( final ClassifierDefinitionId parentCdId, RendererName renderer) { return Collections2.filter(validatorByRendererAndCd.row(renderer).values(), new Predicate<ClassifierInstanceValidator>() { @Override public boolean apply(ClassifierInstanceValidator ciValidator) { if (parentCdId.equals(ciValidator.getParentClassifierDefinitionId())) { return true; } return false; } }); } }
SupportedClassifierDefinitionListener extends DataTreeChangeHandler<SupportedClassifierDefinition> { @VisibleForTesting Collection<ClassifierInstanceValidator> getValidatorsWithParentCdForRenderer( final ClassifierDefinitionId parentCdId, RendererName renderer) { return Collections2.filter(validatorByRendererAndCd.row(renderer).values(), new Predicate<ClassifierInstanceValidator>() { @Override public boolean apply(ClassifierInstanceValidator ciValidator) { if (parentCdId.equals(ciValidator.getParentClassifierDefinitionId())) { return true; } return false; } }); } SupportedClassifierDefinitionListener(DataBroker dataProvider, PolicyValidatorRegistry validatorRegistry); }
SupportedClassifierDefinitionListener extends DataTreeChangeHandler<SupportedClassifierDefinition> { @VisibleForTesting Collection<ClassifierInstanceValidator> getValidatorsWithParentCdForRenderer( final ClassifierDefinitionId parentCdId, RendererName renderer) { return Collections2.filter(validatorByRendererAndCd.row(renderer).values(), new Predicate<ClassifierInstanceValidator>() { @Override public boolean apply(ClassifierInstanceValidator ciValidator) { if (parentCdId.equals(ciValidator.getParentClassifierDefinitionId())) { return true; } return false; } }); } SupportedClassifierDefinitionListener(DataBroker dataProvider, PolicyValidatorRegistry validatorRegistry);  }
SupportedClassifierDefinitionListener extends DataTreeChangeHandler<SupportedClassifierDefinition> { @VisibleForTesting Collection<ClassifierInstanceValidator> getValidatorsWithParentCdForRenderer( final ClassifierDefinitionId parentCdId, RendererName renderer) { return Collections2.filter(validatorByRendererAndCd.row(renderer).values(), new Predicate<ClassifierInstanceValidator>() { @Override public boolean apply(ClassifierInstanceValidator ciValidator) { if (parentCdId.equals(ciValidator.getParentClassifierDefinitionId())) { return true; } return false; } }); } SupportedClassifierDefinitionListener(DataBroker dataProvider, PolicyValidatorRegistry validatorRegistry);   }