Package com.impetus.kundera.query

Examples of com.impetus.kundera.query.Person


{

    @Test
    public void test()
    {
        Person p = new Person();
        RelationHolder rlHolder = new RelationHolder("parent", p);
       
        Assert.assertEquals("parent", rlHolder.getRelationName());
        Assert.assertEquals(p, rlHolder.getRelationValue());
       
View Full Code Here


    }

    @Test
    public void testisLoadedWithReferenceAsLoaded()
    {
        Person p = new Person();
        p.setPersonName("Vivek");
        LoadState state = PersistenceUtilHelper.isLoadedWithReference(p, "personName", cache);

        Assert.assertNotNull(state);
        Assert.assertEquals(LoadState.UNKNOWN, state);
    }
View Full Code Here

    }

    @Test
    public void testisLoadedWithoutReferenceAsLoad()
    {
        Person p = new Person();
        p.setPersonName("Vivek");

        LoadState state = PersistenceUtilHelper.isLoadedWithoutReference(p, "personName", cache);

        Assert.assertNotNull(state);
        Assert.assertEquals(LoadState.LOADED, state);
View Full Code Here

    @Test
    public void testIsLoadedWithOutReference()
    {
        KunderaPersistenceProviderUtil providerUtil = new KunderaPersistenceProviderUtil(persistence);
        Person p = new Person();
        p.setAge(32);
        LoadState state = providerUtil.isLoadedWithoutReference(p,"age");
        Assert.assertNotNull(state);
        Assert.assertEquals(LoadState.LOADED, state);
    }
View Full Code Here

    @Test
    public void testIsLoadedWithReference()
    {
        KunderaPersistenceProviderUtil providerUtil = new KunderaPersistenceProviderUtil(persistence);
        Person p = new Person();
        p.setAge(32);
        LoadState state = providerUtil.isLoadedWithReference(p,"age");
        Assert.assertNotNull(state);
        Assert.assertEquals(LoadState.UNKNOWN, state);
    }
View Full Code Here

    @Test
    public void test()
    {
        NonOperationalCache noOpCache = new NonOperationalCache();
        Person person = new Person();
        person.setAge(32);
        person.setDay(Day.SATURDAY);
        person.setPersonId("p1");
        person.setPersonName("Milan Kundera");
       
        noOpCache.put("p1", person);

        // Non operational cache doesn't do anything. So such assertions won't work!
        //
View Full Code Here

{

    @Test
    public void test()
    {
        Person p = new Person(); // create object.
        p.setAge(23);
        p.setPersonId("personId");

        ElementCollectionCacheManager manager = ElementCollectionCacheManager.getInstance();
        Assert.assertTrue(manager.isCacheEmpty());
        Assert.assertTrue(manager.getElementCollectionCache().isEmpty());
        Assert.assertNull(manager.getElementCollectionObjectName("personId", p));
View Full Code Here

    {
        LuceneIndexer indexer = LuceneIndexer.getInstance(LUCENE_DIR_PATH);

        EntityMetadata metadata = KunderaMetadataManager.getEntityMetadata(
                ((EntityManagerFactoryImpl) emf).getKunderaMetadataInstance(), Person.class);
        Person p = new Person();
        p.setAge(32);
        p.setDay(Day.TUESDAY);
        p.setPersonId("p1");
        indexer.index(metadata, (MetamodelImpl) ((EntityManagerFactoryImpl) emf).getKunderaMetadataInstance()
                .getApplicationMetadata().getMetamodel("patest"), p);
        Assert.assertNotNull(indexer);

        final String luceneQuery = "Invalid lucene query";
View Full Code Here

    {
        LuceneIndexer indexer = LuceneIndexer.getInstance(LUCENE_DIR_PATH);

        EntityMetadata metadata = KunderaMetadataManager.getEntityMetadata(
                ((EntityManagerFactoryImpl) emf).getKunderaMetadataInstance(), Person.class);
        Person p = new Person();
        p.setAge(32);
        p.setDay(Day.TUESDAY);
        p.setPersonId("p1");
        indexer.index(metadata, (MetamodelImpl) ((EntityManagerFactoryImpl) emf).getKunderaMetadataInstance()
                .getApplicationMetadata().getMetamodel("patest"), p);

        indexer.flush();
        Assert.assertNotNull(indexer);
View Full Code Here

    {
        LuceneIndexer indexer = LuceneIndexer.getInstance(LUCENE_DIR_PATH);
        IndexManager ixManager = new IndexManager(indexer, ((EntityManagerFactoryImpl)emf).getKunderaMetadataInstance());

        EntityMetadata metadata = KunderaMetadataManager.getEntityMetadata(((EntityManagerFactoryImpl)emf).getKunderaMetadataInstance(), Person.class);
        Person p = new Person();
        p.setAge(32);
        p.setDay(Day.TUESDAY);
        p.setPersonId("p1");

        Assert.assertNotNull(ixManager.getIndexer());
        Assert.assertEquals(indexer, ixManager.getIndexer());
       
        ixManager.write(metadata, p);

        String luceneQuery = "+Person.AGE:32 AND +entity.class:com.impetus.kundera.query.Person";

        try
        {
            Map<String, Object> results = ixManager.search(metadata.getEntityClazz(), luceneQuery, 0, 10, false);
            Assert.assertTrue(!results.isEmpty());
        }
        catch (LuceneIndexingException liex)
        {
            Assert.fail();
        }

        p.setAge(35);
       
        ixManager.update(metadata, p, null, Person.class);
        luceneQuery = "+Person.AGE:35 AND +entity.class:com.impetus.kundera.query.Person";
       
        try
View Full Code Here

TOP

Related Classes of com.impetus.kundera.query.Person

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.