Skip to content

Commit

Permalink
fix org.apache.camel.quarkus.component.lra.it.LraTest failed apache#2523
Browse files Browse the repository at this point in the history
  • Loading branch information
ffang committed Apr 27, 2021
1 parent 5ad13f2 commit fb9d607
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public class ServiceProducers {
@javax.enterprise.inject.Produces
@Singleton
public CreditService creditService() {
return new CreditService(100);
return new CreditService(120);
}

@javax.enterprise.inject.Produces
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public void testLraTransaction() {
.statusCode(200)
.extract()
.body()
.asString().equals("3");
.asString().equals("4");
});

// Verify credit remaining
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,14 @@
*/
package org.apache.camel.quarkus.component.lra.it;

import java.net.InetAddress;
import java.util.Map;
import java.util.function.Consumer;

import com.github.dockerjava.api.command.CreateContainerCmd;
import com.github.dockerjava.api.model.ExposedPort;
import com.github.dockerjava.api.model.PortBinding;
import com.github.dockerjava.api.model.Ports;
import io.quarkus.test.common.QuarkusTestResourceLifecycleManager;
import org.apache.camel.quarkus.test.AvailablePortFinder;
import org.apache.camel.util.CollectionHelper;
Expand All @@ -36,8 +42,16 @@ public class LraTestResource implements QuarkusTestResourceLifecycleManager {
@Override
public Map<String, String> start() {
try {
String hostname = InetAddress.getLocalHost().getHostName();
Consumer<CreateContainerCmd> cmd = e -> {
e
.withPortBindings(new PortBinding(Ports.Binding.bindPort(LRA_PORT),
new ExposedPort(LRA_PORT)));
};

container = new GenericContainer(LRA_IMAGE)
.withNetworkMode("host")
.withExposedPorts(LRA_PORT)
.withCreateContainerCmdModifier(cmd)
.withCommand(
"java",
"-jar",
Expand Down

0 comments on commit fb9d607

Please sign in to comment.