@Test public void testGetEvsesForNonExistingManufacturerAndModel() { Manufacturer manufacturer = getManufacturerWithConfiguration(VENDOR, MODEL); insertIntoDatabase(entityManagerFactory, manufacturer); Set<Evse> evses = domainService.getEvses(UNKNOWN_VENDOR, UNKNOWN_MODEL); assertEquals(0, evses.size()); }
public Set<io.motown.domain.api.chargingstation.Evse> getEvses(String vendor, String model) { List<ChargingStationType> items = chargingStationTypeRepository.findByCodeAndManufacturerCode(model, vendor); Set<io.motown.domain.api.chargingstation.Evse> result = new HashSet<>(); int resultSize = items.size(); if (resultSize > 0) { ChargingStationType chargingStationType = items.get(0); for (Evse evse : chargingStationType.getEvses()) { result.add(new io.motown.domain.api.chargingstation.Evse(new EvseId(evse.getIdentifier()), convertViewModelConnectorsToDomain(evse.getConnectors()))); } } return result; }
DomainService { public Set<io.motown.domain.api.chargingstation.Evse> getEvses(String vendor, String model) { List<ChargingStationType> items = chargingStationTypeRepository.findByCodeAndManufacturerCode(model, vendor); Set<io.motown.domain.api.chargingstation.Evse> result = new HashSet<>(); int resultSize = items.size(); if (resultSize > 0) { ChargingStationType chargingStationType = items.get(0); for (Evse evse : chargingStationType.getEvses()) { result.add(new io.motown.domain.api.chargingstation.Evse(new EvseId(evse.getIdentifier()), convertViewModelConnectorsToDomain(evse.getConnectors()))); } } return result; } }
DomainService { public Set<io.motown.domain.api.chargingstation.Evse> getEvses(String vendor, String model) { List<ChargingStationType> items = chargingStationTypeRepository.findByCodeAndManufacturerCode(model, vendor); Set<io.motown.domain.api.chargingstation.Evse> result = new HashSet<>(); int resultSize = items.size(); if (resultSize > 0) { ChargingStationType chargingStationType = items.get(0); for (Evse evse : chargingStationType.getEvses()) { result.add(new io.motown.domain.api.chargingstation.Evse(new EvseId(evse.getIdentifier()), convertViewModelConnectorsToDomain(evse.getConnectors()))); } } return result; }  }
DomainService { public Set<io.motown.domain.api.chargingstation.Evse> getEvses(String vendor, String model) { List<ChargingStationType> items = chargingStationTypeRepository.findByCodeAndManufacturerCode(model, vendor); Set<io.motown.domain.api.chargingstation.Evse> result = new HashSet<>(); int resultSize = items.size(); if (resultSize > 0) { ChargingStationType chargingStationType = items.get(0); for (Evse evse : chargingStationType.getEvses()) { result.add(new io.motown.domain.api.chargingstation.Evse(new EvseId(evse.getIdentifier()), convertViewModelConnectorsToDomain(evse.getConnectors()))); } } return result; }  Set<io.motown.domain.api.chargingstation.Evse> getEvses(String vendor, String model); Evse createEvse(Long chargingStationTypeId, Evse evse); Set<Evse> getEvses(Long chargingStationTypeId); ChargingStationType createChargingStationType(ChargingStationType chargingStationType); ChargingStationType updateChargingStationType(Long id, ChargingStationType chargingStationType); List<ChargingStationType> getChargingStationTypes(int offset, int limit); Long getTotalNumberOfChargingStationTypes(); ChargingStationType getChargingStationType(Long id); void deleteChargingStationType(Long id); Set<Connector> getConnectors(Long chargingStationTypeId, Long evseId); Connector createConnector(Long chargingStationTypeId, Long evseId, Connector connector); Connector updateConnector(Long chargingStationTypeId, Long evseId, Connector connector); Connector getConnector(Long chargingStationTypeId, Long evseId, Long id); void deleteConnector(Long chargingStationTypeId, Long evseId, Long id); Evse updateEvse(Long chargingStationTypeId, Evse evse); Evse getEvse(Long chargingStationTypeId, Long id); void deleteEvse(Long chargingStationTypeId, Long id); Manufacturer createManufacturer(Manufacturer manufacturer); Manufacturer updateManufacturer(Long id, Manufacturer manufacturer); List<Manufacturer> getManufacturers(int offset, int limit); Long getTotalNumberOfManufacturers(); Manufacturer getManufacturer(Long id); void deleteManufacturer(Long id); void setChargingStationTypeRepository(ChargingStationTypeRepository chargingStationTypeRepository); void setManufacturerRepository(ManufacturerRepository manufacturerRepository); }
DomainService { public Set<io.motown.domain.api.chargingstation.Evse> getEvses(String vendor, String model) { List<ChargingStationType> items = chargingStationTypeRepository.findByCodeAndManufacturerCode(model, vendor); Set<io.motown.domain.api.chargingstation.Evse> result = new HashSet<>(); int resultSize = items.size(); if (resultSize > 0) { ChargingStationType chargingStationType = items.get(0); for (Evse evse : chargingStationType.getEvses()) { result.add(new io.motown.domain.api.chargingstation.Evse(new EvseId(evse.getIdentifier()), convertViewModelConnectorsToDomain(evse.getConnectors()))); } } return result; }  Set<io.motown.domain.api.chargingstation.Evse> getEvses(String vendor, String model); Evse createEvse(Long chargingStationTypeId, Evse evse); Set<Evse> getEvses(Long chargingStationTypeId); ChargingStationType createChargingStationType(ChargingStationType chargingStationType); ChargingStationType updateChargingStationType(Long id, ChargingStationType chargingStationType); List<ChargingStationType> getChargingStationTypes(int offset, int limit); Long getTotalNumberOfChargingStationTypes(); ChargingStationType getChargingStationType(Long id); void deleteChargingStationType(Long id); Set<Connector> getConnectors(Long chargingStationTypeId, Long evseId); Connector createConnector(Long chargingStationTypeId, Long evseId, Connector connector); Connector updateConnector(Long chargingStationTypeId, Long evseId, Connector connector); Connector getConnector(Long chargingStationTypeId, Long evseId, Long id); void deleteConnector(Long chargingStationTypeId, Long evseId, Long id); Evse updateEvse(Long chargingStationTypeId, Evse evse); Evse getEvse(Long chargingStationTypeId, Long id); void deleteEvse(Long chargingStationTypeId, Long id); Manufacturer createManufacturer(Manufacturer manufacturer); Manufacturer updateManufacturer(Long id, Manufacturer manufacturer); List<Manufacturer> getManufacturers(int offset, int limit); Long getTotalNumberOfManufacturers(); Manufacturer getManufacturer(Long id); void deleteManufacturer(Long id); void setChargingStationTypeRepository(ChargingStationTypeRepository chargingStationTypeRepository); void setManufacturerRepository(ManufacturerRepository manufacturerRepository);  }