Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions logback/doc/changelog.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Version 1.0.0
--------------
* Initial release
8 changes: 8 additions & 0 deletions logback/itests/base.bndrun
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
-resolve.effective: resolve, active

-runproperties.base: \
logback.configurationFile=${fileuri;${.}/logback.xml}

-runstartlevel: \
order=sortbynameversion,\
begin=-1
17 changes: 17 additions & 0 deletions logback/itests/immediate-equinox-logservice/itest.bndrun
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
-include: ../base.bndrun

-runfw: org.eclipse.osgi

-runrequires:\
osgi.identity;filter:='(osgi.identity=org.apache.felix.logback.itests.immediate.equinox.logservice)'

-runpath: \
ch.qos.logback.classic;version=latest,\
ch.qos.logback.core;version=latest,\
slf4j.api;version=latest,\
jul.to.slf4j;version=latest,\
org.apache.felix.logback;version=latest

-runbundles: \
org.apache.felix.logback.itests.immediate.equinox.logservice;version='[2.0.0,2.0.1)',\
org.apache.servicemix.bundles.junit;version='[4.13.2,4.13.3)'
40 changes: 40 additions & 0 deletions logback/itests/immediate-equinox-logservice/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.logback.itests.parent</artifactId>
<version>2.0.0-SNAPSHOT</version>
<relativePath>../itest-parent/pom.xml</relativePath>
</parent>

<artifactId>org.apache.felix.logback.itests.immediate.equinox.logservice</artifactId>

<dependencies>
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.logback.itests.helper</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
</dependency>
</dependencies>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.felix.logback.test;

import org.apache.felix.logback.test.helper.LogTestHelper;
import org.apache.felix.logback.test.helper.ls.LogServiceHelper;
import org.junit.Test;
import org.osgi.framework.BundleContext;
import org.osgi.framework.FrameworkUtil;
import org.osgi.framework.ServiceEvent;
import org.osgi.framework.ServiceReference;
import org.osgi.framework.ServiceRegistration;
import org.osgi.service.log.LogService;
import org.osgi.service.log.Logger;

public class LogServiceTest extends LogTestHelper {

@Test
public void test() {
long time = System.nanoTime();
Logger logger = LogServiceHelper.getLogger(getClass());
if (logger.isInfoEnabled()) {
logger.info(time + "");
}
assertLog("INFO", getClass().getName(), time);
}

@Test
public void service() {
BundleContext bundleContext = FrameworkUtil.getBundle(getClass()).getBundleContext();
ServiceRegistration<Integer> registration = bundleContext.registerService(Integer.class, Integer.valueOf(25), null);

ServiceReference<Integer> reference = registration.getReference();
String refString = reference.toString();

try {
assertExtendedServiceLog(
"INFO|Events.Service." + getBSN() +
"|ServiceEvent REGISTERED " + refString,
ServiceEvent.REGISTERED, reference);
}
finally {
registration.unregister();
assertExtendedServiceLog(
"INFO|Events.Service." + getBSN() +
"|ServiceEvent UNREGISTERING " + refString,
ServiceEvent.UNREGISTERING, reference);
}
}

@SuppressWarnings("deprecation")
@Test
public void logService() {
BundleContext bundleContext = FrameworkUtil.getBundle(getClass()).getBundleContext();
ServiceReference<LogService> reference = bundleContext.getServiceReference(LogService.class);
LogService logService = bundleContext.getService(reference);

logService.log(LogService.LOG_INFO, "Test log");

try {
assertLog("INFO|LogService." + getBSN() + "|Test log");
}
finally {
bundleContext.ungetService(reference);
}
}

}
20 changes: 20 additions & 0 deletions logback/itests/immediate-felix-logservice/itest.bndrun
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
-include: ../base.bndrun

-runfw: org.apache.felix.framework

-runrequires:\
osgi.identity;filter:='(osgi.identity=org.apache.felix.log.extension)',\
osgi.identity;filter:='(osgi.identity=org.apache.felix.logback.itests.immediate.felix.logservice)'

-runpath: \
ch.qos.logback.classic;version=latest,\
ch.qos.logback.core;version=latest,\
slf4j.api;version=latest,\
jul.to.slf4j;version=latest,\
org.apache.felix.log;version=latest,\
org.apache.felix.logback;version=latest

-runbundles: \
org.apache.felix.log.extension;version='[1.0.0,1.0.1)',\
org.apache.felix.logback.itests.immediate.felix.logservice;version='[2.0.0,2.0.1)',\
org.apache.servicemix.bundles.junit;version='[4.13.2,4.13.3)'
39 changes: 39 additions & 0 deletions logback/itests/immediate-felix-logservice/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.logback.itests.parent</artifactId>
<version>2.0.0-SNAPSHOT</version>
<relativePath>../itest-parent</relativePath>
</parent>

<artifactId>org.apache.felix.logback.itests.immediate.felix.logservice</artifactId>

<dependencies>
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.logback.itests.helper</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.felix.logback.test;

import org.apache.felix.logback.test.helper.LogTestHelper;
import org.apache.felix.logback.test.helper.ls.LogServiceHelper;
import org.junit.Test;
import org.osgi.framework.BundleContext;
import org.osgi.framework.FrameworkUtil;
import org.osgi.framework.ServiceReference;
import org.osgi.framework.ServiceRegistration;
import org.osgi.service.log.LogService;
import org.osgi.service.log.Logger;

public class LogServiceTest extends LogTestHelper {

@Test
public void test() {
long time = System.nanoTime();
Logger logger = LogServiceHelper.getLogger(getClass());
if (logger.isInfoEnabled()) {
logger.info(time + "");
}
assertLog("INFO", getClass().getName(), time);
}

@Test
public void service() {
BundleContext bundleContext = FrameworkUtil.getBundle(getClass()).getBundleContext();
ServiceRegistration<Integer> registration = bundleContext.registerService(Integer.class, Integer.valueOf(25), null);

ServiceReference<Integer> reference = registration.getReference();
String refString = reference.toString();

try {
assertLog("INFO|Events.Service." + getBSN() + "|ServiceEvent REGISTERED " + refString);
}
finally {
registration.unregister();
assertLog("INFO|Events.Service." + getBSN() + "|ServiceEvent UNREGISTERING " + refString);
}
}

@SuppressWarnings("deprecation")
@Test
public void logService() {
BundleContext bundleContext = FrameworkUtil.getBundle(getClass()).getBundleContext();
ServiceReference<LogService> reference = bundleContext.getServiceReference(LogService.class);
LogService logService = bundleContext.getService(reference);

logService.log(LogService.LOG_INFO, "Test log");

try {
assertLog("INFO|LogService." + getBSN() + "|Test log");
}
finally {
bundleContext.ungetService(reference);
}
}

}
29 changes: 29 additions & 0 deletions logback/itests/immediate-jbl/itest.bndrun
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
-include: ../base.bndrun

-runfw: org.apache.felix.framework

-runrequires:\
osgi.identity;filter:='(osgi.identity=org.apache.felix.log.extension)',\
osgi.identity;filter:='(osgi.identity=org.apache.felix.logback.itests.immediate.jbl)'

-runpath: \
ch.qos.logback.classic;version=latest,\
ch.qos.logback.core;version=latest,\
slf4j.api;version=latest,\
jul.to.slf4j;version=latest,\
org.apache.felix.log;version=latest,\
org.apache.felix.logback;version=latest

-runsystempackages: \
org.slf4j;version=${version_cleanup;${slf4j.api.version}},\
org.slf4j.helpers;version=${version_cleanup;${slf4j.api.version}},\
org.slf4j.spi;version=${version_cleanup;${slf4j.api.version}}

-runproperties.this: \
org.jboss.logging.provider=slf4j

-runbundles: \
org.apache.felix.log.extension;version='[1.0.0,1.0.1)',\
org.apache.felix.logback.itests.immediate.jbl;version='[2.0.0,2.0.1)',\
org.apache.servicemix.bundles.junit;version='[4.13.2,4.13.3)',\
org.jboss.logging.jboss-logging;version='[3.4.2,3.4.3)'
39 changes: 39 additions & 0 deletions logback/itests/immediate-jbl/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.logback.itests.parent</artifactId>
<version>2.0.0-SNAPSHOT</version>
<relativePath>../itest-parent/pom.xml</relativePath>
</parent>

<artifactId>org.apache.felix.logback.itests.immediate.jbl</artifactId>

<dependencies>
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.logback.itests.helper</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>
Loading