@Test public void testUpdate() { List<MatchBuilder> matches = new ArrayList<>(); Map<String, ParameterValue> params = new HashMap<>(); matches.add(new MatchBuilder() .setEthernetMatch(ClassifierTestUtils.createEthernetMatch(ClassifierTestUtils.IPV4_ETH_TYPE))); params.putAll(ClassifierTestUtils.createIntValueParam(IpProtoClassifierDefinition.PROTO_PARAM, ClassifierTestUtils.TCP)); List<MatchBuilder> updated = Classifier.IP_PROTO_CL.update(matches, params); assertEquals(1, updated.size()); MatchBuilder first = updated.get(0); assertEquals(ClassifierTestUtils.IPV4_ETH_TYPE, first.getEthernetMatch().getEthernetType()); assertSame(ClassifierTestUtils.TCP, first.getIpMatch().getIpProtocol().longValue()); }
@Override protected List<MatchBuilder> update(List<MatchBuilder> matches, Map<String, ParameterValue> params) { Long proto = params.get(IpProtoClassifierDefinition.PROTO_PARAM).getIntValue(); for (MatchBuilder match : matches) { IpMatchBuilder imb; if (match.getIpMatch() != null) { equalOrNotSetValidation(match.getIpMatch().getIpProtocol(), proto); continue; } else { imb = new IpMatchBuilder(); } imb.setIpProtocol(proto.shortValue()); match.setIpMatch(imb.build()); } return matches; }
IpProtoClassifier extends Classifier { @Override protected List<MatchBuilder> update(List<MatchBuilder> matches, Map<String, ParameterValue> params) { Long proto = params.get(IpProtoClassifierDefinition.PROTO_PARAM).getIntValue(); for (MatchBuilder match : matches) { IpMatchBuilder imb; if (match.getIpMatch() != null) { equalOrNotSetValidation(match.getIpMatch().getIpProtocol(), proto); continue; } else { imb = new IpMatchBuilder(); } imb.setIpProtocol(proto.shortValue()); match.setIpMatch(imb.build()); } return matches; } }
IpProtoClassifier extends Classifier { @Override protected List<MatchBuilder> update(List<MatchBuilder> matches, Map<String, ParameterValue> params) { Long proto = params.get(IpProtoClassifierDefinition.PROTO_PARAM).getIntValue(); for (MatchBuilder match : matches) { IpMatchBuilder imb; if (match.getIpMatch() != null) { equalOrNotSetValidation(match.getIpMatch().getIpProtocol(), proto); continue; } else { imb = new IpMatchBuilder(); } imb.setIpProtocol(proto.shortValue()); match.setIpMatch(imb.build()); } return matches; } protected  IpProtoClassifier(Classifier parent); }
IpProtoClassifier extends Classifier { @Override protected List<MatchBuilder> update(List<MatchBuilder> matches, Map<String, ParameterValue> params) { Long proto = params.get(IpProtoClassifierDefinition.PROTO_PARAM).getIntValue(); for (MatchBuilder match : matches) { IpMatchBuilder imb; if (match.getIpMatch() != null) { equalOrNotSetValidation(match.getIpMatch().getIpProtocol(), proto); continue; } else { imb = new IpMatchBuilder(); } imb.setIpProtocol(proto.shortValue()); match.setIpMatch(imb.build()); } return matches; } protected  IpProtoClassifier(Classifier parent); @Override ClassifierDefinitionId getId(); @Override ClassifierDefinition getClassifierDefinition(); @Override List<SupportedParameterValues> getSupportedParameterValues(); static Long getIpProtoValue(Map<String, ParameterValue> params); }
IpProtoClassifier extends Classifier { @Override protected List<MatchBuilder> update(List<MatchBuilder> matches, Map<String, ParameterValue> params) { Long proto = params.get(IpProtoClassifierDefinition.PROTO_PARAM).getIntValue(); for (MatchBuilder match : matches) { IpMatchBuilder imb; if (match.getIpMatch() != null) { equalOrNotSetValidation(match.getIpMatch().getIpProtocol(), proto); continue; } else { imb = new IpMatchBuilder(); } imb.setIpProtocol(proto.shortValue()); match.setIpMatch(imb.build()); } return matches; } protected  IpProtoClassifier(Classifier parent); @Override ClassifierDefinitionId getId(); @Override ClassifierDefinition getClassifierDefinition(); @Override List<SupportedParameterValues> getSupportedParameterValues(); static Long getIpProtoValue(Map<String, ParameterValue> params);  }