@Test public void testToAclLineMatchExpr() { JuniperConfiguration jc = new JuniperConfiguration(); jc.setFilename("host"); jc.getMasterLogicalSystem().getApplications().put("app2", new BaseApplication("app2")); ApplicationSet appSet = new ApplicationSet("appSet"); appSet.setMembers(ImmutableList.of(new ApplicationReference("app2"))); jc.getMasterLogicalSystem().getApplicationSets().put("appSet", appSet); jc.getMasterLogicalSystem().getApplications().put("app1", new BaseApplication("app1")); ApplicationSet masterAppSet = new ApplicationSet("masterAppSet"); List<ApplicationSetMemberReference> members = ImmutableList.of(new ApplicationReference("app1"), new ApplicationSetReference("appSet")); masterAppSet.setMembers(members); assertEquals( masterAppSet.toAclLineMatchExpr(jc, null), new OrMatchExpr( ImmutableList.of( new MatchHeaderSpace( HeaderSpace.builder().build(), ApplicationSetMember.getTraceElement( "host", JuniperStructureType.APPLICATION, "app1")), new OrMatchExpr( ImmutableList.of( new MatchHeaderSpace( HeaderSpace.builder().build(), ApplicationSetMember.getTraceElement( "host", JuniperStructureType.APPLICATION, "app2"))), ApplicationSetMember.getTraceElement( "host", JuniperStructureType.APPLICATION_SET, "appSet"))), ApplicationSetMember.getTraceElement( "host", JuniperStructureType.APPLICATION_SET, "masterAppSet"))); }
@Override public AclLineMatchExpr toAclLineMatchExpr(JuniperConfiguration jc, Warnings w) { return new OrMatchExpr( _members.stream() .map(ref -> ref.resolve(jc)) .filter(Predicates.notNull()) .map(member -> member.toAclLineMatchExpr(jc, w)) .collect(ImmutableList.toImmutableList()), ApplicationSetMember.getTraceElement( jc.getFilename(), JuniperStructureType.APPLICATION_SET, _name)); }
ApplicationSet implements ApplicationSetMember, Serializable { @Override public AclLineMatchExpr toAclLineMatchExpr(JuniperConfiguration jc, Warnings w) { return new OrMatchExpr( _members.stream() .map(ref -> ref.resolve(jc)) .filter(Predicates.notNull()) .map(member -> member.toAclLineMatchExpr(jc, w)) .collect(ImmutableList.toImmutableList()), ApplicationSetMember.getTraceElement( jc.getFilename(), JuniperStructureType.APPLICATION_SET, _name)); } }
ApplicationSet implements ApplicationSetMember, Serializable { @Override public AclLineMatchExpr toAclLineMatchExpr(JuniperConfiguration jc, Warnings w) { return new OrMatchExpr( _members.stream() .map(ref -> ref.resolve(jc)) .filter(Predicates.notNull()) .map(member -> member.toAclLineMatchExpr(jc, w)) .collect(ImmutableList.toImmutableList()), ApplicationSetMember.getTraceElement( jc.getFilename(), JuniperStructureType.APPLICATION_SET, _name)); } ApplicationSet(String name); }
ApplicationSet implements ApplicationSetMember, Serializable { @Override public AclLineMatchExpr toAclLineMatchExpr(JuniperConfiguration jc, Warnings w) { return new OrMatchExpr( _members.stream() .map(ref -> ref.resolve(jc)) .filter(Predicates.notNull()) .map(member -> member.toAclLineMatchExpr(jc, w)) .collect(ImmutableList.toImmutableList()), ApplicationSetMember.getTraceElement( jc.getFilename(), JuniperStructureType.APPLICATION_SET, _name)); } ApplicationSet(String name); @Override void applyTo(
      JuniperConfiguration jc,
      Builder srcHeaderSpaceBuilder,
      LineAction action,
      List<? super ExprAclLine> lines,
      Warnings w); List<ApplicationSetMemberReference> getMembers(); @Override AclLineMatchExpr toAclLineMatchExpr(JuniperConfiguration jc, Warnings w); void setMembers(List<ApplicationSetMemberReference> members); }
ApplicationSet implements ApplicationSetMember, Serializable { @Override public AclLineMatchExpr toAclLineMatchExpr(JuniperConfiguration jc, Warnings w) { return new OrMatchExpr( _members.stream() .map(ref -> ref.resolve(jc)) .filter(Predicates.notNull()) .map(member -> member.toAclLineMatchExpr(jc, w)) .collect(ImmutableList.toImmutableList()), ApplicationSetMember.getTraceElement( jc.getFilename(), JuniperStructureType.APPLICATION_SET, _name)); } ApplicationSet(String name); @Override void applyTo(
      JuniperConfiguration jc,
      Builder srcHeaderSpaceBuilder,
      LineAction action,
      List<? super ExprAclLine> lines,
      Warnings w); List<ApplicationSetMemberReference> getMembers(); @Override AclLineMatchExpr toAclLineMatchExpr(JuniperConfiguration jc, Warnings w); void setMembers(List<ApplicationSetMemberReference> members);  }