Search in sources :

Example 6 with ProxyProperties

use of uk.gov.gchq.gaffer.proxystore.ProxyProperties in project Gaffer by gchq.

the class RoadTrafficRestApiITs method prepareProxy.

@BeforeEach
@Override
public void prepareProxy() throws IOException {
    // Create a proxy store that will proxy all queries to the REST API that has been spun up
    ProxyProperties props = new ProxyProperties(System.getProperties());
    props.setStoreClass(ProxyStore.class);
    props.setStorePropertiesClass(props.getClass());
    final URL restURL = new URL(CLIENT.getRoot());
    props.setGafferHost(restURL.getHost());
    props.setGafferPort(restURL.getPort());
    props.setGafferContextRoot(CLIENT.getPath());
    this.graph = new Graph.Builder().config(StreamUtil.graphConfig(this.getClass())).storeProperties(props).build();
    this.user = new User();
}
Also used : ProxyProperties(uk.gov.gchq.gaffer.proxystore.ProxyProperties) User(uk.gov.gchq.gaffer.user.User) URL(java.net.URL) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 7 with ProxyProperties

use of uk.gov.gchq.gaffer.proxystore.ProxyProperties in project Gaffer by gchq.

the class RoadTrafficRestApiSTs method prepareProxy.

@Override
@BeforeEach
public void prepareProxy() {
    ProxyProperties props = new ProxyProperties(System.getProperties());
    props.setStoreClass(ProxyStore.class);
    props.setStorePropertiesClass(props.getClass());
    this.graph = new Graph.Builder().config(StreamUtil.graphConfig(this.getClass())).storeProperties(props).build();
    this.user = new User();
}
Also used : ProxyProperties(uk.gov.gchq.gaffer.proxystore.ProxyProperties) User(uk.gov.gchq.gaffer.user.User) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 8 with ProxyProperties

use of uk.gov.gchq.gaffer.proxystore.ProxyProperties in project Gaffer by gchq.

the class FederatedStoreRecursionIT method createProxyToRestServiceFederatedGraph.

protected void createProxyToRestServiceFederatedGraph() {
    final Graph proxyToRestServiceFederatedGraph;
    ProxyProperties singleUseFedProperties = new ProxyProperties();
    singleUseFedProperties.setStoreClass(SingleUseFederatedStore.class);
    singleUseFedProperties.setReadTimeout(120000);
    singleUseFedProperties.setConnectTimeout(120000);
    proxyToRestServiceFederatedGraph = new Graph.Builder().storeProperties(singleUseFedProperties).addSchema(new Schema()).config(new GraphConfig(PROXY_TO_REST_SERVICE_FEDERATED_GRAPH)).build();
    this.proxyToRestServiceFederatedGraph = proxyToRestServiceFederatedGraph;
}
Also used : GraphConfig(uk.gov.gchq.gaffer.graph.GraphConfig) Graph(uk.gov.gchq.gaffer.graph.Graph) AddGraph(uk.gov.gchq.gaffer.federatedstore.operation.AddGraph) ProxyProperties(uk.gov.gchq.gaffer.proxystore.ProxyProperties) Schema(uk.gov.gchq.gaffer.store.schema.Schema)

Example 9 with ProxyProperties

use of uk.gov.gchq.gaffer.proxystore.ProxyProperties in project Gaffer by gchq.

the class GetProxyPropertiesHandlerTest method shouldGetURl.

@Test
public void shouldGetURl() throws Exception {
    // given
    Store store = Mockito.mock(Store.class);
    ProxyProperties properties = new ProxyProperties();
    properties.set(GAFFER_PORT, PORT);
    properties.set(GAFFER_HOST, HOST);
    properties.set(GAFFER_CONTEXT_ROOT, DEFAULT_GAFFER_CONTEXT_ROOT);
    properties.setConnectTimeout(999);
    properties.set(EXTRA_KEY, "value");
    Mockito.when(store.getProperties()).thenReturn(properties);
    HashMap expected = getExpected(properties);
    // when
    Map<String, Object> actual = new GetProxyPropertiesHandler().doOperation(new GetProxyProperties(), new Context(), store);
    // then
    assertFalse(actual.containsKey(EXTRA_KEY));
    assertTrue(actual.containsKey(URL_INFERRED));
    assertEquals(expected, actual);
}
Also used : Context(uk.gov.gchq.gaffer.store.Context) GetProxyProperties(uk.gov.gchq.gaffer.proxystore.operation.GetProxyProperties) ProxyProperties(uk.gov.gchq.gaffer.proxystore.ProxyProperties) HashMap(java.util.HashMap) Store(uk.gov.gchq.gaffer.store.Store) GetProxyProperties(uk.gov.gchq.gaffer.proxystore.operation.GetProxyProperties) Test(org.junit.jupiter.api.Test)

Example 10 with ProxyProperties

use of uk.gov.gchq.gaffer.proxystore.ProxyProperties in project Gaffer by gchq.

the class ProxyStoreIT method createProxy.

private Graph createProxy() {
    ProxyProperties proxyProperties = new ProxyProperties();
    proxyProperties.setGafferHost("localhost");
    proxyProperties.setGafferPort(getPort());
    proxyProperties.setGafferContextRoot(getContextPath());
    // When
    return new Graph.Builder().config(new GraphConfig("proxy")).addSchema(new Schema()).storeProperties(proxyProperties).build();
}
Also used : GraphConfig(uk.gov.gchq.gaffer.graph.GraphConfig) ProxyProperties(uk.gov.gchq.gaffer.proxystore.ProxyProperties) Schema(uk.gov.gchq.gaffer.store.schema.Schema)

Aggregations

ProxyProperties (uk.gov.gchq.gaffer.proxystore.ProxyProperties)10 BeforeEach (org.junit.jupiter.api.BeforeEach)4 GraphConfig (uk.gov.gchq.gaffer.graph.GraphConfig)4 Schema (uk.gov.gchq.gaffer.store.schema.Schema)4 AddGraph (uk.gov.gchq.gaffer.federatedstore.operation.AddGraph)3 Graph (uk.gov.gchq.gaffer.graph.Graph)3 HashMap (java.util.HashMap)2 GetProxyProperties (uk.gov.gchq.gaffer.proxystore.operation.GetProxyProperties)2 User (uk.gov.gchq.gaffer.user.User)2 URL (java.net.URL)1 Test (org.junit.jupiter.api.Test)1 Element (uk.gov.gchq.gaffer.data.element.Element)1 View (uk.gov.gchq.gaffer.data.elementdefinition.view.View)1 FederatedOperationChain (uk.gov.gchq.gaffer.federatedstore.operation.FederatedOperationChain)1 OperationChain (uk.gov.gchq.gaffer.operation.OperationChain)1 OperationException (uk.gov.gchq.gaffer.operation.OperationException)1 ExportToOtherGraph (uk.gov.gchq.gaffer.operation.export.graph.ExportToOtherGraph)1 GetAllElements (uk.gov.gchq.gaffer.operation.impl.get.GetAllElements)1 Context (uk.gov.gchq.gaffer.store.Context)1 Store (uk.gov.gchq.gaffer.store.Store)1