// Path: com.swookiee.runtime.core/src/main/java/com/swookiee/runtime/core/internal/logging/FullJsonLayout.java
// public class FullJsonLayout extends JsonLayout {
// 
//     private static final ISO8601DateFormat ISO_FORMATTER = new ISO8601DateFormat();
// 
//     @Override
//     protected Map<String, Object> toJsonMap(final ILoggingEvent event) {
//         @SuppressWarnings("unchecked")
//         Map<String, Object> jsonMap = super.toJsonMap(event);
//         jsonMap.put("ts", ISO_FORMATTER.format(new Date()));
// 
//         if (isMeantToBeLoggedAsFullJson(event)) {
//             jsonMap.put("message", event.getArgumentArray()[0]);
//         }
// 
//         return jsonMap;
//     }
// 
//     private boolean isMeantToBeLoggedAsFullJson(final ILoggingEvent event) {
//         Object[] args = event.getArgumentArray();
//         return event.getMessage().equals("{}") && args.length == 1 && args[0] instanceof Map;
//     }
// }


import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.HashMap;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import org.slf4j.LoggerFactory;
import ch.qos.logback.classic.Level;
import ch.qos.logback.classic.Logger;
import ch.qos.logback.classic.LoggerContext;
import ch.qos.logback.classic.spi.ILoggingEvent;
import ch.qos.logback.contrib.jackson.JacksonJsonFormatter;
import ch.qos.logback.core.OutputStreamAppender;
import ch.qos.logback.core.encoder.LayoutWrappingEncoder;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.swookiee.runtime.core.internal.logging.FullJsonLayout;
/*******************************************************************************
 * Copyright (c) 2014 Thorsten Krüger and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *    Thorsten Krüger - initial API and implementation, ongoing development and documentation
 *******************************************************************************/

package com.swookiee.core.internal.logging;






public class FullJsonLayoutTest {

    private ByteArrayOutputStream outputStream;
    private Logger logger;
    private ObjectMapper mapper = new ObjectMapper();

    @Before
    public void prepareLogger() {
        LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();

        final LayoutWrappingEncoder<ILoggingEvent> wrappingEncoder = new LayoutWrappingEncoder<>();
// Path: com.swookiee.runtime.core/src/main/java/com/swookiee/runtime/core/internal/logging/FullJsonLayout.java
// public class FullJsonLayout extends JsonLayout {
// 
//     private static final ISO8601DateFormat ISO_FORMATTER = new ISO8601DateFormat();
// 
//     @Override
//     protected Map<String, Object> toJsonMap(final ILoggingEvent event) {
//         @SuppressWarnings("unchecked")
//         Map<String, Object> jsonMap = super.toJsonMap(event);
//         jsonMap.put("ts", ISO_FORMATTER.format(new Date()));
// 
//         if (isMeantToBeLoggedAsFullJson(event)) {
//             jsonMap.put("message", event.getArgumentArray()[0]);
//         }
// 
//         return jsonMap;
//     }
// 
//     private boolean isMeantToBeLoggedAsFullJson(final ILoggingEvent event) {
//         Object[] args = event.getArgumentArray();
//         return event.getMessage().equals("{}") && args.length == 1 && args[0] instanceof Map;
//     }
// }


// Path: com.swookiee.runtime.core.test/src/main/groovy/com/swookiee/core/internal/logging/FullJsonLayoutTest.java
import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.HashMap;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import org.slf4j.LoggerFactory;
import ch.qos.logback.classic.Level;
import ch.qos.logback.classic.Logger;
import ch.qos.logback.classic.LoggerContext;
import ch.qos.logback.classic.spi.ILoggingEvent;
import ch.qos.logback.contrib.jackson.JacksonJsonFormatter;
import ch.qos.logback.core.OutputStreamAppender;
import ch.qos.logback.core.encoder.LayoutWrappingEncoder;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.swookiee.runtime.core.internal.logging.FullJsonLayout;

/*******************************************************************************
 * Copyright (c) 2014 Thorsten Krüger and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *    Thorsten Krüger - initial API and implementation, ongoing development and documentation
 *******************************************************************************/

package com.swookiee.core.internal.logging;






public class FullJsonLayoutTest {

    private ByteArrayOutputStream outputStream;
    private Logger logger;
    private ObjectMapper mapper = new ObjectMapper();

    @Before
    public void prepareLogger() {
        LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();

        final LayoutWrappingEncoder<ILoggingEvent> wrappingEncoder = new LayoutWrappingEncoder<>();
        FullJsonLayout jsonLayout = new FullJsonLayout();