public void mergeCounter() { EntityManager em = emf.createEntityManager(); Counters counters = new Counters(); counters = em.find(Counters.class, id1); Assert.assertNotNull(counters); Assert.assertNotNull(counters.getCounter()); try { em.merge(counters); } catch (KunderaException ke) { Assert.assertEquals("java.lang.UnsupportedOperationException: Merge is not permitted on counter column! ", ke.getMessage()); } finally { em.close(); } }
@Test public void testCreateEMFWithNullPu() { KunderaPersistence persistence = new KunderaPersistence(); try { EntityManagerFactory emf = persistence.createEntityManagerFactory(null, null); Assert.fail("Should have gone to catch block!"); } catch (KunderaException kex) { Assert.assertEquals("Persistence unit name should not be null", kex.getMessage()); } }
Assert.assertEquals("Invalid class provided " + null, e.getMessage());
@Test public void testRemove() { PersonnelDTO paramObject = new PersonnelDTO(); PersonnelDTO dto = new PersonnelDTO(); dto.setPersonId("123"); em.persist(dto); dto = em.find(PersonnelDTO.class, 123); try { em.remove(null); } catch (KunderaException e) { Assert.assertEquals("java.lang.IllegalArgumentException: Entity to be removed must not be null.", e.getMessage()); } em.remove(dto); dto = em.find(PersonnelDTO.class, "123"); Assert.assertNull(dto); try { em.remove(paramObject); } catch (Exception e) { Assert.assertEquals("123", "123"); } }
e.getMessage()); e.getMessage());
e.getMessage()); Assert.assertNotNull(e.getMessage());
@Test public void testEntityOperations() { try { MappedPerson p = new MappedPerson(); p.setId("dd"); p.setFirstName("mapped"); p.setLastName("superclass"); em.persist(p); Assert.fail("Should have gone to catch block!"); } catch (KunderaException kex) { Assert.assertNotNull(kex.getMessage()); } }
Assert.assertSame("No transaction in progress.", kex.getMessage()); Assert.fail(kex.getMessage());
@Test public void test() throws NoSuchFieldException, SecurityException { try { Class clazz = ReflectUtils.classForName("Person", this.getClass().getClassLoader()); }catch(KunderaException cfex) { Assert.assertNotNull(cfex.getMessage()); } Class clazz = ReflectUtils.classForName("com.impetus.kundera.query.Person", this.getClass().getClassLoader()); Assert.assertNotNull(clazz); Assert.assertEquals(Person.class, clazz); Field field = Person.class.getDeclaredField("personName"); Assert.assertFalse(ReflectUtils.isTransientOrStatic(field)); Assert.assertFalse(ReflectUtils.hasInterface(Client.class, Person.class)); Assert.assertTrue(ReflectUtils.hasInterface(Client.class, Client.class)); Assert.assertTrue(ReflectUtils.hasInterface(Client.class,CoreTestClient.class)); Assert.assertTrue(ReflectUtils.hasSuperClass(ClientBase.class, CoreTestClient.class)); Assert.assertTrue(ReflectUtils.hasSuperClass(ClientBase.class, ClientBase.class)); Assert.assertFalse(ReflectUtils.hasSuperClass(ClientBase.class, Client.class)); Assert.assertEquals(ClientBase.class,ReflectUtils.stripEnhancerClass(ClientBase.class)); }
private void mergeCounter() { EntityManager em = emf.createEntityManager(); SuperCounters counter = new SuperCounters(); counter = em.find(SuperCounters.class, id1); Assert.assertNotNull(counter); Assert.assertNotNull(counter.getCounter()); try { em.merge(counter); } catch (KunderaException ke) { Assert.assertEquals("java.lang.UnsupportedOperationException: Merge is not permitted on counter column! ", ke.getMessage()); } finally { em.close(); } }
@Test public void test() { EntityMetadata entityMetadata = KunderaMetadataManager.getEntityMetadata(kunderaMetadata, SingularEntityEmbeddable.class); Assert.assertNotNull(entityMetadata); entityMetadata = KunderaMetadataManager.getEntityMetadata(kunderaMetadata, persistenceUnit, SingularEntityEmbeddable.class); Assert.assertNotNull(entityMetadata); try { entityMetadata = KunderaMetadataManager.getEntityMetadata(kunderaMetadata, null); Assert.fail("Should have gone to catch block!"); } catch (KunderaException kex) { Assert.assertNotNull(kex.getMessage()); } entityMetadata = KunderaMetadataManager.getEntityMetadata(kunderaMetadata, GeneratedIdStrategyIdentity.class); Assert.assertNull(entityMetadata); Metamodel metaModel = KunderaMetadataManager.getMetamodel(kunderaMetadata, persistenceUnit); Assert.assertNotNull(metaModel); metaModel = KunderaMetadataManager.getMetamodel(kunderaMetadata, persistenceUnit, "KunderaTests"); Assert.assertNotNull(metaModel); PersistenceUnitMetadata puMetadata = KunderaMetadataManager.getPersistenceUnitMetadata(kunderaMetadata, persistenceUnit); Assert.assertNotNull(puMetadata); puMetadata = KunderaMetadataManager.getPersistenceUnitMetadata(kunderaMetadata, null); Assert.assertNull(puMetadata); }
"java.lang.UnsupportedOperationException: " + GenerationType.class.getSimpleName() + "." + GenerationType.IDENTITY + " Strategy not supported by this client :" + MongoDBClient.class.getName(), e.getMessage()); "java.lang.IllegalArgumentException: " + GenerationType.class.getSimpleName() + "." + GenerationType.SEQUENCE + " Strategy not supported by this client :" + MongoDBClient.class.getName(), e.getMessage()); "java.lang.IllegalArgumentException: " + GenerationType.class.getSimpleName() + "." + GenerationType.TABLE + " Strategy not supported by this client :" + MongoDBClient.class.getName(), e.getMessage()); "java.lang.IllegalArgumentException: " + GenerationType.class.getSimpleName() + "." + GenerationType.SEQUENCE + " Strategy not supported by this client :" + MongoDBClient.class.getName(), e.getMessage()); "java.lang.IllegalArgumentException: " + GenerationType.class.getSimpleName() + "." + GenerationType.TABLE + " Strategy not supported by this client :" + MongoDBClient.class.getName(), e.getMessage()); "java.lang.IllegalArgumentException: " + GenerationType.class.getSimpleName() + "." + GenerationType.SEQUENCE + " Strategy not supported by this client :" + MongoDBClient.class.getName(), e.getMessage()); "java.lang.IllegalArgumentException: " + GenerationType.class.getSimpleName() + "." + GenerationType.TABLE + " Strategy not supported by this client :" + MongoDBClient.class.getName(), e.getMessage());
e.getMessage()); e.getMessage()); "java.lang.UnsupportedOperationException: " + GenerationType.class.getSimpleName() + "." + GenerationType.IDENTITY + " Strategy not supported by this client :" + RedisClient.class.getName(), e.getMessage()); e.getMessage()); e.getMessage()); e.getMessage());
"java.lang.UnsupportedOperationException: " + GenerationType.class.getSimpleName() + "." + GenerationType.IDENTITY + " Strategy not supported by this client :" + ThriftClient.class.getName(), e.getMessage()); "java.lang.IllegalArgumentException: " + GenerationType.class.getSimpleName() + "." + GenerationType.SEQUENCE + " Strategy not supported by this client :" + ThriftClient.class.getName(), e.getMessage()); "java.lang.IllegalArgumentException: " + GenerationType.class.getSimpleName() + "." + GenerationType.SEQUENCE + " Strategy not supported by this client :" + ThriftClient.class.getName(), e.getMessage()); "java.lang.IllegalArgumentException: " + GenerationType.class.getSimpleName() + "." + GenerationType.SEQUENCE + " Strategy not supported by this client :" + ThriftClient.class.getName(), e.getMessage());
"java.lang.UnsupportedOperationException: " + GenerationType.class.getSimpleName() + "." + GenerationType.IDENTITY + " Strategy not supported by this client :" + ThriftClient.class.getName(), e.getMessage()); "java.lang.IllegalArgumentException: " + GenerationType.class.getSimpleName() + "." + GenerationType.SEQUENCE + " Strategy not supported by this client :" + ThriftClient.class.getName(), e.getMessage()); "java.lang.IllegalArgumentException: " + GenerationType.class.getSimpleName() + "." + GenerationType.SEQUENCE + " Strategy not supported by this client :" + ThriftClient.class.getName(), e.getMessage()); "java.lang.IllegalArgumentException: " + GenerationType.class.getSimpleName() + "." + GenerationType.SEQUENCE + " Strategy not supported by this client :" + ThriftClient.class.getName(), e.getMessage());
e.getMessage()); e.getMessage()); "java.lang.UnsupportedOperationException: " + GenerationType.class.getSimpleName() + "." + GenerationType.IDENTITY + " Strategy not supported by this client :" + HBaseClient.class.getName(), e.getMessage()); "java.lang.IllegalArgumentException: " + GenerationType.class.getSimpleName() + "." + GenerationType.SEQUENCE + " Strategy not supported by this client :" + HBaseClient.class.getName(), e.getMessage()); "java.lang.IllegalArgumentException: " + GenerationType.class.getSimpleName() + "." + GenerationType.SEQUENCE + " Strategy not supported by this client :" + HBaseClient.class.getName(), e.getMessage()); "java.lang.IllegalArgumentException: " + GenerationType.class.getSimpleName() + "." + GenerationType.SEQUENCE + " Strategy not supported by this client :" + HBaseClient.class.getName(), e.getMessage());
e.getMessage()); e.getMessage()); "java.lang.UnsupportedOperationException: " + GenerationType.class.getSimpleName() + "." + GenerationType.IDENTITY + " Strategy not supported by this client :" + HBaseClient.class.getName(), e.getMessage()); "java.lang.IllegalArgumentException: " + GenerationType.class.getSimpleName() + "." + GenerationType.SEQUENCE + " Strategy not supported by this client :" + HBaseClient.class.getName(), e.getMessage()); "java.lang.IllegalArgumentException: " + GenerationType.class.getSimpleName() + "." + GenerationType.SEQUENCE + " Strategy not supported by this client :" + HBaseClient.class.getName(), e.getMessage()); "java.lang.IllegalArgumentException: " + GenerationType.class.getSimpleName() + "." + GenerationType.SEQUENCE + " Strategy not supported by this client :" + HBaseClient.class.getName(), e.getMessage());
Assert.assertNotNull(e.getMessage());
Assert.assertNotNull(e.getMessage());
Assert.assertNotNull(e.getMessage());