11/**
2- * Copyright (c) 2012 YCSB contributors. All rights reserved.
2+ * Copyright (c) 2012-2017 YCSB contributors. All rights reserved.
33 *
44 * Licensed under the Apache License, Version 2.0 (the "License"); you
55 * may not use this file except in compliance with the License. You
3030import org .junit .Before ;
3131import org .junit .BeforeClass ;
3232import org .junit .ClassRule ;
33- import org .junit .Rule ;
3433import org .junit .Test ;
3534import org .junit .rules .TemporaryFolder ;
3635
4443public class ElasticsearchClientTest {
4544
4645 @ ClassRule public final static TemporaryFolder temp = new TemporaryFolder ();
47- protected final static ElasticsearchClient instance = new ElasticsearchClient ();
48- protected final static HashMap <String , ByteIterator > MOCK_DATA ;
49- protected final static String MOCK_TABLE = "MOCK_TABLE" ;
50- protected final static String MOCK_KEY0 = "0" ;
51- protected final static String MOCK_KEY1 = "1" ;
52- protected final static String MOCK_KEY2 = "2" ;
46+ private final static ElasticsearchClient instance = new ElasticsearchClient ();
47+ private final static HashMap <String , ByteIterator > MOCK_DATA ;
48+ private final static String MOCK_TABLE = "MOCK_TABLE" ;
49+ private final static String MOCK_KEY0 = "0" ;
50+ private final static String MOCK_KEY1 = "1" ;
51+ private final static String MOCK_KEY2 = "2" ;
5352
5453 static {
55- MOCK_DATA = new HashMap <String , ByteIterator >(10 );
54+ MOCK_DATA = new HashMap <>(10 );
5655 for (int i = 1 ; i <= 10 ; i ++) {
5756 MOCK_DATA .put ("field" + i , new StringByteIterator ("value" + i ));
5857 }
@@ -88,7 +87,6 @@ public void tearDown() {
8887 */
8988 @ Test
9089 public void testInsert () {
91- System .out .println ("insert" );
9290 Status result = instance .insert (MOCK_TABLE , MOCK_KEY0 , MOCK_DATA );
9391 assertEquals (Status .OK , result );
9492 }
@@ -98,7 +96,6 @@ public void testInsert() {
9896 */
9997 @ Test
10098 public void testDelete () {
101- System .out .println ("delete" );
10299 Status result = instance .delete (MOCK_TABLE , MOCK_KEY1 );
103100 assertEquals (Status .OK , result );
104101 }
@@ -108,9 +105,8 @@ public void testDelete() {
108105 */
109106 @ Test
110107 public void testRead () {
111- System .out .println ("read" );
112108 Set <String > fields = MOCK_DATA .keySet ();
113- HashMap <String , ByteIterator > resultParam = new HashMap <String , ByteIterator >(10 );
109+ HashMap <String , ByteIterator > resultParam = new HashMap <>(10 );
114110 Status result = instance .read (MOCK_TABLE , MOCK_KEY1 , fields , resultParam );
115111 assertEquals (Status .OK , result );
116112 }
@@ -120,9 +116,8 @@ public void testRead() {
120116 */
121117 @ Test
122118 public void testUpdate () {
123- System .out .println ("update" );
124119 int i ;
125- HashMap <String , ByteIterator > newValues = new HashMap <String , ByteIterator >(10 );
120+ HashMap <String , ByteIterator > newValues = new HashMap <>(10 );
126121
127122 for (i = 1 ; i <= 10 ; i ++) {
128123 newValues .put ("field" + i , new StringByteIterator ("newvalue" + i ));
@@ -132,24 +127,22 @@ public void testUpdate() {
132127 assertEquals (Status .OK , result );
133128
134129 //validate that the values changed
135- HashMap <String , ByteIterator > resultParam = new HashMap <String , ByteIterator >(10 );
130+ HashMap <String , ByteIterator > resultParam = new HashMap <>(10 );
136131 instance .read (MOCK_TABLE , MOCK_KEY1 , MOCK_DATA .keySet (), resultParam );
137132
138133 for (i = 1 ; i <= 10 ; i ++) {
139134 assertEquals ("newvalue" + i , resultParam .get ("field" + i ).toString ());
140135 }
141-
142136 }
143137
144138 /**
145139 * Test of scan method, of class ElasticsearchClient.
146140 */
147141 @ Test
148142 public void testScan () {
149- System .out .println ("scan" );
150143 int recordcount = 10 ;
151144 Set <String > fields = MOCK_DATA .keySet ();
152- Vector <HashMap <String , ByteIterator >> resultParam = new Vector <HashMap < String , ByteIterator > >(10 );
145+ Vector <HashMap <String , ByteIterator >> resultParam = new Vector <>(10 );
153146 Status result = instance .scan (MOCK_TABLE , MOCK_KEY1 , recordcount , fields , resultParam );
154147 assertEquals (Status .OK , result );
155148 }
0 commit comments