Package com.pugh.sockso

Examples of com.pugh.sockso.StringProperties


       
        final Request req = createMock( Request.class );
        expect( req.getUrlParam(0) ).andReturn( "--DOES-NOT-EXIST--" );
        replay( req );

        final Dispatcher d = new Dispatcher( injector, new StringProperties() );
        d.init( "http", 4444 );
        final BaseAction a = d.getAction( req );
       
        assertNull( a );
       
View Full Code Here


        expect( req.getUrlParam(0) ).andReturn( parts.length > 0 ? parts[1] : "" );
        if ( parts.length > 1 )
            expect( req.getUrlParam(1) ).andReturn( parts[2] );
        replay( req );
       
        final Dispatcher d = new Dispatcher( injector, new StringProperties() );
        d.init( "http", 4444 );
       
        assertEquals( handler, d.getAction( req ).getClass() );

    }
View Full Code Here

        assertEquals( handler, d.getAction( req ).getClass() );

    }

    public void testGettingHost() {
        final StringProperties p = new StringProperties();
        final String host = "some.host.com";
        final int port = 1234;
        p.set( Constants.SERVER_HOST, host );
        final Dispatcher d = new Dispatcher( injector, p );
        d.init( "http", port );
        assertEquals( host + ":" + port, d.getHost() );
    }
View Full Code Here

        assertEquals( IpFinder.LOOPBACK, f.getIp() );
    }

    public void testGetIpFromProperties() {
       
        final Properties p = new StringProperties();
        final IpFinder f = new IpFinder( p, null );
        final String propertiesIp = "123.456.789.101";

        p.set( Constants.SERVER_HOST_LAST_UPDATED, Long.toString(new Date().getTime()) );
        p.set( Constants.SERVER_HOST, propertiesIp );
       
        assertEquals( propertiesIp, f.getIpFromProperties() );

    }
View Full Code Here

    private TestLocale locale;

    @Override
    public void setUp() {
        p = new StringProperties();
        db = new TestDatabase();
        locale = new TestLocale();
        locale.setString( "con.desc.commands", "Usage:" );
        locale.setString( "con.msg.propertySaved", "property saved" );
        cmd = new CommandExecuter( db, p, null, locale, new CommandParser() );
View Full Code Here

    }

    public void testStaleIpInProperties() {

        final Properties p = new StringProperties();
        final IpFinder f = new IpFinder( p, null );
        final String propertiesIp = "123.456.789.101";
        final String staleDate = Long.toString(new Date().getTime() - (Constants.SERVER_IP_TIMEOUT * 2));

        p.set( Constants.SERVER_HOST_LAST_UPDATED, staleDate );
        p.set( Constants.SERVER_HOST, propertiesIp );

        assertNull( f.getIpFromProperties() );

    }
View Full Code Here

    }

    public void testGetIpFromOptions() {

        final TestOptionSet options = new TestOptionSet();
        final StringProperties p = new StringProperties();
        final String ip = "123.123.123.123";
        final IpFinder f = new IpFinder( p, options );

        options.addHas( Options.OPT_IP, ip );
View Full Code Here

    }

    public void testGetIpFromOptionsNothingSpecified() {

        final TestOptionSet options = new TestOptionSet();
        final StringProperties p = new StringProperties();
        final String ip = "123.123.123.123";
        final IpFinder f = new IpFinder( p, options );

        assertNull( f.getIpFromOptions() );
View Full Code Here

    }

    public void testSaveIpToProperties() {

        final StringProperties p = new StringProperties();
        final IpFinder f = new IpFinder( p, null );
       
        assertEquals( f.LOOPBACK, f.getIp() );
        assertEquals( "", p.get(Constants.SERVER_HOST) );
        assertEquals( "", p.get(Constants.SERVER_HOST_LAST_UPDATED) );
       
        f.save();

        assertEquals( f.LOOPBACK, p.get(Constants.SERVER_HOST) );
        assertFalse( p.get(Constants.SERVER_HOST_LAST_UPDATED).equals("") );

    }
View Full Code Here

    public void testGetLatestArtistsQuery() throws Exception {
       
        final Database db = new TestDatabase();
        final Latester b = new Latester();
       
        b.setProperties( new StringProperties() );
        b.setDatabase( db );
        b.getLatestArtists();
       
    }
View Full Code Here

TOP

Related Classes of com.pugh.sockso.StringProperties

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.