portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wea...@apache.org
Subject cvs commit: jakarta-jetspeed-2/portal/src/test/org/apache/jetspeed/tools/pamanager TestPortletDescriptor.java
Date Wed, 26 Nov 2003 20:55:50 GMT
weaver      2003/11/26 12:55:50

  Modified:    portal/src/test/org/apache/jetspeed/services/persistence
                        TestPersistenceService.java
               portal/src/test/org/apache/jetspeed/services/registry
                        TestRegistry.java
               portal/src/test/org/apache/jetspeed/tools/pamanager
                        TestPortletDescriptor.java
  Log:
  Changed all services that use persistence to have methods to control
  beginning, committing and rolling back transactions.  Any add, update
  or delete methods must be called within the confines of a transaction or
  an exception occurs.
  
  Revision  Changes    Path
  1.9       +201 -71   jakarta-jetspeed-2/portal/src/test/org/apache/jetspeed/services/persistence/TestPersistenceService.java
  
  Index: TestPersistenceService.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/portal/src/test/org/apache/jetspeed/services/persistence/TestPersistenceService.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- TestPersistenceService.java	18 Oct 2003 20:48:27 -0000	1.8
  +++ TestPersistenceService.java	26 Nov 2003 20:55:50 -0000	1.9
  @@ -73,6 +73,7 @@
   import org.apache.jetspeed.persistence.LookupCriteria;
   import org.apache.jetspeed.persistence.PersistencePlugin;
   import org.apache.jetspeed.persistence.PersistenceService;
  +import org.apache.jetspeed.persistence.TransactionStateException;
   import org.apache.jetspeed.test.JetspeedTest;
   import org.apache.pluto.om.common.Language;
   import org.apache.pluto.om.portlet.PortletDefinition;
  @@ -168,42 +169,74 @@
           assertNotNull(pd);
       }
   
  -    public void testAddingLangaugeToPortlet()
  +    public void testAddingLangaugeToPortlet() throws Exception
       {
           PersistencePlugin plugin = service.getPersistencePlugin("jetspeed-test");
  -        initTestObject();
  -        MutablePortletApplication app = getTestObject1();
  -
  -        Language english = getEnglishLanguage();
  -        assertNotNull(english);
   
  -        PortletDefinitionComposite pdc = (PortletDefinitionComposite) app.getPortletDefinitionByName("Portlet
1");
  -
  -        pdc.addLanguage(english);
  +        try
  +        {
  +            initTestObject();
  +            MutablePortletApplication app = getTestObject1();
  +            plugin.beginTransaction();
  +            plugin.prepareForUpdate(app);
  +
  +            Language english = getEnglishLanguage();
  +            assertNotNull(english);
  +
  +            PortletDefinitionComposite pdc = (PortletDefinitionComposite) app.getPortletDefinitionByName("Portlet
1");
  +            plugin.prepareForUpdate(pdc);
  +            pdc.addLanguage(english);
   
  -        plugin.update(pdc);
  +            plugin.commitTransaction();
  +        }
  +        catch (TransactionStateException e)
  +        {
  +            try
  +            {
  +                plugin.rollbackTransaction();
  +            }
  +            catch (TransactionStateException e1)
  +            {
  +                e1.printStackTrace();
  +                throw e1;
  +            }
  +            e.printStackTrace();
  +            throw e;
  +        }
   
       }
   
  -    public void testUpdate()
  +    public void testUpdate() throws Exception
       {
           initTestObject();
   
           PersistencePlugin plugin = getService().getPersistencePlugin("jetspeed-test");
   
  -        PortletApplicationDefinitionImpl app = getTestObject1();
  +        PortletApplicationDefinitionImpl app;
  +        try
  +        {
  +            app = getTestObject1();
   
  -        assertNotNull(app);
  +            assertNotNull(app);
  +            plugin.beginTransaction();
  +            plugin.prepareForUpdate(app);
   
  -        String version = app.getVersion();
  +            String version = app.getVersion();
   
  -        app.setVersion("5.5.5");
  +            app.setVersion("5.5.5");
   
  -        MutableWebApplication wac = (MutableWebApplication) app.getWebApplicationDefinition();
  +            MutableWebApplication wac = (MutableWebApplication) app.getWebApplicationDefinition();
   
  -        wac.setContextRoot("/root/changed");
  +            wac.setContextRoot("/root/changed");
   
  -        plugin.update(app);
  +            plugin.commitTransaction();
  +        }
  +        catch (Exception e)
  +        {
  +            plugin.rollbackTransaction();
  +            e.printStackTrace();
  +            throw e;
  +        }
   
           app = getTestObject1();
   
  @@ -215,28 +248,48 @@
           assertTrue(cRoot.equals("/root/changed"));
       }
   
  -    public void testAdd2atATime()
  +    public void testAdd2atATime() throws TransactionStateException
       {
           PersistencePlugin plugin = getService().getPersistencePlugin("jetspeed-test");
           MutablePortletApplication app1 = new PortletApplicationDefinitionImpl();
  -        app1.setName("This is app 1 of 2");
  -        app1.setVersion("1.0");
  -        app1.setDescription("This is app 1 of 2");
  -        app1.setApplicationIdentifier("app1of2");
  -
  -        plugin.add(app1);
   
  -        MutablePortletApplication app2 = new PortletApplicationDefinitionImpl();
  -        app2.setName("This is app 2 of 2");
  -        app2.setVersion("1.0");
  -        app2.setDescription("This is app 2 of 2");
  -        app1.setApplicationIdentifier("app2of2");
  +        try
  +        {
  +            plugin.beginTransaction();
  +            plugin.prepareForUpdate(app1);
  +            app1.setName("This is app 1 of 2");
  +            app1.setVersion("1.0");
  +            app1.setDescription("This is app 1 of 2");
  +            app1.setApplicationIdentifier("app1of2");
  +
  +            MutablePortletApplication app2 = new PortletApplicationDefinitionImpl();
  +            plugin.prepareForUpdate(app2);
  +            app2.setName("This is app 2 of 2");
  +            app2.setVersion("1.0");
  +            app2.setDescription("This is app 2 of 2");
  +            app1.setApplicationIdentifier("app2of2");
   
  -        plugin.add(app2);
  +            plugin.commitTransaction();
  +        }
  +        catch (TransactionStateException e)
  +        {
  +            try
  +            {
  +                plugin.rollbackTransaction();
  +            }
  +            catch (TransactionStateException e1)
  +            {
  +                // TODO Auto-generated catch block                
  +                e1.printStackTrace();
  +            }
  +            // TODO Auto-generated catch block
  +            e.printStackTrace();
  +            throw e;
  +        }
   
       }
   
  -    public void testGet2atATime()
  +    public void testGet2atATime() throws TransactionStateException
       {
           PersistencePlugin plugin = getService().getPersistencePlugin("jetspeed-test");
           LookupCriteria lc1 = plugin.newLookupCriteria();
  @@ -247,19 +300,38 @@
                   plugin.generateQuery(PortletApplicationDefinitionImpl.class, lc1));
   
           assertNotNull("Could not retrieve test app 1 from the db", app1);
  -        plugin.delete(app1);
  +        try
  +        {
  +            plugin.beginTransaction();
  +            plugin.prepareForDelete(app1);
   
  -        LookupCriteria lc2 = plugin.newLookupCriteria();
  -        lc2.addEqualTo("name", "This is app 2 of 2");
  -        MutablePortletApplication app2 =
  -            (MutablePortletApplication) plugin.getObjectByQuery(
  -                PortletApplicationDefinitionImpl.class,
  -                plugin.generateQuery(PortletApplicationDefinitionImpl.class, lc2));
  -        assertNotNull("Could not retrieve test app 2 from the db", app2);
  -        plugin.delete(app2);
  +            LookupCriteria lc2 = plugin.newLookupCriteria();
  +            lc2.addEqualTo("name", "This is app 2 of 2");
  +            MutablePortletApplication app2 =
  +                (MutablePortletApplication) plugin.getObjectByQuery(
  +                    PortletApplicationDefinitionImpl.class,
  +                    plugin.generateQuery(PortletApplicationDefinitionImpl.class, lc2));
  +            assertNotNull("Could not retrieve test app 2 from the db", app2);
  +            plugin.prepareForDelete(app2);
  +            plugin.commitTransaction();
  +        }
  +        catch (TransactionStateException e)
  +        {
  +            try
  +            {
  +                plugin.rollbackTransaction();
  +            }
  +            catch (TransactionStateException e1)
  +            {
  +                e1.printStackTrace();
  +            }
  +
  +            e.printStackTrace();
  +            throw e;
  +        }
       }
   
  -    public void testDelete()
  +    public void testDelete() throws TransactionStateException
       {
           initTestObject();
   
  @@ -269,11 +341,31 @@
   
           PersistencePlugin plugin = getService().getPersistencePlugin("jetspeed-test");
   
  -        plugin.delete(app);
  +        try
  +        {
  +            plugin.beginTransaction();
  +            plugin.prepareForDelete(app);
  +            plugin.commitTransaction();
   
  -        app = getTestObject1();
  +            app = getTestObject1();
   
  -        assertNull(app);
  +            assertNull(app);
  +        }
  +        catch (TransactionStateException e)
  +        {
  +        	try
  +            {
  +                plugin.rollbackTransaction();
  +            }
  +            catch (TransactionStateException e1)
  +            {
  +            
  +                e1.printStackTrace();
  +            }
  +            
  +            e.printStackTrace();
  +            throw e;
  +        }
       }
   
       protected PersistenceService getService()
  @@ -290,30 +382,50 @@
       {
   
           PersistencePlugin plugin = getService().getPersistencePlugin("jetspeed-test");
  -        MutablePortletApplication app = new PortletApplicationDefinitionImpl();
  -        app.setName("test adding object");
  -        app.setVersion("1.0");
  -        app.setDescription("This is a test from persistence layer");
  -        // create a web application
  -        MutableWebApplication wad = new WebApplicationDefinitionImpl();
  -        wad.addDescription(getEnglishLanguage().getLocale(), "This is an english desrcitpion");
  -        wad.addDisplayName(getEnglishLanguage().getLocale(), "This is an english display
name");
  -        wad.setContextRoot("/test");
  -        app.setWebApplicationDefinition(wad);
  -
  -        // Create some Portlets 
  -        PortletDefinitionComposite pdc = new PortletDefinitionImpl();
  -        pdc.setClassName("com.bogus.Class1");
  -        pdc.setName("Portlet 1");
  -
  -        PortletDefinitionComposite pdc2 = new PortletDefinitionImpl();
  -        pdc2.setClassName("com.bogus.Class2");
  -        pdc2.setName("Portlet 2");
  +        try
  +        {
  +
  +            plugin.beginTransaction();
  +            MutablePortletApplication app = new PortletApplicationDefinitionImpl();
  +            plugin.prepareForUpdate(app);
  +            app.setName("test adding object");
  +            app.setVersion("1.0");
  +            app.setDescription("This is a test from persistence layer");
  +            // create a web application
  +            MutableWebApplication wad = new WebApplicationDefinitionImpl();
  +            wad.addDescription(getEnglishLanguage().getLocale(), "This is an english desrcitpion");
  +            wad.addDisplayName(getEnglishLanguage().getLocale(), "This is an english display
name");
  +            wad.setContextRoot("/test");
  +            app.setWebApplicationDefinition(wad);
  +
  +            // Create some Portlets 
  +            PortletDefinitionComposite pdc = new PortletDefinitionImpl();
  +            pdc.setClassName("com.bogus.Class1");
  +            pdc.setName("Portlet 1");
  +
  +            PortletDefinitionComposite pdc2 = new PortletDefinitionImpl();
  +            pdc2.setClassName("com.bogus.Class2");
  +            pdc2.setName("Portlet 2");
   
  -        app.addPortletDefinition(pdc);
  -        app.addPortletDefinition(pdc2);
  +            app.addPortletDefinition(pdc);
  +            app.addPortletDefinition(pdc2);
   
  -        plugin.add(app);
  +            plugin.commitTransaction();
  +        }
  +        catch (Exception e)
  +        {
  +            try
  +            {
  +                plugin.rollbackTransaction();
  +            }
  +            catch (TransactionStateException e1)
  +            {
  +                // TODO Auto-generated catch block
  +                e1.printStackTrace();
  +            }
  +            // TODO Auto-generated catch block
  +            e.printStackTrace();
  +        }
       }
   
       protected Language getEnglishLanguage()
  @@ -354,14 +466,32 @@
                   plugin.generateQuery(PortletApplicationDefinitionImpl.class, c));
   
           Iterator itr = removeUs.iterator();
  -        while (itr.hasNext())
  +        try
  +        {
  +            plugin.beginTransaction();
  +            while (itr.hasNext())
  +            {
  +                plugin.prepareForDelete(itr.next());
  +            }
  +            plugin.commitTransaction();
  +        }
  +        catch (TransactionStateException e)
           {
  -            plugin.delete(itr.next());
  +            try
  +            {
  +                plugin.rollbackTransaction();
  +            }
  +            catch (TransactionStateException e1)
  +            {
  +                // TODO Auto-generated catch block
  +                e1.printStackTrace();
  +            }
  +            e.printStackTrace();
           }
   
       }
   
  -    /**
  +    /**com
        * @see junit.framework.TestCase#tearDown()
        */
       public void tearDown()
  
  
  
  1.6       +100 -52   jakarta-jetspeed-2/portal/src/test/org/apache/jetspeed/services/registry/TestRegistry.java
  
  Index: TestRegistry.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/portal/src/test/org/apache/jetspeed/services/registry/TestRegistry.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- TestRegistry.java	17 Oct 2003 20:19:37 -0000	1.5
  +++ TestRegistry.java	26 Nov 2003 20:55:50 -0000	1.6
  @@ -70,6 +70,7 @@
   import org.apache.jetspeed.om.common.portlet.PortletDefinitionComposite;
   import org.apache.jetspeed.om.common.preference.PreferenceComposite;
   import org.apache.jetspeed.om.common.servlet.MutableWebApplication;
  +import org.apache.jetspeed.persistence.TransactionStateException;
   import org.apache.jetspeed.test.JetspeedTest;
   import org.apache.pluto.om.common.Description;
   import org.apache.pluto.om.common.DisplayName;
  @@ -161,28 +162,38 @@
   
       public void testAddingPortlet()
       {
  -        MutablePortletApplication app = JetspeedPortletRegistry.getPortletApplication(APP_1_NAME);
  -        assertNotNull(app);
  -
  -        //add a portlet
  -        PortletDefinitionComposite portlet1 = JetspeedPortletRegistry.newPortletDefinition();
  -
  -        portlet1.setClassName("com.portlet.MyClass");
  -        portlet1.setName("Portlet 1");
  -        portlet1.setPortletIdentifier("com.portlet.MyClass.Portlet 1");
  -        app.addPortletDefinition(portlet1);
  -
  -        portlet1.addDisplayName(Jetspeed.getDefaultLocale(), "Portlet 1 Display Name");
  -        portlet1.addDescription(Jetspeed.getDefaultLocale(), "Portlet 1 Description");
  -
           try
           {
  -            JetspeedPortletRegistry.updatePortletApplication(app);
  -            System.out.print("");
  +            MutablePortletApplication app = JetspeedPortletRegistry.getPortletApplication(APP_1_NAME);
  +                        
  +            assertNotNull(app);
  +			JetspeedPortletRegistry.beginTransaction();
  +			JetspeedPortletRegistry.updatePortletApplication(app);
  +
  +            //add a portlet
  +            PortletDefinitionComposite portlet1 = JetspeedPortletRegistry.newPortletDefinition();
  +
  +            portlet1.setClassName("com.portlet.MyClass");
  +            portlet1.setName("Portlet 1");
  +            portlet1.setPortletIdentifier("com.portlet.MyClass.Portlet 1");
  +            app.addPortletDefinition(portlet1);
  +
  +            portlet1.addDisplayName(Jetspeed.getDefaultLocale(), "Portlet 1 Display Name");
  +            portlet1.addDescription(Jetspeed.getDefaultLocale(), "Portlet 1 Description");
  +
  +			JetspeedPortletRegistry.commitTransaction();            
           }
           catch (Throwable e)
           {
  -
  +			try
  +            {
  +                JetspeedPortletRegistry.rollbackTransaction();
  +            }
  +            catch (TransactionStateException e1)
  +            {
  +                // TODO Auto-generated catch block
  +                e1.printStackTrace();
  +            }
               e.printStackTrace();
               throw new AssertionFailedError();
           }
  @@ -213,43 +224,69 @@
           System.out.println("Default local displayName  for Portlet 1 is " + displayName.getDisplayName());
       }
   
  -    public void testAddPortletInfo()
  +    public void testAddPortletInfo() throws Exception
       {
  -        MutablePortletApplication app = JetspeedPortletRegistry.getPortletApplication(APP_1_NAME);
  -        assertNotNull(app);
  -        PortletDefinitionComposite pdc = (PortletDefinitionComposite) app.getPortletDefinitionByName("Portlet
0");
  -        assertNotNull(pdc);
  +        try
  +        {
  +            // begin a transaction
  +            JetspeedPortletRegistry.beginTransaction();
   
  -        // add 2 parameters
  -         ((ParameterSetCtrl) pdc.getInitParameterSet()).add("param 1", "value 1");
  -        ((ParameterSetCtrl) pdc.getInitParameterSet()).add("param 2", "value 2");
  -
  -        // add a language
  -        pdc.addLanguage(
  -            JetspeedPortletRegistry.createLanguage(Locale.getDefault(), "Test Portlet 0",
"Portlet 0", "This is Portlet 0", null));
  -
  -        //add content types
  -        ContentTypeComposite html = JetspeedPortletRegistry.newContentType();
  -        html.setContentType("html/text");
  -        ContentTypeComposite wml = JetspeedPortletRegistry.newContentType();
  -        html.addPortletMode(new PortletMode("EDIT"));
  -        html.addPortletMode(new PortletMode("VIEW"));
  -        html.addPortletMode(new PortletMode("HELP"));
  -        wml.setContentType("wml");
  -        wml.addPortletMode(new PortletMode("HELP"));
  -        wml.addPortletMode(new PortletMode("VIEW"));
  -        pdc.addContentType(html);
  -        pdc.addContentType(wml);
  -
  -        PreferenceComposite pref =
  -            pdc.addPreference("preference 1", new String[] { "pref 1 values 1", "pref 1
value 2" });
  +            MutablePortletApplication app = JetspeedPortletRegistry.getPortletApplication(APP_1_NAME);
   
  -        pref.addDescription(Jetspeed.getDefaultLocale(), "Preference 1 description");
  +            
  +            assertNotNull(app);
  +            // Mark portlet app for update
  +			JetspeedPortletRegistry.updatePortletApplication(app);
  +            PortletDefinitionComposite pdc = (PortletDefinitionComposite) app.getPortletDefinitionByName("Portlet
0");
  +            assertNotNull(pdc);
  +
  +            // add 2 parameters
  +             ((ParameterSetCtrl) pdc.getInitParameterSet()).add("param 1", "value 1");
  +            ((ParameterSetCtrl) pdc.getInitParameterSet()).add("param 2", "value 2");
  +
  +            // add a language
  +            pdc.addLanguage(
  +                JetspeedPortletRegistry.createLanguage(
  +                    Locale.getDefault(),
  +                    "Test Portlet 0",
  +                    "Portlet 0",
  +                    "This is Portlet 0",
  +                    null));
  +
  +            //add content types
  +            ContentTypeComposite html = JetspeedPortletRegistry.newContentType();
  +            html.setContentType("html/text");
  +            ContentTypeComposite wml = JetspeedPortletRegistry.newContentType();
  +            html.addPortletMode(new PortletMode("EDIT"));
  +            html.addPortletMode(new PortletMode("VIEW"));
  +            html.addPortletMode(new PortletMode("HELP"));
  +            wml.setContentType("wml");
  +            wml.addPortletMode(new PortletMode("HELP"));
  +            wml.addPortletMode(new PortletMode("VIEW"));
  +            pdc.addContentType(html);
  +            pdc.addContentType(wml);
   
  -        pdc.addDisplayName(Jetspeed.getDefaultLocale(), "Portlet 0 Display Name");
  -        pdc.addDescription(Jetspeed.getDefaultLocale(), "Portlet 0 Description");
  +            PreferenceComposite pref = pdc.addPreference("preference 1", new String[] {
"pref 1 values 1", "pref 1 value 2" });
   
  -        JetspeedPortletRegistry.updatePortletApplication(app);
  +            pref.addDescription(Jetspeed.getDefaultLocale(), "Preference 1 description");
  +
  +            pdc.addDisplayName(Jetspeed.getDefaultLocale(), "Portlet 0 Display Name");
  +            pdc.addDescription(Jetspeed.getDefaultLocale(), "Portlet 0 Description");
  +
  +            JetspeedPortletRegistry.commitTransaction();
  +        }
  +        catch (Exception e)
  +        {
  +            try
  +            {
  +                JetspeedPortletRegistry.rollbackTransaction();
  +            }
  +            catch (TransactionStateException e1)
  +            {
  +                e1.printStackTrace();
  +            }
  +            throw e;
  +        }
       }
   
       public void testContentType()
  @@ -266,7 +303,7 @@
           Iterator modes = html.getPortletModes();
           while (modes.hasNext())
           {
  -            PortletMode mode = (PortletMode)modes.next();
  +            PortletMode mode = (PortletMode) modes.next();
               System.out.println("   - Available Mode: " + mode);
           }
       }
  @@ -325,7 +362,7 @@
           }
   
           assertTrue("\"preference 1\" should have 2 values not " + valueCount, valueCount
== 2);
  -        
  +
           assertTrue(count == 1);
       }
   
  @@ -351,10 +388,21 @@
           {
               try
               {
  +                JetspeedPortletRegistry.beginTransaction();
                   JetspeedPortletRegistry.removeApplication(pac);
  +                JetspeedPortletRegistry.commitTransaction();
               }
               catch (Exception e)
               {
  +                try
  +                {
  +                    JetspeedPortletRegistry.rollbackTransaction();
  +                }
  +                catch (TransactionStateException e1)
  +                {
  +                    // TODO Auto-generated catch block
  +                    e1.printStackTrace();
  +                }
                   System.out.println("Unable to tear down test.");
                   e.printStackTrace();
               }
  
  
  
  1.9       +35 -4     jakarta-jetspeed-2/portal/src/test/org/apache/jetspeed/tools/pamanager/TestPortletDescriptor.java
  
  Index: TestPortletDescriptor.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/portal/src/test/org/apache/jetspeed/tools/pamanager/TestPortletDescriptor.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- TestPortletDescriptor.java	18 Nov 2003 02:51:29 -0000	1.8
  +++ TestPortletDescriptor.java	26 Nov 2003 20:55:50 -0000	1.9
  @@ -71,6 +71,7 @@
   import org.apache.jetspeed.om.common.preference.PreferenceComposite;
   import org.apache.jetspeed.persistence.PersistencePlugin;
   import org.apache.jetspeed.persistence.PersistenceService;
  +import org.apache.jetspeed.persistence.TransactionStateException;
   import org.apache.jetspeed.services.registry.JetspeedPortletRegistry;
   import org.apache.jetspeed.test.JetspeedTest;
   import org.apache.pluto.om.common.DisplayName;
  @@ -306,7 +307,18 @@
           MutablePortletApplication app = JetspeedPortletRegistry.getPortletApplication("HW_App");
           if (app != null)
           {
  -            JetspeedPortletRegistry.removeApplication(app);
  +            try
  +            {
  +                JetspeedPortletRegistry.beginTransaction();
  +                JetspeedPortletRegistry.removeApplication(app);
  +                JetspeedPortletRegistry.commitTransaction();
  +            }
  +            catch (Exception e)
  +            {
  +                JetspeedPortletRegistry.rollbackTransaction();
  +                throw e;
  +            }
  +
           }
           app = PortletDescriptorUtilities.loadPortletDescriptor("./test/testdata/deploy/portlet2.xml",
"HW_App");
   
  @@ -315,7 +327,6 @@
           PersistenceService ps = (PersistenceService) CommonPortletServices.getPortalService(PersistenceService.SERVICE_NAME);
           PersistencePlugin plugin = ps.getDefaultPersistencePlugin();
           plugin.clearCache();
  -        
   
           PortletDefinition pd = JetspeedPortletRegistry.getPortletDefinitionByUniqueName("PreferencePortlet");
           assertNotNull(pd);
  @@ -336,7 +347,27 @@
   
           assertTrue(count > 0);
   
  -        JetspeedPortletRegistry.removeApplication(app);
  +        try
  +        {
  +			JetspeedPortletRegistry.beginTransaction();
  +            JetspeedPortletRegistry.removeApplication(app);
  +			JetspeedPortletRegistry.commitTransaction();
  +        }
  +        catch (Exception e)
  +        {
  +            try
  +            {
  +				JetspeedPortletRegistry.rollbackTransaction();
  +            }
  +            catch (TransactionStateException e1)
  +            {
  +                // TODO Auto-generated catch block
  +                e1.printStackTrace();
  +            }
  +            // TODO Auto-generated catch block
  +            e.printStackTrace();
  +            throw e;
  +        }
   
       }
   }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jetspeed-dev-help@jakarta.apache.org


Mime
View raw message