@Test public void emptyTriples() throws Exception { final String [] emptyStrings = {"", " ", "\t"}; for (final String emptyString : emptyStrings) { when (message.getBody(String.class)).thenReturn(emptyString); cut.process(exchange); verifyZeroInteractions(dao); } }
@Override public void process(final Exchange exchange) throws Exception { if (exchange.getIn().getBody() instanceof NullObject) { return; } final String triples = exchange.getIn().getBody(String.class); logger.debug(MessageCatalog._00049_DEBUG_TRIPLES, triples); final String graphName = exchange.getIn().getHeader(Constants.GRAPH_ATTRIBUTE_NAME, String.class); if (isNotNullAndNotEmpty(triples)) { final Integer jobId = exchange.getIn().getHeader(Constants.JOB_ID_ATTRIBUTE_NAME, Integer.class); final JobInstance configuration = cache.getJobInstance(jobId); if (configuration == null) { logger.error(MessageCatalog._00038_UNKNOWN_JOB_ID, jobId); throw new IllegalArgumentException(String.valueOf(jobId)); } try { rdfStore.executeInsert( configuration.getSparqlEndpointUrl(), graphName, configuration.getSparqlUsername(), configuration.getSparqlPassword(), triples); } catch (final Exception exception) { logger.error(MessageCatalog._00050_RDFSTORE_FAILURE, exception); } } }
RESTSparqlInsertProcessor implements Processor { @Override public void process(final Exchange exchange) throws Exception { if (exchange.getIn().getBody() instanceof NullObject) { return; } final String triples = exchange.getIn().getBody(String.class); logger.debug(MessageCatalog._00049_DEBUG_TRIPLES, triples); final String graphName = exchange.getIn().getHeader(Constants.GRAPH_ATTRIBUTE_NAME, String.class); if (isNotNullAndNotEmpty(triples)) { final Integer jobId = exchange.getIn().getHeader(Constants.JOB_ID_ATTRIBUTE_NAME, Integer.class); final JobInstance configuration = cache.getJobInstance(jobId); if (configuration == null) { logger.error(MessageCatalog._00038_UNKNOWN_JOB_ID, jobId); throw new IllegalArgumentException(String.valueOf(jobId)); } try { rdfStore.executeInsert( configuration.getSparqlEndpointUrl(), graphName, configuration.getSparqlUsername(), configuration.getSparqlPassword(), triples); } catch (final Exception exception) { logger.error(MessageCatalog._00050_RDFSTORE_FAILURE, exception); } } } }
RESTSparqlInsertProcessor implements Processor { @Override public void process(final Exchange exchange) throws Exception { if (exchange.getIn().getBody() instanceof NullObject) { return; } final String triples = exchange.getIn().getBody(String.class); logger.debug(MessageCatalog._00049_DEBUG_TRIPLES, triples); final String graphName = exchange.getIn().getHeader(Constants.GRAPH_ATTRIBUTE_NAME, String.class); if (isNotNullAndNotEmpty(triples)) { final Integer jobId = exchange.getIn().getHeader(Constants.JOB_ID_ATTRIBUTE_NAME, Integer.class); final JobInstance configuration = cache.getJobInstance(jobId); if (configuration == null) { logger.error(MessageCatalog._00038_UNKNOWN_JOB_ID, jobId); throw new IllegalArgumentException(String.valueOf(jobId)); } try { rdfStore.executeInsert( configuration.getSparqlEndpointUrl(), graphName, configuration.getSparqlUsername(), configuration.getSparqlPassword(), triples); } catch (final Exception exception) { logger.error(MessageCatalog._00050_RDFSTORE_FAILURE, exception); } } } RESTSparqlInsertProcessor(); }
RESTSparqlInsertProcessor implements Processor { @Override public void process(final Exchange exchange) throws Exception { if (exchange.getIn().getBody() instanceof NullObject) { return; } final String triples = exchange.getIn().getBody(String.class); logger.debug(MessageCatalog._00049_DEBUG_TRIPLES, triples); final String graphName = exchange.getIn().getHeader(Constants.GRAPH_ATTRIBUTE_NAME, String.class); if (isNotNullAndNotEmpty(triples)) { final Integer jobId = exchange.getIn().getHeader(Constants.JOB_ID_ATTRIBUTE_NAME, Integer.class); final JobInstance configuration = cache.getJobInstance(jobId); if (configuration == null) { logger.error(MessageCatalog._00038_UNKNOWN_JOB_ID, jobId); throw new IllegalArgumentException(String.valueOf(jobId)); } try { rdfStore.executeInsert( configuration.getSparqlEndpointUrl(), graphName, configuration.getSparqlUsername(), configuration.getSparqlPassword(), triples); } catch (final Exception exception) { logger.error(MessageCatalog._00050_RDFSTORE_FAILURE, exception); } } } RESTSparqlInsertProcessor(); @Override void process(final Exchange exchange); }
RESTSparqlInsertProcessor implements Processor { @Override public void process(final Exchange exchange) throws Exception { if (exchange.getIn().getBody() instanceof NullObject) { return; } final String triples = exchange.getIn().getBody(String.class); logger.debug(MessageCatalog._00049_DEBUG_TRIPLES, triples); final String graphName = exchange.getIn().getHeader(Constants.GRAPH_ATTRIBUTE_NAME, String.class); if (isNotNullAndNotEmpty(triples)) { final Integer jobId = exchange.getIn().getHeader(Constants.JOB_ID_ATTRIBUTE_NAME, Integer.class); final JobInstance configuration = cache.getJobInstance(jobId); if (configuration == null) { logger.error(MessageCatalog._00038_UNKNOWN_JOB_ID, jobId); throw new IllegalArgumentException(String.valueOf(jobId)); } try { rdfStore.executeInsert( configuration.getSparqlEndpointUrl(), graphName, configuration.getSparqlUsername(), configuration.getSparqlPassword(), triples); } catch (final Exception exception) { logger.error(MessageCatalog._00050_RDFSTORE_FAILURE, exception); } } } RESTSparqlInsertProcessor(); @Override void process(final Exchange exchange);  }