Package com.impetus.kundera.client

Examples of com.impetus.kundera.client.CoreTestClientFactory


    {
        PersistenceUnitMetadata puMetadata = new PersistenceUnitMetadata();
        Map<String, PersistenceUnitMetadata> puMetadataMap = new HashMap<String, PersistenceUnitMetadata>();
        puMetadataMap.put(PU, puMetadata);
        ((EntityManagerFactoryImpl)emf).getKunderaMetadataInstance().getApplicationMetadata().addPersistenceUnitMetadata(puMetadataMap);
        CoreTestClientFactory clientFactory = new CoreTestClientFactory();
              
       
        Method m = GenericClientFactory.class.getDeclaredMethod("setKunderaMetadata", KunderaMetadata.class);
        if (!m.isAccessible())
        {
            m.setAccessible(true);
        }

        m.invoke(clientFactory, ((EntityManagerFactoryImpl)emf).getKunderaMetadataInstance());
       
        clientFactory.load(PU, null);
       
        clientFactory.setExternalProperties(new HashMap<String, Object>());
       
        Assert.assertEquals(PU,clientFactory.getPersistenceUnit());
        Assert.assertNotNull(clientFactory.getClientInstance());
        Assert.assertNotNull(clientFactory.getSchemaManager(null));
        Assert.assertNull(clientFactory.getConnectionPoolOrConnection());
       
        Assert.assertNotNull(clientFactory.getLoadBalancePolicy("ROUNDROBIN"));
       
        Assert.assertNotNull(clientFactory.getLoadBalancePolicy("LEASTACTIVE"));
       
        Assert.assertNotNull(clientFactory.getLoadBalancePolicy("invalid"));
       
        try
        {
            clientFactory.onValidation(null, null);
            Assert.fail("Should have gone to catch block!");
        }catch(IllegalArgumentException iaex)
        {
            Assert.assertNotNull(iaex.getMessage());
        }
        clientFactory.destroy();
    }
View Full Code Here


//        kunderaMetadata.addClientMetadata(PU, null);
        Map<String, Object> propertyMap = new HashMap<String, Object>();
        propertyMap.put(PersistenceProperties.KUNDERA_INDEXER_CLASS, "com.impetus.kundera.query.CoreIndexer");
        propertyMap.put(PersistenceProperties.KUNDERA_INDEX_HOME_DIR, "");
       
        CoreTestClientFactory clientFactory = new CoreTestClientFactory();
        clientFactory.load(PU, propertyMap);
       
        Assert.assertNotNull(clientFactory.getClientMetadata());
    }
View Full Code Here

TOP

Related Classes of com.impetus.kundera.client.CoreTestClientFactory

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.