cancel
Showing results for 
Search instead for 
Did you mean: 
Subscribe

Hello,

I followed this blog post to access an OData service with the Cloud Platform SDK. I Used a custom OData Service instead of the standard Businesspartner OData service and a R3 ERP on-Premise backend system instead of S/4 HANA.

If I deploy the app to my Cloud Foundry subaccount it is working fine and my OData service is executed via Cloud Connector and destination service on my on-premise backend.

If I try to execute the same application on the local tomee server the on-premise backend system is not reached.

My destination on my subaccount looks like this:

If I pass all the information (URL,User,Password) to the local destination it is not working...

The same erroppr apperas on executing the integration tests.

What must I do to access my on-premise backlend from localhost?

Best regards,

Chris

View Entire Topic
christoffer_fuss
Participant
0 Likes

I have not implemented unit tsts at the moment.

Here is the code for the integration test:

package de.datatrain;

import io.restassured.RestAssured;
import io.restassured.http.ContentType;
import io.restassured.module.jsv.JsonSchemaValidator;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.arquillian.test.api.ArquillianResource;
import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.net.URL;
import com.sap.cloud.sdk.testutil.MockUtil;

import static io.restassured.RestAssured.when;

@RunWith(Arquillian.class)
public class TPServletTest {
    private static final MockUtil mockUtil = new MockUtil();
    private static final Logger logger = LoggerFactory.getLogger(TPServletTest.class);

    @ArquillianResource
    private URL baseUrl;

    @Deployment
    public static WebArchive createDeployment() {
        return TestUtil.createDeployment(TPServletTest.class);
    }

    @BeforeClass
    public static void beforeClass() {
        mockUtil.mockDefaults();
        mockUtil.mockErpDestination("saperp", "saperp");
    }

    @Before
    public void before() {
        RestAssured.baseURI = baseUrl.toExternalForm();
    }

    @Test
    public void testService() {
        // JSON schema validation from resource definition
        final JsonSchemaValidator jsonValidator = JsonSchemaValidator
                .matchesJsonSchemaInClasspath("tiles-schema.json");

        // HTTP GET response OK, JSON header and valid schema
        when()
                .get("/tiles")
        .then()
                .statusCode(200)
                .contentType(ContentType.JSON)
                .body(jsonValidator);
    }
}