NodeStateFacetsConfig extends FacetsConfig { @Override public synchronized void setMultiValued(String dimName, boolean v) { super.setMultiValued(dimName, v); if (v) { NodeBuilder current = this.nodeBuilder; for (String p : PathUtils.elements(dimName)) { NodeBuilder child = current.child(p); if (!child.hasProperty(JcrConstants.JCR_PRIMARYTYPE)) { child.setProperty(JcrConstants.JCR_PRIMARYTYPE, JcrConstants.NT_UNSTRUCTURED, Type.NAME); } child.setProperty(MULTIVALUED, true); current = child; } } } NodeStateFacetsConfig(NodeBuilder nodeBuilder); @Override synchronized void setMultiValued(String dimName, boolean v);  }
@Test public void testMultivaluedDimConfig() throws Exception { NodeStateFacetsConfig nodeStateFacetsConfig = new NodeStateFacetsConfig(builder); String dimension = "foo"; nodeStateFacetsConfig.setMultiValued(dimension, true); FacetsConfig.DimConfig dimConfig = nodeStateFacetsConfig.getDimConfig(dimension); assertNotNull(dimConfig); assertTrue(dimConfig.multiValued); NodeStateFacetsConfig nodeStateFacetsConfig2 = new NodeStateFacetsConfig(builder); FacetsConfig.DimConfig dimConfig2 = nodeStateFacetsConfig2.getDimConfig(dimension); assertNotNull(dimConfig2); assertTrue(dimConfig2.multiValued); }
@Test public void testMultivaluedRelativeDimConfig() throws Exception { NodeStateFacetsConfig nodeStateFacetsConfig = new NodeStateFacetsConfig(builder); String dimension = "jcr:content/text"; nodeStateFacetsConfig.setMultiValued(dimension, true); FacetsConfig.DimConfig dimConfig = nodeStateFacetsConfig.getDimConfig(dimension); assertNotNull(dimConfig); assertTrue(dimConfig.multiValued); NodeStateFacetsConfig nodeStateFacetsConfig2 = new NodeStateFacetsConfig(builder); assertTrue(nodeStateFacetsConfig.getDimConfig(dimension).multiValued); }