Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #199 from hazendaz/master
Add git attributes - to fix line endings
- Loading branch information
Showing
23 changed files
with
1,528 additions
and
1,506 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
118 changes: 59 additions & 59 deletions
118
...ss/src/test/java/ch/qos/logback/access/jetty/JettyFixtureWithListAndConsoleAppenders.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
} | ||
} | ||
|
190 changes: 95 additions & 95 deletions
190
logback-access/src/test/java/ch/qos/logback/access/joran/ConditionalTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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ücü | ||
*/ | ||
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ücü | ||
*/ | ||
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)); | ||
} | ||
} |
50 changes: 25 additions & 25 deletions
50
logback-access/src/test/java/ch/qos/logback/access/joran/PackageTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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ücü | ||
*/ | ||
@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ücü | ||
*/ | ||
@RunWith(Suite.class) | ||
@Suite.SuiteClasses({JoranConfiguratorTest.class, ConditionalTest.class}) | ||
public class PackageTest { | ||
} |
Oops, something went wrong.