Package com.alu.e3.data.model

Examples of com.alu.e3.data.model.Api


 
  @Test
  public void testWin() {
    Exchange exchange = new DefaultExchange(context);
   
    Api api = new Api();
   
    // Setting the key in the request parameters
    Map<String, Object> parameters = new HashMap<String, Object>();
    parameters.put(appKeyName, "asdf");
    exchange.setProperty(ExchangeConstantKeys.E3_REQUEST_PARAMETERS.toString(), parameters);
View Full Code Here


  @Test
  public void testWinHeader() {
    Exchange exchange = new DefaultExchange(context);
    exchange.setProperty(ExchangeConstantKeys.E3_REQUEST_PARAMETERS.toString(), new HashMap<String, Object>());
   
    Api api = new Api();
    api.setId("1234");

    // Setting the key in the header - should be removed
    exchange.getIn().setHeader(appHeaderName, "asdf");
   
    AppKeyExecutor executor = new AppKeyExecutor(appKeyName, appHeaderName, new MockAuthDataAccess("asdf", null, null));
View Full Code Here

 
  @Test
  public void testFailNotAllowed(){
    Exchange exchange = new DefaultExchange(context);

    Api api = new Api();
    api.setId("1234");

    // Setting the key in the request parameters
    Map<String, Object> parameters = new HashMap<String, Object>();
    parameters.put(appKeyName, "asdf");
    exchange.setProperty(ExchangeConstantKeys.E3_REQUEST_PARAMETERS.toString(), parameters);
View Full Code Here

  @Test
  public void testFailNoHeader(){
    Exchange exchange = new DefaultExchange(context);
    exchange.setProperty(ExchangeConstantKeys.E3_REQUEST_PARAMETERS.toString(), new HashMap<String, Object>());
   
    Api api = new Api();
    api.setId("1234");

    // no parameter should fail
    AppKeyExecutor executor = new AppKeyExecutor(appKeyName, appHeaderName, new MockAuthDataAccess("asdf", null, null));
   
    AuthReport authReport = executor.checkAllowed(exchange, api);
View Full Code Here

 
  @Test
  public void testFailBadFormat(){
    Exchange exchange = new DefaultExchange(context);
   
    Api api = new Api();
    api.setId("1234");

    // Setting the wrong key in the request parameters
    Map<String, Object> parameters = new HashMap<String, Object>();
    parameters.put(appKeyName.toUpperCase(), "asdf");
    exchange.setProperty(ExchangeConstantKeys.E3_REQUEST_PARAMETERS.toString(), parameters);
View Full Code Here

 
  @Test
  public void testFailBadFormat2(){
    Exchange exchange = new DefaultExchange(context);
   
    Api api = new Api();
    api.setId("1234");

    // Setting the null key in the request parameters
    Map<String, Object> parameters = new HashMap<String, Object>();
    parameters.put(appKeyName, null);
    exchange.setProperty(ExchangeConstantKeys.E3_REQUEST_PARAMETERS.toString(), parameters);
View Full Code Here

  public void setup(){
    exchange = new DefaultExchange(new DefaultCamelContext());
    processor = new PropertyExtractionProcessor();

    id = new AuthIdentity();
    api = new Api();
    policy1 = new Policy();
    auth = new Auth();
    CallDescriptor cd = new CallDescriptor(policy1, 0, 0);

    id.setApi(api);
View Full Code Here


  protected List<CallDescriptor> checkSubscriberIdAuth(String subscriberId, AuthIdentity authIdentity) throws GatewayException {

    // Get subscriber matching CallDescriptors
    Auth auth;
    try {
      auth = dataManager.getAuthById(subscriberId);
    } catch (InvalidIDException e) {
      throw new GatewayException(GatewayExceptionCode.AUTHORIZATION, e.getMessage() );
    }

    if (auth == null || !auth.getStatus().isActive()) {
      throw new GatewayException(GatewayExceptionCode.AUTHORIZATION, "Authorization status is invalid");
    }

    return   dataManager.getMatchingPolicies(authIdentity.getApi(), auth);
View Full Code Here

    Map<String, String> props = new HashMap<String,String>();

    props.putAll(identity.getApi().getProperties());
    Iterator<CallDescriptor> it = identity.getCallDescriptors().iterator();
    while(it.hasNext()){
      CallDescriptor cd = it.next();
      Policy policy = cd.getPolicy();
      if(policy != null){
        props.putAll(policy.getProperties());
      }
    }
View Full Code Here

    props.putAll(identity.getApi().getProperties());
    Iterator<CallDescriptor> it = identity.getCallDescriptors().iterator();
    while(it.hasNext()){
      CallDescriptor cd = it.next();
      Policy policy = cd.getPolicy();
      if(policy != null){
        props.putAll(policy.getProperties());
      }
    }

    if(identity.getAuth() != null)
      props.putAll(identity.getAuth().getProperties());
View Full Code Here

TOP

Related Classes of com.alu.e3.data.model.Api

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.