summaryrefslogtreecommitdiffstats
path: root/documentapi
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2019-07-22 15:16:19 +0200
committerHenning Baldersheim <balder@yahoo-inc.com>2019-07-22 15:16:19 +0200
commit512c44b5d679c00cd5532b39f6ba368c241ebcd2 (patch)
tree7a87d8555dc251ea45e552a00e52f5205c203fc9 /documentapi
parent48f02f6ddd5e9fc2951a5ce72d800819d63e0bcc (diff)
Add failing test for missing short-circuit of and.
Diffstat (limited to 'documentapi')
-rwxr-xr-xdocumentapi/src/test/java/com/yahoo/documentapi/messagebus/protocol/test/PolicyTestCase.java37
1 files changed, 32 insertions, 5 deletions
diff --git a/documentapi/src/test/java/com/yahoo/documentapi/messagebus/protocol/test/PolicyTestCase.java b/documentapi/src/test/java/com/yahoo/documentapi/messagebus/protocol/test/PolicyTestCase.java
index fd5f43c23c1..cd045c0363d 100755
--- a/documentapi/src/test/java/com/yahoo/documentapi/messagebus/protocol/test/PolicyTestCase.java
+++ b/documentapi/src/test/java/com/yahoo/documentapi/messagebus/protocol/test/PolicyTestCase.java
@@ -47,6 +47,7 @@ import com.yahoo.messagebus.routing.RoutingSpec;
import com.yahoo.messagebus.routing.RoutingTableSpec;
import com.yahoo.messagebus.test.Receptor;
import org.junit.Before;
+import org.junit.Ignore;
import org.junit.Test;
import java.util.ArrayList;
@@ -60,7 +61,7 @@ import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
@@ -68,7 +69,6 @@ import static org.junit.Assert.assertTrue;
/**
* @author Simon Thoresen Hult
*/
-@SuppressWarnings("deprecation")
public class PolicyTestCase {
private static final int TIMEOUT = 300;
@@ -313,7 +313,7 @@ public class PolicyTestCase {
for (int i = 0; i < 10; ++i) {
RoutingNode leaf = frame.select(1).get(0);
String recipient = leaf.getRoute().toString();
- assertTrue(recipient.equals("docproc/cluster.default/*/chain.default"));
+ assertEquals(recipient, "docproc/cluster.default/*/chain.default");
lst.add(recipient);
leaf.handleReply(new EmptyReply());
@@ -496,7 +496,7 @@ public class PolicyTestCase {
if (prev == null) {
assertNotNull(next);
} else {
- assertFalse(prev.equals(next));
+ assertNotEquals(prev, next);
}
prev = next;
leaf.handleReply(new EmptyReply());
@@ -612,6 +612,33 @@ public class PolicyTestCase {
frame.destroy();
}
+ @Test
+ @Ignore
+ public void testDocumentSelectorDualCluster() {
+ PolicyTestFrame frame = new PolicyTestFrame(manager);
+ frame.setHop(new HopSpec("test", "[DocumentRouteSelector:raw:" +
+ "route[2]\n" +
+ "route[0].name \"foo\"\n" +
+ "route[0].selector \"(testdoc AND (testdoc.intfield / 1000 > 0))\"\n" +
+ "route[0].feed \"myfeed\"\n" +
+ "route[1].name \"bar\"\n" +
+ "route[1].selector \"(other AND (other.intfield / 1000 > 0))\"\n" +
+ "route[1].feed \"myfeed\"\n]").addRecipient("foo").addRecipient("bar"));
+
+ frame.setMessage(new GetDocumentMessage(new DocumentId("doc:scheme:"), "fieldSet"));
+ frame.assertSelect(Arrays.asList("bar", "foo"));
+
+ Document doc = new Document(manager.getDocumentType("testdoc"), new DocumentId("doc:scheme:"));
+ doc.setFieldValue("intfield", 3000);
+ Message put = new PutDocumentMessage(new DocumentPut(doc));
+ frame.setMessage(put);
+ frame.assertSelect(Arrays.asList("foo"));
+
+ frame.setMessage(put);
+ frame.assertMergeOneReply("foo");
+
+ frame.destroy();
+ }
@Test
public void testDocumentRouteSelectorIgnore() {
@@ -676,7 +703,7 @@ public class PolicyTestCase {
assertSelect(frame, 32, Arrays.asList("docproc/cluster.default/9/chain.default"));
frame.getNetwork().unregisterSession("9/chain.default");
assertTrue(frame.waitSlobrok("docproc/cluster.default/*/chain.default", 7));
- assertSelect(frame, 32, new ArrayList<String>());
+ assertSelect(frame, 32, new ArrayList<>());
// Test merge behavior.
frame.setHop(new HopSpec("test", "[RoundRobin]").addRecipient("docproc/cluster.default/0/chain.default"));