1 8 9 package org.jboss.cache.marshall; 10 11 import junit.framework.Test; 12 import junit.framework.TestCase; 13 import junit.framework.TestSuite; 14 15 21 public class CrudMethodTest extends TestCase 22 { 23 24 25 public CrudMethodTest(String name) 26 { 27 super(name); 28 } 29 30 public void testPutMethods() 31 { 32 assertTrue(MethodDeclarations.isPutMethod(MethodDeclarations.putDataEraseMethodLocal_id)); 33 assertTrue(MethodDeclarations.isPutMethod(MethodDeclarations.putDataMethodLocal_id)); 34 assertTrue(MethodDeclarations.isPutMethod(MethodDeclarations.putKeyValMethodLocal_id)); 35 assertTrue(MethodDeclarations.isPutMethod(MethodDeclarations.putDataEraseVersionedMethodLocal_id)); 36 assertTrue(MethodDeclarations.isPutMethod(MethodDeclarations.putDataVersionedMethodLocal_id)); 37 assertTrue(MethodDeclarations.isPutMethod(MethodDeclarations.putKeyValVersionedMethodLocal_id)); 38 39 assertEquals(6, MethodDeclarations.putMethodIds.size()); 40 } 41 42 public void testTransactionLifecycleMethods() 43 { 44 assertTrue(MethodDeclarations.isTransactionLifecycleMethod(MethodDeclarations.commitMethod_id)); 45 assertTrue(MethodDeclarations.isTransactionLifecycleMethod(MethodDeclarations.rollbackMethod_id)); 46 assertTrue(MethodDeclarations.isTransactionLifecycleMethod(MethodDeclarations.prepareMethod_id)); 47 assertTrue(MethodDeclarations.isTransactionLifecycleMethod(MethodDeclarations.optimisticPrepareMethod_id)); 48 49 assertEquals(4, MethodDeclarations.transactionLifecycleMethodIds.size()); 50 } 51 52 public void testCrudMethods() 53 { 54 assertTrue(MethodDeclarations.isCrudMethod(MethodDeclarations.putDataEraseMethodLocal_id)); 55 assertTrue(MethodDeclarations.isCrudMethod(MethodDeclarations.putDataMethodLocal_id)); 56 assertTrue(MethodDeclarations.isCrudMethod(MethodDeclarations.putKeyValMethodLocal_id)); 57 assertTrue(MethodDeclarations.isCrudMethod(MethodDeclarations.removeDataMethodLocal_id)); 58 assertTrue(MethodDeclarations.isCrudMethod(MethodDeclarations.removeKeyMethodLocal_id)); 59 assertTrue(MethodDeclarations.isCrudMethod(MethodDeclarations.removeNodeMethodLocal_id)); 60 assertTrue(MethodDeclarations.isCrudMethod(MethodDeclarations.dataGravitationCleanupMethod_id)); 61 assertTrue(MethodDeclarations.isCrudMethod(MethodDeclarations.moveMethodLocal_id)); 62 assertTrue(MethodDeclarations.isCrudMethod(MethodDeclarations.putDataEraseVersionedMethodLocal_id)); 63 assertTrue(MethodDeclarations.isCrudMethod(MethodDeclarations.putDataVersionedMethodLocal_id)); 64 assertTrue(MethodDeclarations.isCrudMethod(MethodDeclarations.putKeyValVersionedMethodLocal_id)); 65 assertTrue(MethodDeclarations.isCrudMethod(MethodDeclarations.removeDataVersionedMethodLocal_id)); 66 assertTrue(MethodDeclarations.isCrudMethod(MethodDeclarations.removeKeyVersionedMethodLocal_id)); 67 assertTrue(MethodDeclarations.isCrudMethod(MethodDeclarations.removeNodeVersionedMethodLocal_id)); 68 69 assertEquals(14, MethodDeclarations.crudMethodIds.size()); 70 71 assertFalse(MethodDeclarations.isCrudMethod(MethodDeclarations.getKeyValueMethodLocal_id)); 72 assertFalse(MethodDeclarations.isCrudMethod(MethodDeclarations.getNodeMethodLocal_id)); 73 assertFalse(MethodDeclarations.isCrudMethod(MethodDeclarations.getKeysMethodLocal_id)); 74 assertFalse(MethodDeclarations.isCrudMethod(MethodDeclarations.getChildrenNamesMethodLocal_id)); 75 } 76 77 public void testBuddyGroupOrganisationMethods() 78 { 79 assertTrue(MethodDeclarations.isBuddyGroupOrganisationMethod(MethodDeclarations.remoteAnnounceBuddyPoolNameMethod_id)); 80 assertTrue(MethodDeclarations.isBuddyGroupOrganisationMethod(MethodDeclarations.remoteAssignToBuddyGroupMethod_id)); 81 assertTrue(MethodDeclarations.isBuddyGroupOrganisationMethod(MethodDeclarations.remoteRemoveFromBuddyGroupMethod_id)); 82 83 assertEquals(3, MethodDeclarations.buddyGroupOrganisationMethodIds.size()); 84 } 85 86 87 public static Test suite() throws Exception 88 { 89 return new TestSuite(CrudMethodTest.class); 90 } 91 92 public static void main(String [] args) throws Exception 93 { 94 junit.textui.TestRunner.run(suite()); 95 } 96 97 98 } 99 | Popular Tags |