Package net.greghaines.jesque.meta

Examples of net.greghaines.jesque.meta.KeyInfo


        final KeyDAOPoolWork work = new KeyDAOPoolWork(key);
        this.mockCtx.checking(new Expectations(){{
            oneOf(jedis).type(key); will(returnValue(KeyType.HASH.toString()));
            oneOf(jedis).hlen(key); will(returnValue(size));
        }});
        final KeyInfo keyInfo = work.doWork(this.jedis);
        Assert.assertNotNull(keyInfo);
        Assert.assertEquals("foo", keyInfo.getNamespace());
        Assert.assertEquals("bar", keyInfo.getName());
        Assert.assertEquals(KeyType.HASH, keyInfo.getType());
        Assert.assertEquals((Long) size, keyInfo.getSize());
        Assert.assertNull(keyInfo.getArrayValue());
    }
View Full Code Here


            oneOf(jedis).type(key); will(returnValue(KeyType.HASH.toString()));
            oneOf(jedis).hlen(key); will(returnValue(size));
            oneOf(jedis).hkeys(key); will(returnValue(valueKeys));
            oneOf(jedis).hmget(key, "foo"); will(returnValue(valueValues));
        }});
        final KeyInfo keyInfo = work.doWork(this.jedis);
        Assert.assertNotNull(keyInfo);
        Assert.assertEquals("foo", keyInfo.getNamespace());
        Assert.assertEquals("bar", keyInfo.getName());
        Assert.assertEquals(KeyType.HASH, keyInfo.getType());
        Assert.assertEquals((Long) size, keyInfo.getSize());
        Assert.assertNotNull(keyInfo.getArrayValue());
        Assert.assertEquals(1, keyInfo.getArrayValue().size());
        Assert.assertTrue(keyInfo.getArrayValue().contains("{foo=123}"));
    }
View Full Code Here

        this.mockCtx.checking(new Expectations(){{
            oneOf(jedis).type(key); will(returnValue(KeyType.HASH.toString()));
            oneOf(jedis).hlen(key); will(returnValue(size));
            oneOf(jedis).hkeys(key); will(returnValue(valueKeys));
        }});
        final KeyInfo keyInfo = work.doWork(this.jedis);
        Assert.assertNotNull(keyInfo);
        Assert.assertEquals("foo", keyInfo.getNamespace());
        Assert.assertEquals("bar", keyInfo.getName());
        Assert.assertEquals(KeyType.HASH, keyInfo.getType());
        Assert.assertEquals((Long) size, keyInfo.getSize());
        Assert.assertNotNull(keyInfo.getArrayValue());
        Assert.assertTrue(keyInfo.getArrayValue().isEmpty());
    }
View Full Code Here

            oneOf(jedis).type(key); will(returnValue(KeyType.HASH.toString()));
            oneOf(jedis).hlen(key); will(returnValue(size));
            oneOf(jedis).hkeys(key); will(returnValue(valueKeys));
            oneOf(jedis).hmget(key, "baz"); will(returnValue(valueValues));
        }});
        final KeyInfo keyInfo = work.doWork(this.jedis);
        Assert.assertNotNull(keyInfo);
        Assert.assertEquals("foo", keyInfo.getNamespace());
        Assert.assertEquals("bar", keyInfo.getName());
        Assert.assertEquals(KeyType.HASH, keyInfo.getType());
        Assert.assertEquals((Long) size, keyInfo.getSize());
        Assert.assertNotNull(keyInfo.getArrayValue());
        Assert.assertEquals(1, keyInfo.getArrayValue().size());
        Assert.assertTrue(keyInfo.getArrayValue().contains("{baz=789}"));
    }
View Full Code Here

        final KeyDAOPoolWork work = new KeyDAOPoolWork(key);
        this.mockCtx.checking(new Expectations(){{
            oneOf(jedis).type(key); will(returnValue(KeyType.LIST.toString()));
            oneOf(jedis).llen(key); will(returnValue(size));
        }});
        final KeyInfo keyInfo = work.doWork(this.jedis);
        Assert.assertNotNull(keyInfo);
        Assert.assertEquals("foo", keyInfo.getNamespace());
        Assert.assertEquals("bar", keyInfo.getName());
        Assert.assertEquals(KeyType.LIST, keyInfo.getType());
        Assert.assertEquals((Long) size, keyInfo.getSize());
        Assert.assertNull(keyInfo.getArrayValue());
    }
View Full Code Here

        this.mockCtx.checking(new Expectations(){{
            oneOf(jedis).type(key); will(returnValue(KeyType.LIST.toString()));
            oneOf(jedis).llen(key); will(returnValue(size));
            oneOf(jedis).lrange(key, offset, offset + count); will(returnValue(value));
        }});
        final KeyInfo keyInfo = work.doWork(this.jedis);
        Assert.assertNotNull(keyInfo);
        Assert.assertEquals("foo", keyInfo.getNamespace());
        Assert.assertEquals("bar", keyInfo.getName());
        Assert.assertEquals(KeyType.LIST, keyInfo.getType());
        Assert.assertEquals((Long) size, keyInfo.getSize());
        Assert.assertNotNull(keyInfo.getArrayValue());
        Assert.assertEquals(count, keyInfo.getArrayValue().size());
        Assert.assertTrue(value.containsAll(keyInfo.getArrayValue()));
    }
View Full Code Here

        final String key = "foo:bar";
        final KeyDAOPoolWork work = new KeyDAOPoolWork(key);
        this.mockCtx.checking(new Expectations(){{
            oneOf(jedis).type(key); will(returnValue("?"));
        }});
        final KeyInfo keyInfo = work.doWork(this.jedis);
        Assert.assertNull(keyInfo);
    }
View Full Code Here

        final String key = "foo:bar";
        final KeyDAOPoolWork work = new KeyDAOPoolWork(key);
        this.mockCtx.checking(new Expectations(){{
            oneOf(jedis).type(key); will(returnValue(KeyType.NONE.toString()));
        }});
        final KeyInfo keyInfo = work.doWork(this.jedis);
        Assert.assertNull(keyInfo);
    }
View Full Code Here

        /**
         * {@inheritDoc}
         */
        @Override
        public KeyInfo doWork(final Jedis jedis) throws Exception {
            final KeyInfo keyInfo;
            final KeyType type = KeyType.getKeyTypeByValue(jedis.type(this.key));
            if (type == null) {
                keyInfo = null;
            } else {
                switch (type) {
View Full Code Here

            }
            return keyInfo;
        }

        protected KeyInfo handleZSet(final Jedis jedis) {
            final KeyInfo keyInfo = new KeyInfo(this.key, KeyType.ZSET);
            keyInfo.setSize(jedis.zcard(this.key));
            if (this.doArrayValue) {
                keyInfo.setArrayValue(new ArrayList<String>(
                        jedis.zrange(this.key, this.offset, this.offset + this.count)));
            }
            return keyInfo;
        }
View Full Code Here

TOP

Related Classes of net.greghaines.jesque.meta.KeyInfo

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.