Skip to content

Commit

Permalink
Merge pull request #199 from hazendaz/master
Browse files Browse the repository at this point in the history
Add git attributes - to fix line endings
  • Loading branch information
tony19 committed May 10, 2014
2 parents 8aa285a + ac8a06e commit f6bf439
Show file tree
Hide file tree
Showing 23 changed files with 1,528 additions and 1,506 deletions.
22 changes: 22 additions & 0 deletions .gitattributes
@@ -0,0 +1,22 @@
# Auto detect text files and perform LF normalization
* text=auto

# Custom for Visual Studio
*.cs diff=csharp
*.sln merge=union
*.csproj merge=union
*.vbproj merge=union
*.fsproj merge=union
*.dbproj merge=union

# Standard to msysgit
*.doc diff=astextplain
*.DOC diff=astextplain
*.docx diff=astextplain
*.DOCX diff=astextplain
*.dot diff=astextplain
*.DOT diff=astextplain
*.pdf diff=astextplain
*.PDF diff=astextplain
*.rtf diff=astextplain
*.RTF diff=astextplain
@@ -1,59 +1,59 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
* Copyright (C) 1999-2013, QOS.ch. All rights reserved.
*
* This program and the accompanying materials are dual-licensed under
* either the terms of the Eclipse Public License v1.0 as published by
* the Eclipse Foundation
*
* or (per the licensee's choosing)
*
* under the terms of the GNU Lesser General Public License version 2.1
* as published by the Free Software Foundation.
*/
package ch.qos.logback.access.jetty;

import ch.qos.logback.access.spi.IAccessEvent;
import ch.qos.logback.access.PatternLayoutEncoder;
import ch.qos.logback.access.testUtil.NotifyingListAppender;
import ch.qos.logback.core.ConsoleAppender;

public class JettyFixtureWithListAndConsoleAppenders extends JettyFixtureBase {

public JettyFixtureWithListAndConsoleAppenders(RequestLogImpl impl, int port) {
super(impl, port);
url = "http://localhost:" + port + "/";
}

public void start() throws Exception {
super.start();
Thread.yield();
}

public void stop() throws Exception {
super.stop();
Thread.sleep(500);
}

@Override
protected void configureRequestLogImpl() {
NotifyingListAppender appender = new NotifyingListAppender();
appender.setContext(requestLogImpl);
appender.setName("list");
appender.start();

ConsoleAppender<IAccessEvent> console = new ConsoleAppender<IAccessEvent>();
console.setContext(requestLogImpl);
console.setName("console");
PatternLayoutEncoder layout = new PatternLayoutEncoder();
layout.setContext(requestLogImpl);
layout.setPattern("%date %server %clientHost");
console.setEncoder(layout);
layout.start();
console.start();

requestLogImpl.addAppender(appender);
requestLogImpl.addAppender(console);
}
}
/**
* Logback: the reliable, generic, fast and flexible logging framework.
* Copyright (C) 1999-2013, QOS.ch. All rights reserved.
*
* This program and the accompanying materials are dual-licensed under
* either the terms of the Eclipse Public License v1.0 as published by
* the Eclipse Foundation
*
* or (per the licensee's choosing)
*
* under the terms of the GNU Lesser General Public License version 2.1
* as published by the Free Software Foundation.
*/
package ch.qos.logback.access.jetty;

import ch.qos.logback.access.spi.IAccessEvent;
import ch.qos.logback.access.PatternLayoutEncoder;
import ch.qos.logback.access.testUtil.NotifyingListAppender;
import ch.qos.logback.core.ConsoleAppender;

public class JettyFixtureWithListAndConsoleAppenders extends JettyFixtureBase {

public JettyFixtureWithListAndConsoleAppenders(RequestLogImpl impl, int port) {
super(impl, port);
url = "http://localhost:" + port + "/";
}

public void start() throws Exception {
super.start();
Thread.yield();
}

public void stop() throws Exception {
super.stop();
Thread.sleep(500);
}

@Override
protected void configureRequestLogImpl() {
NotifyingListAppender appender = new NotifyingListAppender();
appender.setContext(requestLogImpl);
appender.setName("list");
appender.start();

ConsoleAppender<IAccessEvent> console = new ConsoleAppender<IAccessEvent>();
console.setContext(requestLogImpl);
console.setName("console");
PatternLayoutEncoder layout = new PatternLayoutEncoder();
layout.setContext(requestLogImpl);
layout.setPattern("%date %server %clientHost");
console.setEncoder(layout);
layout.start();
console.start();

requestLogImpl.addAppender(appender);
requestLogImpl.addAppender(console);
}
}

@@ -1,95 +1,95 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
* Copyright (C) 1999-2013, QOS.ch. All rights reserved.
*
* This program and the accompanying materials are dual-licensed under
* either the terms of the Eclipse Public License v1.0 as published by
* the Eclipse Foundation
*
* or (per the licensee's choosing)
*
* under the terms of the GNU Lesser General Public License version 2.1
* as published by the Free Software Foundation.
*/
package ch.qos.logback.access.joran;

import ch.qos.logback.access.TeztConstants;
import ch.qos.logback.access.spi.AccessContext;
import ch.qos.logback.core.ConsoleAppender;
import ch.qos.logback.core.joran.spi.JoranException;
import ch.qos.logback.core.read.ListAppender;
import ch.qos.logback.core.status.StatusChecker;
import ch.qos.logback.core.testUtil.RandomUtil;
import ch.qos.logback.core.util.CoreTestConstants;
import org.junit.Before;
import org.junit.Test;

import java.io.IOException;
import java.net.InetAddress;
import java.net.UnknownHostException;

import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;

/**
* @author Ceki G&uuml;c&uuml;
*/
public class ConditionalTest {

AccessContext context = new AccessContext();
StatusChecker checker = new StatusChecker(context);

int diff = RandomUtil.getPositiveInt();
String randomOutputDir = CoreTestConstants.OUTPUT_DIR_PREFIX + diff + "/";

@Before
public void setUp() {
InetAddress localhost = null;
try {
localhost = InetAddress.getLocalHost();
context.putProperty("aHost", localhost.getHostName());
} catch (UnknownHostException e) {
e.printStackTrace();
}
}

void configure(String file) throws JoranException {
JoranConfigurator jc = new JoranConfigurator();
jc.setContext(context);
jc.doConfigure(file);
}

@Test
public void conditionalConsoleApp_IF_THEN_True() throws JoranException, UnknownHostException {
configure(TeztConstants.TEST_DIR_PREFIX + "input/joran/conditional/conditionalConsole.xml");
ConsoleAppender consoleAppender = (ConsoleAppender) context.getAppender("CON");
assertNotNull(consoleAppender);
assertTrue(checker.isErrorFree(0));
}

@Test
public void conditionalConsoleApp_IF_THEN_False() throws JoranException,
IOException, InterruptedException {
context.putProperty("aHost", null);
configure(TeztConstants.TEST_DIR_PREFIX + "input/joran/conditional/conditionalConsole.xml");

ConsoleAppender consoleAppender = (ConsoleAppender) context.getAppender("CON");
assertNull(consoleAppender);

StatusChecker checker = new StatusChecker(context);
assertTrue(checker.isErrorFree(0));
}

@Test
public void conditionalConsoleApp_ELSE() throws JoranException,
IOException, InterruptedException {
configure(TeztConstants.TEST_DIR_PREFIX + "input/joran/conditional/conditionalConsole_ELSE.xml");
ConsoleAppender consoleAppender = (ConsoleAppender) context.getAppender("CON");
assertNull(consoleAppender);

ListAppender listAppender = (ListAppender) context.getAppender("LIST");
assertNotNull(listAppender);
assertTrue(checker.isErrorFree(0));
}
}
/**
* Logback: the reliable, generic, fast and flexible logging framework.
* Copyright (C) 1999-2013, QOS.ch. All rights reserved.
*
* This program and the accompanying materials are dual-licensed under
* either the terms of the Eclipse Public License v1.0 as published by
* the Eclipse Foundation
*
* or (per the licensee's choosing)
*
* under the terms of the GNU Lesser General Public License version 2.1
* as published by the Free Software Foundation.
*/
package ch.qos.logback.access.joran;

import ch.qos.logback.access.TeztConstants;
import ch.qos.logback.access.spi.AccessContext;
import ch.qos.logback.core.ConsoleAppender;
import ch.qos.logback.core.joran.spi.JoranException;
import ch.qos.logback.core.read.ListAppender;
import ch.qos.logback.core.status.StatusChecker;
import ch.qos.logback.core.testUtil.RandomUtil;
import ch.qos.logback.core.util.CoreTestConstants;
import org.junit.Before;
import org.junit.Test;

import java.io.IOException;
import java.net.InetAddress;
import java.net.UnknownHostException;

import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;

/**
* @author Ceki G&uuml;c&uuml;
*/
public class ConditionalTest {

AccessContext context = new AccessContext();
StatusChecker checker = new StatusChecker(context);

int diff = RandomUtil.getPositiveInt();
String randomOutputDir = CoreTestConstants.OUTPUT_DIR_PREFIX + diff + "/";

@Before
public void setUp() {
InetAddress localhost = null;
try {
localhost = InetAddress.getLocalHost();
context.putProperty("aHost", localhost.getHostName());
} catch (UnknownHostException e) {
e.printStackTrace();
}
}

void configure(String file) throws JoranException {
JoranConfigurator jc = new JoranConfigurator();
jc.setContext(context);
jc.doConfigure(file);
}

@Test
public void conditionalConsoleApp_IF_THEN_True() throws JoranException, UnknownHostException {
configure(TeztConstants.TEST_DIR_PREFIX + "input/joran/conditional/conditionalConsole.xml");
ConsoleAppender consoleAppender = (ConsoleAppender) context.getAppender("CON");
assertNotNull(consoleAppender);
assertTrue(checker.isErrorFree(0));
}

@Test
public void conditionalConsoleApp_IF_THEN_False() throws JoranException,
IOException, InterruptedException {
context.putProperty("aHost", null);
configure(TeztConstants.TEST_DIR_PREFIX + "input/joran/conditional/conditionalConsole.xml");

ConsoleAppender consoleAppender = (ConsoleAppender) context.getAppender("CON");
assertNull(consoleAppender);

StatusChecker checker = new StatusChecker(context);
assertTrue(checker.isErrorFree(0));
}

@Test
public void conditionalConsoleApp_ELSE() throws JoranException,
IOException, InterruptedException {
configure(TeztConstants.TEST_DIR_PREFIX + "input/joran/conditional/conditionalConsole_ELSE.xml");
ConsoleAppender consoleAppender = (ConsoleAppender) context.getAppender("CON");
assertNull(consoleAppender);

ListAppender listAppender = (ListAppender) context.getAppender("LIST");
assertNotNull(listAppender);
assertTrue(checker.isErrorFree(0));
}
}
@@ -1,25 +1,25 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
* Copyright (C) 1999-2013, QOS.ch. All rights reserved.
*
* This program and the accompanying materials are dual-licensed under
* either the terms of the Eclipse Public License v1.0 as published by
* the Eclipse Foundation
*
* or (per the licensee's choosing)
*
* under the terms of the GNU Lesser General Public License version 2.1
* as published by the Free Software Foundation.
*/
package ch.qos.logback.access.joran;

import org.junit.runner.RunWith;
import org.junit.runners.Suite;

/**
* @author Ceki G&uuml;c&uuml;
*/
@RunWith(Suite.class)
@Suite.SuiteClasses({JoranConfiguratorTest.class, ConditionalTest.class})
public class PackageTest {
}
/**
* Logback: the reliable, generic, fast and flexible logging framework.
* Copyright (C) 1999-2013, QOS.ch. All rights reserved.
*
* This program and the accompanying materials are dual-licensed under
* either the terms of the Eclipse Public License v1.0 as published by
* the Eclipse Foundation
*
* or (per the licensee's choosing)
*
* under the terms of the GNU Lesser General Public License version 2.1
* as published by the Free Software Foundation.
*/
package ch.qos.logback.access.joran;

import org.junit.runner.RunWith;
import org.junit.runners.Suite;

/**
* @author Ceki G&uuml;c&uuml;
*/
@RunWith(Suite.class)
@Suite.SuiteClasses({JoranConfiguratorTest.class, ConditionalTest.class})
public class PackageTest {
}

0 comments on commit f6bf439

Please sign in to comment.