You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
68 lines
2.8 KiB
68 lines
2.8 KiB
package de.superx.kettle.statistics; |
|
|
|
import java.io.File; |
|
import java.io.IOException; |
|
import java.util.HashMap; |
|
import java.util.Map; |
|
|
|
import org.junit.Test; |
|
import org.pentaho.di.core.logging.LogLevel; |
|
import org.springframework.jdbc.core.JdbcTemplate; |
|
|
|
import de.superx.BaseDbTest; |
|
import de.superx.KettleTestRunner; |
|
import de.superx.stat.StatisticsBase; |
|
|
|
//@ContextConfiguration(classes = { TestApplicationConfigPg.class }) |
|
public class ExmatriculationTest extends BaseDbTest { |
|
|
|
private static final String jobFile = String.join(File.separator, "superx","WEB-INF","conf","edustore","db","module","astat","etl","statistik2016","estatistik.kjb"); |
|
private static final String statSelect = "select * from " + StatisticsBase.MODULE_PREFIX + "astat"; |
|
|
|
private static Map<String, String> parameters = createParameterMap(); |
|
|
|
@Test |
|
public void testExmaVorStichtag() throws IOException { |
|
loadFixtureExmaVorStichtag(); |
|
KettleTestRunner.runKettleJob(jobFile, parameters, LogLevel.ERROR); |
|
deleteFixture(); |
|
validateResultRowCount(statSelect, 0); |
|
} |
|
|
|
@Test |
|
public void testExmaNachStichtag() throws IOException { |
|
loadFixtureExmaNachStichtag(); |
|
KettleTestRunner.runKettleJob(jobFile, parameters, LogLevel.ERROR); |
|
deleteFixture(); |
|
validateResultRowCount(statSelect, 1); |
|
} |
|
|
|
private void loadFixtureExmaVorStichtag() throws IOException { |
|
loadCsvFileIntoTable(String.join(File.separator, "test","resources","db","fixtures","exmas_stichtag","90000001_exma_vor_stichtag.txt"), "sos_stg_aggr"); |
|
loadCsvFileIntoTable(String.join(File.separator, "test","resources","db","fixtures","exmas_stichtag","90000001_sos_sos_exma_vor_stichtag.txt"), "sos_sos"); |
|
} |
|
|
|
private void loadFixtureExmaNachStichtag() throws IOException { |
|
loadCsvFileIntoTable(String.join(File.separator, "test","resources","db","fixtures","exmas_stichtag","90000001_exma_nach_stichtag.txt"), "sos_stg_aggr"); |
|
loadCsvFileIntoTable(String.join(File.separator, "test","resources","db","fixtures","exmas_stichtag","90000001_sos_sos_exma_nach_stichtag.txt"), "sos_sos"); |
|
} |
|
|
|
private void deleteFixture() { |
|
JdbcTemplate jt = new JdbcTemplate(dataSource); |
|
jt.execute("delete from sos_stg_aggr where matrikel_nr=90000001"); |
|
jt.execute("delete from sos_sos where matrikel_nr=90000001"); |
|
} |
|
|
|
private static Map<String,String> createParameterMap() { |
|
Map<String,String> parameterMap = new HashMap<String,String>(); |
|
parameterMap.put("lieferung", "1"); |
|
parameterMap.put("berichtssemester", "20201"); |
|
parameterMap.put("stichtagsart_pruef_vorsem", "2"); |
|
parameterMap.put("stichtagsart_pruef_berichtssem", "4"); |
|
parameterMap.put("stichtagsart_stud_vorsem", "6"); |
|
parameterMap.put("stichtagsart_stud_berichtssem", "1"); |
|
parameterMap.put("matrikelnr", "90000001"); |
|
return parameterMap; |
|
} |
|
|
|
}
|
|
|