Package org.codehaus.dna.impl

Examples of org.codehaus.dna.impl.ConsoleLogger


    public void testConsoleWithEmptyOutput()
        throws Exception
    {
        try
        {
            new ConsoleLogger( MockConsoleLogger.LEVEL_ALL, null );
        }
        catch( final NullPointerException npe )
        {
            assertEquals( "npe.message", "output", npe.getMessage() );
            return;
View Full Code Here


    public void testMockConsoleOutputToConsole()
        throws Exception
    {
        final ByteArrayOutputStream arrayOutput = new ByteArrayOutputStream();
        final PrintStream output = new PrintStream( arrayOutput );
        final ConsoleLogger logger = new ConsoleLogger( MockConsoleLogger.LEVEL_ALL, output );
        logger.debug( "ignore me!", null );
        final String message = arrayOutput.toString();
        final String expectedMessage =
            "[DEBUG] ignore me!" + System.getProperty( "line.separator" );
        assertEquals( "message", expectedMessage, message );
    }
View Full Code Here

    public void testMockConsoleOutputToConsoleWithException()
        throws Exception
    {
        final ByteArrayOutputStream arrayOutput = new ByteArrayOutputStream();
        final PrintStream output = new PrintStream( arrayOutput );
        final ConsoleLogger logger = new ConsoleLogger( MockConsoleLogger.LEVEL_ALL, output );
        logger.debug( "ignore me!", new Throwable( "Ignore me aswell!" ) );
        final String message = arrayOutput.toString();
        final String expectedMessage =
            "[DEBUG] ignore me!" + System.getProperty( "line.separator" );
        assertTrue( "message", message.startsWith( expectedMessage ) );
        assertTrue( "throwable message", -1 != message.indexOf( "Ignore me aswell!" ) );
View Full Code Here

    public void testEnableLoggingOnComponentImplementingStage()
        throws Exception
    {
        final MockComponent object = new MockComponent();
        final ConsoleLogger logger = new ConsoleLogger();

        ContainerUtil.enableLogging( object, logger );

        assertEquals( logger, object.getLogger() );
    }
View Full Code Here

    public void testEnableLoggingOnComponentImplementingStageButNullLogger()
        throws Exception
    {
        final MockComponent object = new MockComponent();
        final ConsoleLogger logger = null;

        try
        {
            ContainerUtil.enableLogging( object, logger );
        }
View Full Code Here

      final DefaultConfiguration root = new DefaultConfiguration( "root", "", "" );
      final DefaultConfiguration configuration = new DefaultConfiguration( "shutdownTimeout", "", "" );
      configuration.setValue( "22" );
      root.addChild( configuration );

      final ConsoleLogger logger = new ConsoleLogger( ConsoleLogger.LEVEL_NONE );
      manager.enableLogging( logger );
      final AcceptorMonitor monitor = manager.getMonitor();
      assertTrue( "getMonitor() instanceof DNAAcceptorMonitor", monitor instanceof DNAAcceptorMonitor );
      final DNAAcceptorMonitor dnaMonitor = (DNAAcceptorMonitor) monitor;
      assertEquals( "logger", logger, dnaMonitor.getLogger() );
View Full Code Here

    private void verify( final PartitionProfile profile )
        throws Exception
    {
        final ClassLoader classLoader = getClass().getClassLoader();
        final SarVerifier verifier = new SarVerifier();
        verifier.enableLogging( new ConsoleLogger() );
        verifier.verifySar( profile, classLoader );
    }
View Full Code Here

    private void runApplicationTest( final PartitionProfile sarMetaData )
        throws Exception
    {
        final DefaultApplication application = new DefaultApplication();
        application.enableLogging( new ConsoleLogger() );
        final MockApplicationContext context =
            new MockApplicationContext( sarMetaData, new ConsoleLogger() );
        application.setApplicationContext( context );
        application.initialize();
        application.dispose();
    }
View Full Code Here

        assertNotNull( "Config resource: " + config, resource );
        final Configuration assembly =
            ConfigurationBuilder.build(
                new InputSource( resource.toExternalForm() ),
                ConfigurationBuilder.ASSEMBLY_SCHEMA,
                new ConsoleLogger() );
        final Map parameters = new HashMap();
        parameters.put( ContainerConstants.ASSEMBLY_NAME, "test" );
        parameters.put( ContainerConstants.ASSEMBLY_DESCRIPTOR, assembly );
        parameters.put( ContainerConstants.CONFIG_DESCRIPTOR,
                        new DefaultConfiguration( "config", "", "" ) );
View Full Code Here

        throws Exception
    {
        final PhoenixProfileBuilder assembler = new PhoenixProfileBuilder();
        final URL resource = getClass().getResource( config );
        assertNotNull( "Config resource: " + config, resource );
        final ConsoleLogger logger = new ConsoleLogger();
        final Configuration assembly =
            ConfigurationBuilder.build( new InputSource( resource.toExternalForm() ),
                                        ConfigurationBuilder.ASSEMBLY_SCHEMA,
                                        logger );
        final Map parameters = new HashMap();
View Full Code Here

TOP

Related Classes of org.codehaus.dna.impl.ConsoleLogger

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.