Explorar o código

AMBARI-19045 Remove unnecessary Log Feeder Date Mapper tests

Change-Id: I9f47bfc5a18b63d1a3f4dd208e7186952f804430
Miklos Gergely %!s(int64=8) %!d(string=hai) anos
pai
achega
5709f438b5

+ 0 - 56
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());
-  }
 }