mirror of
https://gitlab.com/oeffi/public-transport-enabler.git
synced 2025-07-06 15:18:49 +00:00
make spEncId optional
git-svn-id: https://public-transport-enabler.googlecode.com/svn/trunk@795 0924bc21-9374-b0fa-ee44-9ff1593b38f0
This commit is contained in:
parent
6b966aadf2
commit
d0ef68a849
23 changed files with 185 additions and 12 deletions
|
@ -71,6 +71,7 @@ public abstract class AbstractEfaProvider implements NetworkProvider
|
|||
private final String apiBase;
|
||||
private final String additionalQueryParameter;
|
||||
private final boolean canAcceptPoiID;
|
||||
private final boolean needsSpEncId;
|
||||
private final XmlPullParserFactory parserFactory;
|
||||
|
||||
public AbstractEfaProvider()
|
||||
|
@ -84,6 +85,11 @@ public abstract class AbstractEfaProvider implements NetworkProvider
|
|||
}
|
||||
|
||||
public AbstractEfaProvider(final String apiBase, final String additionalQueryParameter, final boolean canAcceptPoiID)
|
||||
{
|
||||
this(apiBase, additionalQueryParameter, false, false);
|
||||
}
|
||||
|
||||
public AbstractEfaProvider(final String apiBase, final String additionalQueryParameter, final boolean canAcceptPoiID, final boolean needsSpEncId)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -97,6 +103,7 @@ public abstract class AbstractEfaProvider implements NetworkProvider
|
|||
this.apiBase = apiBase;
|
||||
this.additionalQueryParameter = additionalQueryParameter;
|
||||
this.canAcceptPoiID = canAcceptPoiID;
|
||||
this.needsSpEncId = needsSpEncId;
|
||||
}
|
||||
|
||||
protected TimeZone timeZone()
|
||||
|
@ -121,8 +128,10 @@ public abstract class AbstractEfaProvider implements NetworkProvider
|
|||
appendLocation(uri, constraint, "sf");
|
||||
if (constraint.type == LocationType.ANY)
|
||||
{
|
||||
uri.append("&SpEncId=0");
|
||||
uri.append("&anyObjFilter_sf=126"); // 1=place 2=stop 4=street 8=address 16=crossing 32=poi 64=postcode
|
||||
if (needsSpEncId)
|
||||
uri.append("&SpEncId=0");
|
||||
// 1=place 2=stop 4=street 8=address 16=crossing 32=poi 64=postcode
|
||||
uri.append("&anyObjFilter_sf=").append(2 + 4 + 8 + 16 + 32 + 64);
|
||||
uri.append("&reducedAnyPostcodeObjFilter_sf=64&reducedAnyTooManyObjFilter_sf=2");
|
||||
uri.append("&useHouseNumberList=true®ionID_sf=1");
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ public class VrrProvider extends AbstractEfaProvider
|
|||
|
||||
public VrrProvider()
|
||||
{
|
||||
super(API_BASE, null, false);
|
||||
super(API_BASE, null, false, true);
|
||||
}
|
||||
|
||||
public NetworkId id()
|
||||
|
|
|
@ -33,7 +33,7 @@ public class VvmProvider extends AbstractEfaProvider
|
|||
|
||||
public VvmProvider()
|
||||
{
|
||||
super(API_BASE, null);
|
||||
super(API_BASE, null, false, true);
|
||||
}
|
||||
|
||||
public NetworkId id()
|
||||
|
|
|
@ -71,6 +71,14 @@ public class AtcProviderLiveTest
|
|||
list(autocompletes);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void autocompleteWithUmlaut() throws Exception
|
||||
{
|
||||
final List<Location> autocompletes = provider.autocompleteStations("grünwink");
|
||||
|
||||
list(autocompletes);
|
||||
}
|
||||
|
||||
private void list(final List<Location> autocompletes)
|
||||
{
|
||||
System.out.print(autocompletes.size() + " ");
|
||||
|
@ -78,7 +86,7 @@ public class AtcProviderLiveTest
|
|||
System.out.print(autocomplete.toDebugString() + " ");
|
||||
System.out.println();
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void shortConnection() throws Exception
|
||||
{
|
||||
|
|
|
@ -70,6 +70,14 @@ public class AvvProviderLiveTest
|
|||
list(autocompletes);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void autocompleteWithUmlaut() throws Exception
|
||||
{
|
||||
final List<Location> autocompletes = provider.autocompleteStations("grünwink");
|
||||
|
||||
list(autocompletes);
|
||||
}
|
||||
|
||||
private void list(final List<Location> autocompletes)
|
||||
{
|
||||
System.out.print(autocompletes.size() + " ");
|
||||
|
|
|
@ -69,6 +69,14 @@ public class BayernProviderLiveTest
|
|||
|
||||
list(autocompletes);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void autocompleteWithUmlaut() throws Exception
|
||||
{
|
||||
final List<Location> autocompletes = provider.autocompleteStations("grün");
|
||||
|
||||
list(autocompletes);
|
||||
}
|
||||
|
||||
private void list(final List<Location> autocompletes)
|
||||
{
|
||||
|
|
|
@ -60,6 +60,16 @@ public class BsagProviderLiveTest
|
|||
|
||||
list(autocompletes);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void autocompleteWithUmlaut() throws Exception
|
||||
{
|
||||
final List<Location> autocompletes = provider.autocompleteStations("grünwink");
|
||||
|
||||
list(autocompletes);
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void list(final List<Location> autocompletes)
|
||||
{
|
||||
|
|
|
@ -61,6 +61,14 @@ public class BsvagProviderLiveTest
|
|||
list(autocompletes);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void autocompleteWithUmlaut() throws Exception
|
||||
{
|
||||
final List<Location> autocompletes = provider.autocompleteStations("grün");
|
||||
|
||||
list(autocompletes);
|
||||
}
|
||||
|
||||
private void list(final List<Location> autocompletes)
|
||||
{
|
||||
System.out.print(autocompletes.size() + " ");
|
||||
|
|
|
@ -69,6 +69,15 @@ public class BvbProviderLiveTest
|
|||
|
||||
list(autocompletes);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void autocompleteWithUmlaut() throws Exception
|
||||
{
|
||||
final List<Location> autocompletes = provider.autocompleteStations("grün");
|
||||
|
||||
list(autocompletes);
|
||||
}
|
||||
|
||||
|
||||
private void list(final List<Location> autocompletes)
|
||||
{
|
||||
|
|
|
@ -70,6 +70,14 @@ public class GvhProviderLiveTest
|
|||
list(autocompletes);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void autocompleteWithUmlaut() throws Exception
|
||||
{
|
||||
final List<Location> autocompletes = provider.autocompleteStations("grün");
|
||||
|
||||
list(autocompletes);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void autocompleteIdentified() throws Exception
|
||||
{
|
||||
|
|
|
@ -70,6 +70,14 @@ public class KvvProviderLiveTest
|
|||
list(autocompletes);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void autocompleteWithUmlaut() throws Exception
|
||||
{
|
||||
final List<Location> autocompletes = provider.autocompleteStations("grünwink");
|
||||
|
||||
list(autocompletes);
|
||||
}
|
||||
|
||||
private void list(final List<Location> autocompletes)
|
||||
{
|
||||
System.out.print(autocompletes.size() + " ");
|
||||
|
|
|
@ -68,6 +68,15 @@ public class LinzProviderLiveTest
|
|||
|
||||
list(autocompletes);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void autocompleteWithUmlaut() throws Exception
|
||||
{
|
||||
final List<Location> autocompletes = provider.autocompleteStations("grün");
|
||||
|
||||
list(autocompletes);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void autocompleteIdentified() throws Exception
|
||||
|
|
|
@ -70,6 +70,14 @@ public class MvgProviderLiveTest
|
|||
list(autocompletes);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void autocompleteWithUmlaut() throws Exception
|
||||
{
|
||||
final List<Location> autocompletes = provider.autocompleteStations("grün");
|
||||
|
||||
list(autocompletes);
|
||||
}
|
||||
|
||||
private void list(final List<Location> autocompletes)
|
||||
{
|
||||
System.out.print(autocompletes.size() + " ");
|
||||
|
|
|
@ -70,6 +70,14 @@ public class MvvProviderLiveTest
|
|||
list(autocompletes);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void autocompleteWithUmlaut() throws Exception
|
||||
{
|
||||
final List<Location> autocompletes = provider.autocompleteStations("grün");
|
||||
|
||||
list(autocompletes);
|
||||
}
|
||||
|
||||
private void list(final List<Location> autocompletes)
|
||||
{
|
||||
System.out.print(autocompletes.size() + " ");
|
||||
|
|
|
@ -69,6 +69,14 @@ public class NaldoProviderLiveTest
|
|||
|
||||
list(autocompletes);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void autocompleteWithUmlaut() throws Exception
|
||||
{
|
||||
final List<Location> autocompletes = provider.autocompleteStations("grünwink");
|
||||
|
||||
list(autocompletes);
|
||||
}
|
||||
|
||||
private void list(final List<Location> autocompletes)
|
||||
{
|
||||
|
|
|
@ -70,6 +70,14 @@ public class NvbwProviderLiveTest
|
|||
list(autocompletes);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void autocompleteWithUmlaut() throws Exception
|
||||
{
|
||||
final List<Location> autocompletes = provider.autocompleteStations("grün");
|
||||
|
||||
list(autocompletes);
|
||||
}
|
||||
|
||||
private void list(final List<Location> autocompletes)
|
||||
{
|
||||
System.out.print(autocompletes.size() + " ");
|
||||
|
|
|
@ -70,6 +70,14 @@ public class StvProviderLiveTest
|
|||
list(autocompletes);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void autocompleteWithUmlaut() throws Exception
|
||||
{
|
||||
final List<Location> autocompletes = provider.autocompleteStations("grün");
|
||||
|
||||
list(autocompletes);
|
||||
}
|
||||
|
||||
private void list(final List<Location> autocompletes)
|
||||
{
|
||||
System.out.print(autocompletes.size() + " ");
|
||||
|
@ -77,12 +85,12 @@ public class StvProviderLiveTest
|
|||
System.out.print(autocomplete.toDebugString() + " ");
|
||||
System.out.println();
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void shortConnection() throws Exception
|
||||
{
|
||||
final QueryConnectionsResult result = provider.queryConnections(new Location(LocationType.STATION, 0, null, "Hauptwache"),
|
||||
null, new Location(LocationType.STATION, 0, null, "Südbahnhof"), new Date(), true, ALL_PRODUCTS, WalkSpeed.NORMAL);
|
||||
final QueryConnectionsResult result = provider.queryConnections(new Location(LocationType.STATION, 0, null, "Hauptwache"), null,
|
||||
new Location(LocationType.STATION, 0, null, "Südbahnhof"), new Date(), true, ALL_PRODUCTS, WalkSpeed.NORMAL);
|
||||
System.out.println(result);
|
||||
final QueryConnectionsResult moreResult = provider.queryMoreConnections(result.context);
|
||||
System.out.println(moreResult);
|
||||
|
|
|
@ -70,6 +70,14 @@ public class VmobilProviderLiveTest
|
|||
list(autocompletes);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void autocompleteWithUmlaut() throws Exception
|
||||
{
|
||||
final List<Location> autocompletes = provider.autocompleteStations("grün");
|
||||
|
||||
list(autocompletes);
|
||||
}
|
||||
|
||||
private void list(final List<Location> autocompletes)
|
||||
{
|
||||
System.out.print(autocompletes.size() + " ");
|
||||
|
|
|
@ -70,6 +70,14 @@ public class VorProviderLiveTest
|
|||
list(autocompletes);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void autocompleteWithUmlaut() throws Exception
|
||||
{
|
||||
final List<Location> autocompletes = provider.autocompleteStations("grün");
|
||||
|
||||
list(autocompletes);
|
||||
}
|
||||
|
||||
private void list(final List<Location> autocompletes)
|
||||
{
|
||||
System.out.print(autocompletes.size() + " ");
|
||||
|
|
|
@ -62,6 +62,14 @@ public class VrnProviderLiveTest
|
|||
System.out.println(result.stationDepartures);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void autocompleteWithUmlaut() throws Exception
|
||||
{
|
||||
final List<Location> autocompletes = provider.autocompleteStations("grün");
|
||||
|
||||
list(autocompletes);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void autocompleteIncomplete() throws Exception
|
||||
{
|
||||
|
@ -101,7 +109,7 @@ public class VrnProviderLiveTest
|
|||
System.out.print(autocomplete.toDebugString() + " ");
|
||||
System.out.println();
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void shortConnection() throws Exception
|
||||
{
|
||||
|
|
|
@ -70,6 +70,14 @@ public class VrrProviderLiveTest
|
|||
list(autocompletes);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void autocompleteWithUmlaut() throws Exception
|
||||
{
|
||||
final List<Location> autocompletes = provider.autocompleteStations("grün");
|
||||
|
||||
list(autocompletes);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void autocompleteIdentified() throws Exception
|
||||
{
|
||||
|
|
|
@ -22,8 +22,8 @@ import java.util.List;
|
|||
|
||||
import org.junit.Test;
|
||||
|
||||
import de.schildbach.pte.VvmProvider;
|
||||
import de.schildbach.pte.NetworkProvider.WalkSpeed;
|
||||
import de.schildbach.pte.VvmProvider;
|
||||
import de.schildbach.pte.dto.Location;
|
||||
import de.schildbach.pte.dto.LocationType;
|
||||
import de.schildbach.pte.dto.NearbyStationsResult;
|
||||
|
@ -70,6 +70,14 @@ public class VvmProviderLiveTest
|
|||
list(autocompletes);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void autocompleteWithUmlaut() throws Exception
|
||||
{
|
||||
final List<Location> autocompletes = provider.autocompleteStations("grün");
|
||||
|
||||
list(autocompletes);
|
||||
}
|
||||
|
||||
private void list(final List<Location> autocompletes)
|
||||
{
|
||||
System.out.print(autocompletes.size() + " ");
|
||||
|
@ -77,7 +85,7 @@ public class VvmProviderLiveTest
|
|||
System.out.print(autocomplete.toDebugString() + " ");
|
||||
System.out.println();
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void shortConnection() throws Exception
|
||||
{
|
||||
|
|
|
@ -70,6 +70,14 @@ public class VvsProviderLiveTest
|
|||
list(autocompletes);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void autocompleteWithUmlaut() throws Exception
|
||||
{
|
||||
final List<Location> autocompletes = provider.autocompleteStations("grün");
|
||||
|
||||
list(autocompletes);
|
||||
}
|
||||
|
||||
private void list(final List<Location> autocompletes)
|
||||
{
|
||||
System.out.print(autocompletes.size() + " ");
|
||||
|
@ -77,7 +85,7 @@ public class VvsProviderLiveTest
|
|||
System.out.print(autocomplete.toDebugString() + " ");
|
||||
System.out.println();
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void shortConnection() throws Exception
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue