Migrated logging to SLF4J

This commit is contained in:
Patrick Gotthard 2014-04-14 19:21:54 +02:00
parent 5926dd2bd2
commit 1072990373
15 changed files with 151 additions and 136 deletions

View file

@ -89,6 +89,11 @@
<artifactId>servlet-api</artifactId> <artifactId>servlet-api</artifactId>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<scope>test</scope>
</dependency>
<dependency> <dependency>
<groupId>junit</groupId> <groupId>junit</groupId>
<artifactId>junit</artifactId> <artifactId>junit</artifactId>

View file

@ -23,13 +23,13 @@ import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.HttpMethodBase; import org.apache.commons.httpclient.HttpMethodBase;
import org.apache.commons.httpclient.MultiThreadedHttpConnectionManager; import org.apache.commons.httpclient.MultiThreadedHttpConnectionManager;
import org.apache.commons.httpclient.methods.GetMethod; import org.apache.commons.httpclient.methods.GetMethod;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jdom2.Document; import org.jdom2.Document;
import org.jdom2.Element; import org.jdom2.Element;
import org.jdom2.input.SAXBuilder; import org.jdom2.input.SAXBuilder;
import org.rometools.propono.atom.common.AtomService; import org.rometools.propono.atom.common.AtomService;
import org.rometools.propono.utils.ProponoException; import org.rometools.propono.utils.ProponoException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.sun.syndication.feed.atom.Entry; import com.sun.syndication.feed.atom.Entry;
import com.sun.syndication.io.impl.Atom10Parser; import com.sun.syndication.io.impl.Atom10Parser;
@ -42,7 +42,7 @@ import com.sun.syndication.io.impl.Atom10Parser;
*/ */
public class ClientAtomService extends AtomService { public class ClientAtomService extends AtomService {
private static final Log LOGGER = LogFactory.getLog(ClientAtomService.class); private static final Logger LOG = LoggerFactory.getLogger(ClientAtomService.class);
private String uri = null; private String uri = null;
private HttpClient httpClient = null; private HttpClient httpClient = null;
@ -106,12 +106,12 @@ public class ClientAtomService extends AtomService {
final SAXBuilder builder = new SAXBuilder(); final SAXBuilder builder = new SAXBuilder();
final String doc = method.getResponseBodyAsString(); final String doc = method.getResponseBodyAsString();
LOGGER.debug(doc); LOG.debug(doc);
return builder.build(method.getResponseBodyAsStream()); return builder.build(method.getResponseBodyAsStream());
} catch (final Throwable t) { } catch (final Throwable t) {
final String msg = "ERROR retrieving Atom Service Document, code: " + code; final String msg = "ERROR retrieving Atom Service Document, code: " + code;
LOGGER.debug(msg, t); LOG.debug(msg, t);
throw new ProponoException(msg, t); throw new ProponoException(msg, t);
} finally { } finally {
if (method != null) { if (method != null) {

View file

@ -33,10 +33,10 @@ import org.apache.commons.httpclient.methods.EntityEnclosingMethod;
import org.apache.commons.httpclient.methods.PostMethod; import org.apache.commons.httpclient.methods.PostMethod;
import org.apache.commons.httpclient.methods.PutMethod; import org.apache.commons.httpclient.methods.PutMethod;
import org.apache.commons.httpclient.methods.StringRequestEntity; import org.apache.commons.httpclient.methods.StringRequestEntity;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.rometools.propono.utils.ProponoException; import org.rometools.propono.utils.ProponoException;
import org.rometools.propono.utils.Utilities; import org.rometools.propono.utils.Utilities;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.sun.syndication.feed.atom.Content; import com.sun.syndication.feed.atom.Content;
import com.sun.syndication.feed.atom.Entry; import com.sun.syndication.feed.atom.Entry;
@ -51,7 +51,8 @@ import com.sun.syndication.io.impl.Atom10Parser;
public class ClientEntry extends Entry { public class ClientEntry extends Entry {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private static final Log LOGGER = LogFactory.getLog(ClientEntry.class);
private static final Logger LOG = LoggerFactory.getLogger(ClientEntry.class);
private ClientAtomService service = null; private ClientAtomService service = null;
private ClientCollection collection = null; private ClientCollection collection = null;
@ -154,7 +155,7 @@ public class ClientEntry extends Entry {
} catch (final Exception e) { } catch (final Exception e) {
final String msg = "ERROR: updating entry, HTTP code: " + code; final String msg = "ERROR: updating entry, HTTP code: " + code;
LOGGER.debug(msg, e); LOG.debug(msg, e);
throw new ProponoException(msg, e); throw new ProponoException(msg, e);
} finally { } finally {
method.releaseConnection(); method.releaseConnection();
@ -221,14 +222,14 @@ public class ClientEntry extends Entry {
} catch (final Exception e) { } catch (final Exception e) {
final String msg = "ERROR: saving entry, HTTP code: " + code; final String msg = "ERROR: saving entry, HTTP code: " + code;
LOGGER.debug(msg, e); LOG.debug(msg, e);
throw new ProponoException(msg, e); throw new ProponoException(msg, e);
} finally { } finally {
method.releaseConnection(); method.releaseConnection();
} }
final Header locationHeader = method.getResponseHeader("Location"); final Header locationHeader = method.getResponseHeader("Location");
if (locationHeader == null) { if (locationHeader == null) {
LOGGER.warn("WARNING added entry, but no location header returned"); LOG.warn("WARNING added entry, but no location header returned");
} else if (getEditURI() == null) { } else if (getEditURI() == null) {
final List<Link> links = getOtherLinks(); final List<Link> links = getOtherLinks();
final Link link = new Link(); final Link link = new Link();

View file

@ -33,11 +33,11 @@ import org.apache.commons.httpclient.methods.InputStreamRequestEntity;
import org.apache.commons.httpclient.methods.PostMethod; import org.apache.commons.httpclient.methods.PostMethod;
import org.apache.commons.httpclient.methods.PutMethod; import org.apache.commons.httpclient.methods.PutMethod;
import org.apache.commons.httpclient.methods.StringRequestEntity; import org.apache.commons.httpclient.methods.StringRequestEntity;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jdom2.JDOMException; import org.jdom2.JDOMException;
import org.rometools.propono.utils.ProponoException; import org.rometools.propono.utils.ProponoException;
import org.rometools.propono.utils.Utilities; import org.rometools.propono.utils.Utilities;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.sun.syndication.feed.atom.Content; import com.sun.syndication.feed.atom.Content;
import com.sun.syndication.feed.atom.Entry; import com.sun.syndication.feed.atom.Entry;
@ -53,7 +53,8 @@ import com.sun.syndication.io.impl.Atom10Parser;
public class ClientMediaEntry extends ClientEntry { public class ClientMediaEntry extends ClientEntry {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private static final Log LOGGER = LogFactory.getLog(ClientMediaEntry.class);
private static final Logger LOG = LoggerFactory.getLogger(ClientMediaEntry.class);
private String slug = null; private String slug = null;
private byte[] bytes; private byte[] bytes;
@ -279,7 +280,7 @@ public class ClientMediaEntry extends ClientEntry {
} }
final Header locationHeader = method.getResponseHeader("Location"); final Header locationHeader = method.getResponseHeader("Location");
if (locationHeader == null) { if (locationHeader == null) {
LOGGER.warn("WARNING added entry, but no location header returned"); LOG.warn("WARNING added entry, but no location header returned");
} else if (getEditURI() == null) { } else if (getEditURI() == null) {
final List<Link> links = getOtherLinks(); final List<Link> links = getOtherLinks();
final Link link = new Link(); final Link link = new Link();

View file

@ -20,11 +20,11 @@ import java.util.List;
import java.util.NoSuchElementException; import java.util.NoSuchElementException;
import org.apache.commons.httpclient.methods.GetMethod; import org.apache.commons.httpclient.methods.GetMethod;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jdom2.Document; import org.jdom2.Document;
import org.jdom2.input.SAXBuilder; import org.jdom2.input.SAXBuilder;
import org.rometools.propono.utils.ProponoException; import org.rometools.propono.utils.ProponoException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.sun.syndication.feed.atom.Entry; import com.sun.syndication.feed.atom.Entry;
import com.sun.syndication.feed.atom.Feed; import com.sun.syndication.feed.atom.Feed;
@ -36,7 +36,8 @@ import com.sun.syndication.io.WireFeedInput;
*/ */
public class EntryIterator implements Iterator<ClientEntry> { public class EntryIterator implements Iterator<ClientEntry> {
private static final Log LOGGER = LogFactory.getLog(EntryIterator.class); private static final Logger LOG = LoggerFactory.getLogger(EntryIterator.class);
private final ClientCollection collection; private final ClientCollection collection;
private Iterator<Entry> members = null; private Iterator<Entry> members = null;
@ -60,7 +61,7 @@ public class EntryIterator implements Iterator<ClientEntry> {
try { try {
getNextEntries(); getNextEntries();
} catch (final Exception ignored) { } catch (final Exception ignored) {
LOGGER.error("ERROR getting next entries", ignored); LOG.error("An error occured while getting next entries", ignored);
} }
} }
return members.hasNext(); return members.hasNext();

View file

@ -18,24 +18,25 @@ package org.rometools.propono.atom.server;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import org.apache.commons.logging.Log; import org.slf4j.Logger;
import org.apache.commons.logging.LogFactory; import org.slf4j.LoggerFactory;
/** /**
* Defines a factory that enables the {@link com.sun.syndication.propono.atom.server.AtomServlet} to obtain an * Defines a factory that enables the {@link com.sun.syndication.propono.atom.server.AtomServlet} to
* {@link com.sun.syndication.propono.atom.server.AtomHandler} that handles an Atom request. * obtain an {@link com.sun.syndication.propono.atom.server.AtomHandler} that handles an Atom
* request.
* *
* <p> * <p>
* To create your own Atom protocol implementation you must sub-class this class with your own factory that is capable of creating instances of your * To create your own Atom protocol implementation you must sub-class this class with your own
* factory that is capable of creating instances of your
* {@link com.sun.syndication.propono.atom.server.AtomHandler} impementation. * {@link com.sun.syndication.propono.atom.server.AtomHandler} impementation.
* </p> * </p>
*/ */
public abstract class AtomHandlerFactory { public abstract class AtomHandlerFactory {
private static Log log = LogFactory.getFactory().getInstance(AtomHandlerFactory.class); private static final Logger LOG = LoggerFactory.getLogger(AtomHandlerFactory.class);
private static final String DEFAULT_PROPERTY_NAME = "org.rometools.propono.atom.server.AtomHandlerFactory"; private static final String DEFAULT_PROPERTY_NAME = "org.rometools.propono.atom.server.AtomHandlerFactory";
private static final String FALLBACK_IMPL_NAME = "org.rometools.propono.atom.server.impl.FileBasedAtomHandlerFactory"; private static final String FALLBACK_IMPL_NAME = "org.rometools.propono.atom.server.impl.FileBasedAtomHandlerFactory";
/* /*
@ -45,46 +46,55 @@ public abstract class AtomHandlerFactory {
} }
/** /**
* Obtain a new instance of a <code>AtomHandlerFactory</code>. This static method creates a new factory instance. This method uses the following ordered * Obtain a new instance of a <code>AtomHandlerFactory</code>. This static method creates a new
* lookup procedure to determine the <code>AtomHandlerFactory</code> implementation class to load: * factory instance. This method uses the following ordered lookup procedure to determine the
* <code>AtomHandlerFactory</code> implementation class to load:
* <ul> * <ul>
* <li> * <li>
* Use the <code>com.sun.syndication.propono.atom.server.AtomHandlerFactory</code> system property.</li> * Use the <code>com.sun.syndication.propono.atom.server.AtomHandlerFactory</code> system
* property.</li>
* <li> * <li>
* Use the properties file "/propono.properties" in the classpath. This configuration file is in standard <code>java.util.Properties</code> format and * Use the properties file "/propono.properties" in the classpath. This configuration file is in
* contains the fully qualified name of the implementation class with the key being the system property defined above. * standard <code>java.util.Properties</code> format and contains the fully qualified name of
* the implementation class with the key being the system property defined above.
* *
* The propono.properties file is read only once by Propono and it's values are then cached for future use. If the file does not exist when the first * The propono.properties file is read only once by Propono and it's values are then cached for
* attempt is made to read from it, no further attempts are made to check for its existence. It is not possible to change the value of any property in * future use. If the file does not exist when the first attempt is made to read from it, no
* propono.properties after it has been read for the first time.</li> * further attempts are made to check for its existence. It is not possible to change the value
* of any property in propono.properties after it has been read for the first time.</li>
* <li> * <li>
* If not available, to determine the classname. The Services API will look for a classname in the file: * If not available, to determine the classname. The Services API will look for a classname in
* <code>META-INF/services/com.sun.syndication.AtomHandlerFactory</code> in jars available to the runtime.</li> * the file: <code>META-INF/services/com.sun.syndication.AtomHandlerFactory</code> in jars
* available to the runtime.</li>
* <li> * <li>
* Platform default <code>AtomHandlerFactory</code> instance.</li> * Platform default <code>AtomHandlerFactory</code> instance.</li>
* </ul> * </ul>
* *
* Once an application has obtained a reference to a <code>AtomHandlerFactory</code> it can use the factory to configure and obtain parser instances. * Once an application has obtained a reference to a <code>AtomHandlerFactory</code> it can use
* the factory to configure and obtain parser instances.
* *
* @return New instance of a <code>AtomHandlerFactory</code> * @return New instance of a <code>AtomHandlerFactory</code>
* *
* @throws FactoryConfigurationError if the implementation is not available or cannot be instantiated. * @throws FactoryConfigurationError if the implementation is not available or cannot be
* instantiated.
*/ */
public static AtomHandlerFactory newInstance() { public static AtomHandlerFactory newInstance() {
try { try {
return (AtomHandlerFactory) FactoryFinder.find(DEFAULT_PROPERTY_NAME, FALLBACK_IMPL_NAME); return (AtomHandlerFactory) FactoryFinder.find(DEFAULT_PROPERTY_NAME, FALLBACK_IMPL_NAME);
} catch (final ConfigurationError e) { } catch (final ConfigurationError e) {
log.error("ERROR: finding factory", e); LOG.error("An error occured while finding factory", e);
throw new FactoryConfigurationError(e.getException(), e.getMessage()); throw new FactoryConfigurationError(e.getException(), e.getMessage());
} }
} }
/** /**
* Creates a new instance of a {@link com.sun.syndication.propono.atom.server.AtomHandler} using the currently configured parameters. * Creates a new instance of a {@link com.sun.syndication.propono.atom.server.AtomHandler} using
* the currently configured parameters.
* *
* @return A new instance of a AtomHandler. * @return A new instance of a AtomHandler.
* *
* @throws AtomConfigurationException if a AtomHandler cannot be created which satisfies the configuration requested. * @throws AtomConfigurationException if a AtomHandler cannot be created which satisfies the
* configuration requested.
*/ */
public abstract AtomHandler newAtomHandler(HttpServletRequest req, HttpServletResponse res); public abstract AtomHandler newAtomHandler(HttpServletRequest req, HttpServletResponse res);
} }

View file

@ -32,14 +32,14 @@ import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jdom2.Document; import org.jdom2.Document;
import org.jdom2.output.Format; import org.jdom2.output.Format;
import org.jdom2.output.XMLOutputter; import org.jdom2.output.XMLOutputter;
import org.rometools.propono.atom.common.AtomService; import org.rometools.propono.atom.common.AtomService;
import org.rometools.propono.atom.common.Categories; import org.rometools.propono.atom.common.Categories;
import org.rometools.propono.utils.Utilities; import org.rometools.propono.utils.Utilities;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.sun.syndication.feed.atom.Content; import com.sun.syndication.feed.atom.Content;
import com.sun.syndication.feed.atom.Entry; import com.sun.syndication.feed.atom.Entry;
@ -66,7 +66,7 @@ public class AtomServlet extends HttpServlet {
public static final String FEED_TYPE = "atom_1.0"; public static final String FEED_TYPE = "atom_1.0";
private static String contextDirPath = null; private static String contextDirPath = null;
private static Log log = LogFactory.getFactory().getInstance(AtomServlet.class); private static final Logger LOG = LoggerFactory.getLogger(AtomServlet.class);
static { static {
Atom10Parser.setResolveURIs(true); Atom10Parser.setResolveURIs(true);
@ -87,7 +87,7 @@ public class AtomServlet extends HttpServlet {
*/ */
@Override @Override
protected void doGet(final HttpServletRequest req, final HttpServletResponse res) throws ServletException, IOException { protected void doGet(final HttpServletRequest req, final HttpServletResponse res) throws ServletException, IOException {
log.debug("Entering"); LOG.debug("Entering");
final AtomHandler handler = createAtomRequestHandler(req, res); final AtomHandler handler = createAtomRequestHandler(req, res);
final String userName = handler.getAuthenticatedUsername(); final String userName = handler.getAuthenticatedUsername();
if (userName != null) { if (userName != null) {
@ -150,16 +150,16 @@ public class AtomServlet extends HttpServlet {
} }
} catch (final AtomException ae) { } catch (final AtomException ae) {
res.sendError(ae.getStatus(), ae.getMessage()); res.sendError(ae.getStatus(), ae.getMessage());
log.debug("ERROR processing GET", ae); LOG.debug("An error occured while processing GET", ae);
} catch (final Exception e) { } catch (final Exception e) {
res.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e.getMessage()); res.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e.getMessage());
log.debug("ERROR processing GET", e); LOG.debug("An error occured while processing GET", e);
} }
} else { } else {
res.setHeader("WWW-Authenticate", "BASIC realm=\"AtomPub\""); res.setHeader("WWW-Authenticate", "BASIC realm=\"AtomPub\"");
res.sendError(HttpServletResponse.SC_UNAUTHORIZED); res.sendError(HttpServletResponse.SC_UNAUTHORIZED);
} }
log.debug("Exiting"); LOG.debug("Exiting");
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
@ -169,7 +169,7 @@ public class AtomServlet extends HttpServlet {
*/ */
@Override @Override
protected void doPost(final HttpServletRequest req, final HttpServletResponse res) throws ServletException, IOException { protected void doPost(final HttpServletRequest req, final HttpServletResponse res) throws ServletException, IOException {
log.debug("Entering"); LOG.debug("Entering");
final AtomHandler handler = createAtomRequestHandler(req, res); final AtomHandler handler = createAtomRequestHandler(req, res);
final String userName = handler.getAuthenticatedUsername(); final String userName = handler.getAuthenticatedUsername();
if (userName != null) { if (userName != null) {
@ -256,16 +256,16 @@ public class AtomServlet extends HttpServlet {
} }
} catch (final AtomException ae) { } catch (final AtomException ae) {
res.sendError(ae.getStatus(), ae.getMessage()); res.sendError(ae.getStatus(), ae.getMessage());
log.debug("ERROR processing POST", ae); LOG.debug("An error occured while processing POST", ae);
} catch (final Exception e) { } catch (final Exception e) {
res.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e.getMessage()); res.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e.getMessage());
log.debug("ERROR processing POST", e); LOG.debug("An error occured while processing POST", e);
} }
} else { } else {
res.setHeader("WWW-Authenticate", "BASIC realm=\"AtomPub\""); res.setHeader("WWW-Authenticate", "BASIC realm=\"AtomPub\"");
res.sendError(HttpServletResponse.SC_UNAUTHORIZED); res.sendError(HttpServletResponse.SC_UNAUTHORIZED);
} }
log.debug("Exiting"); LOG.debug("Exiting");
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
@ -275,7 +275,7 @@ public class AtomServlet extends HttpServlet {
*/ */
@Override @Override
protected void doPut(final HttpServletRequest req, final HttpServletResponse res) throws ServletException, IOException { protected void doPut(final HttpServletRequest req, final HttpServletResponse res) throws ServletException, IOException {
log.debug("Entering"); LOG.debug("Entering");
final AtomHandler handler = createAtomRequestHandler(req, res); final AtomHandler handler = createAtomRequestHandler(req, res);
final String userName = handler.getAuthenticatedUsername(); final String userName = handler.getAuthenticatedUsername();
if (userName != null) { if (userName != null) {
@ -304,10 +304,10 @@ public class AtomServlet extends HttpServlet {
} }
} catch (final AtomException ae) { } catch (final AtomException ae) {
res.sendError(ae.getStatus(), ae.getMessage()); res.sendError(ae.getStatus(), ae.getMessage());
log.debug("ERROR processing PUT", ae); LOG.debug("An error occured while processing PUT", ae);
} catch (final Exception e) { } catch (final Exception e) {
res.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e.getMessage()); res.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e.getMessage());
log.debug("ERROR processing PUT", e); LOG.debug("An error occured while processing PUT", e);
} }
} else { } else {
res.setHeader("WWW-Authenticate", "BASIC realm=\"AtomPub\""); res.setHeader("WWW-Authenticate", "BASIC realm=\"AtomPub\"");
@ -315,7 +315,7 @@ public class AtomServlet extends HttpServlet {
// when I do that, so sticking with setStatus() for time being. // when I do that, so sticking with setStatus() for time being.
res.setStatus(HttpServletResponse.SC_UNAUTHORIZED); res.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
} }
log.debug("Exiting"); LOG.debug("Exiting");
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
@ -324,7 +324,7 @@ public class AtomServlet extends HttpServlet {
*/ */
@Override @Override
protected void doDelete(final HttpServletRequest req, final HttpServletResponse res) throws ServletException, IOException { protected void doDelete(final HttpServletRequest req, final HttpServletResponse res) throws ServletException, IOException {
log.debug("Entering"); LOG.debug("Entering");
final AtomHandler handler = createAtomRequestHandler(req, res); final AtomHandler handler = createAtomRequestHandler(req, res);
final String userName = handler.getAuthenticatedUsername(); final String userName = handler.getAuthenticatedUsername();
if (userName != null) { if (userName != null) {
@ -338,10 +338,10 @@ public class AtomServlet extends HttpServlet {
} }
} catch (final AtomException ae) { } catch (final AtomException ae) {
res.sendError(ae.getStatus(), ae.getMessage()); res.sendError(ae.getStatus(), ae.getMessage());
log.debug("ERROR processing DELETE", ae); LOG.debug("An error occured while processing DELETE", ae);
} catch (final Exception e) { } catch (final Exception e) {
res.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e.getMessage()); res.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e.getMessage());
log.debug("ERROR processing DELETE", e); LOG.debug("An error occured while processing DELETE", e);
} }
} else { } else {
res.setHeader("WWW-Authenticate", "BASIC realm=\"AtomPub\""); res.setHeader("WWW-Authenticate", "BASIC realm=\"AtomPub\"");
@ -349,7 +349,7 @@ public class AtomServlet extends HttpServlet {
// when I do that, so sticking with setStatus() for time being. // when I do that, so sticking with setStatus() for time being.
res.setStatus(HttpServletResponse.SC_UNAUTHORIZED); res.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
} }
log.debug("Exiting"); LOG.debug("Exiting");
} }
/** /**

View file

@ -22,8 +22,6 @@ import javax.servlet.http.HttpServletRequest;
import org.apache.commons.codec.binary.Base64; import org.apache.commons.codec.binary.Base64;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.rometools.propono.atom.common.AtomService; import org.rometools.propono.atom.common.AtomService;
import org.rometools.propono.atom.common.Categories; import org.rometools.propono.atom.common.Categories;
import org.rometools.propono.atom.server.AtomException; import org.rometools.propono.atom.server.AtomException;
@ -31,6 +29,8 @@ import org.rometools.propono.atom.server.AtomHandler;
import org.rometools.propono.atom.server.AtomMediaResource; import org.rometools.propono.atom.server.AtomMediaResource;
import org.rometools.propono.atom.server.AtomRequest; import org.rometools.propono.atom.server.AtomRequest;
import org.rometools.propono.atom.server.AtomServlet; import org.rometools.propono.atom.server.AtomServlet;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.sun.syndication.feed.atom.Entry; import com.sun.syndication.feed.atom.Entry;
import com.sun.syndication.feed.atom.Feed; import com.sun.syndication.feed.atom.Feed;
@ -42,7 +42,7 @@ import com.sun.syndication.feed.atom.Feed;
*/ */
public class FileBasedAtomHandler implements AtomHandler { public class FileBasedAtomHandler implements AtomHandler {
private static final Log LOGGER = LogFactory.getFactory().getInstance(FileBasedAtomHandler.class); private static final Logger LOG = LoggerFactory.getLogger(FileBasedAtomHandler.class);
private String userName = null; private String userName = null;
private String atomProtocolURL = null; private String atomProtocolURL = null;
@ -65,7 +65,7 @@ public class FileBasedAtomHandler implements AtomHandler {
* @param uploaddir File storage upload dir. * @param uploaddir File storage upload dir.
*/ */
public FileBasedAtomHandler(final HttpServletRequest req, final String uploaddir) { public FileBasedAtomHandler(final HttpServletRequest req, final String uploaddir) {
LOGGER.debug("ctor"); LOG.debug("ctor");
userName = authenticateBASIC(req); userName = authenticateBASIC(req);
@ -134,12 +134,12 @@ public class FileBasedAtomHandler implements AtomHandler {
*/ */
@Override @Override
public Categories getCategories(final AtomRequest areq) throws AtomException { public Categories getCategories(final AtomRequest areq) throws AtomException {
LOGGER.debug("getCollection"); LOG.debug("getCollection");
final String[] pathInfo = StringUtils.split(areq.getPathInfo(), "/"); final String[] pathInfo = StringUtils.split(areq.getPathInfo(), "/");
final String handle = pathInfo[0]; final String handle = pathInfo[0];
final String collection = pathInfo[1]; final String collection = pathInfo[1];
final FileBasedCollection col = service.findCollectionByHandle(handle, collection); final FileBasedCollection col = service.findCollectionByHandle(handle, collection);
return (Categories) col.getCategories(true).get(0); return col.getCategories(true).get(0);
} }
/** /**
@ -152,7 +152,7 @@ public class FileBasedAtomHandler implements AtomHandler {
*/ */
@Override @Override
public Feed getCollection(final AtomRequest areq) throws AtomException { public Feed getCollection(final AtomRequest areq) throws AtomException {
LOGGER.debug("getCollection"); LOG.debug("getCollection");
final String[] pathInfo = StringUtils.split(areq.getPathInfo(), "/"); final String[] pathInfo = StringUtils.split(areq.getPathInfo(), "/");
final String handle = pathInfo[0]; final String handle = pathInfo[0];
final String collection = pathInfo[1]; final String collection = pathInfo[1];
@ -172,7 +172,7 @@ public class FileBasedAtomHandler implements AtomHandler {
*/ */
@Override @Override
public Entry postEntry(final AtomRequest areq, final Entry entry) throws AtomException { public Entry postEntry(final AtomRequest areq, final Entry entry) throws AtomException {
LOGGER.debug("postEntry"); LOG.debug("postEntry");
final String[] pathInfo = StringUtils.split(areq.getPathInfo(), "/"); final String[] pathInfo = StringUtils.split(areq.getPathInfo(), "/");
final String handle = pathInfo[0]; final String handle = pathInfo[0];
@ -197,7 +197,7 @@ public class FileBasedAtomHandler implements AtomHandler {
*/ */
@Override @Override
public Entry getEntry(final AtomRequest areq) throws AtomException { public Entry getEntry(final AtomRequest areq) throws AtomException {
LOGGER.debug("getEntry"); LOG.debug("getEntry");
final String[] pathInfo = StringUtils.split(areq.getPathInfo(), "/"); final String[] pathInfo = StringUtils.split(areq.getPathInfo(), "/");
final String handle = pathInfo[0]; final String handle = pathInfo[0];
final String collection = pathInfo[1]; final String collection = pathInfo[1];
@ -223,7 +223,7 @@ public class FileBasedAtomHandler implements AtomHandler {
*/ */
@Override @Override
public void putEntry(final AtomRequest areq, final Entry entry) throws AtomException { public void putEntry(final AtomRequest areq, final Entry entry) throws AtomException {
LOGGER.debug("putEntry"); LOG.debug("putEntry");
final String[] pathInfo = StringUtils.split(areq.getPathInfo(), "/"); final String[] pathInfo = StringUtils.split(areq.getPathInfo(), "/");
final String handle = pathInfo[0]; final String handle = pathInfo[0];
final String collection = pathInfo[1]; final String collection = pathInfo[1];
@ -244,7 +244,7 @@ public class FileBasedAtomHandler implements AtomHandler {
*/ */
@Override @Override
public void deleteEntry(final AtomRequest areq) throws AtomException { public void deleteEntry(final AtomRequest areq) throws AtomException {
LOGGER.debug("deleteEntry"); LOG.debug("deleteEntry");
final String[] pathInfo = StringUtils.split(areq.getPathInfo(), "/"); final String[] pathInfo = StringUtils.split(areq.getPathInfo(), "/");
final String handle = pathInfo[0]; final String handle = pathInfo[0];
final String collection = pathInfo[1]; final String collection = pathInfo[1];
@ -255,7 +255,7 @@ public class FileBasedAtomHandler implements AtomHandler {
} catch (final Exception e) { } catch (final Exception e) {
final String msg = "ERROR in atom.deleteResource"; final String msg = "ERROR in atom.deleteResource";
LOGGER.error(msg, e); LOG.error(msg, e);
throw new AtomException(msg); throw new AtomException(msg);
} }
} }
@ -274,8 +274,8 @@ public class FileBasedAtomHandler implements AtomHandler {
// get incoming slug from HTTP header // get incoming slug from HTTP header
final String slug = areq.getHeader("Slug"); final String slug = areq.getHeader("Slug");
if (LOGGER.isDebugEnabled()) { if (LOG.isDebugEnabled()) {
LOGGER.debug("postMedia - title: " + entry.getTitle() + " slug:" + slug); LOG.debug("postMedia - title: " + entry.getTitle() + " slug:" + slug);
} }
try { try {
@ -290,7 +290,7 @@ public class FileBasedAtomHandler implements AtomHandler {
} catch (final Exception e) { } catch (final Exception e) {
e.printStackTrace(); e.printStackTrace();
final String msg = "ERROR reading posted file"; final String msg = "ERROR reading posted file";
LOGGER.error(msg, e); LOG.error(msg, e);
throw new AtomException(msg, e); throw new AtomException(msg, e);
} finally { } finally {
if (tempFile != null) { if (tempFile != null) {
@ -312,7 +312,7 @@ public class FileBasedAtomHandler implements AtomHandler {
@Override @Override
public void putMedia(final AtomRequest areq) throws AtomException { public void putMedia(final AtomRequest areq) throws AtomException {
LOGGER.debug("putMedia"); LOG.debug("putMedia");
final String[] pathInfo = StringUtils.split(areq.getPathInfo(), "/"); final String[] pathInfo = StringUtils.split(areq.getPathInfo(), "/");
final String handle = pathInfo[0]; final String handle = pathInfo[0];
final String collection = pathInfo[1]; final String collection = pathInfo[1];
@ -328,7 +328,7 @@ public class FileBasedAtomHandler implements AtomHandler {
@Override @Override
public AtomMediaResource getMediaResource(final AtomRequest areq) throws AtomException { public AtomMediaResource getMediaResource(final AtomRequest areq) throws AtomException {
LOGGER.debug("putMedia"); LOG.debug("putMedia");
final String[] pathInfo = StringUtils.split(areq.getPathInfo(), "/"); final String[] pathInfo = StringUtils.split(areq.getPathInfo(), "/");
final String handle = pathInfo[0]; final String handle = pathInfo[0];
final String collection = pathInfo[1]; final String collection = pathInfo[1];
@ -359,7 +359,7 @@ public class FileBasedAtomHandler implements AtomHandler {
*/ */
@Override @Override
public boolean isCategoriesURI(final AtomRequest areq) { public boolean isCategoriesURI(final AtomRequest areq) {
LOGGER.debug("isCategoriesDocumentURI"); LOG.debug("isCategoriesDocumentURI");
final String[] pathInfo = StringUtils.split(areq.getPathInfo(), "/"); final String[] pathInfo = StringUtils.split(areq.getPathInfo(), "/");
if (pathInfo.length == 3 && "categories".equals(pathInfo[2])) { if (pathInfo.length == 3 && "categories".equals(pathInfo[2])) {
return true; return true;
@ -372,7 +372,7 @@ public class FileBasedAtomHandler implements AtomHandler {
*/ */
@Override @Override
public boolean isCollectionURI(final AtomRequest areq) { public boolean isCollectionURI(final AtomRequest areq) {
LOGGER.debug("isCollectionURI"); LOG.debug("isCollectionURI");
// workspace/collection-plural // workspace/collection-plural
// if length is 2 and points to a valid collection then YES // if length is 2 and points to a valid collection then YES
final String[] pathInfo = StringUtils.split(areq.getPathInfo(), "/"); final String[] pathInfo = StringUtils.split(areq.getPathInfo(), "/");
@ -392,7 +392,7 @@ public class FileBasedAtomHandler implements AtomHandler {
*/ */
@Override @Override
public boolean isEntryURI(final AtomRequest areq) { public boolean isEntryURI(final AtomRequest areq) {
LOGGER.debug("isEntryURI"); LOG.debug("isEntryURI");
// workspace/collection-singular/fsid // workspace/collection-singular/fsid
// if length is 3 and points to a valid collection then YES // if length is 3 and points to a valid collection then YES
final String[] pathInfo = StringUtils.split(areq.getPathInfo(), "/"); final String[] pathInfo = StringUtils.split(areq.getPathInfo(), "/");
@ -411,7 +411,7 @@ public class FileBasedAtomHandler implements AtomHandler {
*/ */
@Override @Override
public boolean isMediaEditURI(final AtomRequest areq) { public boolean isMediaEditURI(final AtomRequest areq) {
LOGGER.debug("isMediaEditURI"); LOG.debug("isMediaEditURI");
// workspace/collection-singular/fsid/media/fsid // workspace/collection-singular/fsid/media/fsid
// if length is 4, points to a valid collection and fsid is mentioned // if length is 4, points to a valid collection and fsid is mentioned
// twice then YES // twice then YES
@ -433,7 +433,7 @@ public class FileBasedAtomHandler implements AtomHandler {
* BASIC authentication. * BASIC authentication.
*/ */
public String authenticateBASIC(final HttpServletRequest request) { public String authenticateBASIC(final HttpServletRequest request) {
LOGGER.debug("authenticateBASIC"); LOG.debug("authenticateBASIC");
boolean valid = false; boolean valid = false;
String userID = null; String userID = null;
String password = null; String password = null;
@ -458,7 +458,7 @@ public class FileBasedAtomHandler implements AtomHandler {
} }
} }
} catch (final Exception e) { } catch (final Exception e) {
LOGGER.debug(e); LOG.debug("An error occured while processing Basic authentication", e);
} }
if (valid) { if (valid) {
// For now assume userID as userName // For now assume userID as userName

View file

@ -26,15 +26,15 @@ import java.io.InputStream;
import java.io.OutputStream; import java.io.OutputStream;
import org.apache.commons.lang3.RandomStringUtils; import org.apache.commons.lang3.RandomStringUtils;
import org.apache.commons.logging.Log; import org.slf4j.Logger;
import org.apache.commons.logging.LogFactory; import org.slf4j.LoggerFactory;
/** /**
* Class which helps in handling File persistence related operations. * Class which helps in handling File persistence related operations.
*/ */
class FileStore { class FileStore {
private static final Log LOG = LogFactory.getFactory().getInstance(FileStore.class); private static final Logger LOG = LoggerFactory.getLogger(FileStore.class);
private static final FileStore fileStore = new FileStore(); private static final FileStore fileStore = new FileStore();

View file

@ -17,11 +17,8 @@ package org.rometools.propono.blogclient.atomprotocol;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.Iterator;
import java.util.List; import java.util.List;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.rometools.propono.atom.client.ClientEntry; import org.rometools.propono.atom.client.ClientEntry;
import org.rometools.propono.atom.common.rome.AppModule; import org.rometools.propono.atom.common.rome.AppModule;
import org.rometools.propono.atom.common.rome.AppModuleImpl; import org.rometools.propono.atom.common.rome.AppModuleImpl;
@ -39,7 +36,6 @@ import com.sun.syndication.feed.synd.SyndPerson;
* Atom protocol implementation of BlogEntry. * Atom protocol implementation of BlogEntry.
*/ */
public class AtomEntry extends BaseBlogEntry implements BlogEntry { public class AtomEntry extends BaseBlogEntry implements BlogEntry {
static final Log logger = LogFactory.getLog(AtomCollection.class);
String editURI = null; String editURI = null;
AtomCollection collection = null; AtomCollection collection = null;
@ -61,9 +57,6 @@ public class AtomEntry extends BaseBlogEntry implements BlogEntry {
copyFromRomeEntry(entry); copyFromRomeEntry(entry);
} }
/**
* {@inheritDoc}
*/
@Override @Override
public String getToken() { public String getToken() {
return editURI; return editURI;
@ -91,9 +84,6 @@ public class AtomEntry extends BaseBlogEntry implements BlogEntry {
return false; return false;
} }
/**
* {@inheritDoc}
*/
@Override @Override
public void save() throws BlogClientException { public void save() throws BlogClientException {
final boolean create = getToken() == null; final boolean create = getToken() == null;
@ -120,9 +110,6 @@ public class AtomEntry extends BaseBlogEntry implements BlogEntry {
} }
} }
/**
* {@inheritDoc}
*/
@Override @Override
public void delete() throws BlogClientException { public void delete() throws BlogClientException {
if (getToken() == null) { if (getToken() == null) {
@ -216,8 +203,7 @@ public class AtomEntry extends BaseBlogEntry implements BlogEntry {
} }
if (categories != null) { if (categories != null) {
final List<com.sun.syndication.feed.atom.Category> romeCats = new ArrayList<com.sun.syndication.feed.atom.Category>(); final List<com.sun.syndication.feed.atom.Category> romeCats = new ArrayList<com.sun.syndication.feed.atom.Category>();
for (final Iterator<Category> iter = categories.iterator(); iter.hasNext();) { for (final Category cat : categories) {
final BlogEntry.Category cat = iter.next();
final com.sun.syndication.feed.atom.Category romeCategory = new com.sun.syndication.feed.atom.Category(); final com.sun.syndication.feed.atom.Category romeCategory = new com.sun.syndication.feed.atom.Category();
romeCategory.setTerm(cat.getId()); romeCategory.setTerm(cat.getId());
romeCategory.setScheme(cat.getUrl()); romeCategory.setScheme(cat.getUrl());

View file

@ -17,19 +17,20 @@ package org.rometools.propono.blogclient.atomprotocol;
import java.util.Iterator; import java.util.Iterator;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.rometools.propono.atom.client.ClientEntry; import org.rometools.propono.atom.client.ClientEntry;
import org.rometools.propono.atom.client.ClientMediaEntry; import org.rometools.propono.atom.client.ClientMediaEntry;
import org.rometools.propono.blogclient.BlogClientException; import org.rometools.propono.blogclient.BlogClientException;
import org.rometools.propono.blogclient.BlogEntry; import org.rometools.propono.blogclient.BlogEntry;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** /**
* Atom protocol implementation of BlogClient entry iterator. * Atom protocol implementation of BlogClient entry iterator.
*/ */
public class AtomEntryIterator implements Iterator<BlogEntry> { public class AtomEntryIterator implements Iterator<BlogEntry> {
private static final Log logger = LogFactory.getLog(AtomEntryIterator.class); private static final Logger LOG = LoggerFactory.getLogger(AtomEntryIterator.class);
private Iterator<ClientEntry> iterator = null; private Iterator<ClientEntry> iterator = null;
private AtomCollection collection = null; private AtomCollection collection = null;
@ -63,7 +64,7 @@ public class AtomEntryIterator implements Iterator<BlogEntry> {
return new AtomEntry(collection, entry); return new AtomEntry(collection, entry);
} }
} catch (final Exception e) { } catch (final Exception e) {
logger.error("ERROR fetching entry", e); LOG.error("An error occured while fetching entry", e);
} }
return null; return null;
} }

View file

@ -23,12 +23,12 @@ import junit.framework.Test;
import junit.framework.TestCase; import junit.framework.TestCase;
import junit.framework.TestSuite; import junit.framework.TestSuite;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.junit.Ignore; import org.junit.Ignore;
import org.rometools.propono.atom.common.Categories; import org.rometools.propono.atom.common.Categories;
import org.rometools.propono.atom.common.Collection; import org.rometools.propono.atom.common.Collection;
import org.rometools.propono.utils.ProponoException; import org.rometools.propono.utils.ProponoException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.sun.syndication.feed.atom.Category; import com.sun.syndication.feed.atom.Category;
import com.sun.syndication.feed.atom.Content; import com.sun.syndication.feed.atom.Content;
@ -39,7 +39,7 @@ import com.sun.syndication.feed.atom.Content;
@Ignore @Ignore
public class AtomClientTest extends TestCase { public class AtomClientTest extends TestCase {
private static Log log = LogFactory.getFactory().getInstance(AtomClientTest.class); private static Logger log = LoggerFactory.getLogger(AtomClientTest.class);
private static ClientAtomService service = null; private static ClientAtomService service = null;

View file

@ -23,12 +23,7 @@ import static junit.framework.TestCase.assertTrue;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.logging.ConsoleHandler;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.junit.After; import org.junit.After;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
@ -47,6 +42,8 @@ import org.rometools.propono.atom.common.Categories;
import org.rometools.propono.atom.common.Collection; import org.rometools.propono.atom.common.Collection;
import org.rometools.propono.atom.common.Workspace; import org.rometools.propono.atom.common.Workspace;
import org.rometools.propono.utils.ProponoException; import org.rometools.propono.utils.ProponoException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.sun.syndication.feed.atom.Category; import com.sun.syndication.feed.atom.Category;
import com.sun.syndication.feed.atom.Content; import com.sun.syndication.feed.atom.Content;
@ -57,7 +54,7 @@ import com.sun.syndication.feed.atom.Content;
*/ */
public class AtomClientServerTest { public class AtomClientServerTest {
private static final Log log = LogFactory.getFactory().getInstance(AtomClientServerTest.class); private static final Logger LOG = LoggerFactory.getLogger(AtomClientServerTest.class);
private HttpServer server = null; private HttpServer server = null;
public static final int TESTPORT = 8283; public static final int TESTPORT = 8283;
@ -85,14 +82,10 @@ public class AtomClientServerTest {
@Before @Before
public void setUpClass() throws Exception { public void setUpClass() throws Exception {
log.info("---------------------------------------------");
log.info("Starting Jetty");
log.info("---------------------------------------------");
final ConsoleHandler handler = new ConsoleHandler(); LOG.info("---------------------------------------------");
final Logger logger = Logger.getLogger("org.rometools.propono"); LOG.info("Starting Jetty");
logger.setLevel(Level.FINEST); LOG.info("---------------------------------------------");
logger.addHandler(handler);
setupServer(); setupServer();
final HttpContext context = createContext(); final HttpContext context = createContext();
@ -107,7 +100,7 @@ public class AtomClientServerTest {
@After @After
public void tearDownClass() throws Exception { public void tearDownClass() throws Exception {
if (server != null) { if (server != null) {
log.info("Stoping Jetty"); LOG.info("Stoping Jetty");
server.stop(); server.stop();
server.destroy(); server.destroy();
server = null; server = null;
@ -151,11 +144,11 @@ public class AtomClientServerTest {
for (final Workspace workspace : service.getWorkspaces()) { for (final Workspace workspace : service.getWorkspaces()) {
final ClientWorkspace space = (ClientWorkspace) workspace; final ClientWorkspace space = (ClientWorkspace) workspace;
assertNotNull(space.getTitle()); assertNotNull(space.getTitle());
log.debug("Workspace: " + space.getTitle()); LOG.debug("Workspace: {}", space.getTitle());
for (final Object element : space.getCollections()) { for (final Object element : space.getCollections()) {
final ClientCollection col = (ClientCollection) element; final ClientCollection col = (ClientCollection) element;
log.debug(" Collection: " + col.getTitle() + " Accepts: " + col.getAccepts()); LOG.debug(" Collection: {} Accepts: {}", col.getTitle(), col.getAccepts());
log.debug(" href: " + col.getHrefResolved()); LOG.debug(" href: {}", col.getHrefResolved());
assertNotNull(col.getTitle()); assertNotNull(col.getTitle());
} }
} }

View file

@ -25,6 +25,8 @@ import junit.framework.TestSuite;
import org.junit.Ignore; import org.junit.Ignore;
import org.rometools.propono.blogclient.Blog.Collection; import org.rometools.propono.blogclient.Blog.Collection;
import org.rometools.propono.utils.Utilities; import org.rometools.propono.utils.Utilities;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.sun.syndication.io.impl.Atom10Parser; import com.sun.syndication.io.impl.Atom10Parser;
@ -35,6 +37,8 @@ import com.sun.syndication.io.impl.Atom10Parser;
@Ignore @Ignore
public class SimpleBlogClientTest extends TestCase { public class SimpleBlogClientTest extends TestCase {
private static final Logger LOG = LoggerFactory.getLogger(SimpleBlogClientTest.class);
private final String metaweblogEndpoint = "http://localhost:8080/roller/roller-services/xmlrpc"; private final String metaweblogEndpoint = "http://localhost:8080/roller/roller-services/xmlrpc";
// private String atomEndpoint = "http://localhost:8080/roller/roller-services/app"; // private String atomEndpoint = "http://localhost:8080/roller/roller-services/app";
private final String atomEndpoint = "http://localhost:8080/sample-atomserver/app"; private final String atomEndpoint = "http://localhost:8080/sample-atomserver/app";
@ -68,7 +72,7 @@ public class SimpleBlogClientTest extends TestCase {
int blogCount = 0; int blogCount = 0;
for (final Blog blog : conn.getBlogs()) { for (final Blog blog : conn.getBlogs()) {
System.out.println(blog.getName()); LOG.debug(blog.getName());
blogCount++; blogCount++;
} }
assertTrue(blogCount > 0); assertTrue(blogCount > 0);

View file

@ -0,0 +1,13 @@
<configuration>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger - %msg%n</pattern>
</encoder>
</appender>
<root level="warn">
<appender-ref ref="STDOUT" />
</root>
</configuration>