Package com.alu.e3.data.model

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


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

    MockAuthDataAccess mockDA = new MockAuthDataAccess(null, null, null);
    NoAuthExecutor executor = new NoAuthExecutor(mockDA);
   
    AuthReport authReport = executor.checkAllowed(exchange, api);
View Full Code Here


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

    // Setting the username = "win" should succeed
    exchange.getIn().setHeader(AuthHttpHeaders.Authorization.toString(), "Basic "+new String(Base64.encodeBase64("win:blarg".getBytes())));
    HttpBasicExecutor executor = new HttpBasicExecutor(new MockAuthDataAccess(null, "win:blarg", null));
   
View Full Code Here

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

    // Setting the username = "win" should succeed
    exchange.getIn().setHeader(AuthHttpHeaders.Authorization.toString(), "Basic "+"win:blarg");
    HttpBasicExecutor executor = new HttpBasicExecutor(new MockAuthDataAccess(null, "win:blarg", null));
   
View Full Code Here

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

    // Setting the username = "win" should succeed
    HttpBasicExecutor executor = new HttpBasicExecutor(new MockAuthDataAccess(null, "win:blarg", 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("123");

    // Setting the username = "win" should succeed
    exchange.getIn().setHeader(AuthHttpHeaders.Authorization.toString(), "Vlasic "+new String(Base64.encodeBase64("win:blarg".getBytes())));
    HttpBasicExecutor executor = new HttpBasicExecutor(new MockAuthDataAccess(null, "win:blarg", null));
   
View Full Code Here

  public static Exchange setupExchange(){
    Exchange exchange = new MockExchange();

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

    id.setApi(api);
View Full Code Here

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

    // Setting the username = "win" should succeed
    // This one is bad because it is missing the space between Basic and the user/pass
    exchange.getIn().setHeader(AuthHttpHeaders.Authorization.toString(), "Basic"+new String(Base64.encodeBase64("win:blarg".getBytes())));
    HttpBasicExecutor executor = new HttpBasicExecutor(new MockAuthDataAccess(null, "win:blarg", null));
View Full Code Here

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

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

    // This one should be denied because the MockData is rigged to return null
    exchange.getIn().setHeader(AuthHttpHeaders.Authorization.toString(), "Basic "+new String(Base64.encodeBase64("win:blarg".getBytes())));
    HttpBasicExecutor executor = new HttpBasicExecutor(new MockAuthDataAccess(null, null, null));
   
View Full Code Here

public class TargetHostManagerTest extends TargetHostManagerBase {

  @Test
  public void simpleNoHealthCheck() {
    Api api = newApi(null);
   
    dataManager.addApi(api);
    targetHostManager.registerAPI(api.getId());
   
    for(APIContext context : api.getApiDetail().getContexts()) {
      List<TargetReference> references = targetHostManager.getTargetReferences(api.getId(), context.getId());
       
      // We have same as many targetreference as targethost in the context
      assertTrue("Number of target references == than number of target hosts", references.size() == context.getTargetHosts().size());

      for(TargetReference target : references) {
View Full Code Here

    }
  }
 
  @Test
  public void noProxySet() {
    Api api = newApi(null);
   
    dataManager.addApi(api);
    targetHostManager.registerAPI(api.getId());
   
    for(APIContext context : api.getApiDetail().getContexts()) {
      List<TargetReference> references = targetHostManager.getTargetReferences(api.getId(), context.getId());
       
      for(TargetReference target : references) {
       
        // No proxy associated to the API
        assertNull(target.getTargetHost().getForwardProxy());
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.