All Downloads are FREE. Search and download functionalities are using the official Maven repository.
Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
at.spardat.xma.boot.comp.AppManagerTest Maven / Gradle / Ivy
/*
* @(#) $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 java.util.Properties;
import junit.framework.TestCase;
import at.spardat.xma.boot.Statics;
import at.spardat.xma.boot.transport.XMA_URI;
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(Statics.CFG_PROP_HOSTNAMEACCEPT,"localhost;"+PUBLIC_URLS);
prop.setProperty(Statics.CFG_PROP_HOSTNAMEBLOCK,"");
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(Statics.CFG_PROP_HOSTNAMEACCEPT,PUBLIC_URLS);
prop.setProperty(Statics.CFG_PROP_HOSTNAMEBLOCK,"");
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(Statics.CFG_PROP_HOSTNAMEACCEPT,"localhost;127.0.0.1;92.*");
prop.setProperty(Statics.CFG_PROP_HOSTNAMEBLOCK,"");
appManager = AppManager.initialize(prop);
XMA_URI uri = new XMA_URI(PUBLIC_TEST_URL);
assertTrue("desired accept: " + PUBLIC_TEST_URL, appManager.acceptXMA_URI(uri));
}
public void testAcceptXMA_URI_NoPUBLIC_TEST_URL() throws Exception {
AppManager appManager;
Properties prop = new Properties();
prop.setProperty(Statics.CFG_PROP_HOSTNAMEACCEPT,"localhost;127.0.0.1;*.net");
prop.setProperty(Statics.CFG_PROP_HOSTNAMEBLOCK,"");
appManager = AppManager.initialize(prop);
XMA_URI uri = new XMA_URI(PUBLIC_TEST_URL);
assertFalse("desired blocked: " + PUBLIC_TEST_URL, appManager.acceptXMA_URI(uri));
}
public void testAcceptXMA_URI_BlockLocal() throws Exception {
AppManager appManager;
Properties prop = new Properties();
prop.setProperty(Statics.CFG_PROP_HOSTNAMEACCEPT,"localhost;127.0.0.1;10.*;"+PUBLIC_URLS);
prop.setProperty(Statics.CFG_PROP_HOSTNAMEBLOCK,"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(Statics.CFG_PROP_HOSTNAMEACCEPT,"localhost;127.0.0.1;10.*;"+PUBLIC_URLS);
prop.setProperty(Statics.CFG_PROP_HOSTNAMEBLOCK,"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(Statics.CFG_PROP_HOSTNAMEACCEPT,"localhost;127.0.0.1;10.*"+PUBLIC_URLS);
prop.setProperty(Statics.CFG_PROP_HOSTNAMEBLOCK,"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(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));
}
// 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));
// }
}