@Test
    void testCompound() {
        // Configuration phase

        QueryProfile profile = new QueryProfile("test");
        profile.setDimensions(new String[]{"x", "y"});

        QueryProfile a1 = new QueryProfile("a1");
        a1.set("b", "a1.b.default", null);
        a1.set("c", "a1.c.default", null);
        a1.set("d", "a1.d.default", null);
        a1.set("e", "a1.e.default", null);

        QueryProfile a2 = new QueryProfile("a2");
        a2.set("b", "a2.b.default", null);
        a2.set("c", "a2.c.default", null);
        a2.set("d", "a2.d.default", null);
        a2.set("e", "a2.e.default", null);

        profile.set("a", a1, null); // Must set profile references before overrides
        profile.set("a.b", "a.b.default-override", null);
        profile.set("a.c", "a.c.default-override", null);
        profile.set("a.d", "a.d.default-override", null);
        profile.set("a.g", "a.g.default-override", null);

        String[] d1 = new String[]{"x1", "y1"};
        profile.set("a", a1, d1, null);
        profile.set("a.b", "x1.y1.a.b.default-override", d1, null);
        profile.set("a.c", "x1.y1.a.c.default-override", d1, null);
        profile.set("a.g", "x1.y1.a.g.default-override", d1, null); // This value is never manifest because the runtime override overrides all variants

        String[] d2 = new String[]{"x1", "y2"};
        profile.set("a.b", "x1.y2.a.b.default-override", d2, null);
        profile.set("a.c", "x1.y2.a.c.default-override", d2, null);

        String[] d3 = new String[]{"x2", "y1"};
        profile.set("a", a2, d3, null);
        profile.set("a.b", "x2.y1.a.b.default-override", d3, null);
        profile.set("a.c", "x2.y1.a.c.default-override", d3, null);


        // Runtime phase - four simultaneous requests using different variants makes their own overrides
        QueryProfileProperties defaultRuntimeProfile = new QueryProfileProperties(profile.compile(null));
        defaultRuntimeProfile.set("a.f", "a.f.runtime-override");
        defaultRuntimeProfile.set("a.g", "a.g.runtime-override");

        QueryProfileProperties d1RuntimeProfile = new QueryProfileProperties(profile.compile(null));
        d1RuntimeProfile.set("a.f", "a.f.d1.runtime-override", toMap("x=x1", "y=y1"));
        d1RuntimeProfile.set("a.g", "a.g.d1.runtime-override", toMap("x=x1", "y=y1"));

        QueryProfileProperties d2RuntimeProfile = new QueryProfileProperties(profile.compile(null));
        d2RuntimeProfile.set("a.f", "a.f.d2.runtime-override", toMap("x=x1", "y=y2"));
        d2RuntimeProfile.set("a.g", "a.g.d2.runtime-override", toMap("x=x1", "y=y2"));

        QueryProfileProperties d3RuntimeProfile = new QueryProfileProperties(profile.compile(null));
        d3RuntimeProfile.set("a.f", "a.f.d3.runtime-override", toMap("x=x2", "y=y1"));
        d3RuntimeProfile.set("a.g", "a.g.d3.runtime-override", toMap("x=x2", "y=y1"));

        // Lookups
        assertEquals("a.b.default-override", defaultRuntimeProfile.get("a.b"));
        assertEquals("a.c.default-override", defaultRuntimeProfile.get("a.c"));
        assertEquals("a.d.default-override", defaultRuntimeProfile.get("a.d"));
        assertEquals("a1.e.default",         defaultRuntimeProfile.get("a.e"));
        assertEquals("a.f.runtime-override", defaultRuntimeProfile.get("a.f"));
        assertEquals("a.g.runtime-override", defaultRuntimeProfile.get("a.g"));

        assertEquals("x1.y1.a.b.default-override", d1RuntimeProfile.get("a.b", toMap("x=x1", "y=y1")));
        assertEquals("x1.y1.a.c.default-override", d1RuntimeProfile.get("a.c", toMap("x=x1", "y=y1")));
        assertEquals("a1.d.default",               d1RuntimeProfile.get("a.d", toMap("x=x1", "y=y1")));
        assertEquals("a1.e.default",               d1RuntimeProfile.get("a.e", toMap("x=x1", "y=y1")));
        assertEquals("a.f.d1.runtime-override",    d1RuntimeProfile.get("a.f", toMap("x=x1", "y=y1")));
        assertEquals("a.g.d1.runtime-override",    d1RuntimeProfile.get("a.g", toMap("x=x1", "y=y1")));

        assertEquals("x1.y2.a.b.default-override", d2RuntimeProfile.get("a.b", toMap("x=x1", "y=y2")));
        assertEquals("x1.y2.a.c.default-override", d2RuntimeProfile.get("a.c", toMap("x=x1", "y=y2")));
        assertEquals("a.d.default-override",       d2RuntimeProfile.get("a.d", toMap("x=x1", "y=y2"))); // Because this variant does not itself refer to a
        assertEquals("a1.e.default",               d2RuntimeProfile.get("a.e", toMap("x=x1", "y=y2")));
        assertEquals("a.f.d2.runtime-override",    d2RuntimeProfile.get("a.f", toMap("x=x1", "y=y2")));
        assertEquals("a.g.d2.runtime-override",    d2RuntimeProfile.get("a.g", toMap("x=x1", "y=y2")));

        assertEquals("x2.y1.a.b.default-override", d3RuntimeProfile.get("a.b", toMap("x=x2", "y=y1")));
        assertEquals("x2.y1.a.c.default-override", d3RuntimeProfile.get("a.c", toMap("x=x2", "y=y1")));
        assertEquals("a2.d.default",               d3RuntimeProfile.get("a.d", toMap("x=x2", "y=y1")));
        assertEquals("a2.e.default",               d3RuntimeProfile.get("a.e", toMap("x=x2", "y=y1")));
        assertEquals("a.f.d3.runtime-override",    d3RuntimeProfile.get("a.f", toMap("x=x2", "y=y1")));
        assertEquals("a.g.d3.runtime-override",    d3RuntimeProfile.get("a.g", toMap("x=x2", "y=y1")));
    }
Tests referencing a variant which modifies the dimension set,
and also setting a value within that variants subspace.
container-search/src/test/java/com/yahoo/search/query/profile/test/QueryProfileVariantsTestCase.java