Migrated logging to SLF4J
This commit is contained in:
parent
1033b00b57
commit
de3832b851
42 changed files with 367 additions and 212 deletions
5
pom.xml
5
pom.xml
|
@ -52,6 +52,11 @@
|
|||
<groupId>com.rometools</groupId>
|
||||
<artifactId>rome</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ch.qos.logback</groupId>
|
||||
<artifactId>logback-classic</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
|
|
|
@ -27,8 +27,6 @@ import java.util.ArrayList;
|
|||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.jdom2.Element;
|
||||
import org.jdom2.Namespace;
|
||||
|
@ -40,6 +38,8 @@ import org.rometools.feed.module.base.types.DateTimeRange;
|
|||
import org.rometools.feed.module.base.types.FloatUnit;
|
||||
import org.rometools.feed.module.base.types.IntUnit;
|
||||
import org.rometools.feed.module.base.types.ShortDate;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.sun.syndication.feed.module.Module;
|
||||
import com.sun.syndication.io.ModuleParser;
|
||||
|
@ -49,7 +49,8 @@ import com.sun.syndication.io.ModuleParser;
|
|||
* @author <a href="mailto:cooper@screaming-penguin.com">Robert "kebernet" Cooper</a>
|
||||
*/
|
||||
public class CustomTagParser implements ModuleParser {
|
||||
private static final Logger log = Logger.getAnonymousLogger();
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(CustomTagParser.class);
|
||||
|
||||
static final Namespace NS = Namespace.getNamespace("g-custom", CustomTags.URI);
|
||||
|
||||
|
@ -84,13 +85,13 @@ public class CustomTagParser implements ModuleParser {
|
|||
try {
|
||||
tags.add(new CustomTagImpl(child.getName(), new ShortDate(GoogleBaseParser.SHORT_DT_FMT.parse(child.getTextTrim()))));
|
||||
} catch (final ParseException e) {
|
||||
log.log(Level.WARNING, "Unable to parse date type on " + child.getName(), e);
|
||||
LOG.warn("Unable to parse date type on " + child.getName(), e);
|
||||
}
|
||||
} else if (type.equals("dateTime")) {
|
||||
try {
|
||||
tags.add(new CustomTagImpl(child.getName(), GoogleBaseParser.LONG_DT_FMT.parse(child.getTextTrim())));
|
||||
} catch (final ParseException e) {
|
||||
log.log(Level.WARNING, "Unable to parse date type on " + child.getName(), e);
|
||||
LOG.warn("Unable to parse date type on " + child.getName(), e);
|
||||
}
|
||||
} else if (type.equals("dateTimeRange")) {
|
||||
try {
|
||||
|
@ -98,13 +99,13 @@ public class CustomTagParser implements ModuleParser {
|
|||
.getChild("start", CustomTagParser.NS).getText().trim()), GoogleBaseParser.LONG_DT_FMT.parse(child
|
||||
.getChild("end", CustomTagParser.NS).getText().trim()))));
|
||||
} catch (final Exception e) {
|
||||
log.log(Level.WARNING, "Unable to parse date type on " + child.getName(), e);
|
||||
LOG.warn("Unable to parse date type on " + child.getName(), e);
|
||||
}
|
||||
} else if (type.equals("url")) {
|
||||
try {
|
||||
tags.add(new CustomTagImpl(child.getName(), new URL(child.getTextTrim())));
|
||||
} catch (final MalformedURLException e) {
|
||||
log.log(Level.WARNING, "Unable to parse URL type on " + child.getName(), e);
|
||||
LOG.warn("Unable to parse URL type on " + child.getName(), e);
|
||||
}
|
||||
} else if (type.equals("boolean")) {
|
||||
tags.add(new CustomTagImpl(child.getName(), new Boolean(child.getTextTrim().toLowerCase())));
|
||||
|
@ -114,7 +115,7 @@ public class CustomTagParser implements ModuleParser {
|
|||
throw new Exception("Unknown type: " + type);
|
||||
}
|
||||
} catch (final Exception e) {
|
||||
log.log(Level.WARNING, "Unable to parse type on " + child.getName(), e);
|
||||
LOG.warn("Unable to parse type on " + child.getName(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -52,8 +52,6 @@ import java.util.Iterator;
|
|||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Properties;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.jdom2.Element;
|
||||
import org.jdom2.Namespace;
|
||||
|
@ -69,6 +67,8 @@ import org.rometools.feed.module.base.types.PriceTypeEnumeration;
|
|||
import org.rometools.feed.module.base.types.ShippingType;
|
||||
import org.rometools.feed.module.base.types.Size;
|
||||
import org.rometools.feed.module.base.types.YearType;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.sun.syndication.feed.module.Module;
|
||||
import com.sun.syndication.io.ModuleParser;
|
||||
|
@ -80,7 +80,9 @@ import com.sun.syndication.io.ModuleParser;
|
|||
* @version $Revision: 1.3 $
|
||||
*/
|
||||
public class GoogleBaseParser implements ModuleParser {
|
||||
private static final Logger log = Logger.getAnonymousLogger();
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(GoogleBaseParser.class);
|
||||
|
||||
public static final char[] INTEGER_CHARS = "-1234567890".toCharArray();
|
||||
public static final char[] FLOAT_CHARS = "-1234567890.".toCharArray();
|
||||
public static final SimpleDateFormat SHORT_DT_FMT = new SimpleDateFormat("yyyy-MM-dd");
|
||||
|
@ -95,10 +97,10 @@ public class GoogleBaseParser implements ModuleParser {
|
|||
PROPS2TAGS.load(GoogleBaseParser.class.getResourceAsStream("/org/rometools/feed/module/base/io/tags.properties"));
|
||||
} catch (final IOException e) {
|
||||
e.printStackTrace();
|
||||
log.log(Level.SEVERE, "Unable to read properties file for Google Base tags!", e);
|
||||
LOG.error("Unable to read properties file for Google Base tags!", e);
|
||||
} catch (final IntrospectionException e) {
|
||||
e.printStackTrace();
|
||||
log.log(Level.SEVERE, "Unable to get property descriptors for GoogleBaseImpl!", e);
|
||||
LOG.error("Unable to get property descriptors for GoogleBaseImpl!", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -119,7 +121,7 @@ public class GoogleBaseParser implements ModuleParser {
|
|||
final String tagName = GoogleBaseParser.PROPS2TAGS.getProperty(pd.getName());
|
||||
|
||||
if (tagName == null) {
|
||||
log.log(Level.FINE, "Property: " + pd.getName() + " doesn't have a tag mapping. ");
|
||||
LOG.debug("Property: {} doesn't have a tag mapping.", pd.getName());
|
||||
} else {
|
||||
tag2pd.put(tagName, pd);
|
||||
}
|
||||
|
@ -141,7 +143,7 @@ public class GoogleBaseParser implements ModuleParser {
|
|||
try {
|
||||
handleTag(child, pd, module);
|
||||
} catch (final Exception e) {
|
||||
log.log(Level.WARNING, "Unable to handle tag: " + child.getName(), e);
|
||||
LOG.warn("Unable to handle tag: " + child.getName(), e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -48,6 +48,8 @@ import org.jdom2.Namespace;
|
|||
import org.rometools.feed.module.cc.CreativeCommons;
|
||||
import org.rometools.feed.module.cc.CreativeCommonsImpl;
|
||||
import org.rometools.feed.module.cc.types.License;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.sun.syndication.feed.module.Module;
|
||||
import com.sun.syndication.io.ModuleGenerator;
|
||||
|
@ -58,6 +60,8 @@ import com.sun.syndication.io.ModuleGenerator;
|
|||
*/
|
||||
public class CCModuleGenerator implements ModuleGenerator {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(CCModuleGenerator.class);
|
||||
|
||||
private static final Namespace RSS1 = Namespace.getNamespace("cc", CreativeCommonsImpl.RSS1_URI);
|
||||
private static final Namespace RSS2 = Namespace.getNamespace("creativeCommons", CreativeCommonsImpl.RSS2_URI);
|
||||
private static final Namespace RSS = Namespace.getNamespace("http://purl.org/rss/1.0/");
|
||||
|
@ -102,7 +106,7 @@ public class CCModuleGenerator implements ModuleGenerator {
|
|||
private void generateRSS1(final CreativeCommons module, final Element element) {
|
||||
// throw new RuntimeException( "Generating RSS1 Feeds not currently Supported.");
|
||||
|
||||
System.out.println(element.getName());
|
||||
LOG.debug(element.getName());
|
||||
if (element.getName().equals("channel")) {
|
||||
// Do all licenses list.
|
||||
final License[] all = module.getAllLicenses();
|
||||
|
@ -121,7 +125,7 @@ public class CCModuleGenerator implements ModuleGenerator {
|
|||
permit.setAttribute("resource", permits[j].toString(), RDF);
|
||||
license.addContent(permit);
|
||||
}
|
||||
System.out.println("Is Root?" + element.getParentElement());
|
||||
LOG.debug("Is Root? {}", element.getParentElement());
|
||||
element.getParentElement().addContent(license);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -93,7 +93,7 @@ public class License {
|
|||
License.lookupLicense.put(uri, this);
|
||||
|
||||
if (this.uri.endsWith("/")) {
|
||||
// System.out.println(uri.substring(0,this.uri.lastIndexOf("/")));
|
||||
// LOG.debug(uri.substring(0,this.uri.lastIndexOf("/")));
|
||||
License.lookupLicense.put(uri.substring(0, this.uri.lastIndexOf("/")), this);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -142,11 +142,11 @@ public class ContentItem implements Cloneable {
|
|||
}
|
||||
final ContentItem other = (ContentItem) obj;
|
||||
if (contentFormat == null ? other.contentFormat != null : !contentFormat.equals(other.contentFormat)) {
|
||||
// System.out.println("format");
|
||||
// LOG.debug("format");
|
||||
return false;
|
||||
}
|
||||
if (contentEncoding == null ? other.contentEncoding != null : !contentEncoding.equals(other.contentEncoding)) {
|
||||
// System.out.println("enc");
|
||||
// LOG.debug("enc");
|
||||
return false;
|
||||
}
|
||||
final String thisCV = contentValue.replaceAll(" xmlns=\"http://www.w3.org/1999/xhtml\"", "").trim();
|
||||
|
@ -157,24 +157,24 @@ public class ContentItem implements Cloneable {
|
|||
return false;
|
||||
}
|
||||
if (contentValueDOM != other.contentValueDOM && (contentValueDOM == null || !contentValueDOM.equals(other.contentValueDOM))) {
|
||||
// System.out.println("vd");
|
||||
// LOG.debug("vd");
|
||||
return false;
|
||||
}
|
||||
if (contentAbout == null ? other.contentAbout != null : !contentAbout.equals(other.contentAbout)) {
|
||||
// System.out.println("abt");
|
||||
// LOG.debug("abt");
|
||||
return false;
|
||||
}
|
||||
if (contentValueParseType == null ? other.contentValueParseType != null : !contentValueParseType.equals(other.contentValueParseType)) {
|
||||
// System.out.println("pt");
|
||||
// LOG.debug("pt");
|
||||
return false;
|
||||
}
|
||||
if (contentValueNamespace != other.contentValueNamespace
|
||||
&& (contentValueNamespace == null || !contentValueNamespace.equals(other.contentValueNamespace))) {
|
||||
// System.out.println("ns");
|
||||
// LOG.debug("ns");
|
||||
return false;
|
||||
}
|
||||
if (contentResource == null ? other.contentResource != null : !contentResource.equals(other.contentResource)) {
|
||||
// System.out.println("res");
|
||||
// LOG.debug("res");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -54,6 +54,8 @@ import org.jdom2.Element;
|
|||
import org.jdom2.Namespace;
|
||||
import org.rometools.feed.module.content.ContentItem;
|
||||
import org.rometools.feed.module.content.ContentModule;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* @version $Revision: 1.2 $
|
||||
|
@ -61,6 +63,8 @@ import org.rometools.feed.module.content.ContentModule;
|
|||
*/
|
||||
public class ContentModuleGenerator implements com.sun.syndication.io.ModuleGenerator {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(ContentModuleGenerator.class);
|
||||
|
||||
private static final Namespace CONTENT_NS = Namespace.getNamespace("content", ContentModule.URI);
|
||||
private static final Namespace RDF_NS = Namespace.getNamespace("rdf", ContentModule.RDF_URI);
|
||||
private static final Set<Namespace> NAMESPACES;
|
||||
|
@ -95,7 +99,7 @@ public class ContentModuleGenerator implements com.sun.syndication.io.ModuleGene
|
|||
final List<String> encodeds = cm.getEncodeds();
|
||||
|
||||
if (encodeds != null) {
|
||||
System.out.println(cm.getEncodeds().size());
|
||||
LOG.debug("{}", cm.getEncodeds().size());
|
||||
for (int i = 0; i < encodeds.size(); i++) {
|
||||
element.addContent(generateCDATAElement("encoded", encodeds.get(i).toString()));
|
||||
}
|
||||
|
@ -119,7 +123,7 @@ public class ContentModuleGenerator implements com.sun.syndication.io.ModuleGene
|
|||
}
|
||||
|
||||
if (contentItem.getContentFormat() != null) {
|
||||
// System.out.println( "Format");
|
||||
// LOG.debug( "Format");
|
||||
final Element format = new Element("format", CONTENT_NS);
|
||||
final Attribute formatResource = new Attribute("resource", contentItem.getContentFormat(), RDF_NS);
|
||||
format.setAttribute(formatResource);
|
||||
|
@ -128,7 +132,7 @@ public class ContentModuleGenerator implements com.sun.syndication.io.ModuleGene
|
|||
}
|
||||
|
||||
if (contentItem.getContentEncoding() != null) {
|
||||
// System.out.println( "Encoding");
|
||||
// LOG.debug( "Encoding");
|
||||
final Element encoding = new Element("encoding", CONTENT_NS);
|
||||
final Attribute encodingResource = new Attribute("resource", contentItem.getContentEncoding(), RDF_NS);
|
||||
encoding.setAttribute(encodingResource);
|
||||
|
@ -154,7 +158,7 @@ public class ContentModuleGenerator implements com.sun.syndication.io.ModuleGene
|
|||
final List<Content> detached = new ArrayList<Content>();
|
||||
|
||||
for (int c = 0; c < contentItem.getContentValueDOM().size(); c++) {
|
||||
detached.add(((Content) contentItem.getContentValueDOM().get(c)).clone().detach());
|
||||
detached.add(contentItem.getContentValueDOM().get(c).clone().detach());
|
||||
}
|
||||
|
||||
value.setContent(detached);
|
||||
|
|
|
@ -45,9 +45,10 @@ import java.net.MalformedURLException;
|
|||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.rometools.feed.module.itunes.types.Category;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.sun.syndication.feed.CopyFrom;
|
||||
|
||||
|
@ -58,10 +59,11 @@ import com.sun.syndication.feed.CopyFrom;
|
|||
* @author <a href="mailto:cooper@screaming-penguin.com">Robert "kebernet" Cooper</a>
|
||||
*/
|
||||
public class FeedInformationImpl extends AbstractITunesObject implements FeedInformation {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(FeedInformationImpl.class);
|
||||
|
||||
private String ownerName;
|
||||
private String ownerEmailAddress;
|
||||
private URL image;
|
||||
|
@ -180,7 +182,7 @@ public class FeedInformationImpl extends AbstractITunesObject implements FeedInf
|
|||
setImage(new URL(info.getImage().toExternalForm()));
|
||||
}
|
||||
} catch (final MalformedURLException e) {
|
||||
Logger.getAnonymousLogger().fine("Error copying URL:" + info.getImage());
|
||||
LOG.debug("Error copying URL:" + info.getImage(), e);
|
||||
}
|
||||
|
||||
if (info.getKeywords() != null) {
|
||||
|
|
|
@ -45,7 +45,6 @@ import java.net.URL;
|
|||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.StringTokenizer;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.jdom2.Content;
|
||||
import org.jdom2.Element;
|
||||
|
@ -57,6 +56,8 @@ import org.rometools.feed.module.itunes.FeedInformationImpl;
|
|||
import org.rometools.feed.module.itunes.types.Category;
|
||||
import org.rometools.feed.module.itunes.types.Duration;
|
||||
import org.rometools.feed.module.itunes.types.Subcategory;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.sun.syndication.io.ModuleParser;
|
||||
import com.sun.syndication.io.WireFeedParser;
|
||||
|
@ -66,7 +67,9 @@ import com.sun.syndication.io.WireFeedParser;
|
|||
* @author <a href="mailto:cooper@screaming-penguin.com">Robert "kebernet" Cooper</a>
|
||||
*/
|
||||
public class ITunesParser implements ModuleParser {
|
||||
static Logger log = Logger.getLogger(ITunesParser.class.getName());
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(ITunesParser.class);
|
||||
|
||||
Namespace ns = Namespace.getNamespace(AbstractITunesObject.URI);
|
||||
|
||||
/** Creates a new instance of ITunesParser */
|
||||
|
@ -113,7 +116,7 @@ public class ITunesParser implements ModuleParser {
|
|||
final URL imageURL = new URL(image.getAttributeValue("href").trim());
|
||||
feedInfo.setImage(imageURL);
|
||||
} catch (final MalformedURLException e) {
|
||||
log.finer("Malformed URL Exception reading itunes:image tag: " + image.getAttributeValue("href"));
|
||||
LOG.debug("Malformed URL Exception reading itunes:image tag: {}", image.getAttributeValue("href"));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -26,8 +26,6 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.StringTokenizer;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.jdom2.Element;
|
||||
import org.jdom2.Namespace;
|
||||
|
@ -48,6 +46,8 @@ import org.rometools.feed.module.mediarss.types.Text;
|
|||
import org.rometools.feed.module.mediarss.types.Thumbnail;
|
||||
import org.rometools.feed.module.mediarss.types.Time;
|
||||
import org.rometools.feed.module.mediarss.types.UrlReference;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.sun.syndication.feed.module.Module;
|
||||
import com.sun.syndication.io.ModuleParser;
|
||||
|
@ -59,7 +59,8 @@ import com.sun.syndication.io.impl.NumberParser;
|
|||
*/
|
||||
public class MediaModuleParser implements ModuleParser {
|
||||
|
||||
private static final Logger LOG = Logger.getLogger(MediaModuleParser.class.getName());
|
||||
private static final Logger LOG = LoggerFactory.getLogger(MediaModuleParser.class);
|
||||
|
||||
private static final Namespace NS = Namespace.getNamespace(MediaModule.URI);
|
||||
|
||||
@Override
|
||||
|
@ -104,7 +105,7 @@ public class MediaModuleParser implements ModuleParser {
|
|||
mc = new MediaContent(new UrlReference(new URI(content.getAttributeValue("url"))));
|
||||
mc.setPlayer(parsePlayer(content));
|
||||
} catch (final Exception ex) {
|
||||
LOG.log(Level.WARNING, "Exception parsing content tag.", ex);
|
||||
LOG.warn("Exception parsing content tag.", ex);
|
||||
}
|
||||
} else {
|
||||
mc = new MediaContent(parsePlayer(content));
|
||||
|
@ -114,17 +115,17 @@ public class MediaModuleParser implements ModuleParser {
|
|||
try {
|
||||
mc.setAudioChannels(content.getAttributeValue("channels") == null ? null : new Integer(content.getAttributeValue("channels")));
|
||||
} catch (final Exception ex) {
|
||||
LOG.log(Level.WARNING, "Exception parsing content tag.", ex);
|
||||
LOG.warn("Exception parsing content tag.", ex);
|
||||
}
|
||||
try {
|
||||
mc.setBitrate(content.getAttributeValue("bitrate") == null ? null : new Float(content.getAttributeValue("bitrate")));
|
||||
} catch (final Exception ex) {
|
||||
LOG.log(Level.WARNING, "Exception parsing content tag.", ex);
|
||||
LOG.warn("Exception parsing content tag.", ex);
|
||||
}
|
||||
try {
|
||||
mc.setDuration(content.getAttributeValue("duration") == null ? null : new Long(content.getAttributeValue("duration")));
|
||||
} catch (final Exception ex) {
|
||||
LOG.log(Level.WARNING, "Exception parsing content tag.", ex);
|
||||
LOG.warn("Exception parsing content tag.", ex);
|
||||
}
|
||||
|
||||
mc.setMedium(content.getAttributeValue("medium"));
|
||||
|
@ -144,17 +145,17 @@ public class MediaModuleParser implements ModuleParser {
|
|||
try {
|
||||
mc.setFileSize(content.getAttributeValue("fileSize") == null ? null : NumberParser.parseLong(content.getAttributeValue("fileSize")));
|
||||
} catch (final Exception ex) {
|
||||
LOG.log(Level.WARNING, "Exception parsing content tag.", ex);
|
||||
LOG.warn("Exception parsing content tag.", ex);
|
||||
}
|
||||
try {
|
||||
mc.setFramerate(content.getAttributeValue("framerate") == null ? null : NumberParser.parseFloat(content.getAttributeValue("framerate")));
|
||||
} catch (final Exception ex) {
|
||||
LOG.log(Level.WARNING, "Exception parsing content tag.", ex);
|
||||
LOG.warn("Exception parsing content tag.", ex);
|
||||
}
|
||||
try {
|
||||
mc.setHeight(content.getAttributeValue("height") == null ? null : NumberParser.parseInt(content.getAttributeValue("height")));
|
||||
} catch (final Exception ex) {
|
||||
LOG.log(Level.WARNING, "Exception parsing content tag.", ex);
|
||||
LOG.warn("Exception parsing content tag.", ex);
|
||||
}
|
||||
|
||||
mc.setLanguage(content.getAttributeValue("lang"));
|
||||
|
@ -163,24 +164,24 @@ public class MediaModuleParser implements ModuleParser {
|
|||
mc.setSamplingrate(content.getAttributeValue("samplingrate") == null ? null : NumberParser.parseFloat(content
|
||||
.getAttributeValue("samplingrate")));
|
||||
} catch (final Exception ex) {
|
||||
LOG.log(Level.WARNING, "Exception parsing content tag.", ex);
|
||||
LOG.warn("Exception parsing content tag.", ex);
|
||||
}
|
||||
|
||||
mc.setType(content.getAttributeValue("type"));
|
||||
try {
|
||||
mc.setWidth(content.getAttributeValue("width") == null ? null : NumberParser.parseInt(content.getAttributeValue("width")));
|
||||
} catch (final Exception ex) {
|
||||
LOG.log(Level.WARNING, "Exception parsing content tag.", ex);
|
||||
LOG.warn("Exception parsing content tag.", ex);
|
||||
}
|
||||
|
||||
mc.setDefaultContent(content.getAttributeValue("isDefault") == null ? false : Boolean.getBoolean(content.getAttributeValue("isDefault")));
|
||||
} else {
|
||||
LOG.log(Level.WARNING, "Could not find MediaContent.");
|
||||
LOG.warn("Could not find MediaContent.");
|
||||
}
|
||||
|
||||
}
|
||||
} catch (final Exception ex) {
|
||||
LOG.log(Level.WARNING, "Exception parsing content tag.", ex);
|
||||
LOG.warn("Exception parsing content tag.", ex);
|
||||
}
|
||||
|
||||
return values.toArray(new MediaContent[values.size()]);
|
||||
|
@ -221,7 +222,7 @@ public class MediaModuleParser implements ModuleParser {
|
|||
final Element cat = categories.get(i);
|
||||
values.add(new Category(cat.getAttributeValue("scheme"), cat.getAttributeValue("label"), cat.getText()));
|
||||
} catch (final Exception ex) {
|
||||
LOG.log(Level.WARNING, "Exception parsing category tag.", ex);
|
||||
LOG.warn("Exception parsing category tag.", ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -237,7 +238,7 @@ public class MediaModuleParser implements ModuleParser {
|
|||
md.setCopyrightUrl(copy.getAttributeValue("url") != null ? new URI(copy.getAttributeValue("url")) : null);
|
||||
}
|
||||
} catch (final Exception ex) {
|
||||
LOG.log(Level.WARNING, "Exception parsing copyright tag.", ex);
|
||||
LOG.warn("Exception parsing copyright tag.", ex);
|
||||
}
|
||||
// credits
|
||||
{
|
||||
|
@ -250,7 +251,7 @@ public class MediaModuleParser implements ModuleParser {
|
|||
values.add(new Credit(cred.getAttributeValue("scheme"), cred.getAttributeValue("role"), cred.getText()));
|
||||
md.setCredits(values.toArray(new Credit[values.size()]));
|
||||
} catch (final Exception ex) {
|
||||
LOG.log(Level.WARNING, "Exception parsing credit tag.", ex);
|
||||
LOG.warn("Exception parsing credit tag.", ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -264,7 +265,7 @@ public class MediaModuleParser implements ModuleParser {
|
|||
md.setDescriptionType(description.getAttributeValue("type"));
|
||||
}
|
||||
} catch (final Exception ex) {
|
||||
LOG.log(Level.WARNING, "Exception parsing description tag.", ex);
|
||||
LOG.warn("Exception parsing description tag.", ex);
|
||||
}
|
||||
|
||||
// hash
|
||||
|
@ -275,7 +276,7 @@ public class MediaModuleParser implements ModuleParser {
|
|||
md.setHash(new Hash(hash.getAttributeValue("algo"), hash.getText()));
|
||||
}
|
||||
} catch (final Exception ex) {
|
||||
LOG.log(Level.WARNING, "Exception parsing hash tag.", ex);
|
||||
LOG.warn("Exception parsing hash tag.", ex);
|
||||
}
|
||||
// keywords
|
||||
{
|
||||
|
@ -302,7 +303,7 @@ public class MediaModuleParser implements ModuleParser {
|
|||
final Element rat = ratings.get(i);
|
||||
values.add(new Rating(rat.getAttributeValue("scheme"), rat.getText()));
|
||||
} catch (final Exception ex) {
|
||||
LOG.log(Level.WARNING, "Exception parsing rating tag.", ex);
|
||||
LOG.warn("Exception parsing rating tag.", ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -320,7 +321,7 @@ public class MediaModuleParser implements ModuleParser {
|
|||
final Time end = text.getAttributeValue("end") == null ? null : new Time(text.getAttributeValue("end"));
|
||||
values.add(new Text(text.getAttributeValue("type"), text.getTextTrim(), start, end));
|
||||
} catch (final Exception ex) {
|
||||
LOG.log(Level.WARNING, "Exception parsing text tag.", ex);
|
||||
LOG.warn("Exception parsing text tag.", ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -339,7 +340,7 @@ public class MediaModuleParser implements ModuleParser {
|
|||
final Integer height = thumb.getAttributeValue("height") == null ? null : new Integer(thumb.getAttributeValue("height"));
|
||||
values.add(new Thumbnail(new URI(thumb.getAttributeValue("url")), width, height, t));
|
||||
} catch (final Exception ex) {
|
||||
LOG.log(Level.WARNING, "Exception parsing thumbnail tag.", ex);
|
||||
LOG.warn("Exception parsing thumbnail tag.", ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -414,7 +415,7 @@ public class MediaModuleParser implements ModuleParser {
|
|||
try {
|
||||
p = new PlayerReference(new URI(player.getAttributeValue("url")), width, height);
|
||||
} catch (final Exception ex) {
|
||||
LOG.log(Level.WARNING, "Exception parsing player tag.", ex);
|
||||
LOG.warn("Exception parsing player tag.", ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -47,7 +47,6 @@ import java.text.SimpleDateFormat;
|
|||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.jdom2.Element;
|
||||
import org.jdom2.Namespace;
|
||||
|
@ -55,6 +54,8 @@ import org.rometools.feed.module.photocast.PhotocastModule;
|
|||
import org.rometools.feed.module.photocast.PhotocastModuleImpl;
|
||||
import org.rometools.feed.module.photocast.types.Metadata;
|
||||
import org.rometools.feed.module.photocast.types.PhotoDate;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.sun.syndication.feed.module.Module;
|
||||
import com.sun.syndication.io.ModuleParser;
|
||||
|
@ -64,7 +65,8 @@ import com.sun.syndication.io.ModuleParser;
|
|||
* @author <a href="mailto:cooper@screaming-penguin.com">Robert "kebernet" Cooper</a>
|
||||
*/
|
||||
public class Parser implements ModuleParser {
|
||||
private static final Logger LOG = Logger.getAnonymousLogger();
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(Parser.class);
|
||||
|
||||
private static final Namespace NS = Namespace.getNamespace(PhotocastModule.URI);
|
||||
// 2005-11-29T04:36:06
|
||||
|
@ -95,25 +97,25 @@ public class Parser implements ModuleParser {
|
|||
try {
|
||||
pm.setPhotoDate(Parser.PHOTO_DATE_FORMAT.parse(e.getText()));
|
||||
} catch (final Exception ex) {
|
||||
LOG.warning("Unable to parse photoDate: " + e.getText() + " " + ex.toString());
|
||||
LOG.warn("Unable to parse photoDate: " + e.getText(), ex);
|
||||
}
|
||||
} else if (e.getName().equals("cropDate")) {
|
||||
try {
|
||||
pm.setCropDate(Parser.CROP_DATE_FORMAT.parse(e.getText()));
|
||||
} catch (final Exception ex) {
|
||||
LOG.warning("Unable to parse cropDate: " + e.getText() + " " + ex.toString());
|
||||
LOG.warn("Unable to parse cropDate: " + e.getText(), ex);
|
||||
}
|
||||
} else if (e.getName().equals("thumbnail")) {
|
||||
try {
|
||||
pm.setThumbnailUrl(new URL(e.getText()));
|
||||
} catch (final Exception ex) {
|
||||
LOG.warning("Unable to parse thumnail: " + e.getText() + " " + ex.toString());
|
||||
LOG.warn("Unable to parse thumnail: " + e.getText(), ex);
|
||||
}
|
||||
} else if (e.getName().equals("image")) {
|
||||
try {
|
||||
pm.setImageUrl(new URL(e.getText()));
|
||||
} catch (final Exception ex) {
|
||||
LOG.warning("Unable to parse image: " + e.getText() + " " + ex.toString());
|
||||
LOG.warn("Unable to parse image: " + e.getText(), ex);
|
||||
}
|
||||
} else if (e.getName().equals("metadata")) {
|
||||
String comments = "";
|
||||
|
@ -122,7 +124,7 @@ public class Parser implements ModuleParser {
|
|||
try {
|
||||
photoDate = new PhotoDate(Double.parseDouble(e.getChildText("PhotoDate")));
|
||||
} catch (final Exception ex) {
|
||||
LOG.warning("Unable to parse PhotoDate: " + e.getText() + " " + ex.toString());
|
||||
LOG.warn("Unable to parse PhotoDate: " + e.getText(), ex);
|
||||
}
|
||||
}
|
||||
if (e.getChildText("Comments") != null) {
|
||||
|
|
|
@ -22,6 +22,8 @@ import org.rometools.feed.module.sle.io.ModuleParser;
|
|||
import org.rometools.feed.module.sle.types.EntryValue;
|
||||
import org.rometools.feed.module.sle.types.Group;
|
||||
import org.rometools.feed.module.sle.types.Sort;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.sun.syndication.feed.CopyFrom;
|
||||
import com.sun.syndication.feed.impl.ObjectBean;
|
||||
|
@ -34,10 +36,11 @@ import com.sun.syndication.feed.impl.ObjectBean;
|
|||
* @author <a href="mailto:cooper@screaming-penguin.com">Robert "kebernet" Cooper</a>
|
||||
*/
|
||||
public class SleEntryImpl implements SleEntry {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(SleEntryImpl.class);
|
||||
|
||||
private static final EntryValue[] EMPTY_VALUES = new EntryValue[0];
|
||||
private final ObjectBean obj = new ObjectBean(SleEntryImpl.class, this);
|
||||
private EntryValue[] groupValues = EMPTY_VALUES;
|
||||
|
@ -86,13 +89,13 @@ public class SleEntryImpl implements SleEntry {
|
|||
|
||||
@Override
|
||||
public EntryValue getSortByElement(final Sort element) {
|
||||
System.out.println("Looking for value for " + element.getLabel() + " from " + sortValues.length);
|
||||
LOG.debug("Looking for value for {} from {}", element.getLabel(), sortValues.length);
|
||||
final EntryValue[] values = getSortValues();
|
||||
final LabelNamespaceElement compare = new LabelNamespaceElement(element.getLabel(), element.getNamespace(), element.getElement());
|
||||
for (final EntryValue value : values) {
|
||||
System.out.println("Compare to value " + value.getLabel());
|
||||
LOG.debug("Compare to value {}", value.getLabel());
|
||||
if (compare.equals(new LabelNamespaceElement(value.getLabel(), value.getNamespace(), value.getElement()))) {
|
||||
System.out.println("Match.");
|
||||
LOG.debug("Match.");
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -87,10 +87,10 @@ public class ItemParser implements com.sun.syndication.io.ModuleParser {
|
|||
values = values.size() == 0 ? values : new ArrayList<EntryValue>();
|
||||
|
||||
final List<Element> sorts = new ArrayList<Element>(element.getChildren("sort", ModuleParser.TEMP));
|
||||
// System.out.println("]]] sorts on element"+sorts.size());
|
||||
// LOG.debug("]]] sorts on element"+sorts.size());
|
||||
for (final Element sort : sorts) {
|
||||
final String dataType = sort.getAttributeValue("data-type");
|
||||
// System.out.println("Doing datatype "+dataType +" :: "+sorts.size());
|
||||
// LOG.debug("Doing datatype "+dataType +" :: "+sorts.size());
|
||||
if (dataType == null || dataType.equals(Sort.TEXT_TYPE)) {
|
||||
final StringValue value = new StringValue();
|
||||
value.setElement(sort.getAttributeValue("element"));
|
||||
|
@ -149,7 +149,7 @@ public class ItemParser implements com.sun.syndication.io.ModuleParser {
|
|||
throw new RuntimeException("Unknown datatype");
|
||||
}
|
||||
}
|
||||
// System.out.println("Values created "+values.size()+" from sorts" +sorts.size());
|
||||
// LOG.debug("Values created "+values.size()+" from sorts" +sorts.size());
|
||||
sle.setSortValues(values.toArray(new EntryValue[values.size()]));
|
||||
|
||||
return sle;
|
||||
|
|
|
@ -1,8 +1,13 @@
|
|||
package org.rometools.feed.module.sle.io;
|
||||
|
||||
import org.jdom2.Namespace;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class LabelNamespaceElement {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(LabelNamespaceElement.class);
|
||||
|
||||
private String element;
|
||||
private String label;
|
||||
private Namespace namespace;
|
||||
|
@ -47,15 +52,15 @@ public class LabelNamespaceElement {
|
|||
}
|
||||
final LabelNamespaceElement other = (LabelNamespaceElement) obj;
|
||||
if (element == null ? other.element != null : !element.equals(other.element)) {
|
||||
System.out.println("E " + element + " != " + other.element);
|
||||
LOG.debug("E {} != {}", element, other.element);
|
||||
return false;
|
||||
}
|
||||
if (label == null ? other.label != null : !label.equals(other.label)) {
|
||||
System.out.println("L");
|
||||
LOG.debug("L");
|
||||
return false;
|
||||
}
|
||||
if (namespace != other.namespace && (namespace == null || !namespace.equals(other.namespace))) {
|
||||
System.out.println("N");
|
||||
LOG.debug("N");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -27,6 +27,8 @@ import org.rometools.feed.module.sle.SimpleListExtension;
|
|||
import org.rometools.feed.module.sle.SimpleListExtensionImpl;
|
||||
import org.rometools.feed.module.sle.types.Group;
|
||||
import org.rometools.feed.module.sle.types.Sort;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.sun.syndication.feed.module.Module;
|
||||
|
||||
|
@ -35,6 +37,9 @@ import com.sun.syndication.feed.module.Module;
|
|||
* @author <a href="mailto:cooper@screaming-penguin.com">Robert "kebernet" Cooper</a>
|
||||
*/
|
||||
public class ModuleParser implements com.sun.syndication.io.ModuleParser {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(ModuleParser.class);
|
||||
|
||||
static final Namespace NS = Namespace.getNamespace("cf", SimpleListExtension.URI);
|
||||
public static final Namespace TEMP = Namespace.getNamespace("rome-sle", "urn:rome:sle");
|
||||
|
||||
|
@ -83,7 +88,7 @@ public class ModuleParser implements com.sun.syndication.io.ModuleParser {
|
|||
values = values.size() == 0 ? values : new ArrayList<Object>();
|
||||
|
||||
for (final Element se : listInfo.getChildren("sort", NS)) {
|
||||
System.out.println("Parse cf:sort " + se.getAttributeValue("element") + se.getAttributeValue("data-type"));
|
||||
LOG.debug("Parse cf:sort {}{}", se.getAttributeValue("element"), se.getAttributeValue("data-type"));
|
||||
final Namespace ns = se.getAttributeValue("ns") == null ? element.getNamespace() : Namespace.getNamespace(se.getAttributeValue("ns"));
|
||||
final String elementName = se.getAttributeValue("element");
|
||||
final String label = se.getAttributeValue("label");
|
||||
|
@ -130,7 +135,7 @@ public class ModuleParser implements com.sun.syndication.io.ModuleParser {
|
|||
final Sort[] sorts = sle.getSortFields();
|
||||
|
||||
for (final Sort sort2 : sorts) {
|
||||
System.out.println("Inserting for " + sort2.getElement() + " " + sort2.getDataType());
|
||||
LOG.debug("Inserting for {} {}", sort2.getElement(), sort2.getDataType());
|
||||
final Element sort = new Element("sort", TEMP);
|
||||
// this is the default sort order, so I am just going to ignore
|
||||
// the actual values and add a number type. It really shouldn't
|
||||
|
@ -148,12 +153,12 @@ public class ModuleParser implements com.sun.syndication.io.ModuleParser {
|
|||
|
||||
continue;
|
||||
}
|
||||
// System.out.println(e.getName());
|
||||
// LOG.debug(e.getName());
|
||||
final Element value = e.getChild(sort2.getElement(), sort2.getNamespace());
|
||||
if (value == null) {
|
||||
System.out.println("No value for " + sort2.getElement() + " : " + sort2.getNamespace());
|
||||
LOG.debug("No value for {} : {}", sort2.getElement(), sort2.getNamespace());
|
||||
} else {
|
||||
System.out.println(sort2.getElement() + " value: " + value.getText());
|
||||
LOG.debug("{} value: {}", sort2.getElement(), value.getText());
|
||||
}
|
||||
if (value == null) {
|
||||
continue;
|
||||
|
@ -165,7 +170,7 @@ public class ModuleParser implements com.sun.syndication.io.ModuleParser {
|
|||
addNotNullAttribute(sort, "data-type", sort2.getDataType());
|
||||
addNotNullAttribute(sort, "ns", sort2.getNamespace().getURI());
|
||||
e.addContent(sort);
|
||||
System.out.println("Added " + sort + " " + sort2.getLabel() + " = " + value.getText());
|
||||
LOG.debug("Added {} {} = {}", sort, sort2.getLabel(), value.getText());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,7 +4,6 @@ import java.util.ArrayList;
|
|||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.jdom2.Attribute;
|
||||
import org.jdom2.DataConversionException;
|
||||
|
@ -32,7 +31,6 @@ import com.sun.syndication.io.impl.RSS20Parser;
|
|||
* @author <a href="mailto:ldornin@dev.java.net">ldornin</a>
|
||||
*/
|
||||
public class SSE091Parser implements DelegatingModuleParser {
|
||||
static Logger log = Logger.getLogger(SSE091Parser.class.getName());
|
||||
|
||||
// root of the sharing element
|
||||
private RSS20Parser rssParser;
|
||||
|
|
|
@ -43,7 +43,6 @@ import java.text.SimpleDateFormat;
|
|||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.jdom2.Element;
|
||||
import org.jdom2.Namespace;
|
||||
|
@ -57,6 +56,8 @@ import org.rometools.feed.module.yahooweather.types.Forecast;
|
|||
import org.rometools.feed.module.yahooweather.types.Location;
|
||||
import org.rometools.feed.module.yahooweather.types.Units;
|
||||
import org.rometools.feed.module.yahooweather.types.Wind;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.sun.syndication.feed.module.Module;
|
||||
import com.sun.syndication.io.ModuleParser;
|
||||
|
@ -68,16 +69,14 @@ import com.sun.syndication.io.ModuleParser;
|
|||
* @author <a href="mailto:cooper@screaming-penguin.com">Robert "kebernet" Cooper</a>
|
||||
*/
|
||||
public class WeatherModuleParser implements ModuleParser {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(WeatherModuleParser.class);
|
||||
|
||||
private static final SimpleDateFormat TIME_ONLY = new SimpleDateFormat("h:mm a");
|
||||
private static final SimpleDateFormat LONG_DATE = new SimpleDateFormat("EEE, d MMM yyyy h:mm a zzz");
|
||||
private static final SimpleDateFormat SHORT_DATE = new SimpleDateFormat("d MMM yyyy");
|
||||
private static final Namespace NS = Namespace.getNamespace(YWeatherModule.URI);
|
||||
|
||||
/** Creates a new instance of SlashModuleParser */
|
||||
public WeatherModuleParser() {
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getNamespaceUri() {
|
||||
return YWeatherModule.URI;
|
||||
|
@ -109,7 +108,7 @@ public class WeatherModuleParser implements ModuleParser {
|
|||
Integer.parseInt(wind.getAttributeValue("speed")));
|
||||
module.setWind(w);
|
||||
} catch (final NumberFormatException nfe) {
|
||||
Logger.getAnonymousLogger().warning("NumberFormatException processing <wind> tag.");
|
||||
LOG.warn("NumberFormatException processing <wind> tag.", nfe);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -122,7 +121,7 @@ public class WeatherModuleParser implements ModuleParser {
|
|||
Atmosphere.PressureChange.fromCode(Integer.parseInt(atmosphere.getAttributeValue("rising"))));
|
||||
module.setAtmosphere(a);
|
||||
} catch (final NumberFormatException nfe) {
|
||||
Logger.getAnonymousLogger().warning("NumberFormatException processing <atmosphere> tag.");
|
||||
LOG.warn("NumberFormatException processing <atmosphere> tag.", nfe);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -134,7 +133,7 @@ public class WeatherModuleParser implements ModuleParser {
|
|||
TIME_ONLY.parse(astronomy.getAttributeValue("sunset").replaceAll("am", "AM").replaceAll("pm", "PM")));
|
||||
module.setAstronomy(a);
|
||||
} catch (final ParseException pe) {
|
||||
Logger.getAnonymousLogger().warning("ParseException processing <astronomy> tag.");
|
||||
LOG.warn("ParseException processing <astronomy> tag.", pe);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -147,9 +146,9 @@ public class WeatherModuleParser implements ModuleParser {
|
|||
.getAttributeValue("date").replaceAll("pm", "PM").replaceAll("am", "AM")));
|
||||
module.setCondition(c);
|
||||
} catch (final NumberFormatException nfe) {
|
||||
Logger.getAnonymousLogger().warning("NumberFormatException processing <condition> tag.");
|
||||
LOG.warn("NumberFormatException processing <condition> tag.", nfe);
|
||||
} catch (final ParseException pe) {
|
||||
Logger.getAnonymousLogger().warning("ParseException processing <condition> tag.");
|
||||
LOG.warn("ParseException processing <condition> tag.", pe);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -167,9 +166,9 @@ public class WeatherModuleParser implements ModuleParser {
|
|||
.getAttributeValue("low")), Integer.parseInt(forecast.getAttributeValue("high")), forecast.getAttributeValue("text"),
|
||||
ConditionCode.fromCode(Integer.parseInt(forecast.getAttributeValue("code"))));
|
||||
} catch (final NumberFormatException nfe) {
|
||||
Logger.getAnonymousLogger().warning("NumberFormatException processing <forecast> tag.");
|
||||
LOG.warn("NumberFormatException processing <forecast> tag.", nfe);
|
||||
} catch (final ParseException pe) {
|
||||
Logger.getAnonymousLogger().warning("ParseException processing <forecast> tag.");
|
||||
LOG.warn("ParseException processing <forecast> tag.", pe);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -13,6 +13,8 @@ import junit.framework.Test;
|
|||
import junit.framework.TestSuite;
|
||||
|
||||
import org.rometools.feed.module.itunes.AbstractITunesObject;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.sun.syndication.feed.synd.SyndEntry;
|
||||
import com.sun.syndication.feed.synd.SyndFeed;
|
||||
|
@ -26,6 +28,8 @@ import com.sun.syndication.io.XmlReader;
|
|||
*/
|
||||
public class ITunesGeneratorTest extends AbstractTestCase {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(ITunesGeneratorTest.class);
|
||||
|
||||
public ITunesGeneratorTest(final String testName) {
|
||||
super(testName);
|
||||
}
|
||||
|
@ -40,7 +44,7 @@ public class ITunesGeneratorTest extends AbstractTestCase {
|
|||
* Test of generate method, of class com.totsp.xml.syndication.itunes.ITunesGenerator.
|
||||
*/
|
||||
public void testEndToEnd() throws Exception {
|
||||
System.out.println("testEndToEnd");
|
||||
LOG.debug("testEndToEnd");
|
||||
testFile("xml/leshow.xml");
|
||||
|
||||
// testFile( "/test/xml/apple.xml" );
|
||||
|
@ -57,7 +61,7 @@ public class ITunesGeneratorTest extends AbstractTestCase {
|
|||
output.output(syndfeed, outfeed);
|
||||
|
||||
final SyndFeed syndCheck = input.build(new XmlReader(outfeed.toURI().toURL()));
|
||||
System.out.println(syndCheck.getModule(AbstractITunesObject.URI).toString());
|
||||
LOG.debug(syndCheck.getModule(AbstractITunesObject.URI).toString());
|
||||
assertEquals("Feed Level: ", syndfeed.getModule(AbstractITunesObject.URI).toString(), syndCheck.getModule(AbstractITunesObject.URI).toString());
|
||||
|
||||
final List<SyndEntry> syndEntries = syndfeed.getEntries();
|
||||
|
@ -66,8 +70,8 @@ public class ITunesGeneratorTest extends AbstractTestCase {
|
|||
for (int i = 0; i < syndEntries.size(); i++) {
|
||||
final SyndEntry entry = syndEntries.get(i);
|
||||
final SyndEntry check = syndChecks.get(i);
|
||||
System.out.println("Original: " + entry.getModule(AbstractITunesObject.URI));
|
||||
System.out.println("Check: " + check.getModule(AbstractITunesObject.URI));
|
||||
LOG.debug("Original: {}", entry.getModule(AbstractITunesObject.URI));
|
||||
LOG.debug("Check: {}", check.getModule(AbstractITunesObject.URI));
|
||||
assertEquals("Entry Level: ", entry.getModule(AbstractITunesObject.URI).toString(), check.getModule(AbstractITunesObject.URI).toString());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,6 +16,8 @@ import junit.framework.Test;
|
|||
import junit.framework.TestSuite;
|
||||
|
||||
import org.rometools.feed.module.mediarss.MediaModule;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.sun.syndication.feed.synd.SyndEntry;
|
||||
import com.sun.syndication.feed.synd.SyndFeed;
|
||||
|
@ -28,6 +30,8 @@ import com.sun.syndication.io.SyndFeedOutput;
|
|||
*/
|
||||
public class MediaModuleTest extends AbstractTestCase {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(MediaModuleTest.class);
|
||||
|
||||
public MediaModuleTest(final String testName) {
|
||||
super(testName);
|
||||
}
|
||||
|
@ -49,7 +53,7 @@ public class MediaModuleTest extends AbstractTestCase {
|
|||
final SyndFeed feed = input.build(files[j]);
|
||||
final List<SyndEntry> entries = feed.getEntries();
|
||||
for (int i = 0; i < entries.size(); i++) {
|
||||
System.out.println(entries.get(i).getModule(MediaModule.URI));
|
||||
LOG.debug("{}", entries.get(i).getModule(MediaModule.URI));
|
||||
}
|
||||
final SyndFeedOutput output = new SyndFeedOutput();
|
||||
output.output(feed, new File("target/" + j + "media.xml"));
|
||||
|
@ -85,20 +89,18 @@ public class MediaModuleTest extends AbstractTestCase {
|
|||
* while (li.hasNext()) { item = (Item)li.next(); enc =
|
||||
* (Enclosure)item.getEnclosures().get(0); mModule =
|
||||
* (MediaModule)item.getModule(MediaModule.URI); List modules = item.getModules();
|
||||
* System.out.println("title: " + item.getTitle()); System.out.println("module count: " +
|
||||
* modules.size()); if (mModule != null) { Thumbnail[] mThumbs =
|
||||
* mModule.getMediaThumbnails(); if (mThumbs != null) { for (int i = 0; i < mThumbs.length;
|
||||
* i++) { String imgUrl = mThumbs[i].getUrl(); System.out.println("got MediaModule img " + i
|
||||
* + ": " + imgUrl); } } System.out.println("MediaModule title: " + mModule.getTitle());
|
||||
* System.out.println("MediaModule isAdult: " + mModule.isAdult()); /* if
|
||||
* (mModule.getMediaContent() != null) { for (int i = 0; i <
|
||||
* LOG.debug("title: " + item.getTitle()); LOG.debug("module count: " + modules.size()); if
|
||||
* (mModule != null) { Thumbnail[] mThumbs = mModule.getMediaThumbnails(); if (mThumbs !=
|
||||
* null) { for (int i = 0; i < mThumbs.length; i++) { String imgUrl = mThumbs[i].getUrl();
|
||||
* LOG.debug("got MediaModule img " + i + ": " + imgUrl); } }
|
||||
* LOG.debug("MediaModule title: " + mModule.getTitle()); LOG.debug("MediaModule isAdult: "
|
||||
* + mModule.isAdult()); /* if (mModule.getMediaContent() != null) { for (int i = 0; i <
|
||||
* mModule.getMediaContent().length; i++) { MediaContent mc = mModule.getMediaContent()[i];
|
||||
* mThumbs = mc.getMediaThumbnails(); if (mThumbs != null) { for (int n = 0; n <
|
||||
* mThumbs.length; n++) { String imgUrl = mThumbs[n].getUrl();
|
||||
* System.out.println("got MediaContentImage " + n + " img: " + imgUrl); } }
|
||||
* System.out.println("MediaContent title:" + mc.getTitle());
|
||||
* System.out.println("MediaContent text:" + mc.getText()); } } } else {
|
||||
* System.out.println("no MediaModule!"); } }
|
||||
* LOG.debug("got MediaContentImage " + n + " img: " + imgUrl); } }
|
||||
* LOG.debug("MediaContent title:" + mc.getTitle()); LOG.debug("MediaContent text:" +
|
||||
* mc.getText()); } } } else { LOG.debug("no MediaModule!"); } }
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,12 +19,17 @@ package org.rometools.feed.module.activitystreams.types;
|
|||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author robert.cooper
|
||||
*/
|
||||
public class VerbTest extends TestCase {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(VerbTest.class);
|
||||
|
||||
public VerbTest(final String testName) {
|
||||
super(testName);
|
||||
}
|
||||
|
@ -43,7 +48,7 @@ public class VerbTest extends TestCase {
|
|||
* Test of valueOf method, of class Verb.
|
||||
*/
|
||||
public void testValueOf() {
|
||||
System.out.println("valueOf");
|
||||
LOG.debug("valueOf");
|
||||
final String fav = Verb.MARK_AS_FAVORITE.toString();
|
||||
assertEquals("http://activitystrea.ms/schema/1.0/favorite", fav);
|
||||
assertEquals(Verb.MARK_AS_FAVORITE, Verb.fromIRI(fav));
|
||||
|
|
|
@ -18,6 +18,8 @@ import org.junit.Assert;
|
|||
import org.rometools.feed.module.AbstractTestCase;
|
||||
import org.rometools.feed.module.base.CustomTag;
|
||||
import org.rometools.feed.module.base.CustomTags;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.sun.syndication.feed.synd.SyndEntry;
|
||||
import com.sun.syndication.feed.synd.SyndFeed;
|
||||
|
@ -30,6 +32,8 @@ import com.sun.syndication.io.SyndFeedOutput;
|
|||
*/
|
||||
public class CustomTagGeneratorTest extends AbstractTestCase {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(CustomTagGeneratorTest.class);
|
||||
|
||||
public CustomTagGeneratorTest(final String testName) {
|
||||
super(testName);
|
||||
}
|
||||
|
@ -61,8 +65,8 @@ public class CustomTagGeneratorTest extends AbstractTestCase {
|
|||
while (it.hasNext()) {
|
||||
final CustomTag tag = it.next();
|
||||
final CustomTag tag2 = it2.next();
|
||||
System.out.println("tag1:" + tag);
|
||||
System.out.println("tag2:" + tag2);
|
||||
LOG.debug("tag1: {}", tag);
|
||||
LOG.debug("tag2: {}", tag2);
|
||||
Assert.assertEquals(tag, tag2);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,6 +25,8 @@ import org.rometools.feed.module.base.CustomTags;
|
|||
import org.rometools.feed.module.base.types.DateTimeRange;
|
||||
import org.rometools.feed.module.base.types.FloatUnit;
|
||||
import org.rometools.feed.module.base.types.IntUnit;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.sun.syndication.feed.synd.SyndEntry;
|
||||
import com.sun.syndication.feed.synd.SyndFeed;
|
||||
|
@ -36,6 +38,8 @@ import com.sun.syndication.io.SyndFeedInput;
|
|||
*/
|
||||
public class CustomTagParserTest extends AbstractTestCase {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(CustomTagParserTest.class);
|
||||
|
||||
public CustomTagParserTest(final String testName) {
|
||||
super(testName);
|
||||
}
|
||||
|
@ -56,7 +60,7 @@ public class CustomTagParserTest extends AbstractTestCase {
|
|||
final Iterator<CustomTag> it = customTags.getValues().iterator();
|
||||
while (it.hasNext()) {
|
||||
final CustomTag tag = it.next();
|
||||
System.out.println(tag);
|
||||
LOG.debug("{}", tag);
|
||||
if (tag.getName().equals("language_skills")) {
|
||||
Assert.assertEquals("Fluent in English and German", tag.getValue());
|
||||
}
|
||||
|
|
|
@ -19,6 +19,8 @@ import org.rometools.feed.module.base.GoogleBase;
|
|||
import org.rometools.feed.module.base.GoogleBaseImpl;
|
||||
import org.rometools.feed.module.base.Product;
|
||||
import org.rometools.feed.module.base.Vehicle;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.sun.syndication.feed.synd.SyndContent;
|
||||
import com.sun.syndication.feed.synd.SyndContentImpl;
|
||||
|
@ -35,6 +37,8 @@ import com.sun.syndication.io.SyndFeedOutput;
|
|||
*/
|
||||
public class GoogleBaseGeneratorTest extends AbstractTestCase {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(GoogleBaseGeneratorTest.class);
|
||||
|
||||
public GoogleBaseGeneratorTest(final String testName) {
|
||||
super(testName);
|
||||
}
|
||||
|
@ -49,7 +53,7 @@ public class GoogleBaseGeneratorTest extends AbstractTestCase {
|
|||
* Test of generate method, of class com.totsp.xml.syndication.base.io.GoogleBaseGenerator.
|
||||
*/
|
||||
public void testGenerate() throws Exception {
|
||||
System.out.println("testGenerate");
|
||||
LOG.debug("testGenerate");
|
||||
final SyndFeedInput input = new SyndFeedInput();
|
||||
final SyndFeedOutput output = new SyndFeedOutput();
|
||||
final File testDir = new File(super.getTestFile("xml"));
|
||||
|
@ -58,7 +62,7 @@ public class GoogleBaseGeneratorTest extends AbstractTestCase {
|
|||
if (!testFiles[h].getName().endsWith(".xml")) {
|
||||
continue;
|
||||
}
|
||||
System.out.println(testFiles[h].getName());
|
||||
LOG.debug(testFiles[h].getName());
|
||||
final SyndFeed feed = input.build(testFiles[h]);
|
||||
try {
|
||||
output.output(feed, new File("target/" + testFiles[h].getName()));
|
||||
|
@ -109,7 +113,7 @@ public class GoogleBaseGeneratorTest extends AbstractTestCase {
|
|||
feed.setEntries(entries);
|
||||
|
||||
final SyndFeedOutput output = new SyndFeedOutput();
|
||||
System.out.println(output.outputString(feed));
|
||||
LOG.debug(output.outputString(feed));
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,6 +36,8 @@ import org.rometools.feed.module.base.types.GenderEnumeration;
|
|||
import org.rometools.feed.module.base.types.PaymentTypeEnumeration;
|
||||
import org.rometools.feed.module.base.types.PriceTypeEnumeration;
|
||||
import org.rometools.feed.module.base.types.ShippingType;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.sun.syndication.feed.synd.SyndEntry;
|
||||
import com.sun.syndication.feed.synd.SyndFeed;
|
||||
|
@ -47,6 +49,8 @@ import com.sun.syndication.io.SyndFeedInput;
|
|||
*/
|
||||
public class GoogleBaseParserTest extends AbstractTestCase {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(GoogleBaseParserTest.class);
|
||||
|
||||
public GoogleBaseParserTest(final String testName) {
|
||||
super(testName);
|
||||
}
|
||||
|
@ -62,7 +66,7 @@ public class GoogleBaseParserTest extends AbstractTestCase {
|
|||
*/
|
||||
public void testQuickParse() throws Exception {
|
||||
try {
|
||||
System.out.println("testParse");
|
||||
LOG.debug("testParse");
|
||||
final SyndFeedInput input = new SyndFeedInput();
|
||||
final File testDir = new File(super.getTestFile("xml"));
|
||||
final File[] testFiles = testDir.listFiles();
|
||||
|
@ -79,13 +83,13 @@ public class GoogleBaseParserTest extends AbstractTestCase {
|
|||
final List<SyndEntry> entries = feed.getEntries();
|
||||
for (int i = 0; i < entries.size(); i++) {
|
||||
final SyndEntry entry = entries.get(i);
|
||||
System.out.println(entry.getModules().size());
|
||||
LOG.debug("{}", entry.getModules().size());
|
||||
for (int j = 0; j < entry.getModules().size(); j++) {
|
||||
System.out.println(entry.getModules().get(j).getClass());
|
||||
LOG.debug("{}", entry.getModules().get(j).getClass());
|
||||
if (entry.getModules().get(j) instanceof GoogleBase) {
|
||||
final GoogleBase base = (GoogleBase) entry.getModules().get(j);
|
||||
System.out.println(testFiles[h].getName());
|
||||
System.out.println(super.beanToString(base, false));
|
||||
LOG.debug(testFiles[h].getName());
|
||||
LOG.debug(super.beanToString(base, false));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -100,7 +104,7 @@ public class GoogleBaseParserTest extends AbstractTestCase {
|
|||
* Test of parse method, of class com.totsp.xml.syndication.base.io.GoogleBaseParser.
|
||||
*/
|
||||
public void testCourse2Parse() throws Exception {
|
||||
System.out.println("testCourse2Parse");
|
||||
LOG.debug("testCourse2Parse");
|
||||
final SyndFeedInput input = new SyndFeedInput();
|
||||
|
||||
final SyndFeed feed = input.build(new File(super.getTestFile("xml/courses2.xml")));
|
||||
|
@ -146,7 +150,7 @@ public class GoogleBaseParserTest extends AbstractTestCase {
|
|||
* Test of parse method, of class com.totsp.xml.syndication.base.io.GoogleBaseParser.
|
||||
*/
|
||||
public void testEvent2Parse() throws Exception {
|
||||
System.out.println("testEvent2Parse");
|
||||
LOG.debug("testEvent2Parse");
|
||||
final SyndFeedInput input = new SyndFeedInput();
|
||||
|
||||
final SyndFeed feed = input.build(new File(super.getTestFile("xml/events2.xml")));
|
||||
|
@ -216,7 +220,7 @@ public class GoogleBaseParserTest extends AbstractTestCase {
|
|||
* Test of parse method, of class com.totsp.xml.syndication.base.io.GoogleBaseParser.
|
||||
*/
|
||||
public void testHousing2Parse() throws Exception {
|
||||
System.out.println("testHousing2Parse");
|
||||
LOG.debug("testHousing2Parse");
|
||||
final SyndFeedInput input = new SyndFeedInput();
|
||||
final Calendar cal = Calendar.getInstance();
|
||||
cal.setTimeInMillis(0);
|
||||
|
@ -280,7 +284,7 @@ public class GoogleBaseParserTest extends AbstractTestCase {
|
|||
* Test of parse method, of class com.totsp.xml.syndication.base.io.GoogleBaseParser.
|
||||
*/
|
||||
public void testJobs2Parse() throws Exception {
|
||||
System.out.println("testJobs2Parse");
|
||||
LOG.debug("testJobs2Parse");
|
||||
final SyndFeedInput input = new SyndFeedInput();
|
||||
final Calendar cal = Calendar.getInstance();
|
||||
cal.setTimeInMillis(0);
|
||||
|
@ -295,7 +299,7 @@ public class GoogleBaseParserTest extends AbstractTestCase {
|
|||
this.assertEquals("Industriy", new String[] { "Internet" }, module.getJobIndustries());
|
||||
Assert.assertEquals("Employer", "Google, Inc", module.getEmployer());
|
||||
this.assertEquals("Job Function", new String[] { "Google Coordinator" }, module.getJobFunctions());
|
||||
System.out.println(module.getJobTypes());
|
||||
LOG.debug("{}", module.getJobTypes());
|
||||
this.assertEquals("Job Type", new String[] { "full-time" }, module.getJobTypes());
|
||||
Assert.assertEquals("Currency", CurrencyEnumeration.USD, module.getCurrency());
|
||||
Assert.assertEquals("Salary", new Float(40000), module.getSalary());
|
||||
|
@ -310,7 +314,7 @@ public class GoogleBaseParserTest extends AbstractTestCase {
|
|||
* Test of parse method, of class com.totsp.xml.syndication.base.io.GoogleBaseParser.
|
||||
*/
|
||||
public void testNews2Parse() throws Exception {
|
||||
System.out.println("testNews2Parse");
|
||||
LOG.debug("testNews2Parse");
|
||||
final SyndFeedInput input = new SyndFeedInput();
|
||||
final Calendar cal = Calendar.getInstance();
|
||||
cal.setTimeInMillis(0);
|
||||
|
@ -334,7 +338,7 @@ public class GoogleBaseParserTest extends AbstractTestCase {
|
|||
* Test of parse method, of class com.totsp.xml.syndication.base.io.GoogleBaseParser.
|
||||
*/
|
||||
public void testTravel2Parse() throws Exception {
|
||||
System.out.println("testTravel2Parse");
|
||||
LOG.debug("testTravel2Parse");
|
||||
final SyndFeedInput input = new SyndFeedInput();
|
||||
final Calendar cal = Calendar.getInstance();
|
||||
cal.setTimeInMillis(0);
|
||||
|
@ -372,7 +376,7 @@ public class GoogleBaseParserTest extends AbstractTestCase {
|
|||
* Test of parse method, of class com.totsp.xml.syndication.base.io.GoogleBaseParser.
|
||||
*/
|
||||
public void testPersona2Parse() throws Exception {
|
||||
System.out.println("testPerson2Parse");
|
||||
LOG.debug("testPerson2Parse");
|
||||
final SyndFeedInput input = new SyndFeedInput();
|
||||
final Calendar cal = Calendar.getInstance();
|
||||
cal.setTimeInMillis(0);
|
||||
|
@ -400,7 +404,7 @@ public class GoogleBaseParserTest extends AbstractTestCase {
|
|||
* Test of parse method, of class com.totsp.xml.syndication.base.io.GoogleBaseParser.
|
||||
*/
|
||||
public void testProduct2Parse() throws Exception {
|
||||
System.out.println("testProduct2Parse");
|
||||
LOG.debug("testProduct2Parse");
|
||||
final SyndFeedInput input = new SyndFeedInput();
|
||||
final Calendar cal = Calendar.getInstance();
|
||||
cal.setTimeInMillis(0);
|
||||
|
@ -423,7 +427,7 @@ public class GoogleBaseParserTest extends AbstractTestCase {
|
|||
Assert.assertEquals("Manufacturer", "Google", module.getManufacturer());
|
||||
Assert.assertEquals("ManufacturerId", "2325", module.getManufacturerId());
|
||||
Assert.assertEquals("Model number", "234", module.getModelNumber());
|
||||
System.out.println(module.getSize());
|
||||
LOG.debug("{}", module.getSize());
|
||||
Assert.assertEquals("Size", 10, module.getSize().getLength().getValue(), 0);
|
||||
Assert.assertEquals("Size", 50, module.getSize().getWidth().getValue(), 0);
|
||||
Assert.assertEquals("Size", 20, module.getSize().getHeight().getValue(), 0);
|
||||
|
@ -439,7 +443,7 @@ public class GoogleBaseParserTest extends AbstractTestCase {
|
|||
* Test of parse method, of class com.totsp.xml.syndication.base.io.GoogleBaseParser.
|
||||
*/
|
||||
public void testResearch2Parse() throws Exception {
|
||||
System.out.println("testResearch2Parse");
|
||||
LOG.debug("testResearch2Parse");
|
||||
final SyndFeedInput input = new SyndFeedInput();
|
||||
final Calendar cal = Calendar.getInstance();
|
||||
cal.setTimeInMillis(0);
|
||||
|
@ -463,7 +467,7 @@ public class GoogleBaseParserTest extends AbstractTestCase {
|
|||
* Test of parse method, of class com.totsp.xml.syndication.base.io.GoogleBaseParser.
|
||||
*/
|
||||
public void testReview2Parse() throws Exception {
|
||||
System.out.println("testReview2Parse");
|
||||
LOG.debug("testReview2Parse");
|
||||
final SyndFeedInput input = new SyndFeedInput();
|
||||
final Calendar cal = Calendar.getInstance();
|
||||
cal.setTimeInMillis(0);
|
||||
|
@ -490,7 +494,7 @@ public class GoogleBaseParserTest extends AbstractTestCase {
|
|||
* Test of parse method, of class com.totsp.xml.syndication.base.io.GoogleBaseParser.
|
||||
*/
|
||||
public void testService2Parse() throws Exception {
|
||||
System.out.println("testService2Parse");
|
||||
LOG.debug("testService2Parse");
|
||||
final SyndFeedInput input = new SyndFeedInput();
|
||||
final Calendar cal = Calendar.getInstance();
|
||||
cal.setTimeInMillis(0);
|
||||
|
@ -520,7 +524,7 @@ public class GoogleBaseParserTest extends AbstractTestCase {
|
|||
* Test of parse method, of class com.totsp.xml.syndication.base.io.GoogleBaseParser.
|
||||
*/
|
||||
public void testVehicle2Parse() throws Exception {
|
||||
System.out.println("testVehicle2Parse");
|
||||
LOG.debug("testVehicle2Parse");
|
||||
final SyndFeedInput input = new SyndFeedInput();
|
||||
final Calendar cal = Calendar.getInstance();
|
||||
cal.setTimeInMillis(0);
|
||||
|
@ -554,7 +558,7 @@ public class GoogleBaseParserTest extends AbstractTestCase {
|
|||
* Test of parse method, of class com.totsp.xml.syndication.base.io.GoogleBaseParser.
|
||||
*/
|
||||
public void testWanted2Parse() throws Exception {
|
||||
System.out.println("testVehicle2Parse");
|
||||
LOG.debug("testVehicle2Parse");
|
||||
final SyndFeedInput input = new SyndFeedInput();
|
||||
final Calendar cal = Calendar.getInstance();
|
||||
cal.setTimeInMillis(0);
|
||||
|
@ -573,7 +577,7 @@ public class GoogleBaseParserTest extends AbstractTestCase {
|
|||
* Test of getNamespaceUri method, of class com.totsp.xml.syndication.base.io.GoogleBaseParser.
|
||||
*/
|
||||
public void testGetNamespaceUri() {
|
||||
System.out.println("testGetNamespaceUri");
|
||||
System.out.println(new GoogleBaseParser().getNamespaceUri());
|
||||
LOG.debug("testGetNamespaceUri");
|
||||
LOG.debug(new GoogleBaseParser().getNamespaceUri());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,12 +11,17 @@ import junit.framework.Test;
|
|||
import junit.framework.TestCase;
|
||||
import junit.framework.TestSuite;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author rcooper
|
||||
*/
|
||||
public class FloatUnitTest extends TestCase {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(FloatUnitTest.class);
|
||||
|
||||
public FloatUnitTest(final String testName) {
|
||||
super(testName);
|
||||
}
|
||||
|
@ -31,7 +36,7 @@ public class FloatUnitTest extends TestCase {
|
|||
* Test of getUnits method, of class com.totsp.xml.syndication.base.types.FloatUnit.
|
||||
*/
|
||||
public void testFloatUnit() {
|
||||
System.out.println("testFloatUnit");
|
||||
LOG.debug("testFloatUnit");
|
||||
FloatUnit fu = new FloatUnit("1.22km");
|
||||
|
||||
assertEquals((float) 1.22, fu.getValue(), 0);
|
||||
|
|
|
@ -11,12 +11,18 @@ import junit.framework.Test;
|
|||
import junit.framework.TestCase;
|
||||
import junit.framework.TestSuite;
|
||||
|
||||
import org.rometools.feed.module.cc.io.CCModuleGenerator;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author rcooper
|
||||
*/
|
||||
public class IntUnitTest extends TestCase {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(CCModuleGenerator.class);
|
||||
|
||||
public IntUnitTest(final String testName) {
|
||||
super(testName);
|
||||
}
|
||||
|
@ -31,7 +37,7 @@ public class IntUnitTest extends TestCase {
|
|||
* Test of getUnits method, of class com.totsp.xml.syndication.base.types.IntUnit.
|
||||
*/
|
||||
public void testIntUnit() {
|
||||
System.out.println("testIntUnit");
|
||||
LOG.debug("testIntUnit");
|
||||
IntUnit fu = new IntUnit("1km");
|
||||
|
||||
assertEquals(1, fu.getValue());
|
||||
|
|
|
@ -14,6 +14,8 @@ import junit.framework.TestSuite;
|
|||
|
||||
import org.rometools.feed.module.AbstractTestCase;
|
||||
import org.rometools.feed.module.cc.CreativeCommons;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.sun.syndication.feed.synd.SyndEntry;
|
||||
import com.sun.syndication.feed.synd.SyndFeed;
|
||||
|
@ -26,6 +28,8 @@ import com.sun.syndication.io.SyndFeedOutput;
|
|||
*/
|
||||
public class CCModuleGeneratorTest extends AbstractTestCase {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(CCModuleGeneratorTest.class);
|
||||
|
||||
public CCModuleGeneratorTest(final String testName) {
|
||||
super(testName);
|
||||
}
|
||||
|
@ -37,7 +41,7 @@ public class CCModuleGeneratorTest extends AbstractTestCase {
|
|||
}
|
||||
|
||||
public void testGenerate() throws Exception {
|
||||
System.out.println("testGenerate");
|
||||
LOG.debug("testGenerate");
|
||||
final SyndFeedInput input = new SyndFeedInput();
|
||||
final SyndFeedOutput output = new SyndFeedOutput();
|
||||
final File testDir = new File(super.getTestFile("xml"));
|
||||
|
@ -46,7 +50,7 @@ public class CCModuleGeneratorTest extends AbstractTestCase {
|
|||
if (!testFiles[h].getName().endsWith(".xml")) {
|
||||
continue;
|
||||
}
|
||||
System.out.println(testFiles[h].getName());
|
||||
LOG.debug(testFiles[h].getName());
|
||||
final SyndFeed feed = input.build(testFiles[h]);
|
||||
// if( !feed.getFeedType().equals("rss_1.0"))
|
||||
{
|
||||
|
@ -64,7 +68,7 @@ public class CCModuleGeneratorTest extends AbstractTestCase {
|
|||
// final CreativeCommons base = (CreativeCommons)
|
||||
// entry.getModule(CreativeCommons.URI);
|
||||
final CreativeCommons base2 = (CreativeCommons) entry2.getModule(CreativeCommons.URI);
|
||||
System.out.println(base2);
|
||||
LOG.debug("{}", base2);
|
||||
// FIXME
|
||||
// if( base != null)
|
||||
// this.assertEquals( testFiles[h].getName(), base.getLicenses(),
|
||||
|
|
|
@ -15,6 +15,8 @@ import junit.framework.TestSuite;
|
|||
|
||||
import org.rometools.feed.module.AbstractTestCase;
|
||||
import org.rometools.feed.module.cc.CreativeCommons;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.sun.syndication.feed.synd.SyndEntry;
|
||||
import com.sun.syndication.feed.synd.SyndFeed;
|
||||
|
@ -26,6 +28,8 @@ import com.sun.syndication.io.SyndFeedInput;
|
|||
*/
|
||||
public class ModuleParserTest extends AbstractTestCase {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(ModuleParserTest.class);
|
||||
|
||||
public ModuleParserTest(final String testName) {
|
||||
super(testName);
|
||||
}
|
||||
|
@ -49,16 +53,16 @@ public class ModuleParserTest extends AbstractTestCase {
|
|||
if (!testFiles[h].getName().endsWith(".xml")) {
|
||||
continue;
|
||||
}
|
||||
System.out.println(testFiles[h].getName());
|
||||
LOG.debug(testFiles[h].getName());
|
||||
final SyndFeed feed = input.build(testFiles[h]);
|
||||
final List<SyndEntry> entries = feed.getEntries();
|
||||
final CreativeCommons fMod = (CreativeCommons) feed.getModule(CreativeCommons.URI);
|
||||
System.out.println(fMod);
|
||||
LOG.debug("{}", fMod);
|
||||
for (int i = 0; i < entries.size(); i++) {
|
||||
final SyndEntry entry = entries.get(i);
|
||||
final CreativeCommons eMod = (CreativeCommons) entry.getModule(CreativeCommons.URI);
|
||||
System.out.println("\nEntry:");
|
||||
System.out.println(eMod);
|
||||
LOG.debug("\nEntry:");
|
||||
LOG.debug("{}", eMod);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,6 +9,9 @@ package org.rometools.feed.module.content;
|
|||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* This is all standard property storage testing.
|
||||
*
|
||||
|
@ -16,6 +19,8 @@ import junit.framework.TestCase;
|
|||
*/
|
||||
public class ContentItemTest extends TestCase {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(ContentItemTest.class);
|
||||
|
||||
private final ContentItem item = new ContentItem();
|
||||
|
||||
public ContentItemTest(final String testName) {
|
||||
|
@ -40,7 +45,7 @@ public class ContentItemTest extends TestCase {
|
|||
* Test of ContentFormat method, of class com.totsp.xml.syndication.content.ContentItem.
|
||||
*/
|
||||
public void testContentFormat() {
|
||||
System.out.println("testContentFormat");
|
||||
LOG.debug("testContentFormat");
|
||||
final String test = "application/xhtml";
|
||||
item.setContentFormat(test);
|
||||
assertTrue(item.getContentFormat().equals(test));
|
||||
|
@ -50,7 +55,7 @@ public class ContentItemTest extends TestCase {
|
|||
* Test of ContentEncoding method, of class com.totsp.xml.syndication.content.ContentItem.
|
||||
*/
|
||||
public void testContentEncoding() {
|
||||
System.out.println("testContentEncoding");
|
||||
LOG.debug("testContentEncoding");
|
||||
final String test = "http://www.w3.org/TR/REC-xml#dt-wellformed";
|
||||
|
||||
item.setContentFormat(test);
|
||||
|
@ -61,7 +66,7 @@ public class ContentItemTest extends TestCase {
|
|||
* Test of ContentValue method, of class com.totsp.xml.syndication.content.ContentItem.
|
||||
*/
|
||||
public void testContentValue() {
|
||||
System.out.println("testContentValue");
|
||||
LOG.debug("testContentValue");
|
||||
final String test = "<em>This is<strong>very</em> cool</strong>.";
|
||||
|
||||
item.setContentFormat(test);
|
||||
|
@ -72,7 +77,7 @@ public class ContentItemTest extends TestCase {
|
|||
* Test of ContentAbout method, of class com.totsp.xml.syndication.content.ContentItem.
|
||||
*/
|
||||
public void testContentAbout() {
|
||||
System.out.println("testContentAbout");
|
||||
LOG.debug("testContentAbout");
|
||||
final String test = "http://example.org/item/content.svg";
|
||||
|
||||
item.setContentFormat(test);
|
||||
|
@ -83,7 +88,7 @@ public class ContentItemTest extends TestCase {
|
|||
* Test of ContentValueParseType method, of class com.totsp.xml.syndication.content.ContentItem.
|
||||
*/
|
||||
public void testContentValueParseType() {
|
||||
System.out.println("testContentValueParseType");
|
||||
LOG.debug("testContentValueParseType");
|
||||
final String test = "Literal";
|
||||
|
||||
item.setContentFormat(test);
|
||||
|
@ -94,7 +99,7 @@ public class ContentItemTest extends TestCase {
|
|||
* Test of ContentValueNamespace method, of class com.totsp.xml.syndication.content.ContentItem.
|
||||
*/
|
||||
public void testContentValueNamespace() {
|
||||
System.out.println("testContentValueNamespace");
|
||||
LOG.debug("testContentValueNamespace");
|
||||
final String test = "http://www.w3.org/1999/xhtml";
|
||||
|
||||
item.setContentFormat(test);
|
||||
|
@ -105,7 +110,7 @@ public class ContentItemTest extends TestCase {
|
|||
* Test of ContentResource method, of class com.totsp.xml.syndication.content.ContentItem.
|
||||
*/
|
||||
public void testContentResource() {
|
||||
System.out.println("testContentResource");
|
||||
LOG.debug("testContentResource");
|
||||
final String test = "http://www.w3.org/2000/svg";
|
||||
|
||||
item.setContentResource(test);
|
||||
|
@ -119,7 +124,7 @@ public class ContentItemTest extends TestCase {
|
|||
* com.totsp.xml.syndication.content.ContentItem.
|
||||
*/
|
||||
public void testEquals() {
|
||||
System.out.println("testEquals");
|
||||
LOG.debug("testEquals");
|
||||
final String test = "http://www.w3.org/2000/svg";
|
||||
|
||||
assertTrue(test.equals(test));
|
||||
|
|
|
@ -7,8 +7,11 @@
|
|||
package org.rometools.feed.module.content;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.StringWriter;
|
||||
|
||||
import org.rometools.feed.module.AbstractTestCase;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.sun.syndication.feed.synd.SyndEntry;
|
||||
import com.sun.syndication.feed.synd.SyndFeed;
|
||||
|
@ -21,6 +24,9 @@ import com.sun.syndication.io.XmlReader;
|
|||
* @author <a href="mailto:cooper@screaming-penguin.com">Robert Cooper</a>
|
||||
*/
|
||||
public class ContentModuleGeneratorTest extends AbstractTestCase {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(ContentModuleGeneratorTest.class);
|
||||
|
||||
public ContentModuleGeneratorTest(final String testName) {
|
||||
super(testName);
|
||||
}
|
||||
|
@ -43,13 +49,18 @@ public class ContentModuleGeneratorTest extends AbstractTestCase {
|
|||
* Test of generate method, of class com.totsp.xml.syndication.content.ContentModuleGenerator.
|
||||
*/
|
||||
public void testGenerate() throws Exception {
|
||||
System.out.println("testGenerate");
|
||||
|
||||
LOG.debug("testGenerate");
|
||||
|
||||
final SyndFeedInput input = new SyndFeedInput();
|
||||
final SyndFeed feed = input.build(new XmlReader(new File(getTestFile("xml/test-rdf.xml")).toURI().toURL()));
|
||||
final SyndEntry entry = feed.getEntries().get(0);
|
||||
entry.getModule(ContentModule.URI);
|
||||
final SyndFeedOutput output = new SyndFeedOutput();
|
||||
output.output(feed, new java.io.PrintWriter(System.out));
|
||||
final StringWriter writer = new StringWriter();
|
||||
output.output(feed, writer);
|
||||
|
||||
LOG.debug("{}", writer);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,12 +12,17 @@ import java.util.List;
|
|||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author <a href="mailto:cooper@screaming-penguin.com">Robert Cooper</a>
|
||||
*/
|
||||
public class ContentModuleImplTest extends TestCase {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(ContentModuleImplTest.class);
|
||||
|
||||
private final ContentModuleImpl module = new ContentModuleImpl();
|
||||
public static ArrayList<ContentItem> contentItems = new ArrayList<ContentItem>();
|
||||
|
||||
|
@ -88,7 +93,7 @@ public class ContentModuleImplTest extends TestCase {
|
|||
* Test of getInterface method, of class com.totsp.xml.syndication.content.ContentModuleImpl.
|
||||
*/
|
||||
public void testInterface() {
|
||||
System.out.println("testInterface");
|
||||
LOG.debug("testInterface");
|
||||
assertTrue(module.getInterface().equals(ContentModule.class));
|
||||
}
|
||||
|
||||
|
@ -96,7 +101,7 @@ public class ContentModuleImplTest extends TestCase {
|
|||
* Test of getContentItems method, of class com.totsp.xml.syndication.content.ContentModuleImpl.
|
||||
*/
|
||||
public void testContentItems() {
|
||||
System.out.println("testContentItems");
|
||||
LOG.debug("testContentItems");
|
||||
module.setContentItems(contentItems);
|
||||
assertTrue(module.getContentItems().equals(contentItems));
|
||||
}
|
||||
|
@ -105,7 +110,7 @@ public class ContentModuleImplTest extends TestCase {
|
|||
* Test of getContents method, of class com.totsp.xml.syndication.content.ContentModuleImpl.
|
||||
*/
|
||||
public void testContents() {
|
||||
System.out.println("testContents");
|
||||
LOG.debug("testContents");
|
||||
final ArrayList<String> contents = new ArrayList<String>();
|
||||
contents.add("Foo");
|
||||
contents.add("Bar");
|
||||
|
@ -119,7 +124,7 @@ public class ContentModuleImplTest extends TestCase {
|
|||
* Test of copyFrom method, of class com.totsp.xml.syndication.content.ContentModuleImpl.
|
||||
*/
|
||||
public void testCopyFrom() {
|
||||
System.out.println("testCopyFrom");
|
||||
LOG.debug("testCopyFrom");
|
||||
final ContentModule test = new ContentModuleImpl();
|
||||
test.copyFrom(module);
|
||||
assertTrue(test.getContentItems().equals(module.getContentItems()) & test.getContents().equals(module.getContents())
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
package org.rometools.feed.module.itunes;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.io.StringWriter;
|
||||
import java.util.List;
|
||||
|
||||
import junit.framework.Test;
|
||||
|
@ -15,6 +15,8 @@ import junit.framework.TestSuite;
|
|||
|
||||
import org.rometools.feed.module.AbstractTestCase;
|
||||
import org.rometools.feed.module.itunes.types.Category;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.sun.syndication.feed.synd.SyndEntry;
|
||||
import com.sun.syndication.feed.synd.SyndFeed;
|
||||
|
@ -28,6 +30,9 @@ import com.sun.syndication.io.XmlReader;
|
|||
* @author cooper
|
||||
*/
|
||||
public class ITunesGeneratorTest extends AbstractTestCase {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(ITunesGeneratorTest.class);
|
||||
|
||||
static final String URI = AbstractITunesObject.URI;
|
||||
|
||||
public ITunesGeneratorTest(final String testName) {
|
||||
|
@ -35,18 +40,15 @@ public class ITunesGeneratorTest extends AbstractTestCase {
|
|||
}
|
||||
|
||||
public static Test suite() {
|
||||
final TestSuite suite = new TestSuite(ITunesGeneratorTest.class);
|
||||
|
||||
return suite;
|
||||
return new TestSuite(ITunesGeneratorTest.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of generate method, of class com.totsp.xml.syndication.itunes.ITunesGenerator.
|
||||
*/
|
||||
public void testEndToEnd() throws Exception {
|
||||
System.out.println("testEndToEnd");
|
||||
LOG.debug("testEndToEnd");
|
||||
testFile("xml/leshow.xml");
|
||||
|
||||
// testFile( "/test/xml/apple.xml" );
|
||||
testFile("xml/lr.xml");
|
||||
}
|
||||
|
@ -61,7 +63,7 @@ public class ITunesGeneratorTest extends AbstractTestCase {
|
|||
output.output(syndfeed, outfeed);
|
||||
|
||||
final SyndFeed syndCheck = input.build(new XmlReader(outfeed.toURI().toURL()));
|
||||
System.out.println(syndCheck.getModule(AbstractITunesObject.URI).toString());
|
||||
LOG.debug(syndCheck.getModule(AbstractITunesObject.URI).toString());
|
||||
assertEquals("Feed Level: ", syndfeed.getModule(AbstractITunesObject.URI).toString(), syndCheck.getModule(AbstractITunesObject.URI).toString());
|
||||
|
||||
final List<SyndEntry> syndEntries = syndfeed.getEntries();
|
||||
|
@ -70,16 +72,17 @@ public class ITunesGeneratorTest extends AbstractTestCase {
|
|||
for (int i = 0; i < syndEntries.size(); i++) {
|
||||
final SyndEntry entry = syndEntries.get(i);
|
||||
final SyndEntry check = syndChecks.get(i);
|
||||
System.out.println("Original: " + entry.getModule(AbstractITunesObject.URI));
|
||||
System.out.println("Check: " + check.getModule(AbstractITunesObject.URI));
|
||||
System.out.println(entry.getModule(AbstractITunesObject.URI).toString());
|
||||
System.out.println("-----------------------------------------");
|
||||
System.out.println(check.getModule(AbstractITunesObject.URI).toString());
|
||||
LOG.debug("Original: " + entry.getModule(AbstractITunesObject.URI));
|
||||
LOG.debug("Check: " + check.getModule(AbstractITunesObject.URI));
|
||||
LOG.debug(entry.getModule(AbstractITunesObject.URI).toString());
|
||||
LOG.debug("-----------------------------------------");
|
||||
LOG.debug(check.getModule(AbstractITunesObject.URI).toString());
|
||||
assertEquals("Entry Level: ", entry.getModule(AbstractITunesObject.URI).toString(), check.getModule(AbstractITunesObject.URI).toString());
|
||||
}
|
||||
}
|
||||
|
||||
public void testCreate() throws Exception {
|
||||
|
||||
final SyndFeed feed = new SyndFeedImpl();
|
||||
final String feedType = "rss_2.0";
|
||||
feed.setFeedType(feedType);
|
||||
|
@ -95,6 +98,9 @@ public class ITunesGeneratorTest extends AbstractTestCase {
|
|||
feed.getModules().add(fi);
|
||||
|
||||
final SyndFeedOutput output = new SyndFeedOutput();
|
||||
output.output(feed, new OutputStreamWriter(System.out));
|
||||
final StringWriter writer = new StringWriter();
|
||||
output.output(feed, writer);
|
||||
LOG.debug("{}", writer);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,6 +15,8 @@ import junit.framework.TestSuite;
|
|||
|
||||
import org.rometools.feed.module.AbstractTestCase;
|
||||
import org.rometools.feed.module.itunes.io.ITunesGenerator;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.sun.syndication.feed.module.Module;
|
||||
import com.sun.syndication.feed.synd.SyndEntry;
|
||||
|
@ -27,6 +29,9 @@ import com.sun.syndication.io.XmlReader;
|
|||
* @author cooper
|
||||
*/
|
||||
public class ITunesParserTest extends AbstractTestCase {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(ITunesParserTest.class);
|
||||
|
||||
public ITunesParserTest(final String testName) {
|
||||
super(testName);
|
||||
}
|
||||
|
@ -49,7 +54,7 @@ public class ITunesParserTest extends AbstractTestCase {
|
|||
* Test of getNamespaceUri method, of class com.totsp.xml.syndication.itunes.ITunesParser.
|
||||
*/
|
||||
public void testGetNamespaceUri() {
|
||||
System.out.println("testGetNamespaceUri");
|
||||
LOG.debug("testGetNamespaceUri");
|
||||
|
||||
assertEquals("Namespace", "http://www.itunes.com/dtds/podcast-1.0.dtd", new ITunesGenerator().getNamespaceUri());
|
||||
}
|
||||
|
@ -80,7 +85,7 @@ public class ITunesParserTest extends AbstractTestCase {
|
|||
while (it.hasNext()) {
|
||||
final SyndEntry entry = it.next();
|
||||
final EntryInformationImpl entryInfo = (EntryInformationImpl) entry.getModule(AbstractITunesObject.URI);
|
||||
System.out.println(entryInfo);
|
||||
LOG.debug("{}", entryInfo);
|
||||
}
|
||||
|
||||
feed = new File(getTestFile("xml/rsr.xml"));
|
||||
|
@ -91,7 +96,8 @@ public class ITunesParserTest extends AbstractTestCase {
|
|||
while (it.hasNext()) {
|
||||
final SyndEntry entry = it.next();
|
||||
final EntryInformationImpl entryInfo = (EntryInformationImpl) entry.getModule(AbstractITunesObject.URI);
|
||||
System.out.println(entryInfo.getDuration());
|
||||
LOG.debug("{}", entryInfo.getDuration());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -25,11 +25,17 @@ import junit.framework.Test;
|
|||
import junit.framework.TestCase;
|
||||
import junit.framework.TestSuite;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author cooper
|
||||
*/
|
||||
public class DurationTest extends TestCase {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(DurationTest.class);
|
||||
|
||||
private final Duration duration = new Duration(2 * Duration.HOUR + 3 * Duration.MINUTE + 20 * Duration.SECOND);
|
||||
private final Duration duration2 = new Duration(12000 * Duration.HOUR + 61 * Duration.MINUTE + 61 * Duration.SECOND);
|
||||
private final Duration duration3 = new Duration("1:20:01");
|
||||
|
@ -60,15 +66,15 @@ public class DurationTest extends TestCase {
|
|||
* Test of toString method, of class com.totsp.xml.syndication.itunes.Duration.
|
||||
*/
|
||||
public void testToString() {
|
||||
System.out.println("testToString");
|
||||
System.out.println(duration.toString());
|
||||
LOG.debug("testToString");
|
||||
LOG.debug(duration.toString());
|
||||
assertEquals("Regular time failed", "02:03:20", duration.toString());
|
||||
System.out.println(duration2.toString());
|
||||
LOG.debug(duration2.toString());
|
||||
assertEquals("Long time failed", "12001:02:01", duration2.toString());
|
||||
}
|
||||
|
||||
public void testGetMilliseconds() {
|
||||
System.out.println("testGetMilliseconds");
|
||||
LOG.debug("testGetMilliseconds");
|
||||
assertEquals("Milliseconds from 3 string constructor", duration3ms, duration3.getMilliseconds());
|
||||
assertEquals("Milliseconds from 2 string constructor", duration4ms, duration4.getMilliseconds());
|
||||
}
|
||||
|
|
|
@ -12,6 +12,8 @@ import junit.framework.TestCase;
|
|||
import junit.framework.TestSuite;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -19,6 +21,8 @@ import org.junit.Assert;
|
|||
*/
|
||||
public class TimeTest extends TestCase {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(TimeTest.class);
|
||||
|
||||
public TimeTest(final String testName) {
|
||||
super(testName);
|
||||
}
|
||||
|
@ -34,11 +38,11 @@ public class TimeTest extends TestCase {
|
|||
*/
|
||||
public void testToString() {
|
||||
final Time t = new Time("12:05:35.3");
|
||||
System.out.println(t);
|
||||
LOG.debug("{}", t);
|
||||
final Time t2 = new Time(t.toString());
|
||||
Assert.assertEquals(t.toString(), t2.toString());
|
||||
System.out.println(t2);
|
||||
System.out.println(new Time("3:54.00001").toString());
|
||||
LOG.debug("{}", t2);
|
||||
LOG.debug(new Time("3:54.00001").toString());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -15,6 +15,8 @@ import junit.framework.TestSuite;
|
|||
|
||||
import org.rometools.feed.module.AbstractTestCase;
|
||||
import org.rometools.feed.module.photocast.PhotocastModule;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.sun.syndication.feed.synd.SyndEntry;
|
||||
import com.sun.syndication.feed.synd.SyndFeed;
|
||||
|
@ -27,6 +29,8 @@ import com.sun.syndication.io.SyndFeedOutput;
|
|||
*/
|
||||
public class GeneratorTest extends AbstractTestCase {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(GeneratorTest.class);
|
||||
|
||||
public GeneratorTest(final String testName) {
|
||||
super(testName);
|
||||
}
|
||||
|
@ -46,7 +50,7 @@ public class GeneratorTest extends AbstractTestCase {
|
|||
final SyndFeed feed = input.build(new File(super.getTestFile("index.rss")));
|
||||
final List<SyndEntry> entries = feed.getEntries();
|
||||
for (int i = 0; i < entries.size(); i++) {
|
||||
System.out.println(entries.get(i).getModule(PhotocastModule.URI));
|
||||
LOG.debug("{}", entries.get(i).getModule(PhotocastModule.URI));
|
||||
}
|
||||
final SyndFeedOutput output = new SyndFeedOutput();
|
||||
output.output(feed, new File("target/index.rss"));
|
||||
|
|
|
@ -9,6 +9,8 @@ import junit.framework.TestSuite;
|
|||
|
||||
import org.rometools.feed.module.AbstractTestCase;
|
||||
import org.rometools.feed.module.sle.types.Sort;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.sun.syndication.feed.module.Extendable;
|
||||
import com.sun.syndication.feed.synd.SyndEntry;
|
||||
|
@ -21,6 +23,8 @@ import com.sun.syndication.io.SyndFeedInput;
|
|||
*/
|
||||
public class GroupAndSortTest extends AbstractTestCase {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(GroupAndSortTest.class);
|
||||
|
||||
public GroupAndSortTest(final String testName) {
|
||||
super(testName);
|
||||
}
|
||||
|
@ -89,7 +93,7 @@ public class GroupAndSortTest extends AbstractTestCase {
|
|||
final List<Extendable> sortedEntries = SleUtility.sort(entries, sle.getSortFields()[0], true);
|
||||
for (int i = 0; i < sortedEntries.size(); i++) {
|
||||
final SyndEntry entry = (SyndEntry) sortedEntries.get(i);
|
||||
System.out.println(entry.getTitle());
|
||||
LOG.debug(entry.getTitle());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -18,6 +18,8 @@ import org.rometools.feed.module.sle.SimpleListExtension;
|
|||
import org.rometools.feed.module.sle.SleEntry;
|
||||
import org.rometools.feed.module.sle.types.Group;
|
||||
import org.rometools.feed.module.sle.types.Sort;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.sun.syndication.feed.synd.SyndEntry;
|
||||
import com.sun.syndication.feed.synd.SyndFeed;
|
||||
|
@ -29,6 +31,8 @@ import com.sun.syndication.io.SyndFeedInput;
|
|||
*/
|
||||
public class ModuleParserTest extends AbstractTestCase {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(ModuleParserTest.class);
|
||||
|
||||
public ModuleParserTest(final String testName) {
|
||||
super(testName);
|
||||
}
|
||||
|
@ -46,7 +50,7 @@ public class ModuleParserTest extends AbstractTestCase {
|
|||
final SyndFeedInput input = new SyndFeedInput();
|
||||
final SyndFeed feed = input.build(new File(super.getTestFile("data/bookexample.xml")));
|
||||
final SimpleListExtension sle = (SimpleListExtension) feed.getModule(SimpleListExtension.URI);
|
||||
// System.out.println( sle );
|
||||
// LOG.debug( sle );
|
||||
assertEquals("list", sle.getTreatAs());
|
||||
final Group[] groups = sle.getGroupFields();
|
||||
assertEquals("genre", groups[0].getElement());
|
||||
|
@ -59,11 +63,11 @@ public class ModuleParserTest extends AbstractTestCase {
|
|||
assertEquals(sorts[1].getElement(), "firstedition");
|
||||
final SyndEntry entry = feed.getEntries().get(0);
|
||||
final SleEntry sleEntry = (SleEntry) entry.getModule(SleEntry.URI);
|
||||
System.out.println(sleEntry);
|
||||
System.out.println("getGroupByElement");
|
||||
System.out.println(sleEntry.getGroupByElement(groups[0]));
|
||||
System.out.println("getSortByElement");
|
||||
System.out.println(sleEntry.getSortByElement(sorts[0]));
|
||||
LOG.debug("{}", sleEntry);
|
||||
LOG.debug("getGroupByElement");
|
||||
LOG.debug("{}", sleEntry.getGroupByElement(groups[0]));
|
||||
LOG.debug("getSortByElement");
|
||||
LOG.debug("{}", sleEntry.getSortByElement(sorts[0]));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -215,7 +215,7 @@ public class SSEParserTest extends AbstractTestCase {
|
|||
// if (!foundEqual) {
|
||||
// // show accumulated error messages
|
||||
// for (Iterator mesgIter = messages.iterator(); mesgIter.hasNext();) {
|
||||
// System.out.println((String) mesgIter.next());
|
||||
// LOG.debug((String) mesgIter.next());
|
||||
// }
|
||||
// }
|
||||
|
||||
|
|
|
@ -15,6 +15,8 @@ import junit.framework.TestSuite;
|
|||
import org.junit.Assert;
|
||||
import org.rometools.feed.module.AbstractTestCase;
|
||||
import org.rometools.feed.module.yahooweather.YWeatherModule;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.sun.syndication.feed.synd.SyndEntry;
|
||||
import com.sun.syndication.feed.synd.SyndFeed;
|
||||
|
@ -25,23 +27,23 @@ import com.sun.syndication.io.SyndFeedOutput;
|
|||
*
|
||||
* @author <a href="mailto:cooper@screaming-penguin.com">Robert "kebernet" Cooper</a>
|
||||
*/
|
||||
public class WeahterGeneratorTest extends AbstractTestCase {
|
||||
public class WeatherGeneratorTest extends AbstractTestCase {
|
||||
|
||||
public WeahterGeneratorTest(final String testName) {
|
||||
private static final Logger LOG = LoggerFactory.getLogger(WeatherGeneratorTest.class);
|
||||
|
||||
public WeatherGeneratorTest(final String testName) {
|
||||
super(testName);
|
||||
}
|
||||
|
||||
public static Test suite() {
|
||||
final TestSuite suite = new TestSuite(WeahterGeneratorTest.class);
|
||||
|
||||
return suite;
|
||||
return new TestSuite(WeatherGeneratorTest.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of generate method, of class com.totsp.xml.syndication.base.io.SlashGenerator.
|
||||
*/
|
||||
public void testGenerate() throws Exception {
|
||||
System.out.println("testGenerate");
|
||||
LOG.debug("testGenerate");
|
||||
final SyndFeedInput input = new SyndFeedInput();
|
||||
final SyndFeedOutput output = new SyndFeedOutput();
|
||||
final File testDir = new File(super.getTestFile("xml"));
|
||||
|
@ -50,7 +52,7 @@ public class WeahterGeneratorTest extends AbstractTestCase {
|
|||
if (!testFiles[h].getName().endsWith(".xml")) {
|
||||
continue;
|
||||
}
|
||||
System.out.println("processing" + testFiles[h]);
|
||||
LOG.debug("processing" + testFiles[h]);
|
||||
final SyndFeed feed = input.build(testFiles[h]);
|
||||
output.output(feed, new File("target/" + testFiles[h].getName()));
|
||||
final SyndFeed feed2 = input.build(new File("target/" + testFiles[h].getName()));
|
|
@ -14,9 +14,12 @@ import junit.framework.Test;
|
|||
import junit.framework.TestSuite;
|
||||
|
||||
import org.rometools.feed.module.AbstractTestCase;
|
||||
import org.rometools.feed.module.cc.io.CCModuleGenerator;
|
||||
import org.rometools.feed.module.yahooweather.YWeatherEntryModule;
|
||||
import org.rometools.feed.module.yahooweather.YWeatherModule;
|
||||
import org.rometools.feed.module.yahooweather.YWeatherModuleImpl;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.sun.syndication.feed.synd.SyndEntry;
|
||||
import com.sun.syndication.feed.synd.SyndFeed;
|
||||
|
@ -28,6 +31,8 @@ import com.sun.syndication.io.SyndFeedInput;
|
|||
*/
|
||||
public class WeatherModuleParserTest extends AbstractTestCase {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(CCModuleGenerator.class);
|
||||
|
||||
public WeatherModuleParserTest(final String testName) {
|
||||
super(testName);
|
||||
}
|
||||
|
@ -45,7 +50,7 @@ public class WeatherModuleParserTest extends AbstractTestCase {
|
|||
}
|
||||
|
||||
public void testQuickParse() throws Exception {
|
||||
System.out.println("testParse");
|
||||
LOG.debug("testParse");
|
||||
final SyndFeedInput input = new SyndFeedInput();
|
||||
final File testDir = new File(super.getTestFile("xml"));
|
||||
final File[] testFiles = testDir.listFiles();
|
||||
|
@ -58,14 +63,14 @@ public class WeatherModuleParserTest extends AbstractTestCase {
|
|||
final List<SyndEntry> entries = feed.getEntries();
|
||||
for (int i = 0; i < entries.size(); i++) {
|
||||
final SyndEntry entry = entries.get(i);
|
||||
System.out.println(entry.getModules().size());
|
||||
LOG.debug("{}", entry.getModules().size());
|
||||
for (int j = 0; j < entry.getModules().size(); j++) {
|
||||
System.out.println(entry.getModules().get(j).getClass());
|
||||
LOG.debug("{}", entry.getModules().get(j).getClass());
|
||||
if (entry.getModules().get(j) instanceof YWeatherModule) {
|
||||
final YWeatherModule base = (YWeatherModule) entry.getModules().get(j);
|
||||
assertTrue(((YWeatherEntryModule) base).getForecasts().length > 0);
|
||||
System.out.println(testFiles[h].getName());
|
||||
System.out.println(super.beanToString(base, false));
|
||||
LOG.debug(testFiles[h].getName());
|
||||
LOG.debug(super.beanToString(base, false));
|
||||
|
||||
final YWeatherEntryModule module2 = new YWeatherModuleImpl();
|
||||
module2.copyFrom(base);
|
||||
|
|
13
src/test/resources/logback-test.xml
Normal file
13
src/test/resources/logback-test.xml
Normal 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>
|
Loading…
Reference in a new issue