@Test public void testValidTenant() { String tenantId = "Midgar"; Mockito.doNothing().when(localEdOrgExtractor).execute(Mockito.eq("tenant"), Mockito.any(File.class), Mockito.any(DateTime.class)); Mockito.when(bulkExtractMongoDA.getTenant(tenantId)).thenReturn(testTenantEntity); launcher.execute(tenantId, false); Mockito.verify(localEdOrgExtractor, Mockito.times(1)).execute(Mockito.eq(tenantId), Mockito.any(File.class), Mockito.any(DateTime.class)); }
public void execute(String tenant, boolean isDelta) { audit(securityEventUtil.createSecurityEvent(Launcher.class.getName(), "Bulk extract execution", LogLevelType.TYPE_INFO, BEMessageCode.BE_SE_CODE_0001)); Entity tenantEntity = bulkExtractMongoDA.getTenant(tenant); if (tenantEntity != null) { DateTime startTime = new DateTime(); if (isDelta) { LOG.info("isDelta=true ... deltaExtractor.execute()"); deltaExtractor.execute(tenant, getTenantDirectory(tenant), startTime); } else { LOG.info("isDelta=false ... localEdOrgExtractor.execute()"); edOrgExtractor.execute(tenant, getTenantDirectory(tenant), startTime); LOG.info("Starting public data extract..."); tenantPublicDataExtractor.execute(tenant, getTenantDirectory(tenant), startTime); } } else { audit(securityEventUtil.createSecurityEvent(Launcher.class.getName(), "Bulk extract execution", LogLevelType.TYPE_ERROR, BEMessageCode.BE_SE_CODE_0002, tenant)); LOG.error( "A bulk extract is not being initiated for the tenant {} because the tenant has not been onboarded.", tenant); } }
Launcher { public void execute(String tenant, boolean isDelta) { audit(securityEventUtil.createSecurityEvent(Launcher.class.getName(), "Bulk extract execution", LogLevelType.TYPE_INFO, BEMessageCode.BE_SE_CODE_0001)); Entity tenantEntity = bulkExtractMongoDA.getTenant(tenant); if (tenantEntity != null) { DateTime startTime = new DateTime(); if (isDelta) { LOG.info("isDelta=true ... deltaExtractor.execute()"); deltaExtractor.execute(tenant, getTenantDirectory(tenant), startTime); } else { LOG.info("isDelta=false ... localEdOrgExtractor.execute()"); edOrgExtractor.execute(tenant, getTenantDirectory(tenant), startTime); LOG.info("Starting public data extract..."); tenantPublicDataExtractor.execute(tenant, getTenantDirectory(tenant), startTime); } } else { audit(securityEventUtil.createSecurityEvent(Launcher.class.getName(), "Bulk extract execution", LogLevelType.TYPE_ERROR, BEMessageCode.BE_SE_CODE_0002, tenant)); LOG.error( "A bulk extract is not being initiated for the tenant {} because the tenant has not been onboarded.", tenant); } } }
Launcher { public void execute(String tenant, boolean isDelta) { audit(securityEventUtil.createSecurityEvent(Launcher.class.getName(), "Bulk extract execution", LogLevelType.TYPE_INFO, BEMessageCode.BE_SE_CODE_0001)); Entity tenantEntity = bulkExtractMongoDA.getTenant(tenant); if (tenantEntity != null) { DateTime startTime = new DateTime(); if (isDelta) { LOG.info("isDelta=true ... deltaExtractor.execute()"); deltaExtractor.execute(tenant, getTenantDirectory(tenant), startTime); } else { LOG.info("isDelta=false ... localEdOrgExtractor.execute()"); edOrgExtractor.execute(tenant, getTenantDirectory(tenant), startTime); LOG.info("Starting public data extract..."); tenantPublicDataExtractor.execute(tenant, getTenantDirectory(tenant), startTime); } } else { audit(securityEventUtil.createSecurityEvent(Launcher.class.getName(), "Bulk extract execution", LogLevelType.TYPE_ERROR, BEMessageCode.BE_SE_CODE_0002, tenant)); LOG.error( "A bulk extract is not being initiated for the tenant {} because the tenant has not been onboarded.", tenant); } }  }
Launcher { public void execute(String tenant, boolean isDelta) { audit(securityEventUtil.createSecurityEvent(Launcher.class.getName(), "Bulk extract execution", LogLevelType.TYPE_INFO, BEMessageCode.BE_SE_CODE_0001)); Entity tenantEntity = bulkExtractMongoDA.getTenant(tenant); if (tenantEntity != null) { DateTime startTime = new DateTime(); if (isDelta) { LOG.info("isDelta=true ... deltaExtractor.execute()"); deltaExtractor.execute(tenant, getTenantDirectory(tenant), startTime); } else { LOG.info("isDelta=false ... localEdOrgExtractor.execute()"); edOrgExtractor.execute(tenant, getTenantDirectory(tenant), startTime); LOG.info("Starting public data extract..."); tenantPublicDataExtractor.execute(tenant, getTenantDirectory(tenant), startTime); } } else { audit(securityEventUtil.createSecurityEvent(Launcher.class.getName(), "Bulk extract execution", LogLevelType.TYPE_ERROR, BEMessageCode.BE_SE_CODE_0002, tenant)); LOG.error( "A bulk extract is not being initiated for the tenant {} because the tenant has not been onboarded.", tenant); } }  void execute(String tenant, boolean isDelta); static String getTimeStamp(Date date); void setBaseDirectory(String baseDirectory); static void main(String[] args); void setEdOrgExtractor(EdOrgExtractor edOrgExtractor); EdOrgExtractor getEdOrgExtractor(); void setTenantPublicDataExtractor(TenantPublicDataExtractor tenantPublicDataExtractor); BulkExtractMongoDA getBulkExtractMongoDA(); void setBulkExtractMongoDA(BulkExtractMongoDA bulkExtractMongoDA); void setSecurityEventUtil(SecurityEventUtil securityEventUtil); }
Launcher { public void execute(String tenant, boolean isDelta) { audit(securityEventUtil.createSecurityEvent(Launcher.class.getName(), "Bulk extract execution", LogLevelType.TYPE_INFO, BEMessageCode.BE_SE_CODE_0001)); Entity tenantEntity = bulkExtractMongoDA.getTenant(tenant); if (tenantEntity != null) { DateTime startTime = new DateTime(); if (isDelta) { LOG.info("isDelta=true ... deltaExtractor.execute()"); deltaExtractor.execute(tenant, getTenantDirectory(tenant), startTime); } else { LOG.info("isDelta=false ... localEdOrgExtractor.execute()"); edOrgExtractor.execute(tenant, getTenantDirectory(tenant), startTime); LOG.info("Starting public data extract..."); tenantPublicDataExtractor.execute(tenant, getTenantDirectory(tenant), startTime); } } else { audit(securityEventUtil.createSecurityEvent(Launcher.class.getName(), "Bulk extract execution", LogLevelType.TYPE_ERROR, BEMessageCode.BE_SE_CODE_0002, tenant)); LOG.error( "A bulk extract is not being initiated for the tenant {} because the tenant has not been onboarded.", tenant); } }  void execute(String tenant, boolean isDelta); static String getTimeStamp(Date date); void setBaseDirectory(String baseDirectory); static void main(String[] args); void setEdOrgExtractor(EdOrgExtractor edOrgExtractor); EdOrgExtractor getEdOrgExtractor(); void setTenantPublicDataExtractor(TenantPublicDataExtractor tenantPublicDataExtractor); BulkExtractMongoDA getBulkExtractMongoDA(); void setBulkExtractMongoDA(BulkExtractMongoDA bulkExtractMongoDA); void setSecurityEventUtil(SecurityEventUtil securityEventUtil);  }