FIAS database synchronization service written on a java
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.
fias/src/test/java/me/bearns/fias/service/StreamSaverTest.java

57 lines
1.6 KiB

package me.bearns.fias.service;
import me.bearns.fias.exceptions.CommonException;
import me.bearns.fias.helper.XMLSourceHelper;
import me.bearns.fias.helpers.Catalog;
import me.bearns.fias.helpers.UnmarshallerParameters;
import me.bearns.fias.helpers.UpdateHelper;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit4.SpringRunner;
import java.io.InputStream;
@ActiveProfiles("test")
@RunWith(SpringRunner.class)
@SpringBootTest
public class StreamSaverTest {
private static final String AO_FILENAME = "AS_ADDROBJ_20200903_b02fb98f-354f-4ed4-af2f-467c5789989f.XML";
private static final String HOUSE_FILENAME = "AS_HOUSE_20200903_f7ab498f-1f85-4d80-8254-349399de9460.XML";
@Autowired
private StreamSaver service;
@Autowired
private Catalog catalog;
@Autowired
private UpdateHelper helper;
@Test
public void addrobjTest() throws CommonException {
final UnmarshallerParameters config = catalog.getByPrefix(AO_FILENAME);
final InputStream stream = XMLSourceHelper.getAOStream();
service.process(stream, config, null);
}
@Test
public void houseTest() throws CommonException {
final UnmarshallerParameters config = catalog.getByPrefix(HOUSE_FILENAME);
final InputStream stream = XMLSourceHelper.getHouseStream();
service.process(stream, config, null);
}
}