Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * @(#) $Id: AppManagerTest.java 6052 2010-07-01 11:33:12Z webok $
   *
   * Copyright 2004/2005 by SPARDAT Sparkassen-Datendienst Ges.m.b.H.,
   * A-1110 Wien, Geiselbergstr.21-25.
   * All rights reserved.
   *
   */
  package at.spardat.xma.boot.comp;
 
 
 import  junit.framework.TestCase;
 
 public class AppManagerTest extends TestCase {
 
 	private static String PUBLIC_URLS = "10.*;*.at;*.net;*.org";
 	private static String PUBLIC_TEST_URL = "http://92.51.130.119:8180/xma_simplesample/AccountList.xma?idCustomer=1";
 
     public AppManagerTest() {
         super();
     }
 
     public AppManagerTest(String name) {
         super(name);
     }
 
     protected void setUp() throws Exception {
         super.setUp();
     }
 
     public static void main(String[] args) {
         junit.awtui.TestRunner.run(AppManagerTest.class);
     }
 
     public void testAcceptXMA_URI_AllIntern() throws Exception {
         AppManager appManager;
 
         Properties prop = new Properties();
         prop.setProperty(.,"localhost;"+);
         prop.setProperty(.,"");
         appManager = AppManager.initialize(prop);
 
         XMA_URI uri = new XMA_URI("http://localhost:8080/xma_samplespar/Kundensuche");
         assertTrue("desired: all internal URLS accepted"appManager.acceptXMA_URI(uri));
     }
 
     public void testAcceptXMA_URI_NoLocal() throws Exception {
         AppManager appManager;
 
         Properties prop = new Properties();
         prop.setProperty(.,"");
         appManager = AppManager.initialize(prop);
 
         XMA_URI uri = new XMA_URI("http://localhost:8080/xma_samplespar/Kundensuche");
         assertFalse("desired: local URLS not accepted"appManager.acceptXMA_URI(uri));
     }
 
     public void testAcceptXMA_URI_AcceptPUBLIC_TEST_URL() throws Exception {
         AppManager appManager;
 
         Properties prop = new Properties();
         prop.setProperty(.,"localhost;127.0.0.1;92.*");
         prop.setProperty(.,"");
         appManager = AppManager.initialize(prop);
 
         XMA_URI uri = new XMA_URI();
         assertTrue("desired accept: " + appManager.acceptXMA_URI(uri));
     }
 
     public void testAcceptXMA_URI_NoPUBLIC_TEST_URL() throws Exception {
         AppManager appManager;
 
         Properties prop = new Properties();
         prop.setProperty(.,"localhost;127.0.0.1;*.net");
         prop.setProperty(.,"");
         appManager = AppManager.initialize(prop);
 
         XMA_URI uri = new XMA_URI();
         assertFalse("desired blocked: " + appManager.acceptXMA_URI(uri));
     }
 
     public void testAcceptXMA_URI_BlockLocal() throws Exception {
         AppManager appManager;
 
         Properties prop = new Properties();
         prop.setProperty(.,"localhost;127.0.0.1;10.*;"+);
         prop.setProperty(.,"localhost");
         appManager = AppManager.initialize(prop);
 
         XMA_URI uri = new XMA_URI("http://localhost:8080/xma_samplespar/Kundensuche");
         assertFalse("desired: local URLS blocked"appManager.acceptXMA_URI(uri));
     }
 
     public void testAcceptXMA_URI_Block127() throws Exception {
         AppManager appManager;
        Properties prop = new Properties();
        prop.setProperty(.,"localhost;127.0.0.1;10.*;"+);
        prop.setProperty(.,"127.0.0.1");
        appManager = AppManager.initialize(prop);
        XMA_URI uri = new XMA_URI("http://localhost:8080/xma_samplespar/Kundensuche");
        assertFalse("desired: 127.0.0.1 URL blocked"appManager.acceptXMA_URI(uri));
    }
    public void testAcceptXMA_URI_Block10() throws Exception {
        AppManager appManager;
        Properties prop = new Properties();
        prop.setProperty(.,"localhost;127.0.0.1;10.*"+);
        prop.setProperty(.,"10.*");
        appManager = AppManager.initialize(prop);
        XMA_URI uri = new XMA_URI("http://10.18.93.132:8080/xma_samplespar/Kundensuche");
        assertFalse("desired: 10.* URL blocked"appManager.acceptXMA_URI(uri));
    }
    public void testAcceptXMA_URI_BlockPUBLIC_TEST_URL() throws Exception {
        AppManager appManager;
        Properties prop = new Properties();
        prop.setProperty(.,"localhost;127.0.0.1;10.*;92.*;"+);
        prop.setProperty(.,"92.*");
        appManager = AppManager.initialize(prop);
        XMA_URI uri = new XMA_URI();
        assertFalse("desired blocked: " + appManager.acceptXMA_URI(uri));
    }
//    public void testAcceptXMA_URI_BlockPUBLIC_TEST_URL2() throws Exception {
//        AppManager appManager;
//
//        Properties prop = new Properties();
//        prop.setProperty(Statics.CFG_PROP_HOSTNAMEACCEPT,"localhost;127.0.0.1;10.*;92.*;"+PUBLIC_URLS);
//        prop.setProperty(Statics.CFG_PROP_HOSTNAMEBLOCK,"92.*");
//        appManager = AppManager.initialize(prop);
//
//        XMA_URI uri = new XMA_URI(PUBLIC_TEST_URL);
//        assertFalse("desired blocked: " + PUBLIC_TEST_URL, appManager.acceptXMA_URI(uri));
//    }
New to GrepCode? Check out our FAQ X