jackrabbit-oak-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marcel Reutegger <mreut...@adobe.com>
Subject RE: svn commit: r1485701 - /jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/EmptyPropertyTest.java
Date Thu, 23 May 2013 14:23:46 GMT
Hi,

I looked at the PropertyIndexTest first, but the code to setup
the test wasn't straight forward to me. PropertyIndexTest
actually doesn't have a common setup method for its tests.
It was easier for me to copy the initialization code from
MultipleIndicesTest. this also made the actual test method
very easy to read and understand.

regards
 marcel

> -----Original Message-----
> From: Alex Parvulescu [mailto:alex.parvulescu@gmail.com]
> Sent: Donnerstag, 23. Mai 2013 16:15
> To: oak-dev@jackrabbit.apache.org
> Subject: Re: svn commit: r1485701 - /jackrabbit/oak/trunk/oak-
> core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/Empt
> yPropertyTest.java
> 
> I'm wondering if we need to bootstrap the entire repo when there are
> enough
> elements for a simple test in the existing PropertyIndexTest
> 
> alex
> 
> 
> On Thu, May 23, 2013 at 3:35 PM, <mreutegg@apache.org> wrote:
> 
> > Author: mreutegg
> > Date: Thu May 23 13:35:58 2013
> > New Revision: 1485701
> >
> > URL: http://svn.apache.org/r1485701
> > Log:
> > OAK-841: Indexing empty string fails with "there's already a child node
> > with name ':index'"
> > - Test case (currently ignored)
> >
> > Added:
> >
> > jackrabbit/oak/trunk/oak-
> core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/Empt
> yPropertyTest.java
> >   (with props)
> >
> > Added:
> > jackrabbit/oak/trunk/oak-
> core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/Empt
> yPropertyTest.java
> > URL:
> > http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-
> core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/Empt
> yPropertyTest.java?rev=1485701&view=auto
> >
> >
> ==========================================================
> ====================
> > ---
> > jackrabbit/oak/trunk/oak-
> core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/Empt
> yPropertyTest.java
> > (added)
> > +++
> > jackrabbit/oak/trunk/oak-
> core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/Empt
> yPropertyTest.java
> > Thu May 23 13:35:58 2013
> > @@ -0,0 +1,73 @@
> > +/*
> > + * Licensed to the Apache Software Foundation (ASF) under one or more
> > + * contributor license agreements.  See the NOTICE file distributed with
> > + * this work for additional information regarding copyright ownership.
> > + * The ASF licenses this file to You under the Apache License, Version 2.0
> > + * (the "License"); you may not use this file except in compliance with
> > + * the License.  You may obtain a copy of the License at
> > + *
> > + *     http://www.apache.org/licenses/LICENSE-2.0
> > + *
> > + * Unless required by applicable law or agreed to in writing, software
> > + * distributed under the License is distributed on an "AS IS" BASIS,
> > + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
> or
> > implied.
> > + * See the License for the specific language governing permissions and
> > + * limitations under the License.
> > + */
> > +package org.apache.jackrabbit.oak.plugins.index.property;
> > +
> > +import org.apache.jackrabbit.oak.Oak;
> > +import org.apache.jackrabbit.oak.api.CommitFailedException;
> > +import org.apache.jackrabbit.oak.api.ContentRepository;
> > +import org.apache.jackrabbit.oak.api.Tree;
> > +import org.apache.jackrabbit.oak.plugins.nodetype.write.InitialContent;
> > +import org.apache.jackrabbit.oak.query.AbstractQueryTest;
> > +import org.apache.jackrabbit.oak.spi.lifecycle.RepositoryInitializer;
> > +import org.apache.jackrabbit.oak.spi.security.OpenSecurityProvider;
> > +import org.apache.jackrabbit.oak.spi.state.NodeBuilder;
> > +import org.apache.jackrabbit.oak.spi.state.NodeState;
> > +import org.junit.Ignore;
> > +import org.junit.Test;
> > +
> > +import com.google.common.collect.ImmutableList;
> > +
> > +import static
> > org.apache.jackrabbit.oak.plugins.index.IndexUtils.createIndexDefinition;
> > +import static
> > org.apache.jackrabbit.oak.plugins.index.IndexUtils.getOrCreateOakIndex;
> > +
> > +/**
> > + * Test for OAK-841
> > + */
> > +public class EmptyPropertyTest extends AbstractQueryTest {
> > +
> > +    @Override
> > +    protected ContentRepository createRepository() {
> > +        return new Oak()
> > +                .with(new InitialContent())
> > +                .with(new RepositoryInitializer() {
> > +                    @Override
> > +                    public NodeState initialize(NodeState state) {
> > +                        NodeBuilder root = state.builder();
> > +                        createIndexDefinition(getOrCreateOakIndex(root),
> > "prop",
> > +                                true, false, ImmutableList.of("prop"),
> > null);
> > +                        return root.getNodeState();
> > +                    }
> > +                }).with(new OpenSecurityProvider())
> > +                .with(new PropertyIndexProvider())
> > +                .with(new PropertyIndexEditorProvider())
> > +                .createContentRepository();
> > +    }
> > +
> > +    @Ignore
> > +    @Test
> > +    public void emptyStringValue() throws CommitFailedException {
> > +        Tree t = root.getTree("/");
> > +        t.addChild("node-1").setProperty("prop", "value");
> > +        root.commit();
> > +
> > +        t = root.getTree("/");
> > +        t.addChild("node-2").setProperty("prop", "");
> > +        root.commit();
> > +    }
> > +}
> > +
> > +
> >
> > Propchange:
> > jackrabbit/oak/trunk/oak-
> core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/Empt
> yPropertyTest.java
> >
> > ------------------------------------------------------------------------------
> >     svn:eol-style = native
> >
> > Propchange:
> > jackrabbit/oak/trunk/oak-
> core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/Empt
> yPropertyTest.java
> >
> > ------------------------------------------------------------------------------
> >     svn:keywords = Author Date Id Revision Rev URL
> >
> >
> >

Mime
View raw message