public static GeneralRouter getRouter(
     net.osmand.router.RoutingConfiguration.Builder builder, ApplicationMode am) {
   GeneralRouter router = builder.getRouter(am.getStringKey());
   if (router == null && am.getParent() != null) {
     router = builder.getRouter(am.getParent().getStringKey());
   }
   return router;
 }
  @BeforeClass
  public static void setUp() throws Exception {
    String fileName = "../../resources/Turn_lanes_test.obf";

    File fl = new File(fileName);

    RandomAccessFile raf = new RandomAccessFile(fl, "r");

    fe = new RoutePlannerFrontEnd(false);
    RoutingConfiguration.Builder builder = RoutingConfiguration.getDefault();
    Map<String, String> params = new LinkedHashMap<String, String>();
    params.put("car", "true");
    params.put("short_way", "true");
    RoutingConfiguration config =
        builder.build("car", RoutingConfiguration.DEFAULT_MEMORY_LIMIT * 3, params);
    BinaryMapIndexReader[] binaryMapIndexReaders = {new BinaryMapIndexReader(raf, fl)};
    ctx =
        fe.buildRoutingContext(
            config, null, binaryMapIndexReaders, RoutePlannerFrontEnd.RouteCalculationMode.NORMAL);
    ctx.leftSideNavigation = false;
    RouteResultPreparation.PRINT_TO_CONSOLE_ROUTE_INFORMATION_TO_TEST = true;
  }
  public static RoutingConfiguration.Builder parseFromInputStream(InputStream is)
      throws IOException, XmlPullParserException {
    XmlPullParser parser = PlatformUtil.newXMLPullParser();
    final RoutingConfiguration.Builder config = new RoutingConfiguration.Builder();
    GeneralRouter currentRouter = null;
    String previousKey = null;
    String previousTag = null;
    int tok;
    parser.setInput(is, "UTF-8");
    while ((tok = parser.next()) != XmlPullParser.END_DOCUMENT) {
      if (tok == XmlPullParser.START_TAG) {
        String name = parser.getName();
        if ("osmand_routing_config".equals(name)) {
          config.defaultRouter = parser.getAttributeValue("", "defaultProfile");
        } else if ("routingProfile".equals(name)) {
          currentRouter = parseRoutingProfile(parser, config);
        } else if ("attribute".equals(name)) {
          parseAttribute(parser, config, currentRouter);
          previousKey = parser.getAttributeValue("", "name");
          previousTag = name;
        } else if ("specialization".equals(name)) {
          parseSpecialization(parser, currentRouter, previousKey, previousTag);
        } else {
          previousKey =
              parser.getAttributeValue("", "tag") + "$" + parser.getAttributeValue("", "value");
          previousTag = name;
          if (parseCurrentRule(parser, currentRouter, previousKey, name)) {

          } else {

          }
        }
      }
    }
    return config;
  }