Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright (c) 2003, 2007 s IT Solutions AT Spardat GmbH . All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html Contributors: s IT Solutions AT Spardat GmbH - initial API and implementation /
/*
 * @(#) $Id: HostnameVerifierImplTest.java 2647 2008-08-26 13:53:08Z webok $
 */
package at.spardat.xma.boot.test;
import  junit.framework.Assert;
import  junit.framework.TestCase;

Author(s):
s2877
Since:
version_number
public class HostnameVerifierImplTest extends TestCase {

    

Parameters:
arg0
    public HostnameVerifierImplTest(String arg0) {
        super(arg0);
    }
    public static void main(String[] args) {
        junit.awtui.TestRunner.run(HostnameVerifierImplTest.class);
    }
    public void testVerify() {
        Properties props = new Properties();
        props.setProperty("boot.transport.hostnameverify.ignore","*host|local*|pre*post|a*a*a|10.18.*");
        Assert.assertTrue(hv.verify("myhost",null));
        Assert.assertTrue(!hv.verify("myhosty",null));
        Assert.assertTrue(hv.verify("host",null));
        Assert.assertTrue(hv.verify("localpc",null));
        Assert.assertTrue(!hv.verify("llocalpc",null));
        Assert.assertTrue(hv.verify("local",null));
        Assert.assertTrue(hv.verify("prepost",null));
        Assert.assertTrue(hv.verify("pre.gurke.post",null));
        Assert.assertTrue(!hv.verify("ababa",null));
        Assert.assertTrue(hv.verify("w0188000962",null));
        // wildcard for all hosts
        props = new Properties();
        props.setProperty("boot.transport.hostnameverify.ignore","*");
        Assert.assertTrue(hv.verify("alles",null));
        // no ignors at all
        props = new Properties();
        Assert.assertTrue(!hv.verify("alles",null));
    }
New to GrepCode? Check out our FAQ X