Coder Social home page Coder Social logo

Comments (24)

jamesdbloom avatar jamesdbloom commented on May 21, 2024

Hey, I'll take a look later today and get back to you. Cheer, J

from mockserver.

jamesdbloom avatar jamesdbloom commented on May 21, 2024

I think this issue is caused by google guava version 14.0.1, according to https://code.google.com/p/guava-libraries/issues/detail?id=1433#c20 and https://code.google.com/p/google-web-toolkit/issues/detail?id=8590.

I have updated guava to version 15 as apparently this fixes the issue.

This is in the 3.1-SNAPSHOT version.

Please test it and let me know if this fixes it.

Cheers,

James

from mockserver.

lordofthejars avatar lordofthejars commented on May 21, 2024

Currently I am using the 2.10 version, is 3.0 or 3.1-SNAPSHOT available in some repo? (I have not seen in central maven repo)

from mockserver.

jamesdbloom avatar jamesdbloom commented on May 21, 2024

The 3.1-SNAPSHOT is at https://oss.sonatype.org/content/repositories/snapshots/org/mock-server/mockserver-war/3.1-SNAPSHOT/

Also the 3.0 release version was released but I just released it wasn't pushed to Maven Central. It should be visible on the Maven Central search page http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22org.mock-server%22%20AND%20a%3A%22mockserver%22 within the next two hours.

from mockserver.

jamesdbloom avatar jamesdbloom commented on May 21, 2024

p.s. The Sonatype SNAPSHOT repo can be configured in Maven with:

    <repositories>
        <repository>
            <id>sonatype-nexus-snapshots</id>
            <name>Sonatype Nexus Snapshots</name>
            <url>https://oss.sonatype.org/content/repositories/snapshots</url>
            <releases>
                <enabled>false</enabled>
            </releases>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </repository>
    </repositories>

from mockserver.

lordofthejars avatar lordofthejars commented on May 21, 2024

Hello, it seems that it is not correctly released to snapshot repository.

Jun 11, 2014 10:36:36 PM org.jboss.shrinkwrap.resolver.impl.maven.logging.LogTransferListener transferFailed
WARNING: Failed downloading org/mock-server/mockserver/3.1-SNAPSHOT/mockserver-3.1-SNAPSHOT.pom from https://oss.sonatype.org/content/repositories/snapshots/. Reason: 
org.eclipse.aether.transfer.ArtifactNotFoundException: Could not find artifact org.mock-server:mockserver:pom:3.1-SNAPSHOT in sonatype-nexus-snapshots (https://oss.sonatype.org/content/repositories/snapshots)

See that it is trying to resolve snapshot from snapshot repository but the pom it is not present. In fact there is only since version 2.4 https://oss.sonatype.org/content/repositories/snapshots/org/mock-server/mockserver/

So I think that it would require a full upload instead of only the war one.

WDYT?

from mockserver.

jamesdbloom avatar jamesdbloom commented on May 21, 2024

Yes your right there was an issue with the TravisCI build for SNAPSHOTS and it wasn't uploading the parent pom. This has been fixed now so the parent pom is there. Can you please try this SNAPSHOT if it is working I can do a release.

Thanks,

James

from mockserver.

lordofthejars avatar lordofthejars commented on May 21, 2024

Ok now it works no error is thrown and is deployed as expected, but I think I am missing something in case of deploying as WAR. Look I have deployed into wildfly the snapshot war (basically dropped the war file inside the server), and then I execute next code:

new MockServerClient("127.0.0.1", 8080, "mockserver-war-3.1-SNAPSHOT")
        .when(
                request()
                        .withMethod("GET")
                        .withPath("/")
        )
        .respond(
                response()
                        .withBody("{username: 'foo', password: 'bar'}")
        );


        String url = "http://127.0.0.1:8080/mockserver-war-3.1-SNAPSHOT";

        URL obj = new URL(url);
        HttpURLConnection con = (HttpURLConnection) obj.openConnection();

        // optional default is GET
        con.setRequestMethod("GET");

        //add request header

        int responseCode = con.getResponseCode();
        System.out.println("\nSending 'GET' request to URL : " + url);
        System.out.println("Response Code : " + responseCode);

        BufferedReader in = new BufferedReader(
                new InputStreamReader(con.getInputStream()));
        String inputLine;
        StringBuffer response = new StringBuffer();

        while ((inputLine = in.readLine()) != null) {
            response.append(inputLine);
        }
        in.close();

        //print result
        System.out.println(response.toString());

And response code returns a 404- Maybe something related with the port?

from mockserver.

jamesdbloom avatar jamesdbloom commented on May 21, 2024

Are you sure the context path of the web application is mockserver-war-3.1-SNAPSHOT?

When I deploy the web application to Tomcat using the context path mockserver-war-3.1-SNAPSHOT and run the following code:

import org.mockserver.client.server.MockServerClient;

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;

import static org.mockserver.model.HttpRequest.request;
import static org.mockserver.model.HttpResponse.response;

/**
 * @author jamesdbloom
 */
public class Test {

    public static void main(String[] args) throws Exception {
        new MockServerClient("127.0.0.1", 8080, "mockserver-war-3.1-SNAPSHOT")
                .when(
                        request()
                                .withMethod("GET")
                                .withPath("/")
                )
                .respond(
                        response()
                                .withBody("{username: 'foo', password: 'bar'}")
                );


        String url = "http://127.0.0.1:8080/mockserver-war-3.1-SNAPSHOT";

        URL obj = new URL(url);
        HttpURLConnection con = (HttpURLConnection) obj.openConnection();

        // optional default is GET
        con.setRequestMethod("GET");

        //add request header

        int responseCode = con.getResponseCode();
        System.out.println("\nSending 'GET' request to URL : " + url);
        System.out.println("Response Code : " + responseCode);

        BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
        String inputLine;
        StringBuilder response = new StringBuilder();

        while ((inputLine = in.readLine()) != null) {
            response.append(inputLine);
        }
        in.close();

        //print result
        System.out.println(response.toString());
    }

}

I get the following output:

Sending 'GET' request to URL : http://127.0.0.1:8080/mockserver-war-3.1-SNAPSHOT/
Response Code : 200
{username: 'foo', password: 'bar'}

If you can run the application in debug try putting a break point at the following places and see what you get:

  1. org/mockserver/server/MockServerServlet.java:87 - this should show all incoming GET or POST requests to the MockServer web application.
  2. org/mockserver/server/MockServerServlet.java:54 - this should show all incoming PUT requests to the MockServer web application, in particular this shows the initial request to setup the expectation.
  3. org/mockserver/matchers/HttpRequestMatcher.java:106 - this should show how each incoming request is matched, and if the request is not matched against an expectation why it is not being matched.

This should allow you see what the problem is and double check whether context path is setup correctly.

from mockserver.

lordofthejars avatar lordofthejars commented on May 21, 2024

From Wildfly logs it seems that context. I will try with tomcat as well and
see what's happen with Wildfly. In fact I copy paste the context from
wildfly log.

2014-06-17 8:26 GMT+02:00 James D Bloom [email protected]:

Are you sure the context path of the web application is
mockserver-war-3.1-SNAPSHOT?

When I deploy the web application to Tomcat using the context path
mockserver-war-3.1-SNAPSHOT and run the following code:

import org.mockserver.client.server.MockServerClient;
import java.io.BufferedReader;import java.io.InputStreamReader;import java.net.HttpURLConnection;import java.net.URL;
import static org.mockserver.model.HttpRequest.request;import static org.mockserver.model.HttpResponse.response;
/** * @author jamesdbloom */public class Test {

public static void main(String[] args) throws Exception {
    new MockServerClient("127.0.0.1", 8080, "mockserver-war-3.1-SNAPSHOT")
            .when(
                    request()
                            .withMethod("GET")
                            .withPath("/")
            )
            .respond(
                    response()
                            .withBody("{username: 'foo', password: 'bar'}")
            );


    String url = "http://127.0.0.1:8080/mockserver-war-3.1-SNAPSHOT";

    URL obj = new URL(url);
    HttpURLConnection con = (HttpURLConnection) obj.openConnection();

    // optional default is GET
    con.setRequestMethod("GET");

    //add request header

    int responseCode = con.getResponseCode();
    System.out.println("\nSending 'GET' request to URL : " + url);
    System.out.println("Response Code : " + responseCode);

    BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
    String inputLine;
    StringBuilder response = new StringBuilder();

    while ((inputLine = in.readLine()) != null) {
        response.append(inputLine);
    }
    in.close();

    //print result
    System.out.println(response.toString());
}

}

I get the following output:

Sending 'GET' request to URL : http://127.0.0.1:8080/mockserver-war-3.1-SNAPSHOT/
Response Code : 200{username: 'foo', password: 'bar'}

If you can run the application in debug try putting a break point at the
following places and see what you get:

  1. org/mockserver/server/MockServerServlet.java:87 - this should
    show all incoming GET or POST requests to the MockServer web application.
  2. org/mockserver/server/MockServerServlet.java:54 - this should
    show all incoming PUT requests to the MockServer web application, in
    particular this shows the initial request to setup the expectation.
  3. org/mockserver/matchers/HttpRequestMatcher.java:106 - this should
    show how each incoming request is matched, and if the request is not
    matched against an expectation why it is not being matched.

This should allow you see what the problem is and double check whether
context path is setup correctly.


Reply to this email directly or view it on GitHub
#43 (comment)
.

+----------------------------------------------------------+
Alex Soto Bueno - Computer Engineer
www.lordofthejars.com
+----------------------------------------------------------+

from mockserver.

jamesbloomnektan avatar jamesbloomnektan commented on May 21, 2024

Did you manage to check this?

from mockserver.

lordofthejars avatar lordofthejars commented on May 21, 2024

Hi, really busy time :( currently working 7 days a week so no time for open source projects 😠 but hope tomorrow I will be able to take a review. Thank you so much, I think that adding mock-server to Arquillian will add a great visibility to mock-server as well on the other direction. Thank you so much for your support.

from mockserver.

jamesdbloom avatar jamesdbloom commented on May 21, 2024

Adding mock-server to Arquillian sounds like an interesting idea I'll look into that.

from mockserver.

lordofthejars avatar lordofthejars commented on May 21, 2024

It worked using Arquillian Tomcat, but not using Wildfly. I am not sure if the problem is in Wildlfy or or in the integration between mockserver and Wildfly. Let me try to find the problem and if you don't have to change anything then you can close this issue.

from mockserver.

jamesdbloom avatar jamesdbloom commented on May 21, 2024

If you can send me the code / configuration you used to do it with Tomcat and Wildfire I'll make sure it works and add tests that cover these scenarios.

from mockserver.

lordofthejars avatar lordofthejars commented on May 21, 2024

The code is here
https://github.com/lordofthejars/arquillian-mock-server/tree/master/arquillian-mock-server-moco/src/test/java/org/jboss/arquillian/mockserver/moco/client
and
there is one profile for remote Wildfly and another one for tomcat. If you
want you can configure the embedded Wldfly as well. But I remember trying
to drop the war file inside Wildfly and run a test (not the one of the
project) and it doesn't work.

Thank you so much for your support.
Alex.

2014-07-01 20:41 GMT+02:00 James D Bloom [email protected]:

If you can send me the code / configuration you used to do it with Tomcat
and Wildfire I'll make sure it works and add tests that cover these
scenarios.


Reply to this email directly or view it on GitHub
#43 (comment)
.

+----------------------------------------------------------+
Alex Soto Bueno - Computer Engineer
www.lordofthejars.com
+----------------------------------------------------------+

from mockserver.

jamesdbloom avatar jamesdbloom commented on May 21, 2024

Great I'll look at in the next couple of days very busy at the moment.

from mockserver.

apehm avatar apehm commented on May 21, 2024

Version 3.4 still fails for the same reason

12:46,391 ERROR [org.jboss.msc.service.fail.startFailed] [MSC service thread 1-5] MSC000001: Failed to start service jboss.deployment.unit."mockserver-war-3.4.war".WeldStartService: org.jboss.msc.service.StartException in service jboss.deployment.unit."mockserver-war-3.4.war".WeldStartService: Failed to start service
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1767) [jboss-msc.jar:1.0.4.GA-redhat-1]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_17]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_17]
at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_17]
Caused by: org.jboss.weld.exceptions.DeploymentException: WELD-001408 Unsatisfied dependencies for type [Set] with qualifiers [@default] at injection point [[parameter 1] of [constructor] @Inject com.google.common.util.concurrent.ServiceManager(Set)]
at org.jboss.weld.bootstrap.Validator.validateInjectionPoint(Validator.java:311)
at org.jboss.weld.bootstrap.Validator.validateInjectionPoint(Validator.java:280)
at org.jboss.weld.bootstrap.Validator.validateBean(Validator.java:143)
at org.jboss.weld.bootstrap.Validator.validateRIBean(Validator.java:163)
at org.jboss.weld.bootstrap.Validator.validateBeans(Validator.java:382)
at org.jboss.weld.bootstrap.Validator.validateDeployment(Validator.java:367)
at org.jboss.weld.bootstrap.WeldBootstrap.validateBeans(WeldBootstrap.java:379)
at org.jboss.as.weld.WeldStartService.start(WeldStartService.java:64)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc.jar:1.0.4.GA-redhat-1]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc.jar:1.0.4.GA-redhat-1]

from mockserver.

jamesbloomnektan avatar jamesbloomnektan commented on May 21, 2024

I will look into fixing this, however, It would be good if I could understand your user requirements, for starting this with Weld.

Are you trying to run this for a unit / integration test as there are lots of other ways to start the MockServer as follows:

All of these should be working correctly except starting the WAR via weld. I believe this is because Weld has specific logic looking for a beans.xml, etc none of which is specifically tested or supported currently. I do plan on resolving this as soon as I can but realistically it might take a week or two as I'm very busy on a Go / Docker project.

from mockserver.

apehm avatar apehm commented on May 21, 2024

It would just make things easier for me if I could deploy the mock server to a JEE 6 compliant environment.
The reason is company-specific in my case. Spawning a new VM with a JBoss EAP and deploying a war file inside is something that can be done fully automated.
Command line, Docker etc. means I have to create a ticket for the applications engineers to get the mock server up and running.
But if the time horizon is one or two weeks I will go for the command line option.
Anyway, thanks for the great work and all the effort that you put into this project!

from mockserver.

lordofthejars avatar lordofthejars commented on May 21, 2024

In my case I just need an integration to Wildfly because I need to deploy
the WAR file inside wildfly :) But sure I can wait no problem.

2014-07-15 12:53 GMT+02:00 apehm [email protected]:

It would just make things easier for me if I could deploy the mock server
to a JEE 6 compliant environment.
The reason is company-specific in my case. Spawning a new VM with a JBoss
EAP and deploying a war file inside is something that can be done fully
automated.
Command line, Docker etc. means I have to create a ticket for the
applications engineers to get the mock server up and running.
But if the time horizon is one or two weeks I will go for the command line
option.
Anyway, thanks for the great work and all the effort that you put into
this project!


Reply to this email directly or view it on GitHub
#43 (comment)
.

+----------------------------------------------------------+
Alex Soto Bueno - Computer Engineer
www.lordofthejars.com
+----------------------------------------------------------+

from mockserver.

jamesbloomnektan avatar jamesbloomnektan commented on May 21, 2024

@apehm I'll try to take a look this in the next few days. I don't believe it is anything to do with MockServer not working in a JEE 6 compliant environment as the WAR deploys correctly on Tomcat, Jetty, and Websphere. I believe JBoss is doing something extra that these other containers are not and this is causing an issue with one of the dependencies of the MockServer but I'm not 100% on this yet.

from mockserver.

jamesdbloom avatar jamesdbloom commented on May 21, 2024

I'm not having any issues deploying in Wildfly, I've performed several test for both mocking and request forward and all seems to work correctly, as follows:

=========================================================================

  JBoss Bootstrap Environment

  JBOSS_HOME: /Users/jamesdbloom/git/wildfly-8.1.0.Final

  JAVA: /Library/Java/JavaVirtualMachines/jdk1.7.0_17.jdk/Contents/Home/bin/java

  JAVA_OPTS:  -server -Xms64m -Xmx512m -XX:MaxPermSize=256m -Djava.net.preferIPv4Stack=true -Djboss.modules.system.pkgs=org.jboss.byteman -Djava.awt.headless=true

=========================================================================

20:52:51,348 INFO  [org.jboss.modules] (main) JBoss Modules version 1.3.3.Final
20:52:51,995 INFO  [org.jboss.msc] (main) JBoss MSC version 1.2.2.Final
20:52:52,055 INFO  [org.jboss.as] (MSC service thread 1-6) JBAS015899: WildFly 8.1.0.Final "Kenny" starting
20:52:52,904 INFO  [org.jboss.as.server] (Controller Boot Thread) JBAS015888: Creating http management service using socket-binding (management-http)
20:52:52,919 INFO  [org.xnio] (MSC service thread 1-8) XNIO version 3.2.2.Final
20:52:52,929 INFO  [org.xnio.nio] (MSC service thread 1-8) XNIO NIO Implementation Version 3.2.2.Final
20:52:52,946 INFO  [org.wildfly.extension.io] (ServerService Thread Pool -- 31) WFLYIO001: Worker 'default' has auto-configured to 16 core threads with 128 task threads based on your 8 available processors
20:52:52,948 INFO  [org.jboss.as.security] (ServerService Thread Pool -- 45) JBAS013171: Activating Security Subsystem
20:52:52,948 WARN  [org.jboss.as.txn] (ServerService Thread Pool -- 46) JBAS010153: Node identifier property is set to the default value. Please make sure it is unique.
20:52:53,041 INFO  [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 32) JBAS010280: Activating Infinispan subsystem.
20:52:53,051 INFO  [org.jboss.as.naming] (ServerService Thread Pool -- 40) JBAS011800: Activating Naming Subsystem
20:52:53,051 INFO  [org.jboss.as.jsf] (ServerService Thread Pool -- 38) JBAS012615: Activated the following JSF Implementations: [main]
20:52:53,051 INFO  [org.jboss.as.security] (MSC service thread 1-4) JBAS013170: Current PicketBox version=4.0.21.Beta1
20:52:53,072 INFO  [org.wildfly.extension.undertow] (ServerService Thread Pool -- 47) JBAS017502: Undertow 1.0.15.Final starting
20:52:53,072 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-13) JBAS017502: Undertow 1.0.15.Final starting
20:52:53,073 INFO  [org.jboss.as.webservices] (ServerService Thread Pool -- 48) JBAS015537: Activating WebServices Extension
20:52:53,089 INFO  [org.jboss.as.connector.logging] (MSC service thread 1-13) JBAS010408: Starting JCA Subsystem (IronJacamar 1.1.5.Final)
20:52:53,109 INFO  [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 27) JBAS010403: Deploying JDBC-compliant driver class org.h2.Driver (version 1.3)
20:52:53,112 INFO  [org.jboss.remoting] (MSC service thread 1-8) JBoss Remoting version 4.0.3.Final
20:52:53,118 INFO  [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-5) JBAS010417: Started Driver service with driver-name = h2
20:52:53,128 INFO  [org.jboss.as.naming] (MSC service thread 1-5) JBAS011802: Starting Naming Service
20:52:53,129 INFO  [org.jboss.as.mail.extension] (MSC service thread 1-12) JBAS015400: Bound mail session [java:jboss/mail/Default]
20:52:53,299 INFO  [org.wildfly.extension.undertow] (ServerService Thread Pool -- 47) JBAS017527: Creating file handler for path /Users/jamesdbloom/git/wildfly-8.1.0.Final/welcome-content
20:52:53,319 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-5) JBAS017525: Started server default-server.
20:52:53,335 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-12) JBAS017531: Host default-host starting
20:52:53,408 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-5) JBAS017519: Undertow HTTP listener default listening on /127.0.0.1:8080
20:52:53,745 INFO  [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-2) JBAS010400: Bound data source [java:jboss/datasources/ExampleDS]
20:52:53,753 INFO  [org.jboss.as.server.deployment.scanner] (MSC service thread 1-5) JBAS015012: Started FileSystemDeploymentService for directory /Users/jamesdbloom/git/wildfly-8.1.0.Final/standalone/deployments
20:52:54,091 INFO  [org.jboss.ws.common.management] (MSC service thread 1-9) JBWS022052: Starting JBoss Web Services - Stack CXF Server 4.2.4.Final
20:52:54,138 INFO  [org.jboss.as] (Controller Boot Thread) JBAS015961: Http management interface listening on http://127.0.0.1:9990/management
20:52:54,138 INFO  [org.jboss.as] (Controller Boot Thread) JBAS015951: Admin console listening on http://127.0.0.1:9990
20:52:54,138 INFO  [org.jboss.as] (Controller Boot Thread) JBAS015874: WildFly 8.1.0.Final "Kenny" started in 3072ms - Started 184 of 233 services (81 services are lazy, passive or on-demand)
20:54:13,364 INFO  [org.jboss.as.repository] (management-handler-thread - 1) JBAS014900: Content added at location /Users/jamesdbloom/git/wildfly-8.1.0.Final/standalone/data/content/5c/b0327107f93fe0b346bd89675c1e1dd94d809b/content
20:54:13,378 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-8) JBAS015876: Starting deployment of "mockserver-war-3.5-SNAPSHOT.war" (runtime-name: "mockserver-war-3.5-SNAPSHOT.war")
20:54:15,066 INFO  [org.jboss.weld.deployer] (MSC service thread 1-15) JBAS016002: Processing weld deployment mockserver-war-3.5-SNAPSHOT.war
20:54:15,285 INFO  [org.hibernate.validator.internal.util.Version] (MSC service thread 1-15) HV000001: Hibernate Validator 5.1.0.Final
20:54:15,400 INFO  [org.jboss.weld.deployer] (MSC service thread 1-12) JBAS016005: Starting Services for CDI deployment: mockserver-war-3.5-SNAPSHOT.war
20:54:15,425 INFO  [org.jboss.weld.Version] (MSC service thread 1-12) WELD-000900: 2.1.2 (Final)
20:54:15,454 INFO  [org.jboss.weld.deployer] (MSC service thread 1-2) JBAS016008: Starting weld service for deployment mockserver-war-3.5-SNAPSHOT.war
20:54:16,361 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-14) JBAS017534: Registered web context: /mockserver-war-3.5-SNAPSHOT
20:54:16,403 INFO  [org.jboss.as.server] (management-handler-thread - 1) JBAS018559: Deployed "mockserver-war-3.5-SNAPSHOT.war" (runtime-name : "mockserver-war-3.5-SNAPSHOT.war")

I downloaded a fresh copy of Wild 8.1.0 and it run with no issues first time.

I ran the following steps:

cd wildfly-8.1.0.Final
./bin/standalone.sh
./bin/jboss-cli.sh
connect
deploy ~/git/mockserver/mockserver-war/target/mockserver-war-3.5-SNAPSHOT.war

Then I ran the follow two tests:

1. mocking

$ curl -v 'http://127.0.0.1:8080/mockserver-war-3.5-SNAPSHOT/expectation' -X PUT --data '{"httpRequest": {"method":"GET","path":"/test"},"httpResponse": {"body":"\n\na test response\n\n"}}'
* About to connect() to 127.0.0.1 port 8080 (#0)
*   Trying 127.0.0.1...
* Adding handle: conn: 0x7fff14004000
* Adding handle: send: 0
* Adding handle: recv: 0
* Curl_addHandleToPipeline: length: 1
* - Conn 0 (0x7fff14004000) send_pipe: 1, recv_pipe: 0
* Connected to 127.0.0.1 (127.0.0.1) port 8080 (#0)
> PUT /mockserver-war-3.5-SNAPSHOT/expectation HTTP/1.1
> User-Agent: curl/7.30.0
> Host: 127.0.0.1:8080
> Accept: */*
> Content-Length: 99
> Content-Type: application/x-www-form-urlencoded
> 
* upload completely sent off: 99 out of 99 bytes
< HTTP/1.1 201 Created
< Connection: keep-alive
< X-Powered-By: Undertow/1
* Server WildFly/8 is not blacklisted
< Server: WildFly/8
< Content-Length: 0
< Date: Sun, 20 Jul 2014 20:18:05 GMT
< 
* Connection #0 to host 127.0.0.1 left intact

mocking response

$ curl -v 'http://127.0.0.1:8080/mockserver-war-3.5-SNAPSHOT/test'
* About to connect() to 127.0.0.1 port 8080 (#0)
*   Trying 127.0.0.1...
* Adding handle: conn: 0x7fc2e2004000
* Adding handle: send: 0
* Adding handle: recv: 0
* Curl_addHandleToPipeline: length: 1
* - Conn 0 (0x7fc2e2004000) send_pipe: 1, recv_pipe: 0
* Connected to 127.0.0.1 (127.0.0.1) port 8080 (#0)
> GET /mockserver-war-3.5-SNAPSHOT/test HTTP/1.1
> User-Agent: curl/7.30.0
> Host: 127.0.0.1:8080
> Accept: */*
> 
< HTTP/1.1 200 OK
< Connection: keep-alive
< X-Powered-By: Undertow/1
* Server WildFly/8 is not blacklisted
< Server: WildFly/8
< Content-Length: 19
< Date: Sun, 20 Jul 2014 20:18:08 GMT
< 


a test response

* Connection #0 to host 127.0.0.1 left intact

2. forwarding

$ curl -vvv 'http://127.0.0.1:8080/mockserver-war-3.5-SNAPSHOT/expectation' -X PUT --data '{"httpRequest": {"method":"GET","path":"/sitemap.xml"},"httpForward": {"host": "www.mock-server.com","port": "80","scheme": "HTTP"}}'
* About to connect() to 127.0.0.1 port 8080 (#0)
*   Trying 127.0.0.1...
* Adding handle: conn: 0x7fc8cb004000
* Adding handle: send: 0
* Adding handle: recv: 0
* Curl_addHandleToPipeline: length: 1
* - Conn 0 (0x7fc8cb004000) send_pipe: 1, recv_pipe: 0
* Connected to 127.0.0.1 (127.0.0.1) port 8080 (#0)
> PUT /mockserver-war-3.5-SNAPSHOT/expectation HTTP/1.1
> User-Agent: curl/7.30.0
> Host: 127.0.0.1:8080
> Accept: */*
> Content-Length: 132
> Content-Type: application/x-www-form-urlencoded
> 
* upload completely sent off: 132 out of 132 bytes
< HTTP/1.1 201 Created
< Connection: keep-alive
< X-Powered-By: Undertow/1
* Server WildFly/8 is not blacklisted
< Server: WildFly/8
< Content-Length: 0
< Date: Sun, 20 Jul 2014 20:22:00 GMT

forwarded request

$ curl -v 'http://127.0.0.1:8080/mockserver-war-3.5-SNAPSHOT/sitemap.xml' -H 'Host: www.mock-server.com'
* About to connect() to 127.0.0.1 port 8080 (#0)
*   Trying 127.0.0.1...
* Adding handle: conn: 0x7f9053804000
* Adding handle: send: 0
* Adding handle: recv: 0
* Curl_addHandleToPipeline: length: 1
* - Conn 0 (0x7f9053804000) send_pipe: 1, recv_pipe: 0
* Connected to 127.0.0.1 (127.0.0.1) port 8080 (#0)
> GET /mockserver-war-3.5-SNAPSHOT/sitemap.xml HTTP/1.1
> User-Agent: curl/7.30.0
> Accept: */*
> Host: www.mock-server.com
> 
< HTTP/1.1 200 OK
< CF-RAY: 14d1de968d390cf5-LHR
< X-Powered-By: Undertow/1
< Set-Cookie: __cfduid=dffe48612175efe3f8e0e562e311f31a31405887732245; expires=Mon, 23-Dec-2019 23:50:00 GMT; path=/; domain=.mock-server.com; HttpOnly
< Set-Cookie: __cfduid=dffe48612175efe3f8e0e562e311f31a31405887732245
* Server WildFly/8 is not blacklisted
< Server: WildFly/8
* Server cloudflare-nginx is not blacklisted
< Server: cloudflare-nginx
< Date: Sun, 20 Jul 2014 20:22:12 GMT
< Connection: keep-alive
< Vary: User-Agent
< Last-Modified: Sun, 09 Feb 2014 10:02:21 GMT
< Cf-Railgun: e24c6442e7 0000 normal 5360
< Content-Type: application/xml
< Content-Length: 870
< 
<?xml version='1.0' encoding='UTF-8'?>
<urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd http://www.google.com/schemas/sitemap-image/1.1"
        xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">
    <url>
        <loc>http://www.mock-server.com/index.html</loc>
        <lastmod>2014-02-09</lastmod>
        <changefreq>weekly</changefreq>
        <priority>1.0</priority>
        <image:image>
            <image:loc>http://www.mock-server.com/images/SystemInProduction.png</image:loc>
        </image:image>
        <image:image>
            <image:loc>http://www.mock-server.com/images/SystemUnderTest.png</image:loc>
        </image:image>
    </url>
* Connection #0 to host 127.0.0.1 left intact
</urlset>

These two example tests show that everything seems to be working correctly on Wildfly 8.1.0.

I would be grateful if you can provide me with more details then I can look into fixing any issues you have.

Can you provide me with more information:

  • What else do you have deployed in the container?
  • Do you have any special non-default extensions enabled?
  • What version of Java are you using?
  • What OS are you running Wildfly on?

Thanks,

James

from mockserver.

jamesdbloom avatar jamesdbloom commented on May 21, 2024

closing this issue as can't reproduce, if there is more information about there being a problem with MockServer happy to re-open issue again

from mockserver.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.