use of org.onebusaway.gtfs_transformer.factory.EntitiesTransformStrategy.MatchAndTransform in project onebusaway-gtfs-modules by OneBusAway.
the class TransformFactoryTest method testFileMatch.
@Test
public void testFileMatch() throws IOException, TransformSpecificationException {
_factory.addModificationsFromString("{'op':'remove', 'match':{'file':'routes.txt', 'shortName':'10'}}");
GtfsTransformStrategy transform = _transformer.getLastTransform();
assertEquals(EntitiesTransformStrategy.class, transform.getClass());
EntitiesTransformStrategy strategy = (EntitiesTransformStrategy) transform;
List<MatchAndTransform> transforms = strategy.getModifications();
assertEquals(1, transforms.size());
}
use of org.onebusaway.gtfs_transformer.factory.EntitiesTransformStrategy.MatchAndTransform in project onebusaway-gtfs-modules by OneBusAway.
the class TransformFactoryTest method test.
@Test
public void test() throws IOException, TransformSpecificationException {
_factory.addModificationsFromString("{'op':'remove', 'match':{'class':'Route', 'shortName':'10'}}");
GtfsTransformStrategy transform = _transformer.getLastTransform();
assertEquals(EntitiesTransformStrategy.class, transform.getClass());
EntitiesTransformStrategy strategy = (EntitiesTransformStrategy) transform;
List<MatchAndTransform> transforms = strategy.getModifications();
assertEquals(1, transforms.size());
MatchAndTransform pair = transforms.get(0);
EntityMatch match = pair.getMatch();
Route route = new Route();
assertFalse(match.isApplicableToObject(route));
route.setShortName("10");
assertTrue(match.isApplicableToObject(route));
EntityTransformStrategy entityTransform = pair.getTransform();
assertEquals(RemoveEntityUpdateStrategy.class, entityTransform.getClass());
}
Aggregations