Search in sources :

Example 1 with BaseURLSourceImpl

use of org.apache.tapestry5.http.internal.services.BaseURLSourceImpl in project tapestry-5 by apache.

the class BaseURLSourceImplTest method contributed_hostname.

@Test
public void contributed_hostname() {
    expect(request.getServerPort()).andReturn(80).once();
    expect(request.isSecure()).andReturn(false);
    replay();
    BaseURLSource baseURLSource = new BaseURLSourceImpl(request, "my.server.com", 0, 0);
    assertEquals(baseURLSource.getBaseURL(false), "http://my.server.com");
    verify();
}
Also used : BaseURLSourceImpl(org.apache.tapestry5.http.internal.services.BaseURLSourceImpl) BaseURLSource(org.apache.tapestry5.http.services.BaseURLSource) Test(org.testng.annotations.Test)

Example 2 with BaseURLSourceImpl

use of org.apache.tapestry5.http.internal.services.BaseURLSourceImpl in project tapestry-5 by apache.

the class BaseURLSourceImplTest method hostname_from_environment_variable.

@Test
public void hostname_from_environment_variable() {
    expect(request.getServerPort()).andReturn(80).once();
    expect(request.isSecure()).andReturn(false);
    replay();
    BaseURLSource baseURLSource = new BaseURLSourceImpl(request, "$HOSTNAME", 0, 0);
    assertEquals(baseURLSource.getBaseURL(false), "http://" + System.getenv("HOSTNAME"));
    verify();
}
Also used : BaseURLSourceImpl(org.apache.tapestry5.http.internal.services.BaseURLSourceImpl) BaseURLSource(org.apache.tapestry5.http.services.BaseURLSource) Test(org.testng.annotations.Test)

Example 3 with BaseURLSourceImpl

use of org.apache.tapestry5.http.internal.services.BaseURLSourceImpl in project tapestry-5 by apache.

the class BaseURLSourceImplTest method secure_url_using_default_port.

@Test
public void secure_url_using_default_port() {
    replay();
    BaseURLSource baseURLSource = new BaseURLSourceImpl(request, "localhost", 80, 443);
    assertEquals(baseURLSource.getBaseURL(true), "https://localhost");
    verify();
}
Also used : BaseURLSourceImpl(org.apache.tapestry5.http.internal.services.BaseURLSourceImpl) BaseURLSource(org.apache.tapestry5.http.services.BaseURLSource) Test(org.testng.annotations.Test)

Example 4 with BaseURLSourceImpl

use of org.apache.tapestry5.http.internal.services.BaseURLSourceImpl in project tapestry-5 by apache.

the class BaseURLSourceImplTest method insecure_url_using_default_port.

@Test
public void insecure_url_using_default_port() {
    replay();
    BaseURLSource baseURLSource = new BaseURLSourceImpl(request, "localhost", 80, 443);
    assertEquals(baseURLSource.getBaseURL(false), "http://localhost");
    verify();
}
Also used : BaseURLSourceImpl(org.apache.tapestry5.http.internal.services.BaseURLSourceImpl) BaseURLSource(org.apache.tapestry5.http.services.BaseURLSource) Test(org.testng.annotations.Test)

Example 5 with BaseURLSourceImpl

use of org.apache.tapestry5.http.internal.services.BaseURLSourceImpl in project tapestry-5 by apache.

the class BaseURLSourceImplTest method getBaseURLWithContributedNonStandardSecurePort.

@Test
public void getBaseURLWithContributedNonStandardSecurePort() {
    replay();
    BaseURLSource baseURLSource = new BaseURLSourceImpl(request, "localhost", 80, 8443);
    assertEquals(baseURLSource.getBaseURL(true), "https://localhost:8443");
    verify();
}
Also used : BaseURLSourceImpl(org.apache.tapestry5.http.internal.services.BaseURLSourceImpl) BaseURLSource(org.apache.tapestry5.http.services.BaseURLSource) Test(org.testng.annotations.Test)

Aggregations

BaseURLSourceImpl (org.apache.tapestry5.http.internal.services.BaseURLSourceImpl)7 BaseURLSource (org.apache.tapestry5.http.services.BaseURLSource)7 Test (org.testng.annotations.Test)7