fix url for https

This commit is contained in:
verboomp
2026-02-03 14:35:02 +01:00
parent 3a1b9a3af6
commit 2e120291c7
5 changed files with 54 additions and 42 deletions

View File

@@ -40,10 +40,10 @@ public class CustomerPictureResourceTest extends AbstractRestTest {
@Order(2)
public void doAddCustomerPicture() throws IOException {
LOG.info("doAddCustomerPicture");
assertEquals(3, customerCount());
assertEquals(5, pictureCount());
String path = deploymentURL + PATH;
Request request = Request.Post(path).addHeader("Accept", "application/json; charset=utf-8")
.bodyFile(new File(BASE_UPLOAD + "add.json"), ContentType.APPLICATION_JSON);
@@ -51,19 +51,19 @@ public class CustomerPictureResourceTest extends AbstractRestTest {
HttpResponse httpResponse = executeRequest(request);
int code = httpResponse.getStatusLine().getStatusCode();
assertEquals(200, code);
assertEquals(3, customerCount());
assertEquals(6, pictureCount());
}
@Test
@Order(3)
public void doAddCustomerWithPicture() throws IOException {
LOG.info("doAddCustomerWithPicture");
assertEquals(3, customerCount());
assertEquals(6, pictureCount());
String authorization = getBasicHeader();
LOG.info("authorization: " + authorization);
String path = deploymentURL + PATH;
@@ -74,16 +74,16 @@ public class CustomerPictureResourceTest extends AbstractRestTest {
HttpResponse httpResponse = executeRequest(request);
int code = httpResponse.getStatusLine().getStatusCode();
assertEquals(200, code);
assertEquals(4, customerCount());
assertEquals(7, pictureCount());
}
@Test
@Order(1)
public void doAddCustomerPictureWrongJson() throws IOException {
LOG.info("doAddCustomerPictureWrongJson");
String authorization = getBasicHeader();
LOG.info("authorization: " + authorization);
String path = deploymentURL + PATH;
@@ -94,55 +94,44 @@ public class CustomerPictureResourceTest extends AbstractRestTest {
HttpResponse httpResponse = executeRequest(request);
int code = httpResponse.getStatusLine().getStatusCode();
assertEquals(400, code);
String text = getResponseText(httpResponse, "doGetAll");
System.out.println(text);
}
@Test
@Order(2)
public void doTest() throws IOException {
LOG.info("doAddCustomerPicture");
//String authorization = getBasicHeader();
//LOG.info("authorization: " + authorization);
String path = deploymentURL + PATH;
Request request = Request.Options(path).addHeader("Accept", "application/json; charset=utf-8");
//.addHeader("Authorization", authorization)
//.bodyFile(new File(BASE_UPLOAD + "add.json"), ContentType.APPLICATION_JSON);
//.addHeader("Authorization", authorization)
//.bodyFile(new File(BASE_UPLOAD + "add.json"), ContentType.APPLICATION_JSON);
HttpResponse httpResponse = executeRequest(request);
var headers = httpResponse.getAllHeaders();
for (var header : headers) {
System.out.println(header.getName() + " " + header.getValue());
}
int code = httpResponse.getStatusLine().getStatusCode();
assertEquals(200, code);
}
public static void main(String[] args) throws IOException {
String baseUrl = "http://hartmann-cue.heydevelop.de/api/";
//String baseUrl = "http://localhost:8080/api/";
String sizeUrl = baseUrl;
System.out.println();
if(baseUrl.startsWith("http://") && !baseUrl.startsWith("http://localhost")){
System.out.println("starts with http:// ");
sizeUrl = "https://" + baseUrl.substring(7);
System.out.println("new baseUrl " + sizeUrl);
}
/*
var test = new CustomerPictureResourceTest();
test.deploymentURL = "http://localhost:8080/";
test.deploymentURL = "https://hartmann-cue.heydevelop.de/";
test.username = "adm";
test.password = "x1t0e7Pb49";
test.doTest();*/
test.doTest();
}
}