use of io.gravitee.gateway.handlers.api.manager.ApiManager in project gravitee-gateway by gravitee-io.
the class ApiDeployerStatement method evaluate.
@Override
public void evaluate() throws Throwable {
URL home = ApiDeployerStatement.class.getResource("/gravitee-01/");
System.setProperty("gravitee.home", URLDecoder.decode(home.getPath(), "UTF-8"));
container = new Container();
if (target instanceof PolicyRegister) {
((PolicyRegister) target).register(container.getApplicationContext().getBean(PolicyPluginManager.class));
}
container.start();
Thread.sleep(1000);
ApiManager apiManager = container.getApplicationContext().getBean(ApiManager.class);
Api api = loadApi(target.getClass().getAnnotation(ApiDescriptor.class).value());
try {
apiManager.deploy(api);
base.evaluate();
} finally {
apiManager.undeploy(api.getId());
container.stop();
}
}
Aggregations