@Test public void shouldFindByFlowId() { Collection<ApplicationRule> foundRules = applicationRepository.findByFlowId(TEST_FLOW_ID); assertEquals(2, foundRules.size()); assertTrue(foundRules.contains(buildRuleA())); assertTrue(foundRules.contains(buildRuleB())); }
@Override public Collection<ApplicationRule> findByFlowId(String flowId) { return framedGraph().traverse(g -> g.V() .hasLabel(ApplicationRuleFrame.FRAME_LABEL) .has(ApplicationRuleFrame.FLOW_ID_PROPERTY, flowId)) .toListExplicit(ApplicationRuleFrame.class).stream() .map(ApplicationRule::new) .collect(Collectors.toList()); }
FermaApplicationRepository extends FermaGenericRepository<ApplicationRule, ApplicationRuleData,
        ApplicationRuleFrame> implements ApplicationRepository { @Override public Collection<ApplicationRule> findByFlowId(String flowId) { return framedGraph().traverse(g -> g.V() .hasLabel(ApplicationRuleFrame.FRAME_LABEL) .has(ApplicationRuleFrame.FLOW_ID_PROPERTY, flowId)) .toListExplicit(ApplicationRuleFrame.class).stream() .map(ApplicationRule::new) .collect(Collectors.toList()); } }
FermaApplicationRepository extends FermaGenericRepository<ApplicationRule, ApplicationRuleData,
        ApplicationRuleFrame> implements ApplicationRepository { @Override public Collection<ApplicationRule> findByFlowId(String flowId) { return framedGraph().traverse(g -> g.V() .hasLabel(ApplicationRuleFrame.FRAME_LABEL) .has(ApplicationRuleFrame.FLOW_ID_PROPERTY, flowId)) .toListExplicit(ApplicationRuleFrame.class).stream() .map(ApplicationRule::new) .collect(Collectors.toList()); } FermaApplicationRepository(FramedGraphFactory<?> graphFactory, TransactionManager transactionManager); }
FermaApplicationRepository extends FermaGenericRepository<ApplicationRule, ApplicationRuleData,
        ApplicationRuleFrame> implements ApplicationRepository { @Override public Collection<ApplicationRule> findByFlowId(String flowId) { return framedGraph().traverse(g -> g.V() .hasLabel(ApplicationRuleFrame.FRAME_LABEL) .has(ApplicationRuleFrame.FLOW_ID_PROPERTY, flowId)) .toListExplicit(ApplicationRuleFrame.class).stream() .map(ApplicationRule::new) .collect(Collectors.toList()); } FermaApplicationRepository(FramedGraphFactory<?> graphFactory, TransactionManager transactionManager); @Override Optional<ApplicationRule> lookupRuleByMatchAndFlow(SwitchId switchId, String flowId, String srcIp,
                                                              Integer srcPort, String dstIp, Integer dstPort,
                                                              String proto, String ethType, Long metadata); @Override Optional<ApplicationRule> lookupRuleByMatchAndCookie(SwitchId switchId, ExclusionCookie cookie, String srcIp,
                                                                Integer srcPort, String dstIp, Integer dstPort,
                                                                String proto, String ethType, Long metadata); @Override Collection<ApplicationRule> findBySwitchId(SwitchId switchId); @Override Collection<ApplicationRule> findByFlowId(String flowId); }
FermaApplicationRepository extends FermaGenericRepository<ApplicationRule, ApplicationRuleData,
        ApplicationRuleFrame> implements ApplicationRepository { @Override public Collection<ApplicationRule> findByFlowId(String flowId) { return framedGraph().traverse(g -> g.V() .hasLabel(ApplicationRuleFrame.FRAME_LABEL) .has(ApplicationRuleFrame.FLOW_ID_PROPERTY, flowId)) .toListExplicit(ApplicationRuleFrame.class).stream() .map(ApplicationRule::new) .collect(Collectors.toList()); } FermaApplicationRepository(FramedGraphFactory<?> graphFactory, TransactionManager transactionManager); @Override Optional<ApplicationRule> lookupRuleByMatchAndFlow(SwitchId switchId, String flowId, String srcIp,
                                                              Integer srcPort, String dstIp, Integer dstPort,
                                                              String proto, String ethType, Long metadata); @Override Optional<ApplicationRule> lookupRuleByMatchAndCookie(SwitchId switchId, ExclusionCookie cookie, String srcIp,
                                                                Integer srcPort, String dstIp, Integer dstPort,
                                                                String proto, String ethType, Long metadata); @Override Collection<ApplicationRule> findBySwitchId(SwitchId switchId); @Override Collection<ApplicationRule> findByFlowId(String flowId);  }