use of org.wso2.carbon.identity.cors.mgt.core.exception.CORSManagementServiceClientException in project carbon-identity-framework by wso2.
the class OriginTests method testNullHost.
@Test
public void testNullHost() {
String uri = "http:///path/";
Origin origin;
try {
origin = new Origin(new Origin(uri).toString());
fail();
} catch (CORSManagementServiceClientException e) {
assertEquals(e.getMessage(), "Bad origin URI: Missing authority (host)");
}
}
use of org.wso2.carbon.identity.cors.mgt.core.exception.CORSManagementServiceClientException in project carbon-identity-framework by wso2.
the class OriginTests method testOrigin.
@Test
public void testOrigin() throws CORSManagementServiceClientException {
String uri = "http://example.com";
Origin o = new Origin(uri);
assertEquals(o.toString(), uri);
assertEquals(o.hashCode(), uri.hashCode());
}
use of org.wso2.carbon.identity.cors.mgt.core.exception.CORSManagementServiceClientException in project carbon-identity-framework by wso2.
the class OriginTests method testIPAddressHost.
@Test
public void testIPAddressHost() {
String uri = "http://192.168.0.1:8080";
Origin origin = null;
try {
origin = new Origin(new Origin(uri).toString());
} catch (CORSManagementServiceClientException e) {
fail(e.getMessage());
}
assertEquals(origin.toString(), uri);
assertEquals(origin.getScheme(), "http");
assertEquals(origin.getHost(), "192.168.0.1");
assertEquals(origin.getPort(), 8080);
assertEquals(origin.getSuffix(), "192.168.0.1:8080");
}
use of org.wso2.carbon.identity.cors.mgt.core.exception.CORSManagementServiceClientException in project carbon-identity-framework by wso2.
the class OriginTests method testOriginInequality.
@Test
public void testOriginInequality() throws CORSManagementServiceClientException {
String uri1 = "http://example.com";
String uri2 = "HTTP://EXAMPLE.COM";
Origin o1 = new Origin(uri1);
Origin o2 = new Origin(uri2);
assertNotEquals(o2, o1);
}
use of org.wso2.carbon.identity.cors.mgt.core.exception.CORSManagementServiceClientException in project carbon-identity-framework by wso2.
the class OriginTests method testValidation.
@Test
public void testValidation() {
String uri = "http://example.com";
Origin origin = null;
try {
origin = new Origin(uri);
} catch (CORSManagementServiceClientException e) {
fail(e.getMessage());
}
assertNotNull(origin);
assertEquals(origin.toString(), uri);
}
Aggregations