Package com.basho.riak.client.core.query.indexes

Examples of com.basho.riak.client.core.query.indexes.RiakIndexes


    public synchronized RiakIndexes getIndexes()
    {
        // Lazy initialization of the internal container.
        if (null == riakIndexes)
        {
            riakIndexes = new RiakIndexes();
        }
        return riakIndexes;
    }
View Full Code Here


    private RiakIndexes indexes;
   
    @Before
    public void setup()
    {
        indexes = new RiakIndexes();
    }
View Full Code Here

        for (Integer i = 0; i < 5; i++)
        {
            bytes.add(BinaryValue.create(i.toString().getBytes()));
        }
       
        RiakIndexes rIndexes = new RiakIndexes();
       
        rIndexes.getIndex(StringBinIndex.named("favorite_languages")).add(langs);
        rIndexes.getIndex(StringBinIndex.named("lucky_language")).add(langs);
        rIndexes.getIndex(LongIntIndex.named("longs")).add(longs);
        rIndexes.getIndex(LongIntIndex.named("lucky_long")).add(longs);
        rIndexes.getIndex(LongIntIndex.named("lucky_longlong")).add(longs);
        rIndexes.getIndex(RawIndex.named("raw", IndexType.INT)).add(bytes);
        rIndexes.getIndex(RawIndex.named("set_raw", IndexType.INT)).add(bytes);
        rIndexes.getIndex(RawIndex.named("raw", IndexType.BIN)).add(bytes);
        rIndexes.getIndex(RawIndex.named("set_raw", IndexType.BIN)).add(bytes);
       
        PojoWithAnnotatedFields pojo = new PojoWithAnnotatedFields();
       
        AnnotationUtil.populateIndexes(rIndexes, pojo);
       
View Full Code Here

        }
       
        pojo.rawInt = pojo.rawInts.iterator().next();
        pojo.rawBin = pojo.rawBins.iterator().next();
       
        RiakIndexes rIndexes = new RiakIndexes();
        AnnotationUtil.getIndexes(rIndexes, pojo);
       
        assertEquals("Expected RiakIndexes BinIndex (favorite_languages) to be populated",
                      rIndexes.getIndex(StringBinIndex.named("favorite_languages")).size(),
                      pojo.languages.size());       
        assertEquals("Expected RiakIndexes BinIndex (lucky_language) to be populated",
                      rIndexes.getIndex(StringBinIndex.named("lucky_language")).size(),
                      1);
        assertEquals("Expected RiakIndexes BinIndex (set_raw) to be pupulated",
                      rIndexes.getIndex(RawIndex.named("set_raw", IndexType.BIN)).size(),
                      pojo.rawBins.size());
        assertEquals("Expected RiakIndexes BinIndex (raw) to be pupulated",
                      rIndexes.getIndex(RawIndex.named("raw", IndexType.BIN)).size(),
                      1);
       
       
        assertEquals("Expected RiakIndexes IntIndex (longs) to be populated",
                      rIndexes.getIndex(LongIntIndex.named("longs")).size(),
                      pojo.longs.size());
        assertEquals("Expected RiakIndexes IntIndex (lucky_long) to be populated",
                      rIndexes.getIndex(LongIntIndex.named("lucky_long")).size(),
                      1);
        assertEquals("Expected RiakIndexes IntIndex (lucky_longlong) to be populated",
                      rIndexes.getIndex(LongIntIndex.named("lucky_longlong")).size(),
                      1);
        assertEquals("Expected RiakIndexes IntIndex (set_raw) to be pupulated",
                      rIndexes.getIndex(RawIndex.named("set_raw", IndexType.INT)).size(),
                      pojo.rawInts.size());
        assertEquals("Expected RiakIndexes IntIndex (raw) to be pupulated",
                      rIndexes.getIndex(RawIndex.named("raw", IndexType.INT)).size(),
                      1);
       
       
        assertTrue(rIndexes.getIndex(StringBinIndex.named("favorite_languages")).values().containsAll(pojo.languages));
        assertEquals(rIndexes.getIndex(StringBinIndex.named("lucky_language")).iterator().next(),
                     pojo.languages.iterator().next());
       
        assertTrue(rIndexes.getIndex(LongIntIndex.named("longs")).values().containsAll(pojo.longs));
        assertEquals(rIndexes.getIndex(LongIntIndex.named("lucky_long")).iterator().next(),
                     pojo.longs.iterator().next());
        assertEquals(rIndexes.getIndex(LongIntIndex.named("lucky_longlong")).iterator().next(),
                     pojo.longs.iterator().next());
        assertArrayEquals(rIndexes.getIndex(RawIndex.named("raw", IndexType.INT)).iterator().next().getValue(),
                     pojo.rawInt);
       
    }
View Full Code Here

        for (Integer i = 0; i < 5; i++)
        {
            bytes.add(BinaryValue.create(i.toString().getBytes()));
        }
       
        RiakIndexes rIndexes = new RiakIndexes();
       
        rIndexes.getIndex(StringBinIndex.named("strings")).add(strings);
        rIndexes.getIndex(StringBinIndex.named("string")).add(strings);
        rIndexes.getIndex(LongIntIndex.named("longs")).add(longs);
        rIndexes.getIndex(LongIntIndex.named("long")).add(longs);
        rIndexes.getIndex(LongIntIndex.named("longlong")).add(longs);
        rIndexes.getIndex(RawIndex.named("raw", IndexType.INT)).add(bytes);
        rIndexes.getIndex(RawIndex.named("set_raw", IndexType.INT)).add(bytes);
        rIndexes.getIndex(RawIndex.named("raw", IndexType.BIN)).add(bytes);
        rIndexes.getIndex(RawIndex.named("set_raw", IndexType.BIN)).add(bytes);
       
        PojoWithAnnotatedMethods pojo = new PojoWithAnnotatedMethods();
       
        AnnotationUtil.populateIndexes(rIndexes, pojo);
       
View Full Code Here

        }
       
        pojo.rawInt = pojo.rawInts.iterator().next();
        pojo.rawBin = pojo.rawBins.iterator().next();
       
        RiakIndexes rIndexes = new RiakIndexes();
        AnnotationUtil.getIndexes(rIndexes, pojo);
       
        assertEquals("Expected RiakIndexes BinIndex (strings) to be populated",
                      rIndexes.getIndex(StringBinIndex.named("strings")).size(),
                      pojo.getStrings().size());       
        assertEquals("Expected RiakIndexes BinIndex (string) to be populated",
                      rIndexes.getIndex(StringBinIndex.named("string")).size(),
                      1);
        assertEquals("Expected RiakIndexes BinIndex (set_raw) to be pupulated",
                      rIndexes.getIndex(RawIndex.named("set_raw", IndexType.BIN)).size(),
                      pojo.rawBins.size());
        assertEquals("Expected RiakIndexes BinIndex (raw) to be pupulated",
                      rIndexes.getIndex(RawIndex.named("raw", IndexType.BIN)).size(),
                      1);
       
        assertEquals("Expected RiakIndexes IntIndex (longs) to be populated",
                      rIndexes.getIndex(LongIntIndex.named("longs")).size(),
                      pojo.longs.size());
        assertEquals("Expected RiakIndexes IntIndex (long) to be populated",
                      rIndexes.getIndex(LongIntIndex.named("long")).size(),
                      1);
        assertEquals("Expected RiakIndexes IntIndex (longlong) to be populated",
                      rIndexes.getIndex(LongIntIndex.named("longlong")).size(),
                      1);
        assertEquals("Expected RiakIndexes IntIndex (set_raw) to be pupulated",
                      rIndexes.getIndex(RawIndex.named("set_raw", IndexType.INT)).size(),
                      pojo.rawInts.size());
        assertEquals("Expected RiakIndexes IntIndex (raw) to be pupulated",
                      rIndexes.getIndex(RawIndex.named("raw", IndexType.INT)).size(),
                      1);
       
        assertTrue(rIndexes.getIndex(StringBinIndex.named("strings")).values().containsAll(pojo.getStrings()));
        assertEquals(rIndexes.getIndex(StringBinIndex.named("string")).iterator().next(),
                     pojo.getStrings().iterator().next());
       
        assertTrue(rIndexes.getIndex(LongIntIndex.named("longs")).values().containsAll(pojo.getLongs()));
        assertEquals(rIndexes.getIndex(LongIntIndex.named("long")).iterator().next(),
                     pojo.getLongs().iterator().next());
        assertEquals(rIndexes.getIndex(LongIntIndex.named("longlong")).iterator().next(),
                     pojo.getLongs().iterator().next());
       
    }
View Full Code Here

        List<RiakLink> links = new ArrayList<RiakLink>();
        links.add(new RiakLink("bucket", "key", "tag"));
        ro.getLinks().addLinks(links);

        RiakIndexes indexes = ro.getIndexes();
        LongIntIndex longIndex = indexes.getIndex(LongIntIndex.named("dave"));
        longIndex.add(42L);

        ro.setValue(BinaryValue.unsafeCreate(expectedValue));

        Location location = new Location(ns, key);
View Full Code Here

    }
   
    @Test
    public void illegalRiakIndexFieldType()
    {
        final RiakIndexes rIndexes = new RiakIndexes();
       
        Object o = new Object()
        {
            @RiakIndex(name="whatever")
            private final Boolean domainProperty = null;
View Full Code Here

    }
   
    @Test
    public void illegalRiakIndexSetterType()
    {
        final RiakIndexes rIndexes = new RiakIndexes();
       
        Object o = new Object()
        {
            @RiakIndex(name="whatever")
            public void setIndex(Boolean b)
View Full Code Here

    }
   
    @Test
    public void illegalRiakIndexGetterType()
    {
        final RiakIndexes rIndexes = new RiakIndexes();
       
        Object o = new Object()
        {
            @RiakIndex(name="whatever")
            public void setIndex(Long b)
View Full Code Here

TOP

Related Classes of com.basho.riak.client.core.query.indexes.RiakIndexes

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.