diff --git a/elasticsearch5/src/test/java/com/yahoo/ycsb/db/elasticsearch5/ElasticsearchRestClientIT.java b/elasticsearch5/src/test/java/com/yahoo/ycsb/db/elasticsearch5/ElasticsearchRestClientIT.java index 5b833c14..1173b022 100644 --- a/elasticsearch5/src/test/java/com/yahoo/ycsb/db/elasticsearch5/ElasticsearchRestClientIT.java +++ b/elasticsearch5/src/test/java/com/yahoo/ycsb/db/elasticsearch5/ElasticsearchRestClientIT.java @@ -1,132 +1,132 @@ /** * Copyright (c) 2017 YCSB contributors. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); you * may not use this file except in compliance with the License. You * may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or * implied. See the License for the specific language governing * permissions and limitations under the License. See accompanying * LICENSE file. */ package com.yahoo.ycsb.db.elasticsearch5; import com.yahoo.ycsb.ByteIterator; import com.yahoo.ycsb.DBException; import com.yahoo.ycsb.Status; import com.yahoo.ycsb.StringByteIterator; import org.junit.After; import org.junit.Before; import org.junit.Test; import java.io.IOException; import java.util.HashMap; import java.util.Properties; import java.util.Set; import java.util.Vector; import static org.junit.Assert.assertEquals; public class ElasticsearchRestClientIT { private final ElasticsearchRestClient instance = new ElasticsearchRestClient(); private final static HashMap MOCK_DATA; private final static String MOCK_TABLE = "MOCK_TABLE"; static { MOCK_DATA = new HashMap<>(10); for (int i = 1; i <= 10; i++) { MOCK_DATA.put("field" + i, new StringByteIterator("value" + i)); } } @Before public void setUp() throws DBException, IOException { final Properties props = new Properties(); props.put("es.new_index", "true"); instance.setProperties(props); instance.init(); for (int i = 0; i < 16; i++) { instance.insert(MOCK_TABLE, Integer.toString(i), MOCK_DATA); } } @After public void tearDown() throws DBException { instance.cleanup(); } /** - * Test of insert method, of class ElasticsearchClient. + * Test of insert method, of class {@link ElasticsearchRestClient}. */ @Test public void testInsert() { final Status result = instance.insert(MOCK_TABLE, "0", MOCK_DATA); assertEquals(Status.OK, result); } /** - * Test of delete method, of class ElasticsearchClient. + * Test of delete method, of class {@link ElasticsearchRestClient}. */ @Test public void testDelete() { final Status result = instance.delete(MOCK_TABLE, "1"); assertEquals(Status.OK, result); } /** - * Test of read method, of class ElasticsearchClient. + * Test of read method, of class {@link ElasticsearchRestClient}. */ @Test public void testRead() { final Set fields = MOCK_DATA.keySet(); final HashMap resultParam = new HashMap<>(10); final Status result = instance.read(MOCK_TABLE, "1", fields, resultParam); assertEquals(Status.OK, result); } /** - * Test of update method, of class ElasticsearchClient. + * Test of update method, of class {@link ElasticsearchRestClient}. */ @Test public void testUpdate() { final HashMap newValues = new HashMap<>(10); for (int i = 1; i <= 10; i++) { newValues.put("field" + i, new StringByteIterator("newvalue" + i)); } final Status updateResult = instance.update(MOCK_TABLE, "1", newValues); assertEquals(Status.OK, updateResult); // validate that the values changed final HashMap resultParam = new HashMap<>(10); final Status readResult = instance.read(MOCK_TABLE, "1", MOCK_DATA.keySet(), resultParam); assertEquals(Status.OK, readResult); for (int i = 1; i <= 10; i++) { assertEquals("newvalue" + i, resultParam.get("field" + i).toString()); } } /** - * Test of scan method, of class ElasticsearchClient. + * Test of scan method, of class {@link ElasticsearchRestClient}. */ @Test public void testScan() { final int recordcount = 10; final Set fields = MOCK_DATA.keySet(); final Vector> resultParam = new Vector<>(10); final Status result = instance.scan(MOCK_TABLE, "1", recordcount, fields, resultParam); assertEquals(Status.OK, result); assertEquals(10, resultParam.size()); } }