Package com.alu.e3.data.model

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


  @Test
  public void testAddAuthThenUpdate() {

    // Add a new Auth
    Auth auth = new Auth();
    auth.setId("id2");
    auth.setAuthDetail(new AuthDetail());
    auth.getAuthDetail().setUsername("username");
    auth.getAuthDetail().setType(NBAuthType.AUTHKEY);
    auth.getAuthDetail().setAuthKeyValue("authKey");
    dataManager.addAuth(auth);

    // Now, get the "simple" Auth and check that it's OK
    Auth auth2 = dataManager.getAuthById("id2", true);
    assertNotNull("Auth was added/returned", auth2);

    auth2.getAuthDetail().setAuthKeyValue("authKey2");
    dataManager.updateAuth(auth2);

    // Now, get the "full" Auth and check that it's OK
    Auth auth3 = dataManager.getAuthById("id2", true);
    assertNotNull("Auth was added/returned", auth3);
    assertEquals("Auth values are correct", auth2.getAuthDetail().getAuthKeyValue(), auth3.getAuthDetail().getAuthKeyValue());

    dataManager.removeAuth("id2");

    boolean isInvalidID = false;
View Full Code Here


  @Test
  public void testAddTwiceAuthSameId() {

    // Add a new Auth
    Auth auth = new Auth();
    auth.setId("id2");
    auth.setAuthDetail(new AuthDetail());
    auth.getAuthDetail().setType(NBAuthType.AUTHKEY);
    auth.getAuthDetail().setAuthKeyValue("authKey");
    dataManager.addAuth(auth);

    // Add a new Auth
    Auth auth2 = new Auth();
    auth2.setId("id2");
    auth2.setAuthDetail(new AuthDetail());
    auth2.getAuthDetail().setType(NBAuthType.AUTHKEY);
    auth2.getAuthDetail().setAuthKeyValue("authKey2");

    boolean exceptionRaised = false;
    try
    {
      dataManager.addAuth(auth2);
View Full Code Here

  @Test
  public void testAddTwiceAuthSameToken() {

    // Add a new Auth
    Auth auth = new Auth();
    auth.setId("id2");
    auth.setAuthDetail(new AuthDetail());
    auth.getAuthDetail().setUsername("username");
    auth.getAuthDetail().setType(NBAuthType.AUTHKEY);
    auth.getAuthDetail().setAuthKeyValue("authKey");
    dataManager.addAuth(auth);

    Auth auth2 = new Auth();
    auth2.setId("id3");
    auth2.setAuthDetail(new AuthDetail());
    auth2.getAuthDetail().setUsername("username");
    auth2.getAuthDetail().setType(NBAuthType.AUTHKEY);
    auth2.getAuthDetail().setAuthKeyValue("authKey");

    boolean wasException = false;
    try
    {
      dataManager.addAuth(auth2);
View Full Code Here

  public MockDataManager(boolean isAlwaysHappy) {
    Api api = new Api();
    api.setStatus(StatusType.ACTIVE);
    this.setApi(api);   
    if(isAlwaysHappy) {
      this.setAuth(new Auth());
      this.getCallDescriptors().add(new CallDescriptor(new Policy(), 1, 2));
    }
  }
View Full Code Here

    // no auth found
    assertNull(dataAccess.checkAllowed(api, "authKey").getAuthIdentity());
    assertNull(dataAccess.checkAllowed(api, "username", "password").getAuthIdentity());
    assertNull(dataAccess.checkAllowed(api, new CanonicalizedIpAddress("127.0.0.1")).getAuthIdentity());
   
    Auth auth = new Auth();
    auth.setStatus(StatusType.ACTIVE);
    mockDataManager.setAuth(auth);
   
    // No policy found
    assertNull(dataAccess.checkAllowed(api, "authKey").getAuthIdentity());
    assertNull(dataAccess.checkAllowed(api, "username", "password").getAuthIdentity());
View Full Code Here

    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);
    id.setAuth(auth);
    id.getCallDescriptors().add(cd);
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

  }

  private static final LoadBalancing toDataModel(com.alu.e3.prov.restapi.model.LoadBalancing loadBalancing) {
    if (loadBalancing==null) throw new IllegalArgumentException("loadBalancing must not be null");

    LoadBalancing lb = new LoadBalancing();
    lb.setLoadBalancingType(toDataModel(loadBalancing.getLoadBalancingType()));

    if(loadBalancing.getTargetHealthCheck() != null)
      lb.setTargetHealthCheck(toDataModel(loadBalancing.getTargetHealthCheck()));

    if(loadBalancing.getFailOver() != null)
      lb.setFailOver(toDataModel(loadBalancing.getFailOver()));

    return lb;
  }
View Full Code Here

  }

  public static final QuotaRLBucket toDataModel(com.alu.e3.prov.restapi.model.AuthIdsNoIdType authIds) {
    if (authIds==null) throw new IllegalArgumentException("authIds must not be null");

    QuotaRLBucket ids = new QuotaRLBucket();
    ids.getAuthIds().addAll(authIds.getAuthIds());
    ids.setId(authIds.getId());

    return ids;
  }
View Full Code Here

TOP

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

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.