Package com.alu.e3.prov.restapi.model

Examples of com.alu.e3.prov.restapi.model.ApiContext


  {
    ServletContextHandler context = new ServletContextHandler(server, "/",
        ServletContextHandler.NO_SECURITY | ServletContextHandler.NO_SESSIONS);
    context.setConnectorNames(new String[] {connector.getName()});

    DispatchingContinuationServlet servlet = new DispatchingContinuationServlet();
    servlet.setDispatcher(new TreeDispatcher<HttpConsumer>());
    Long timeout = endpoint.getContinuationTimeout() != null ? endpoint
        .getContinuationTimeout() : getContinuationTimeout();
    if (timeout != null) {
      servlet.setContinuationTimeout(timeout);
    }

    ServletHolder holder = new ServletHolder();
    holder.setServlet(servlet);
    context.addServlet(holder, "/*");
 
View Full Code Here


    if (LOG.isDebugEnabled())
      LOG.debug("Update API ID: {}", apiId);

    // check API ID same in Pay-load/URL
    if (api == null || api.getId() == null)
      throw new WebApplicationException(new ProvisionException(ApplicationCodeConstants.API_ID_NOT_PROVIDED, "API ID missing in the body for Update operation"));

    if (!api.getId().equals(apiId))
      throw new WebApplicationException(new ProvisionException(ApplicationCodeConstants.API_ID_MISMATCH, "API ID not the same in URL vs Body for Update operation: +" + apiId + "/" + apiId));

    Action action = new Action() {
      protected Object doAction(Object... params) {
        try {
          apiService.update(api);
View Full Code Here

    Action action = new Action() {

      protected Object doAction(Object... params) {
        try {
          Api api = apiService.get(apiId);
          return new ApiResponse(ApiResponse.SUCCESS, api);

        } catch (ProvisionException e) {
          throw new WebApplicationException(e);
        }
View Full Code Here

  }

  private void setupExchange(Exchange exchange, ProvisionAuthentication auth){
    Api api = new Api();

    ApiContext env = new ApiContext();
    env.setId("test");

    api.setType(ApiType.PASS_THROUGH);
    api.setContexts(Arrays.asList(env));

    List<TargetHost> targetList = new ArrayList<TargetHost>();

    api.setEndpoint("www.yahoo.fr");

    TargetHost to1 = new TargetHost();
    to1.setUrl("http://www.google.com");
    targetList.add(to1);

    TargetHost to2 = new TargetHost();
    to2.setUrl("http://www.google.com?toto=tutu");
    targetList.add(to2);

    TargetHost to3 = new TargetHost();
    to3.setUrl("http://www.google.com?toto=tutu&tata=tete&titi=toto");
    targetList.add(to3);

    env.setTargetHosts(targetList);

    TdrEnabled tdr = new TdrEnabled();
    tdr.setEnabled("true");
    api.setTdrEnabled(tdr);
View Full Code Here

  private Api newApi() {

    Api api = new Api();

    ApiContext env = new ApiContext();
    env.setDefaultContext(true);
    env.setId("test");
    api.getContexts().add(env);

    env.setStatus(Status.ACTIVE);
    /*
     * env.setMaxRateLimitTPMThreshold(1); env.setMaxRateLimitTPMWarning(1);
     * env.setMaxRateLimitTPSThreshold(1); env.setMaxRateLimitTPSWarning(1);
     */

    api.setId("getLocation" + (new Random().nextLong()));
    api.setDisplayName("test");
    api.setType(ApiType.PASS_THROUGH);
    api.setVersion("1.0");
    api.setEndpoint("AEndpointURL");

    api.setStatus(Status.ACTIVE);

    ProvisionAuthentication pauth = new ProvisionAuthentication();
    Authkey authKey = new Authkey();
    authKey.setKeyName("key");
    pauth.setAuthKey(authKey);

    api.setAuthentication(pauth);

    pauth.getAuths().add(AuthType.AUTHKEY);
    pauth.getAuths().add(AuthType.BASIC);
    pauth.getAuths().add(AuthType.IP_WHITE_LIST);

    TargetHost th = new TargetHost();
    th.setUrl("http://www.yahoo.com");

    TargetHost th2 = new TargetHost();
    th2.setUrl("http://www.google.com");

    Authentication auth = new Authentication();
    auth.setType("NoAuth");
    Data d = new Data();
    Key k = new Key();
    k.setName("aKey00");
    k.setValue("key000Val");
    d.setKey(Arrays.asList(k));
    auth.setData(d);
    th.setAuthentication(auth);
    th2.setAuthentication(auth);

    env.setTargetHosts(Arrays.asList(th, th2));
    api.setTdrEnabled(new TdrEnabled());
    api.getTdrEnabled().setEnabled("true");

    HTTPSType httpsType = new HTTPSType();
    httpsType.setEnabled(true);
View Full Code Here

  private Api newApi() {

    Api api = new Api();


    ApiContext env = new ApiContext();
    env.setDefaultContext(true);
    env.setId("test");
    api.getContexts().add(env);

    env.setStatus(Status.ACTIVE);
    /*env.setMaxRateLimitTPMThreshold(1);
    env.setMaxRateLimitTPMWarning(1);
    env.setMaxRateLimitTPSThreshold(1);
    env.setMaxRateLimitTPSWarning(1);*/

    api.setId("getLocation" + (new Random().nextLong()));
    api.setDisplayName("test");
    api.setType(ApiType.PASS_THROUGH);
    api.setVersion("1.0");
    api.setEndpoint(new Random().nextLong()+"");

    api.setStatus(Status.ACTIVE);


    ProvisionAuthentication pauth = new ProvisionAuthentication();
    Authkey authKey = new Authkey(); authKey.setKeyName("key");
    pauth.setAuthKey(authKey);

    api.setAuthentication(pauth);

    pauth.getAuths().add(AuthType.AUTHKEY);
    pauth.getAuths().add(AuthType.BASIC);
    pauth.getAuths().add(AuthType.IP_WHITE_LIST);


    TargetHost th = new TargetHost();
    th.setUrl("http://www.yahoo.com");

    TargetHost th2 = new TargetHost();
    th2.setUrl("http://www.google.com");

    Authentication auth = new Authentication();
    auth.setType("NoAuth");
    Data d = new Data();
    Key k = new Key();
    k.setName("aKey00");
    k.setValue("key000Val");
    d.setKey(Arrays.asList(k));
    auth.setData(d);
    th.setAuthentication(auth);
    th2.setAuthentication(auth);

    env.setTargetHosts(Arrays.asList(th, th2));
    api.setTdrEnabled(new TdrEnabled());
    api.getTdrEnabled().setEnabled("true");

    HTTPSType httpsType = new HTTPSType();
    httpsType.setEnabled(true);
View Full Code Here

  }

  @Test
  public void testCreateMultipleDefaultContexts() throws Exception {
    Api data = newApi();
    ApiContext anotherDefaultContext = new ApiContext();
    anotherDefaultContext.setId("test_anotherDefaultContext");
    anotherDefaultContext.setDefaultContext(true);
    data.getContexts().add(anotherDefaultContext);


    BasicResponse response = given()
        .contentType("application/xml")
View Full Code Here

  private void setupExchange(Exchange exchange, boolean https){
    Api api = new Api();

    api.setType(ApiType.PASS_THROUGH);

    ApiContext env = new ApiContext();
    env.setId("test");

    api.setContexts(Arrays.asList(env));

    List<TargetHost> targetList = new ArrayList<TargetHost>();

    api.setEndpoint("www.yahoo.fr");

    TargetHost to1 = new TargetHost();
    to1.setUrl("http://www.google.com");
    targetList.add(to1);

    TargetHost to2 = new TargetHost();
    to2.setUrl("http://www.google.com?toto=tutu");
    targetList.add(to2);

    TargetHost to3 = new TargetHost();
    to3.setUrl("http://www.google.com?toto=tutu&tata=tete&titi=toto");
    targetList.add(to3);

    env.setTargetHosts(targetList);

    TdrEnabled tdr = new TdrEnabled();
    tdr.setEnabled("true");
    api.setTdrEnabled(tdr);
View Full Code Here

    provisionData.setValidation(fromDataModel(api.getValidation()));
    provisionData.setHeaderTransEnabled(api.getHeaderTransEnabled());
    provisionData.setInternal(api.getInternal());
   
    ApiProxySettings proxySettings = null;
   
    if(api.isUseGlobalProxy()){
      proxySettings = new ApiProxySettings();
      proxySettings.setGlobalProxy(new ApiProxySettings.GlobalProxy());
    }else if(api.getForwardProxy() != null){
      proxySettings = new ApiProxySettings();
      proxySettings.setLocalProxy(fromDataModel(api.getForwardProxy()));
    }
    provisionData.setProxySettings(proxySettings);
   
    return provisionData;
  }
View Full Code Here

        try {
          apiService.create(api);
        } catch (ProvisionException e) {
          throw new WebApplicationException(e);
        }
        return new ApiResponse(ApiResponse.SUCCESS, api.getId());
      }
    };

    return execute(action, (Object) null);
   
View Full Code Here

TOP

Related Classes of com.alu.e3.prov.restapi.model.ApiContext

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.