Search in sources :

Example 81 with Logger

use of org.slf4j.Logger in project sling by apache.

the class InjectorSpecificAnnotationTest method testOSGiServiceField.

@Test
public void testOSGiServiceField() throws InvalidSyntaxException {
    ServiceReference ref = mock(ServiceReference.class);
    Logger log = mock(Logger.class);
    when(bundleContext.getServiceReferences(Logger.class.getName(), null)).thenReturn(new ServiceReference[] { ref });
    when(bundleContext.getService(ref)).thenReturn(log);
    InjectorSpecificAnnotationModel model = factory.getAdapter(request, InjectorSpecificAnnotationModel.class);
    assertNotNull("Could not instanciate model", model);
    assertEquals(log, model.getService());
}
Also used : InjectorSpecificAnnotationModel(org.apache.sling.models.testmodels.classes.InjectorSpecificAnnotationModel) Logger(org.slf4j.Logger) ServiceReference(org.osgi.framework.ServiceReference) Test(org.junit.Test)

Example 82 with Logger

use of org.slf4j.Logger in project sling by apache.

the class InjectorSpecificAnnotationTest method testOrderForValueAnnotationField.

@Test
public void testOrderForValueAnnotationField() {
    // make sure that that the correct injection is used
    // make sure that log is adapted from value map
    // and not coming from request attribute
    Logger logFromValueMap = LoggerFactory.getLogger(this.getClass());
    Map<String, Object> map = new HashMap<String, Object>();
    map.put("first", "first-value");
    map.put("log", logFromValueMap);
    ValueMap vm = new ValueMapDecorator(map);
    Resource res = mock(Resource.class);
    when(res.adaptTo(ValueMap.class)).thenReturn(vm);
    when(request.getResource()).thenReturn(res);
    InjectorSpecificAnnotationModel model = factory.getAdapter(request, InjectorSpecificAnnotationModel.class);
    assertNotNull("Could not instanciate model", model);
    assertEquals("first-value", model.getFirst());
    assertEquals(logFromValueMap, model.getLog());
}
Also used : InjectorSpecificAnnotationModel(org.apache.sling.models.testmodels.classes.InjectorSpecificAnnotationModel) HashMap(java.util.HashMap) ValueMap(org.apache.sling.api.resource.ValueMap) ValueMapDecorator(org.apache.sling.api.wrappers.ValueMapDecorator) Resource(org.apache.sling.api.resource.Resource) Logger(org.slf4j.Logger) Test(org.junit.Test)

Example 83 with Logger

use of org.slf4j.Logger in project sling by apache.

the class Activator method initializeLogbackManager.

private void initializeLogbackManager(boolean immediateInit) throws InvalidSyntaxException {
    logManager = new LogbackManager(context);
    final Logger log = LoggerFactory.getLogger(getClass());
    if (immediateInit) {
        log.info("LogbackManager initialized at bundle startup");
    } else {
        log.info("LogbackManager initialized after waiting for Slf4j, {} msec after startup", System.currentTimeMillis() - startTime);
    }
}
Also used : Logger(org.slf4j.Logger)

Example 84 with Logger

use of org.slf4j.Logger in project spring-boot by spring-projects.

the class LoggingApplicationListenerIntegrationTests method loggingPerformedDuringChildApplicationStartIsNotLost.

@Test
public void loggingPerformedDuringChildApplicationStartIsNotLost() {
    new SpringApplicationBuilder(Config.class).web(WebApplicationType.NONE).child(Config.class).web(WebApplicationType.NONE).listeners(new ApplicationListener<ApplicationStartingEvent>() {

        private final Logger logger = LoggerFactory.getLogger(getClass());

        @Override
        public void onApplicationEvent(ApplicationStartingEvent event) {
            this.logger.info("Child application starting");
        }
    }).run();
    assertThat(this.outputCapture.toString()).contains("Child application starting");
}
Also used : SpringApplicationBuilder(org.springframework.boot.builder.SpringApplicationBuilder) ApplicationListener(org.springframework.context.ApplicationListener) ApplicationStartingEvent(org.springframework.boot.context.event.ApplicationStartingEvent) Logger(org.slf4j.Logger) Test(org.junit.Test)

Example 85 with Logger

use of org.slf4j.Logger in project openhab1-addons by openhab.

the class MBrickletSegmentDisplay4x7Impl method setLogger.

/**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * 
     * @generated
     */
@Override
public void setLogger(Logger newLogger) {
    Logger oldLogger = logger;
    logger = newLogger;
    if (eNotificationRequired())
        eNotify(new ENotificationImpl(this, Notification.SET, ModelPackage.MBRICKLET_SEGMENT_DISPLAY4X7__LOGGER, oldLogger, logger));
}
Also used : ENotificationImpl(org.eclipse.emf.ecore.impl.ENotificationImpl) Logger(org.slf4j.Logger)

Aggregations

Logger (org.slf4j.Logger)1088 Test (org.junit.Test)249 IOException (java.io.IOException)127 ENotificationImpl (org.eclipse.emf.ecore.impl.ENotificationImpl)110 ArrayList (java.util.ArrayList)71 InputStream (java.io.InputStream)64 List (java.util.List)59 File (java.io.File)56 Map (java.util.Map)51 LoggerFactory (org.slf4j.LoggerFactory)46 Test (org.testng.annotations.Test)43 HashMap (java.util.HashMap)39 Properties (java.util.Properties)35 HashSet (java.util.HashSet)31 FileInputStream (java.io.FileInputStream)29 Transfer (org.commonjava.maven.galley.model.Transfer)29 Set (java.util.Set)28 StoreKey (org.commonjava.indy.model.core.StoreKey)28 ArtifactStore (org.commonjava.indy.model.core.ArtifactStore)27 Date (java.util.Date)26