package com.epam.wilma.gepard.test.sequence.handling; /*========================================================================== Copyright 2013-2017 EPAM Systems This file is part of Wilma. Wilma is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. Wilma is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Wilma. If not, see <http://www.gnu.org/licenses/>. ===========================================================================*/ import com.epam.gepard.annotations.TestClass; import com.epam.wilma.gepard.testclient.RequestParameters; import org.junit.Test; import java.io.ByteArrayInputStream; import java.io.FileNotFoundException; import java.io.InputStream; /** * Tests that the sequence keys consists of the sequence descriptor name and the key * generated by the sequence handler concatenated with an underscore as a separator * between them. * * @author Adam_Csaba_Kiraly */ @TestClass(id = "SequenceHandling", name = "Sequence Key") public class SequenceKeyTest extends SequenceHandlingTestBase { private String tcName = getDataDrivenTestParameter("PAR0"); private String tcRequestBody = getDataDrivenTestParameter("PAR1"); private String tcJarFile = getDataDrivenTestParameter("PAR2"); private String tcJarPath = getDataDrivenTestParameter("PAR3"); private String tcStubConfigFile = getDataDrivenTestParameter("PAR4"); private String tcFinalResponse = getDataDrivenTestParameter("PAR5"); @Test public void testSequenceHandling() throws Exception { clearSequences(); uploadJarToWilma(tcJarFile, tcJarPath); uploadStubConfigToWilma(tcStubConfigFile); RequestParameters firstRequestParameter = createRequestParametersWithBody(tcRequestBody); setExpectedResponseMessageFromFile(tcFinalResponse); callWilmaWithPostMethodAndAssertResponse(firstRequestParameter); } protected RequestParameters createRequestParametersWithBody(final String text) throws FileNotFoundException { InputStream requestBody = new ByteArrayInputStream(text.getBytes()); String testServerUrl = getWilmaVersionInfoUrl(); String wilmaHost = getTestClassExecutionData().getEnvironment().getProperty("wilma.host"); Integer wilmaPort = Integer.parseInt(getTestClassExecutionData().getEnvironment().getProperty("wilma.port.external")); String contentType = "text/plain"; String acceptHeader = "xml"; String contentEncoding = "no"; String acceptEncoding = "no"; return new RequestParameters().testServerUrl(testServerUrl).useProxy(true).wilmaHost(wilmaHost).wilmaPort(wilmaPort).xmlIS(requestBody) .contentType(contentType).acceptHeader(acceptHeader).contentEncoding(contentEncoding).acceptEncoding(acceptEncoding); } }