Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package integration.tests;
- import static org.junit.Assert.assertNotNull;
- import static org.junit.Assert.assertTrue;
- import java.util.List;
- import javax.xml.bind.JAXBElement;
- import org.junit.Before;
- import org.junit.Test;
- import org.junit.runner.RunWith;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.test.context.ContextConfiguration;
- import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
- import org.springframework.test.context.transaction.TransactionConfiguration;
- import com.agtsoft.integration.ctis.generated.Device;
- import com.agtsoft.integration.ctis.generated.DeviceList;
- import com.agtsoft.integration.ctis.generated.Equipment;
- import com.agtsoft.integration.ctis.generated.EquipmentList;
- import com.agtsoft.integration.ctis.generated.ObjectFactory;
- import com.agtsoft.integration.ctis.generated.TownCode;
- import com.agtsoft.integration.ctis.generated.TownEquipment;
- import com.agtsoft.integration.ctis.ws.CtisEndpoint;
- /**
- * Интеграционный тест, предназначенный для проверки конфигурации контекста
- * и сервиса предоставления информации по оборудованию. Тест жестко завязан на тестовые данные
- * в файле src/test/resources/import.sql.
- *
- * Проводится тестирование всех десяти методов получения данных по оборудованию. Конфигурация филиалов
- * и их удаленных сервисов находится в import.sql.
- * @author Artem Medeu
- *
- */
- @RunWith(SpringJUnit4ClassRunner.class)
- @ContextConfiguration({"classpath:test-context.xml"})
- @TransactionConfiguration(defaultRollback=true)
- public class CtisEndpointShould {
- @Autowired
- CtisEndpoint ctis;
- ObjectFactory of;
- TownCode tarazCode;
- @Before
- public void setUp() {
- of = new ObjectFactory();
- tarazCode = new TownCode();
- tarazCode.setCode("7262");
- }
- private TownEquipment createEquipment(String id) {
- Equipment eq = new Equipment();
- eq.setId(id);
- TownEquipment te = new TownEquipment();
- te.setEquipment(eq);
- te.setTownCode(tarazCode);
- return te;
- }
- @Test
- public void returnListOfCrossesByTownCode7262() {
- System.out.println("Кроссы по коду города 7262: ");
- JAXBElement<EquipmentList> jaxbElem = ctis.getCrossList(of.createGetCrossListRequest(tarazCode));
- assertNotNull(jaxbElem);
- List<Equipment> eqList = jaxbElem.getValue().getList();
- assertNotNull(eqList);
- for (Equipment equipment : eqList) {
- System.out.println(equipment.getName() + "; id=" + equipment.getId());
- }
- System.out.println();
- }
- @Test
- public void returnListOfThunderBandsByCrossId172527() {
- System.out.println("Громполосы по кроссу ID = 172527:");
- JAXBElement<EquipmentList> jaxbElem = ctis.getThunderbandList(
- of.createGetThunderbandListByCrossRequest(createEquipment("172527")));
- assertNotNull(jaxbElem);
- List<Equipment> eqList = jaxbElem.getValue().getList();
- assertNotNull(eqList);
- for (Equipment equipment : eqList) {
- System.out.println(equipment.getName() + "; id=" + equipment.getId());
- }
- System.out.println();
- }
- @Test
- public void returnListOfCardsByThunderbandId7364176() {
- System.out.println("Платы по громполосе ID = 7364176:");
- JAXBElement<EquipmentList> jaxbElem = ctis.getCardList(
- of.createGetCardListByThunderbandRequest(createEquipment("7364176")));
- assertNotNull(jaxbElem);
- List<Equipment> eqList = jaxbElem.getValue().getList();
- assertNotNull(eqList);
- assertTrue(eqList.size() > 0);
- for (Equipment equipment : eqList) {
- System.out.println(equipment.getName() + "; id=" + equipment.getId());
- }
- System.out.println();
- }
- @Test
- public void returnListOfDevicesByCardId7381798() {
- System.out.println("Оборудование по плате ID = 7381798:");
- JAXBElement<DeviceList> jaxbElem = ctis.getDeviceListByCard(
- of.createGetDeviceListByCardRequest(createEquipment("7381798")));
- assertNotNull(jaxbElem);
- List<Device> eqList = jaxbElem.getValue().getDevices();
- assertNotNull(eqList);
- assertTrue(eqList.size() > 0);
- for (Device equipment : eqList) {
- System.out.println(equipment.getLinearData());
- }
- System.out.println();
- }
- @Test
- public void returnListOfTerminalEnclosuresByCrossId172527() {
- System.out.println("РШ по кроссу ID = 172527:");
- JAXBElement<EquipmentList> jaxbElem = ctis.getTerminalEnclosureList(
- of.createGetTerminalEnclosureListByCrossRequest(createEquipment("172527")));
- assertNotNull(jaxbElem);
- List<Equipment> eqList = jaxbElem.getValue().getList();
- assertNotNull(eqList);
- assertTrue(eqList.size() > 0);
- for (Equipment equipment : eqList) {
- System.out.println(equipment.getName() + "; id=" + equipment.getId());
- }
- System.out.println();
- }
- @Test
- public void returnListOfDistributionCabinetsByTerminalEnclosureId4092874() {
- System.out.println("Боксы по РШ ID = 4092874:");
- JAXBElement<EquipmentList> jaxbElem = ctis.getDistributionCabinetList(
- of.createGetDistributionCabinetListByTerminalEnclosureRequest(createEquipment("4092874")));
- assertNotNull(jaxbElem);
- List<Equipment> eqList = jaxbElem.getValue().getList();
- assertNotNull(eqList);
- assertTrue(eqList.size() > 0);
- for (Equipment equipment : eqList) {
- System.out.println(equipment.getName() + "; id=" + equipment.getId());
- }
- System.out.println();
- }
- @Test
- public void returnListOfDistributionBoxesByDistributionCabinetId9961537() {
- System.out.println("РК по боксам РШ ID = 9961537:");
- JAXBElement<EquipmentList> jaxbElem = ctis.getDistributionBoxList(
- of.createGetDistributionBoxListByDistributionCabinetRequest(createEquipment("9961537")));
- assertNotNull(jaxbElem);
- List<Equipment> eqList = jaxbElem.getValue().getList();
- assertNotNull(eqList);
- assertTrue(eqList.size() > 0);
- for (Equipment equipment : eqList) {
- System.out.println(equipment.getName() + "; id=" + equipment.getId());
- }
- System.out.println();
- }
- @Test
- public void returnListOfDevicesByDistributionBoxId10044774() {
- System.out.println("Оборудование по РК ID = 10044774:");
- JAXBElement<DeviceList> jaxbElem = ctis.getDeviceListByDistributionBox(
- of.createGetDeviceListByDistributionBoxRequest(createEquipment("10044774")));
- assertNotNull(jaxbElem);
- List<Device> eqList = jaxbElem.getValue().getDevices();
- assertNotNull(eqList);
- assertTrue(eqList.size() > 0);
- for (Device equipment : eqList) {
- System.out.println(equipment.getLinearData());
- }
- System.out.println();
- }
- @Test
- public void returnListOfDirectSupplyBoxesByCrossId172527() {
- System.out.println("РКпп по кроссу ID = 172527:");
- JAXBElement<EquipmentList> jaxbElem = ctis.getDirectSupplyBoxList(
- of.createGetDirectSupplyBoxListByCrossRequest(createEquipment("172527")));
- assertNotNull(jaxbElem);
- List<Equipment> eqList = jaxbElem.getValue().getList();
- assertNotNull(eqList);
- assertTrue(eqList.size() > 0);
- for (Equipment equipment : eqList) {
- System.out.println(equipment.getName() + "; id=" + equipment.getId());
- }
- System.out.println();
- }
- @Test
- public void returnListOfDevicesByDirectSupplyBoxIdId5642772() {
- System.out.println("Оборудование по плате ID = 5642772:");
- JAXBElement<DeviceList> jaxbElem = ctis.getDeviceListByDirectSupplyBox(
- of.createGetDeviceListByDirectSupplyBoxRequest(createEquipment("5642772")));
- assertNotNull(jaxbElem);
- List<Device> eqList = jaxbElem.getValue().getDevices();
- assertNotNull(eqList);
- assertTrue(eqList.size() > 0);
- for (Device equipment : eqList) {
- System.out.println(equipment.getLinearData());
- }
- System.out.println();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement