@Test public final void testLocationWithNullLines() { Location locNullLines = LocationFactory.createLineLocation( "locWithNullLines", Arrays.asList((Line) null, null)); Location locOneNullLine = LocationFactory.createLineLocation( "locWithOnlyOneNullLine", Arrays.asList((Line) null)); List<LocationReferenceHolder> encLocRef; try { OpenLREncoder encoder = new OpenLREncoder(); OpenLREncoderParameter params = new OpenLREncoderParameter.Builder().with(td.getMapDatabase()).with(td.getConfiguration()).buildParameter(); encLocRef = encoder.encodeLocations(params, Arrays.asList(locNullLines, locOneNullLine)); for (LocationReferenceHolder lrh : encLocRef) { assertFalse(lrh.isValid()); assertEquals(lrh.getReturnCode(), EncoderReturnCode.LOCATION_NOT_CONNECTED); } } catch (OpenLRProcessingException e) { fail("Encoding location failed with exception: " + e.getErrorCode(), e); } }
@Override public List<LocationReferenceHolder> encodeLocations( final OpenLREncoderParameter parameter, final List<Location> loc) throws OpenLRProcessingException { if (loc == null || loc.isEmpty()) { LOG.error("No location provided!"); throw new OpenLREncoderProcessingException( EncoderProcessingError.INVALID_PARAMETER); } if (LOG.isDebugEnabled()) { LOG.debug("OpenLR encoding of " + loc.size() + " locations started"); } List<LocationReferenceHolder> llr = new ArrayList<LocationReferenceHolder>(); OpenLREncoderProperties properties = new OpenLREncoderProperties(parameter.getConfiguration(), parameter.getPhysicalEncoders()); for (Location l : loc) { LocationReferenceHolder lr = encodeLocation(parameter, properties, l); llr.add(lr); } return llr; }
OpenLREncoder implements openlr.OpenLREncoder { @Override public List<LocationReferenceHolder> encodeLocations( final OpenLREncoderParameter parameter, final List<Location> loc) throws OpenLRProcessingException { if (loc == null || loc.isEmpty()) { LOG.error("No location provided!"); throw new OpenLREncoderProcessingException( EncoderProcessingError.INVALID_PARAMETER); } if (LOG.isDebugEnabled()) { LOG.debug("OpenLR encoding of " + loc.size() + " locations started"); } List<LocationReferenceHolder> llr = new ArrayList<LocationReferenceHolder>(); OpenLREncoderProperties properties = new OpenLREncoderProperties(parameter.getConfiguration(), parameter.getPhysicalEncoders()); for (Location l : loc) { LocationReferenceHolder lr = encodeLocation(parameter, properties, l); llr.add(lr); } return llr; } }
OpenLREncoder implements openlr.OpenLREncoder { @Override public List<LocationReferenceHolder> encodeLocations( final OpenLREncoderParameter parameter, final List<Location> loc) throws OpenLRProcessingException { if (loc == null || loc.isEmpty()) { LOG.error("No location provided!"); throw new OpenLREncoderProcessingException( EncoderProcessingError.INVALID_PARAMETER); } if (LOG.isDebugEnabled()) { LOG.debug("OpenLR encoding of " + loc.size() + " locations started"); } List<LocationReferenceHolder> llr = new ArrayList<LocationReferenceHolder>(); OpenLREncoderProperties properties = new OpenLREncoderProperties(parameter.getConfiguration(), parameter.getPhysicalEncoders()); for (Location l : loc) { LocationReferenceHolder lr = encodeLocation(parameter, properties, l); llr.add(lr); } return llr; }  }
OpenLREncoder implements openlr.OpenLREncoder { @Override public List<LocationReferenceHolder> encodeLocations( final OpenLREncoderParameter parameter, final List<Location> loc) throws OpenLRProcessingException { if (loc == null || loc.isEmpty()) { LOG.error("No location provided!"); throw new OpenLREncoderProcessingException( EncoderProcessingError.INVALID_PARAMETER); } if (LOG.isDebugEnabled()) { LOG.debug("OpenLR encoding of " + loc.size() + " locations started"); } List<LocationReferenceHolder> llr = new ArrayList<LocationReferenceHolder>(); OpenLREncoderProperties properties = new OpenLREncoderProperties(parameter.getConfiguration(), parameter.getPhysicalEncoders()); for (Location l : loc) { LocationReferenceHolder lr = encodeLocation(parameter, properties, l); llr.add(lr); } return llr; }  static List<PhysicalEncoder> getPhysicalEncoderServices(); @Override List<LocationReferenceHolder> encodeLocations(
            final OpenLREncoderParameter parameter, final List<Location> loc); @Override LocationReferenceHolder encodeLocation(
            final OpenLREncoderParameter parameter, final Location loc); @Override String getMajorVersion(); @Override String getMinorVersion(); @Override String getPatchVersion(); @Override String getVersion(); }
OpenLREncoder implements openlr.OpenLREncoder { @Override public List<LocationReferenceHolder> encodeLocations( final OpenLREncoderParameter parameter, final List<Location> loc) throws OpenLRProcessingException { if (loc == null || loc.isEmpty()) { LOG.error("No location provided!"); throw new OpenLREncoderProcessingException( EncoderProcessingError.INVALID_PARAMETER); } if (LOG.isDebugEnabled()) { LOG.debug("OpenLR encoding of " + loc.size() + " locations started"); } List<LocationReferenceHolder> llr = new ArrayList<LocationReferenceHolder>(); OpenLREncoderProperties properties = new OpenLREncoderProperties(parameter.getConfiguration(), parameter.getPhysicalEncoders()); for (Location l : loc) { LocationReferenceHolder lr = encodeLocation(parameter, properties, l); llr.add(lr); } return llr; }  static List<PhysicalEncoder> getPhysicalEncoderServices(); @Override List<LocationReferenceHolder> encodeLocations(
            final OpenLREncoderParameter parameter, final List<Location> loc); @Override LocationReferenceHolder encodeLocation(
            final OpenLREncoderParameter parameter, final Location loc); @Override String getMajorVersion(); @Override String getMinorVersion(); @Override String getPatchVersion(); @Override String getVersion();  }