"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "solr/core/src/test/org/apache/solr/filestore/TestDistribPackageStore.java" between
solr-8.4.0-src.tgz and solr-8.4.1-src.tgz

About: Solr is the search platform from the Apache Lucene project. Its major features include full-text search, hit highlighting, faceted search, caching, replication, and a web admin interface.

TestDistribPackageStore.java  (solr-8.4.0-src.tgz):TestDistribPackageStore.java  (solr-8.4.1-src.tgz)
skipping to change at line 47 skipping to change at line 47
import org.apache.solr.client.solrj.impl.HttpSolrClient; import org.apache.solr.client.solrj.impl.HttpSolrClient;
import org.apache.solr.client.solrj.request.V2Request; import org.apache.solr.client.solrj.request.V2Request;
import org.apache.solr.client.solrj.response.V2Response; import org.apache.solr.client.solrj.response.V2Response;
import org.apache.solr.cloud.MiniSolrCloudCluster; import org.apache.solr.cloud.MiniSolrCloudCluster;
import org.apache.solr.cloud.SolrCloudTestCase; import org.apache.solr.cloud.SolrCloudTestCase;
import org.apache.solr.common.NavigableObject; import org.apache.solr.common.NavigableObject;
import org.apache.solr.common.params.CommonParams; import org.apache.solr.common.params.CommonParams;
import org.apache.solr.common.params.ModifiableSolrParams; import org.apache.solr.common.params.ModifiableSolrParams;
import org.apache.solr.common.util.StrUtils; import org.apache.solr.common.util.StrUtils;
import org.apache.solr.common.util.Utils; import org.apache.solr.common.util.Utils;
import org.apache.solr.packagemanager.PackageUtils;
import org.apache.solr.util.LogLevel; import org.apache.solr.util.LogLevel;
import org.apache.zookeeper.CreateMode;
import org.apache.zookeeper.server.ByteBufferInputStream; import org.apache.zookeeper.server.ByteBufferInputStream;
import org.junit.After; import org.junit.After;
import org.junit.Before; import org.junit.Before;
import static org.apache.solr.common.util.Utils.JAVABINCONSUMER; import static org.apache.solr.common.util.Utils.JAVABINCONSUMER;
import static org.apache.solr.core.TestDynamicLoading.getFileContent; import static org.apache.solr.core.TestDynamicLoading.getFileContent;
@LogLevel("org.apache.solr.filestore.PackageStoreAPI=DEBUG;org.apache.solr.files tore.DistribPackageStore=DEBUG") @LogLevel("org.apache.solr.filestore.PackageStoreAPI=DEBUG;org.apache.solr.files tore.DistribPackageStore=DEBUG")
public class TestDistribPackageStore extends SolrCloudTestCase { public class TestDistribPackageStore extends SolrCloudTestCase {
skipping to change at line 78 skipping to change at line 78
public void testPackageStoreManagement() throws Exception { public void testPackageStoreManagement() throws Exception {
MiniSolrCloudCluster cluster = MiniSolrCloudCluster cluster =
configureCluster(4) configureCluster(4)
.withJettyConfig(jetty -> jetty.enableV2(true)) .withJettyConfig(jetty -> jetty.enableV2(true))
.addConfig("conf", configset("cloud-minimal")) .addConfig("conf", configset("cloud-minimal"))
.configure(); .configure();
try { try {
byte[] derFile = readFile("cryptokeys/pub_key512.der"); byte[] derFile = readFile("cryptokeys/pub_key512.der");
cluster.getZkClient().makePath("/keys/exe", true); uploadKey(derFile, PackageStoreAPI.KEYS_DIR+"/pub_key512.der", cluster);
cluster.getZkClient().create("/keys/exe/pub_key512.der", derFile, CreateMo // cluster.getZkClient().makePath("/keys/exe", true);
de.PERSISTENT, true); // cluster.getZkClient().create("/keys/exe/pub_key512.der", derFile, Create
Mode.PERSISTENT, true);
try { try {
postFile(cluster.getSolrClient(), getFileContent("runtimecode/runtimelib s.jar.bin"), postFile(cluster.getSolrClient(), getFileContent("runtimecode/runtimelib s.jar.bin"),
"/package/mypkg/v1.0/runtimelibs.jar", "/package/mypkg/v1.0/runtimelibs.jar",
"j+Rflxi64tXdqosIhbusqi6GTwZq8znunC/dzwcWW0/dHlFGKDurOaE1Nz9FSPJuXbH kVLj638yZ0Lp1ssnoYA==" "j+Rflxi64tXdqosIhbusqi6GTwZq8znunC/dzwcWW0/dHlFGKDurOaE1Nz9FSPJuXbH kVLj638yZ0Lp1ssnoYA=="
); );
fail("should have failed because of wrong signature "); fail("should have failed because of wrong signature ");
} catch (RemoteExecutionException e) { } catch (RemoteExecutionException e) {
assertTrue(e.getMessage().contains("Signature does not match")); assertTrue(e.getMessage().contains("Signature does not match"));
} }
skipping to change at line 246 skipping to change at line 247
else if (i >= repeats - 1) { else if (i >= repeats - 1) {
fail("req: " + callable.toString() +" . attempt: " + i + " Mismatch fo r value : '" + key + "' in response , " + Utils.toJSONString(rsp)); fail("req: " + callable.toString() +" . attempt: " + i + " Mismatch fo r value : '" + key + "' in response , " + Utils.toJSONString(rsp));
} }
} }
} }
return rsp; return rsp;
} }
public static void uploadKey(byte[] bytes, String path, MiniSolrCloudCluster c
luster) throws Exception {
JettySolrRunner jetty = cluster.getRandomJetty(random());
try(HttpSolrClient client = (HttpSolrClient) jetty.newClient()) {
PackageUtils.uploadKey(bytes, path, jetty.getCoreContainer().getResourceLo
ader().getInstancePath(), client);
Object resp = Utils.executeGET(client.getHttpClient(), jetty.getBaseURLV2(
).toString() + "/node/files" + path + "?sync=true", null);
System.out.println("sync resp: "+jetty.getBaseURLV2().toString() + "/node/
files" + path + "?sync=true"+" ,is: "+resp);
}
waitForAllNodesHaveFile(cluster,path, Utils.makeMap(":files:" + path + ":nam
e", (Predicate<Object>) Objects::nonNull),
false);
}
public static void postFile(SolrClient client, ByteBuffer buffer, String name, String sig) public static void postFile(SolrClient client, ByteBuffer buffer, String name, String sig)
throws SolrServerException, IOException { throws SolrServerException, IOException {
String resource = "/cluster/files" + name; String resource = "/cluster/files" + name;
ModifiableSolrParams params = new ModifiableSolrParams(); ModifiableSolrParams params = new ModifiableSolrParams();
params.add("sig", sig); params.add("sig", sig);
V2Response rsp = new V2Request.Builder(resource) V2Response rsp = new V2Request.Builder(resource)
.withMethod(SolrRequest.METHOD.PUT) .withMethod(SolrRequest.METHOD.PUT)
.withPayload(buffer) .withPayload(buffer)
.forceV2(true) .forceV2(true)
.withMimeType("application/octet-stream") .withMimeType("application/octet-stream")
 End of changes. 4 change blocks. 
4 lines changed or deleted 21 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)