use of io.gravitee.definition.model.VirtualHost in project gravitee-management-rest-api by gravitee-io.
the class VirtualHostServiceTest method shouldFail_create_sameBasePath2.
@Test
public void shouldFail_create_sameBasePath2() {
Api api1 = createMock("mock1", "/context");
when(apiRepository.search(null)).thenReturn(Collections.singletonList(api1));
virtualHostService.sanitizeAndValidate(Collections.singletonList(new VirtualHost("/context2")));
}
use of io.gravitee.definition.model.VirtualHost in project gravitee-management-rest-api by gravitee-io.
the class VirtualHostServiceTest method shouldFail_create_sameBasePath.
@Test
public void shouldFail_create_sameBasePath() {
Api api1 = createMock("mock1", "/context2");
when(apiRepository.search(null)).thenReturn(Collections.singletonList(api1));
virtualHostService.sanitizeAndValidate(Collections.singletonList(new VirtualHost("/context")));
}
use of io.gravitee.definition.model.VirtualHost in project gravitee-management-rest-api by gravitee-io.
the class VirtualHostServiceTest method validate_hostSubDomainOfOneOfDomainConstraints.
@Test
public void validate_hostSubDomainOfOneOfDomainConstraints() {
VirtualHost vhost = getValidVirtualHost();
String domainConstraint = vhost.getHost();
vhost.setHost("level2.level1." + domainConstraint);
EnvironmentEntity environmentEntity = new EnvironmentEntity();
environmentEntity.setDomainRestrictions(Arrays.asList("test.gravitee.io", "other.gravitee.io", domainConstraint));
when(environmentService.findById(any())).thenReturn(environmentEntity);
virtualHostService.sanitizeAndValidate(Collections.singletonList(vhost));
}
use of io.gravitee.definition.model.VirtualHost in project gravitee-management-rest-api by gravitee-io.
the class VirtualHostServiceTest method validate_hostEqualsToDomainConstraint.
@Test
public void validate_hostEqualsToDomainConstraint() {
VirtualHost vhost = getValidVirtualHost();
EnvironmentEntity environmentEntity = new EnvironmentEntity();
environmentEntity.setDomainRestrictions(Collections.singletonList(vhost.getHost()));
when(environmentService.findById(any())).thenReturn(environmentEntity);
virtualHostService.sanitizeAndValidate(Collections.singletonList(vhost));
}
use of io.gravitee.definition.model.VirtualHost in project gravitee-management-rest-api by gravitee-io.
the class VirtualHostServiceTest method shouldSucceed_create_noMatchingPath.
@Test
public void shouldSucceed_create_noMatchingPath() {
Api api1 = createMock("mock1", "/existing");
when(apiRepository.search(null)).thenReturn(Collections.singletonList(api1));
virtualHostService.sanitizeAndValidate(Collections.singletonList(new VirtualHost("/context")));
}
Aggregations