oasp / oasp4j

The Open Application Standard Platform for Java
Apache License 2.0
60 stars 303 forks source link

Autogenerated SecurityRestServiceImplTest is not save against port and context path changes #691

Closed maybeec closed 5 years ago

maybeec commented 5 years ago

Generating the archetype 3.0.0, you may want to change the port and/or context path of the application.

  1. This leads to failing SecurityRestServiceImplTest.
  2. I tried to fix this, but I was not entirely able to do this with the ServiceConfigBuilder. It seems, that it does not support to set a context path at all.
maybeec commented 5 years ago

possibly related to #683

hohwille commented 5 years ago

Can you explain a little more and be more precise? You are talking about this test: https://github.com/oasp/oasp4j/blob/a858d6556cafd30f7226e7928f71549b29b74107/templates/server/src/main/resources/archetype-resources/core/src/test/java/__packageInPathFormat__/general/service/impl/rest/SecurityRestServiceImplTest.java

What did you change and what was the error? Actually the test does not hardcode any port or context path. For the port I am even sure that I have implemented some code that is taking it from the running server and as spring is using a random port for the JUnit it should not be as you are saying. For the context path I am not sure and you might be right. Maybe the assumption here is that you have to have an empty context path. I can not remember right now, but if it is not empty then I am quite sure it is not hardcoded in another place. For productive use you will either use envoy/istio or service discovery or you put the endpoint directly into your config. In any case you will provide an environment config: https://github.com/oasp/oasp4j/wiki/guide-service-client#configuration

maybeec commented 5 years ago

It's a duplicate of #683, I tested it.