Skip to content

Commit

Permalink
Merge pull request #6 from DevFactory/release/fixing-quality-issues-s…
Browse files Browse the repository at this point in the history
…quids-S2786-S00115

Fixing code quality issues squids S2786 and S00115
  • Loading branch information
leonlee committed May 26, 2016
2 parents d49f51b + 46b1f33 commit fba1f22
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
10 changes: 5 additions & 5 deletions src/main/java/org/riderzen/flume/sink/MongoSink.java
Expand Up @@ -120,7 +120,7 @@ public void configure(Context context) {
username = "";
password = "";
}
model = CollectionModel.valueOf(context.getString(MODEL, CollectionModel.single.name()));
model = CollectionModel.valueOf(context.getString(MODEL, CollectionModel.SINGLE.name()));
dbName = context.getString(DB_NAME, DEFAULT_DB);
collectionName = context.getString(COLLECTION, DEFAULT_COLLECTION);
batchSize = context.getInteger(BATCH_SIZE, DEFAULT_BATCH);
Expand Down Expand Up @@ -342,11 +342,11 @@ private void doUpsert(Map<String, List<DBObject>> eventMap) {

private void processEvent(Map<String, List<DBObject>> eventMap, Event event) {
switch (model) {
case single:
case SINGLE:
putSingleEvent(eventMap, event);

break;
case dynamic:
case DYNAMIC:
putDynamicEvent(eventMap, event);

break;
Expand Down Expand Up @@ -430,7 +430,7 @@ private List<DBObject> addEventToList(List<DBObject> documents, Event event) {
return documents;
}

public static enum CollectionModel {
dynamic, single
public enum CollectionModel {
DYNAMIC, SINGLE
}
}
16 changes: 8 additions & 8 deletions src/test/java/org/riderzen/flume/sink/MongoSinkTest.java
Expand Up @@ -61,7 +61,7 @@ public static void tearDown() {

@Test(groups = "dev", invocationCount = 1)
public void sinkDynamicTest() throws EventDeliveryException, InterruptedException {
ctx.put(MongoSink.MODEL, MongoSink.CollectionModel.dynamic.name());
ctx.put(MongoSink.MODEL, MongoSink.CollectionModel.DYNAMIC.name());
MongoSink sink = new MongoSink();
Configurables.configure(sink, ctx);

Expand Down Expand Up @@ -108,7 +108,7 @@ public void sinkDynamicTest() throws EventDeliveryException, InterruptedExceptio

@Test(groups = "dev")
public void sinkDynamicTest2() throws EventDeliveryException, InterruptedException {
ctx.put(MongoSink.MODEL, MongoSink.CollectionModel.dynamic.name());
ctx.put(MongoSink.MODEL, MongoSink.CollectionModel.DYNAMIC.name());
MongoSink sink = new MongoSink();
Configurables.configure(sink, ctx);

Expand Down Expand Up @@ -155,7 +155,7 @@ public void sinkDynamicTest2() throws EventDeliveryException, InterruptedExcepti

@Test(groups = "dev")
public void sinkSingleModelTest() throws EventDeliveryException {
ctx.put(MongoSink.MODEL, MongoSink.CollectionModel.single.name());
ctx.put(MongoSink.MODEL, MongoSink.CollectionModel.SINGLE.name());

MongoSink sink = new MongoSink();
Configurables.configure(sink, ctx);
Expand Down Expand Up @@ -265,7 +265,7 @@ public void autoWrapTest() throws EventDeliveryException {

@Test(groups = "dev")
public void sinkDynamicDbTest() throws EventDeliveryException {
ctx.put(MongoSink.MODEL, MongoSink.CollectionModel.dynamic.name());
ctx.put(MongoSink.MODEL, MongoSink.CollectionModel.DYNAMIC.name());
MongoSink sink = new MongoSink();
Configurables.configure(sink, ctx);

Expand Down Expand Up @@ -314,7 +314,7 @@ public void sinkDynamicDbTest() throws EventDeliveryException {

@Test(groups = "dev")
public void timestampNewFieldTest() throws EventDeliveryException {
ctx.put(MongoSink.MODEL, MongoSink.CollectionModel.dynamic.name());
ctx.put(MongoSink.MODEL, MongoSink.CollectionModel.DYNAMIC.name());
String tsField = "createdOn";
ctx.put(MongoSink.TIMESTAMP_FIELD, tsField);
MongoSink sink = new MongoSink();
Expand Down Expand Up @@ -366,7 +366,7 @@ public void timestampNewFieldTest() throws EventDeliveryException {

@Test(groups = "dev")
public void timestampExistingFieldTest() throws EventDeliveryException, ParseException {
ctx.put(MongoSink.MODEL, MongoSink.CollectionModel.dynamic.name());
ctx.put(MongoSink.MODEL, MongoSink.CollectionModel.DYNAMIC.name());
String tsField = "createdOn";
ctx.put(MongoSink.TIMESTAMP_FIELD, tsField);
MongoSink sink = new MongoSink();
Expand Down Expand Up @@ -422,7 +422,7 @@ public void timestampExistingFieldTest() throws EventDeliveryException, ParseExc

@Test(groups = "dev")
public void upsertTest() throws EventDeliveryException, ParseException {
ctx.put(MongoSink.MODEL, MongoSink.CollectionModel.dynamic.name());
ctx.put(MongoSink.MODEL, MongoSink.CollectionModel.DYNAMIC.name());
String tsField = "createdOn";
ctx.put(MongoSink.TIMESTAMP_FIELD, tsField);
MongoSink sink = new MongoSink();
Expand Down Expand Up @@ -509,7 +509,7 @@ public static void sandbox() throws EventDeliveryException {
msg.put("_id", "111111111111111111111111111");
msg.put("pid", "111111111111111111111111111");

ctx.put(MongoSink.MODEL, MongoSink.CollectionModel.dynamic.name());
ctx.put(MongoSink.MODEL, MongoSink.CollectionModel.DYNAMIC.name());
String tsField = "createdOn";
ctx.put(MongoSink.TIMESTAMP_FIELD, tsField);
MongoSink sink = new MongoSink();
Expand Down

0 comments on commit fba1f22

Please sign in to comment.