Repository: ambari
Updated Branches:
  refs/heads/branch-2.5 80b5348ca -> 5709f438b


AMBARI-19045 Remove unnecessary Log Feeder Date Mapper tests

Change-Id: I9f47bfc5a18b63d1a3f4dd208e7186952f804430


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/5709f438
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/5709f438
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/5709f438

Branch: refs/heads/branch-2.5
Commit: 5709f438b5b52aecd1f1fdf93fadbb8630b77e6d
Parents: 80b5348
Author: Miklos Gergely <mgerg...@hortonworks.com>
Authored: Thu Dec 1 11:41:42 2016 +0100
Committer: Miklos Gergely <mgerg...@hortonworks.com>
Committed: Thu Dec 1 11:41:42 2016 +0100

----------------------------------------------------------------------
 .../ambari/logfeeder/mapper/MapperDateTest.java | 56 --------------------
 1 file changed, 56 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/5709f438/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/mapper/MapperDateTest.java
----------------------------------------------------------------------
diff --git 
a/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/mapper/MapperDateTest.java
 
b/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/mapper/MapperDateTest.java
index 667c9ff..08680f6 100644
--- 
a/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/mapper/MapperDateTest.java
+++ 
b/ambari-logsearch/ambari-logsearch-logfeeder/src/test/java/org/apache/ambari/logfeeder/mapper/MapperDateTest.java
@@ -141,60 +141,4 @@ public class MapperDateTest {
     assertEquals("Invalid value wasn't returned as it is", invalidValue, 
mappedValue);
     assertTrue("jsonObj is not empty", jsonObj.isEmpty());
   }
-  
-  @Test
-  public void testMapperDate_patternWithoutYear_previousYearLog() throws 
Exception {
-    LOG.info("testMapperDate_patternWithoutYear_previousYearLog()");
-    String fieldName = "logtime";
-    Calendar currentCalendar = Calendar.getInstance();
-    Map<String, Object> mapConfigs = new HashMap<>();
-    mapConfigs.put("target_date_pattern", "yyyy-MM-dd HH:mm:ss.SSS");
-    String srcDatePattern ="MMM dd HH:mm:ss";
-    mapConfigs.put("src_date_pattern", srcDatePattern);
-    MapperDate mapperDate = new MapperDate();
-    assertTrue("Could not initialize!", mapperDate.init(null, fieldName, null, 
mapConfigs));
-    Map<String, Object> jsonObj = new HashMap<>();
-    Calendar nextMonthCalendar = Calendar.getInstance();
-    
-    nextMonthCalendar.set(Calendar.MONTH, 
currentCalendar.get(Calendar.MONTH)+1 );
-    String inputDateStr = new 
SimpleDateFormat("MMM").format(nextMonthCalendar.getTime()) + " 01 12:01:45";
-    Object mappedValue = mapperDate.apply(jsonObj, inputDateStr);
-    Date mappedDateValue = new SimpleDateFormat("yyyy-MM-dd 
HH:mm:ss.SSS").parse(mappedValue.toString());
-    String mappedDateValueStr = new 
SimpleDateFormat(srcDatePattern).format(mappedDateValue);
-    assertEquals(Date.class, mappedDateValue.getClass());
-    
-    int expectedLogYear = currentCalendar.get(Calendar.YEAR)-1;
-    Calendar mapppedValueCalendar = Calendar.getInstance();
-    mapppedValueCalendar.setTime(mappedDateValue);
-    assertEquals("Mapped year wasn't matched properly", expectedLogYear, 
mapppedValueCalendar.get(Calendar.YEAR));
-    assertEquals("Mapped date wasn't matched properly", inputDateStr, 
mappedDateValueStr);
-    assertEquals("Value wasn't put into jsonObj",mappedValue, 
jsonObj.remove(fieldName));
-    assertTrue("jsonObj is not empty", jsonObj.isEmpty());
-  }
-  
-  @Test
-  public void testMapperDate_patternWithoutYear_currentYearLog() throws 
Exception {
-    LOG.info("testMapperDate_patternWithoutYear_currentYearLog()");
-    String fieldName = "logtime";
-    Calendar currentCalendar = Calendar.getInstance();
-    Map<String, Object> mapConfigs = new HashMap<>();
-    mapConfigs.put("target_date_pattern", "yyyy-MM-dd HH:mm:ss.SSS");
-    String srcDatePattern ="MMM dd HH:mm:ss";
-    mapConfigs.put("src_date_pattern", srcDatePattern);
-    MapperDate mapperDate = new MapperDate();
-    assertTrue("Could not initialize!", mapperDate.init(null, fieldName, null, 
mapConfigs));
-    Map<String, Object> jsonObj = new HashMap<>();
-    String inputDateStr = new 
SimpleDateFormat("MMM").format(currentCalendar.getTime()) + " 01 12:01:45";
-    Object mappedValue = mapperDate.apply(jsonObj, inputDateStr);
-    Date mappedDateValue = new SimpleDateFormat("yyyy-MM-dd 
HH:mm:ss.SSS").parse(mappedValue.toString());
-    String mappedDateValueStr = new 
SimpleDateFormat(srcDatePattern).format(mappedDateValue);
-    assertEquals(Date.class, mappedDateValue.getClass());
-    int expectedLogYear = currentCalendar.get(Calendar.YEAR);
-    Calendar mapppedValueCalendar = Calendar.getInstance();
-    mapppedValueCalendar.setTime(mappedDateValue);
-    assertEquals("Mapped year wasn't matched properly", expectedLogYear, 
mapppedValueCalendar.get(Calendar.YEAR));
-    assertEquals("Mapped date wasn't matched properly", inputDateStr, 
mappedDateValueStr);
-    assertEquals("Value wasn't put into jsonObj",mappedValue, 
jsonObj.remove(fieldName));
-    assertTrue("jsonObj is not empty", jsonObj.isEmpty());
-  }
 }

Reply via email to