示例#1
0
 /** Creates a gateway from a gateway test config file. */
 protected static void createAndConfigureGateway() {
   String testConfig = System.getProperty("apiman.gateway-test.config", null);
   if (testConfig == null) {
     testConfig = "default";
   }
   URL configUrl =
       GatewayRestTester.class
           .getClassLoader()
           .getResource("test-configs/" + testConfig + ".json");
   ObjectMapper mapper = new ObjectMapper();
   try {
     JsonNode config = mapper.readTree(configUrl);
     String factoryFQN = config.get("factory").asText();
     IGatewayTestServerFactory factory =
         (IGatewayTestServerFactory) Class.forName(factoryFQN).newInstance();
     gatewayServer = factory.createGatewayTestServer();
     gatewayServer.configure(config);
   } catch (IOException
       | ClassNotFoundException
       | InstantiationException
       | IllegalAccessException e) {
     throw new RuntimeException(e);
   }
 }