Skip to content

Commit

Permalink
Try to use dev port for JAX-RS url CodeLens
Browse files Browse the repository at this point in the history
Closes redhat-developer#311

Signed-off-by: David Thompson <davthomp@redhat.com>
  • Loading branch information
datho7561 committed Nov 17, 2020
1 parent 88e8fd3 commit d28514d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,11 @@ public void urlCodeLensProperties() throws Exception {
// remove quarkus.http.port from application.properties
saveFile(JDTMicroProfileProject.APPLICATION_PROPERTIES_FILE, "", javaProject);
assertCodeLenses(8081, params, utils); // here port is 8081 coming from META-INF/microprofile-config.properties

// Set a different value for the dev profile.
// If the dev profile for quarkus.http.port exists, this should be used instead of the default profile
saveFile(JDTMicroProfileProject.APPLICATION_PROPERTIES_FILE, "quarkus.http.port = 8080\n%dev.quarkus.http.port = 9090", javaProject);
assertCodeLenses(9090, params, utils);
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,13 @@
*
* Quarkus JAX-RS CodeLens participant used to update the server port declared
* with "quarkus.http.port" property.
*
*
* @author Angelo ZERR
*
*
*/
public class QuarkusJaxRsCodeLensParticipant implements IJavaCodeLensParticipant {

private static final String QUARKUS_DEV_HTTP_PORT = "%dev.quarkus.http.port";
private static final String QUARKUS_HTTP_PORT = "quarkus.http.port";

@Override
Expand All @@ -43,7 +44,8 @@ public void beginCodeLens(JavaCodeLensContext context, IProgressMonitor monitor)
JDTMicroProfileProject mpProject = JDTMicroProfileProjectManager.getInstance()
.getJDTMicroProfileProject(javaProject);
int serverPort = mpProject.getPropertyAsInteger(QUARKUS_HTTP_PORT, JaxRsContext.DEFAULT_PORT);
JaxRsContext.getJaxRsContext(context).setServerPort(serverPort);
int devServerPort = mpProject.getPropertyAsInteger(QUARKUS_DEV_HTTP_PORT, serverPort);
JaxRsContext.getJaxRsContext(context).setServerPort(devServerPort);
}

@Override
Expand Down

0 comments on commit d28514d

Please sign in to comment.