@Test public void shouldCreateSwitchPropertiesWithRelation() { Switch origSwitch = Switch.builder() .switchId(TEST_SWITCH_ID) .description("Some description") .build(); switchRepository.add(origSwitch); SwitchProperties switchProperties = SwitchProperties.builder() .switchObj(origSwitch) .supportedTransitEncapsulation(SwitchProperties.DEFAULT_FLOW_ENCAPSULATION_TYPES) .build(); switchPropertiesRepository.add(switchProperties); List<SwitchProperties> switchPropertiesResult = new ArrayList<>(switchPropertiesRepository.findAll()); assertEquals(1, switchPropertiesResult.size()); assertNotNull(switchPropertiesResult.get(0).getSwitchObj()); }
@Override public Collection<SwitchProperties> findAll() { return framedGraph().traverse(g -> g.V() .hasLabel(SwitchPropertiesFrame.FRAME_LABEL)) .toListExplicit(SwitchPropertiesFrame.class).stream() .map(SwitchProperties::new) .collect(Collectors.toList()); }
FermaSwitchPropertiesRepository extends FermaGenericRepository<SwitchProperties, SwitchPropertiesData, SwitchPropertiesFrame> implements SwitchPropertiesRepository { @Override public Collection<SwitchProperties> findAll() { return framedGraph().traverse(g -> g.V() .hasLabel(SwitchPropertiesFrame.FRAME_LABEL)) .toListExplicit(SwitchPropertiesFrame.class).stream() .map(SwitchProperties::new) .collect(Collectors.toList()); } }
FermaSwitchPropertiesRepository extends FermaGenericRepository<SwitchProperties, SwitchPropertiesData, SwitchPropertiesFrame> implements SwitchPropertiesRepository { @Override public Collection<SwitchProperties> findAll() { return framedGraph().traverse(g -> g.V() .hasLabel(SwitchPropertiesFrame.FRAME_LABEL)) .toListExplicit(SwitchPropertiesFrame.class).stream() .map(SwitchProperties::new) .collect(Collectors.toList()); } FermaSwitchPropertiesRepository(FramedGraphFactory<?> graphFactory, TransactionManager transactionManager); }
FermaSwitchPropertiesRepository extends FermaGenericRepository<SwitchProperties, SwitchPropertiesData, SwitchPropertiesFrame> implements SwitchPropertiesRepository { @Override public Collection<SwitchProperties> findAll() { return framedGraph().traverse(g -> g.V() .hasLabel(SwitchPropertiesFrame.FRAME_LABEL)) .toListExplicit(SwitchPropertiesFrame.class).stream() .map(SwitchProperties::new) .collect(Collectors.toList()); } FermaSwitchPropertiesRepository(FramedGraphFactory<?> graphFactory, TransactionManager transactionManager); @Override Collection<SwitchProperties> findAll(); @Override Optional<SwitchProperties> findBySwitchId(SwitchId switchId); }
FermaSwitchPropertiesRepository extends FermaGenericRepository<SwitchProperties, SwitchPropertiesData, SwitchPropertiesFrame> implements SwitchPropertiesRepository { @Override public Collection<SwitchProperties> findAll() { return framedGraph().traverse(g -> g.V() .hasLabel(SwitchPropertiesFrame.FRAME_LABEL)) .toListExplicit(SwitchPropertiesFrame.class).stream() .map(SwitchProperties::new) .collect(Collectors.toList()); } FermaSwitchPropertiesRepository(FramedGraphFactory<?> graphFactory, TransactionManager transactionManager); @Override Collection<SwitchProperties> findAll(); @Override Optional<SwitchProperties> findBySwitchId(SwitchId switchId);  }