Search in sources :

Example 11 with Property

use of org.apache.knox.gateway.topology.builder.property.Property in project knox by apache.

the class PropertyTopologyBuilderTest method testBuildFailedForWrongProviderParamToken1.

@Test(expected = IllegalArgumentException.class)
public void testBuildFailedForWrongProviderParamToken1() {
    PropertyTopologyBuilder propertyTopologyBuilder = new PropertyTopologyBuilder();
    propertyTopologyBuilder.addProperty(new Property("topology.gateway.provider.authentication.ShiroProvider.param", "value"));
    propertyTopologyBuilder.build();
}
Also used : Property(org.apache.knox.gateway.topology.builder.property.Property) Test(org.junit.Test)

Example 12 with Property

use of org.apache.knox.gateway.topology.builder.property.Property in project knox by apache.

the class PropertyTopologyBuilder method build.

public Topology build() {
    Topology topology = new Topology();
    PropertyInterpreter propertyInterpreter = new PropertyInterpreter(topology);
    for (Property property : properties) {
        try {
            propertyInterpreter.interpret(property.getName(), property.getValue());
        } catch (InterpretException ie) {
            log.failedToInterpretProperty(property.getName(), ie);
            throw new IllegalArgumentException(gatewayResources.wrongTopologyDataFormatError());
        }
    }
    return topology;
}
Also used : InterpretException(org.apache.knox.gateway.topology.builder.property.interpreter.InterpretException) PropertyInterpreter(org.apache.knox.gateway.topology.builder.property.interpreter.PropertyInterpreter) Topology(org.apache.knox.gateway.topology.Topology) Property(org.apache.knox.gateway.topology.builder.property.Property)

Example 13 with Property

use of org.apache.knox.gateway.topology.builder.property.Property in project knox by apache.

the class PropertyTopologyBuilderTest method testBuildFailedForWrongServiceToken3.

@Test(expected = IllegalArgumentException.class)
public void testBuildFailedForWrongServiceToken3() {
    PropertyTopologyBuilder propertyTopologyBuilder = new PropertyTopologyBuilder();
    propertyTopologyBuilder.addProperty(new Property("topology.gateway.service.WEBHDFS.", "value"));
    propertyTopologyBuilder.build();
}
Also used : Property(org.apache.knox.gateway.topology.builder.property.Property) Test(org.junit.Test)

Example 14 with Property

use of org.apache.knox.gateway.topology.builder.property.Property in project knox by apache.

the class PropertyTopologyBuilderTest method testBuildSuccessfulForServiceProperty.

@Test(expected = IllegalArgumentException.class)
public void testBuildSuccessfulForServiceProperty() {
    PropertyTopologyBuilder propertyTopologyBuilder = new PropertyTopologyBuilder();
    propertyTopologyBuilder.addProperty(new Property("topology.gateway.service.WEBHDFS..url", "http://host:50070/webhdfs"));
    Topology topology = propertyTopologyBuilder.build();
    assertThat(topology, notNullValue());
}
Also used : Topology(org.apache.knox.gateway.topology.Topology) Property(org.apache.knox.gateway.topology.builder.property.Property) Test(org.junit.Test)

Example 15 with Property

use of org.apache.knox.gateway.topology.builder.property.Property in project knox by apache.

the class PropertyTopologyBuilderTest method testBuildFailedForWrongServiceToken2.

@Test(expected = IllegalArgumentException.class)
public void testBuildFailedForWrongServiceToken2() {
    PropertyTopologyBuilder propertyTopologyBuilder = new PropertyTopologyBuilder();
    propertyTopologyBuilder.addProperty(new Property("topology.gateway.service.WEBHDFS", "value"));
    propertyTopologyBuilder.build();
}
Also used : Property(org.apache.knox.gateway.topology.builder.property.Property) Test(org.junit.Test)

Aggregations

Property (org.apache.knox.gateway.topology.builder.property.Property)18 Test (org.junit.Test)17 Topology (org.apache.knox.gateway.topology.Topology)4 InterpretException (org.apache.knox.gateway.topology.builder.property.interpreter.InterpretException)1 PropertyInterpreter (org.apache.knox.gateway.topology.builder.property.interpreter.PropertyInterpreter)1