fix formatting

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1667347 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Noble Paul 2015-03-17 16:13:16 +00:00
parent 4c4d8ee994
commit fd8a588bc5
1 changed files with 16 additions and 16 deletions

View File

@ -55,7 +55,7 @@ import java.util.Map;
import static org.apache.solr.core.ConfigOverlay.getObjectByPath;
public class TestBlobHandler extends AbstractFullDistribZkTestBase {
static final Logger log = LoggerFactory.getLogger(TestBlobHandler.class);
static final Logger log = LoggerFactory.getLogger(TestBlobHandler.class);
@Test
public void doBlobHandlerTest() throws Exception {
@ -82,24 +82,24 @@ public class TestBlobHandler extends AbstractFullDistribZkTestBase {
"/blob",
"class")));
byte[] bytarr = new byte[1024];
for (int i = 0; i < bytarr.length; i++) bytarr[i]= (byte) (i % 127);
byte[] bytarr2 = new byte[2048];
for (int i = 0; i < bytarr2.length; i++) bytarr2[i]= (byte) (i % 127);
byte[] bytarr = new byte[1024];
for (int i = 0; i < bytarr.length; i++) bytarr[i] = (byte) (i % 127);
byte[] bytarr2 = new byte[2048];
for (int i = 0; i < bytarr2.length; i++) bytarr2[i] = (byte) (i % 127);
String blobName = "test";
postAndCheck(cloudClient, baseUrl, blobName, ByteBuffer.wrap(bytarr), 1);
postAndCheck(cloudClient, baseUrl, blobName, ByteBuffer.wrap(bytarr2), 2);
url = baseUrl + "/.system/blob/test/1";
map = TestSolrConfigHandlerConcurrent.getAsMap(url,cloudClient);
map = TestSolrConfigHandlerConcurrent.getAsMap(url, cloudClient);
List l = (List) ConfigOverlay.getObjectByPath(map, false, Arrays.asList("response", "docs"));
assertNotNull(""+map, l);
assertNotNull("" + map, l);
assertTrue("" + map, l.size() > 0);
map = (Map) l.get(0);
assertEquals(""+bytarr.length,String.valueOf(map.get("size")));
assertEquals("" + bytarr.length, String.valueOf(map.get("size")));
compareInputAndOutput(baseUrl+"/.system/blob/test?wt=filestream", bytarr2);
compareInputAndOutput(baseUrl+"/.system/blob/test/1?wt=filestream", bytarr);
compareInputAndOutput(baseUrl + "/.system/blob/test?wt=filestream", bytarr2);
compareInputAndOutput(baseUrl + "/.system/blob/test/1?wt=filestream", bytarr);
}
}
@ -131,12 +131,12 @@ public class TestBlobHandler extends AbstractFullDistribZkTestBase {
Map map = null;
List l;
long start = System.currentTimeMillis();
int i=0;
for(;i<150;i++) {//15 secs
int i = 0;
for (; i < 150; i++) {//15 secs
url = baseUrl + "/.system/blob/" + blobName;
map = TestSolrConfigHandlerConcurrent.getAsMap(url, cloudClient);
String numFound = String.valueOf(ConfigOverlay.getObjectByPath(map, false, Arrays.asList("response", "numFound")));
if(!(""+count).equals(numFound)) {
if (!("" + count).equals(numFound)) {
Thread.sleep(100);
continue;
}
@ -147,7 +147,7 @@ public class TestBlobHandler extends AbstractFullDistribZkTestBase {
return;
}
fail(MessageFormat.format("Could not successfully add blob after {0} attempts. Expecting {1} items. time elapsed {2} output for url is {3}",
i,count, System.currentTimeMillis()-start, getAsString(map)));
i, count, System.currentTimeMillis() - start, getAsString(map)));
}
public static String getAsString(Map map) {
@ -178,13 +178,13 @@ public class TestBlobHandler extends AbstractFullDistribZkTestBase {
String response = null;
try {
httpPost = new HttpPost(baseUrl + "/.system/blob/" + blobName);
httpPost.setHeader("Content-Type","application/octet-stream");
httpPost.setHeader("Content-Type", "application/octet-stream");
httpPost.setEntity(new ByteArrayEntity(bytarr.array(), bytarr.arrayOffset(), bytarr.limit()));
entity = cloudClient.getLbClient().getHttpClient().execute(httpPost).getEntity();
try {
response = EntityUtils.toString(entity, StandardCharsets.UTF_8);
Map m = (Map) ObjectBuilder.getVal(new JSONParser(new StringReader(response)));
assertFalse("Error in posting blob "+ getAsString(m),m.containsKey("error"));
assertFalse("Error in posting blob " + getAsString(m), m.containsKey("error"));
} catch (JSONParser.ParseException e) {
log.error("$ERROR$", response, e);
fail();