DATAMONGO-723 - Cleand up a few misnamed test cases.
Reactivated test cases that were name Test instead of Tests by accident.
This commit is contained in:
@@ -32,7 +32,7 @@ An example log entry might look like:
|
|||||||
{
|
{
|
||||||
"_id" : ObjectId("4d89341a8ef397e06940d5cd"),
|
"_id" : ObjectId("4d89341a8ef397e06940d5cd"),
|
||||||
"applicationId" : "my.application",
|
"applicationId" : "my.application",
|
||||||
"name" : "org.springframework.data.mongodb.log4j.AppenderTest",
|
"name" : "org.springframework.data.mongodb.log4j.MongoLog4jAppenderIntegrationTests",
|
||||||
"level" : "DEBUG",
|
"level" : "DEBUG",
|
||||||
"timestamp" : ISODate("2011-03-23T16:53:46.778Z"),
|
"timestamp" : ISODate("2011-03-23T16:53:46.778Z"),
|
||||||
"properties" : {
|
"properties" : {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2011 by the original author(s).
|
* Copyright 2011-2013 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -13,63 +13,65 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.springframework.data.mongodb.log4j;
|
package org.springframework.data.mongodb.log4j;
|
||||||
|
|
||||||
import static org.hamcrest.Matchers.*;
|
import static org.hamcrest.Matchers.*;
|
||||||
import static org.junit.Assert.*;
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
import java.net.UnknownHostException;
|
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
|
|
||||||
import com.mongodb.DB;
|
|
||||||
import com.mongodb.DBCursor;
|
|
||||||
import com.mongodb.Mongo;
|
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
import org.apache.log4j.MDC;
|
import org.apache.log4j.MDC;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
/**
|
import com.mongodb.DB;
|
||||||
* @author Jon Brisbin <jbrisbin@vmware.com>
|
import com.mongodb.DBCursor;
|
||||||
*/
|
import com.mongodb.Mongo;
|
||||||
public class AppenderTest {
|
|
||||||
|
|
||||||
private static final String NAME = AppenderTest.class.getName();
|
/**
|
||||||
private Logger log = Logger.getLogger(NAME);
|
* Integration tests for {@link MongoLog4jAppender}.
|
||||||
private Mongo mongo;
|
*
|
||||||
private DB db;
|
* @author Jon Brisbin
|
||||||
private String collection;
|
* @author Oliver Gierke
|
||||||
|
*/
|
||||||
|
public class MongoLog4jAppenderIntegrationTests {
|
||||||
|
|
||||||
|
static final String NAME = MongoLog4jAppenderIntegrationTests.class.getName();
|
||||||
|
|
||||||
|
Logger log = Logger.getLogger(NAME);
|
||||||
|
Mongo mongo;
|
||||||
|
DB db;
|
||||||
|
String collection;
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setup() {
|
public void setUp() throws Exception {
|
||||||
try {
|
|
||||||
mongo = new Mongo("localhost", 27017);
|
mongo = new Mongo("localhost", 27017);
|
||||||
db = mongo.getDB("logs");
|
db = mongo.getDB("logs");
|
||||||
|
|
||||||
Calendar now = Calendar.getInstance();
|
Calendar now = Calendar.getInstance();
|
||||||
collection = String.valueOf(now.get(Calendar.YEAR)) + String.format("%1$02d", now.get(Calendar.MONTH) + 1);
|
collection = String.valueOf(now.get(Calendar.YEAR)) + String.format("%1$02d", now.get(Calendar.MONTH) + 1);
|
||||||
db.getCollection(collection).drop();
|
db.getCollection(collection).drop();
|
||||||
} catch (UnknownHostException e) {
|
|
||||||
throw new RuntimeException(e.getMessage(), e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testLogging() {
|
public void testLogging() {
|
||||||
|
|
||||||
log.debug("DEBUG message");
|
log.debug("DEBUG message");
|
||||||
log.info("INFO message");
|
log.info("INFO message");
|
||||||
log.warn("WARN message");
|
log.warn("WARN message");
|
||||||
log.error("ERROR message");
|
log.error("ERROR message");
|
||||||
|
|
||||||
DBCursor msgs = db.getCollection(collection).find();
|
DBCursor msgs = db.getCollection(collection).find();
|
||||||
assertThat(msgs.count(), is(4));
|
|
||||||
|
|
||||||
|
assertThat(msgs.count(), is(4));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testProperties() {
|
public void testProperties() {
|
||||||
|
|
||||||
MDC.put("property", "one");
|
MDC.put("property", "one");
|
||||||
log.debug("DEBUG message");
|
log.debug("DEBUG message");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -10,11 +10,4 @@ log4j.appender.stdout.collectionPattern = %X{year}%X{month}
|
|||||||
log4j.appender.stdout.applicationId = my.application
|
log4j.appender.stdout.applicationId = my.application
|
||||||
log4j.appender.stdout.warnOrHigherWriteConcern = FSYNC_SAFE
|
log4j.appender.stdout.warnOrHigherWriteConcern = FSYNC_SAFE
|
||||||
|
|
||||||
log4j.category.org.apache.activemq=ERROR
|
log4j.category.org.springframework.data.mongodb=DEBUG
|
||||||
log4j.category.org.springframework.batch=DEBUG
|
|
||||||
log4j.category.org.springframework.data.document.mongodb=DEBUG
|
|
||||||
log4j.category.org.springframework.transaction=INFO
|
|
||||||
|
|
||||||
log4j.category.org.hibernate.SQL=DEBUG
|
|
||||||
# for debugging datasource initialization
|
|
||||||
# log4j.category.test.jdbc=DEBUG
|
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ import com.mongodb.WriteConcern;
|
|||||||
*
|
*
|
||||||
* @author Oliver Gierke
|
* @author Oliver Gierke
|
||||||
*/
|
*/
|
||||||
public class StringToWriteConcernConverterUnitTest {
|
public class StringToWriteConcernConverterUnitTests {
|
||||||
|
|
||||||
StringToWriteConcernConverter converter = new StringToWriteConcernConverter();
|
StringToWriteConcernConverter converter = new StringToWriteConcernConverter();
|
||||||
|
|
||||||
@@ -35,7 +35,7 @@ import com.mongodb.WriteConcern;
|
|||||||
* @author Oliver Gierke
|
* @author Oliver Gierke
|
||||||
* @author Thomas Darimont
|
* @author Thomas Darimont
|
||||||
*/
|
*/
|
||||||
public class MongoFactoryBeanIntegrationTest {
|
public class MongoFactoryBeanIntegrationTests {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see DATAMONGO-408
|
* @see DATAMONGO-408
|
||||||
@@ -1,64 +0,0 @@
|
|||||||
package org.springframework.data.mongodb.core;
|
|
||||||
|
|
||||||
public class SomeEnumTest {
|
|
||||||
|
|
||||||
public enum StringEnum {
|
|
||||||
ONE, TWO, FIVE;
|
|
||||||
}
|
|
||||||
|
|
||||||
public enum NumberEnum {
|
|
||||||
ONE(1), TWO(2), FIVE(5);
|
|
||||||
|
|
||||||
private int value;
|
|
||||||
|
|
||||||
public int value() {
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
NumberEnum(int value) {
|
|
||||||
this.value = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private StringEnum stringEnum;
|
|
||||||
|
|
||||||
private NumberEnum numberEnum;
|
|
||||||
|
|
||||||
private String id;
|
|
||||||
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
public StringEnum getStringEnum() {
|
|
||||||
return stringEnum;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setStringEnum(StringEnum stringEnum) {
|
|
||||||
this.stringEnum = stringEnum;
|
|
||||||
}
|
|
||||||
|
|
||||||
public NumberEnum getNumberEnum() {
|
|
||||||
return numberEnum;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setNumberEnum(NumberEnum numberEnum) {
|
|
||||||
this.numberEnum = numberEnum;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setId(String id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setName(String name) {
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -36,7 +36,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
|||||||
*/
|
*/
|
||||||
@RunWith(SpringJUnit4ClassRunner.class)
|
@RunWith(SpringJUnit4ClassRunner.class)
|
||||||
@ContextConfiguration
|
@ContextConfiguration
|
||||||
public class ValidatingMongoEventListenerTest {
|
public class ValidatingMongoEventListenerTests {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
MongoTemplate mongoTemplate;
|
MongoTemplate mongoTemplate;
|
||||||
@@ -7,7 +7,7 @@
|
|||||||
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
|
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||||
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
|
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
|
||||||
|
|
||||||
<mongo:db-factory />
|
<mongo:db-factory dbname="validation" />
|
||||||
|
|
||||||
<mongo:mapping-converter base-package="org.springframework.data.mongodb.core" />
|
<mongo:mapping-converter base-package="org.springframework.data.mongodb.core" />
|
||||||
|
|
||||||
Reference in New Issue
Block a user