From df1b06d8d2d25c246e41995d25ef64eaa27ed437 Mon Sep 17 00:00:00 2001 From: Jeen Broekstra Date: Sat, 12 Oct 2019 14:51:15 +1100 Subject: [PATCH] cleaned up accidental commit and made a Github-recognizable license file --- LICENSE | 27 ++++ .../client/RDF4JProtocolSessionTest.java.orig | 139 ------------------ 2 files changed, 27 insertions(+), 139 deletions(-) create mode 100644 LICENSE delete mode 100644 core/http/client/src/test/java/org/eclipse/rdf4j/http/client/RDF4JProtocolSessionTest.java.orig diff --git a/LICENSE b/LICENSE new file mode 100644 index 00000000000..84dc5416914 --- /dev/null +++ b/LICENSE @@ -0,0 +1,27 @@ +Copyright (c) 2007, Eclipse Foundation, Inc. and its licensors. +Copyright Aduna (http://www.aduna-software.com/) 2001-2013 + +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. +* Neither the name of the Eclipse Foundation, Inc. nor the names of its + contributors may be used to endorse or promote products derived from this + software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/core/http/client/src/test/java/org/eclipse/rdf4j/http/client/RDF4JProtocolSessionTest.java.orig b/core/http/client/src/test/java/org/eclipse/rdf4j/http/client/RDF4JProtocolSessionTest.java.orig deleted file mode 100644 index 17577468939..00000000000 --- a/core/http/client/src/test/java/org/eclipse/rdf4j/http/client/RDF4JProtocolSessionTest.java.orig +++ /dev/null @@ -1,139 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2019 Eclipse RDF4J contributors. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Distribution License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/org/documents/edl-v10.php. - *******************************************************************************/ -package org.eclipse.rdf4j.http.client; - -<<<<<<< HEAD -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -import java.util.concurrent.ScheduledExecutorService; - -import org.apache.http.HttpEntity; -import org.apache.http.HttpResponse; -import org.apache.http.HttpVersion; -import org.apache.http.client.HttpClient; -import org.apache.http.client.methods.HttpPut; -import org.apache.http.client.methods.HttpUriRequest; -import org.apache.http.message.BasicStatusLine; -import org.apache.http.protocol.HttpContext; -import org.eclipse.rdf4j.repository.config.RepositoryConfig; -======= -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.argThat; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -import java.util.HashMap; -import java.util.concurrent.ScheduledExecutorService; - -import org.apache.http.Header; -import org.apache.http.HttpResponse; -import org.apache.http.StatusLine; -import org.apache.http.client.HttpClient; -import org.apache.http.client.methods.HttpUriRequest; -import org.apache.http.entity.InputStreamEntity; -import org.apache.http.entity.StringEntity; -import org.apache.http.message.BasicHeader; -import org.apache.http.protocol.HttpContext; -import org.eclipse.rdf4j.query.resultio.TupleQueryResultFormat; ->>>>>>> master -import org.junit.Before; -import org.junit.Test; - -/** - * Unit tests for {@link RDF4JProtocolSession} - * - * @author Jeen Broekstra -<<<<<<< HEAD - * -======= ->>>>>>> master - */ -public class RDF4JProtocolSessionTest { - - private RDF4JProtocolSession subject; -<<<<<<< HEAD - private HttpClient client; - - @Before - public void setUp() throws Exception { - client = mock(HttpClient.class); - HttpResponse response = mock(HttpResponse.class); - - when(client.execute(any(HttpUriRequest.class), any(HttpContext.class))).thenReturn(response); - when(response.getEntity()).thenReturn(mock(HttpEntity.class)); - when(response.getStatusLine()).thenReturn(new BasicStatusLine(HttpVersion.HTTP_1_1, 200, "OK")); - ScheduledExecutorService executor = mock(ScheduledExecutorService.class); - subject = new RDF4JProtocolSession(client, executor); - subject.setServerURL("http://example.org/"); - } - - @Test - public void testCreateRepositoryExecutesPut() throws Exception { - RepositoryConfig config = new RepositoryConfig("test"); - subject.createRepository(config); - verify(client, times(1)).execute(any(HttpPut.class), any(HttpContext.class)); - } - -======= - private HttpClient httpclient; - - private String testHeader = "X-testing-header"; - private String testValue = "foobar"; - private HttpResponse response; - - @Before - public void setUp() throws Exception { - - httpclient = mock(HttpClient.class); - response = mock(HttpResponse.class); - StatusLine statusLine = mock(StatusLine.class); - - when(httpclient.execute(any(HttpUriRequest.class), any(HttpContext.class))).thenReturn(response); - when(response.getStatusLine()).thenReturn(statusLine); - when(statusLine.getStatusCode()).thenReturn(200); - - subject = new RDF4JProtocolSession(httpclient, mock(ScheduledExecutorService.class)); - subject.setRepository("http://localhost/rdf4j-server/repositories/test"); - - HashMap additionalHeaders = new HashMap<>(); - additionalHeaders.put(testHeader, testValue); - subject.setAdditionalHttpHeaders(additionalHeaders); - } - - @Test - public void testSize() throws Exception { - when(response.getEntity()).thenReturn(new StringEntity("8")); - - assertThat(subject.size()).isEqualTo(8); - verifyHeaders(); - } - - @Test - public void testRepositoryList() throws Exception { - Header h = new BasicHeader("Content-Type", TupleQueryResultFormat.SPARQL.getDefaultMIMEType()); - when(response.getHeaders("Content-Type")).thenReturn(new Header[] { h }); - InputStreamEntity reponseData = new InputStreamEntity( - getClass().getResourceAsStream("/fixtures/repository-list.xml")); - when(response.getEntity()).thenReturn(reponseData); - - assertThat(subject.getRepositoryList().getBindingNames()).contains("id"); - verifyHeaders(); - } - - private void verifyHeaders() throws Exception { - verify(httpclient).execute(argThat(r -> r.getFirstHeader(testHeader).getValue().equals(testValue)), - any(HttpContext.class)); - } ->>>>>>> master -}