package gov.nih.nci.cagrid.portal.portlet.browse.community;

import gov.nih.nci.cagrid.portal.portlet.PortalPortletIntegrationTestBase;
import gov.nih.nci.cagrid.portal.portlet.browse.CreateCatalogEntryController;
import org.springframework.mock.web.portlet.MockPortletRequest;
import org.springframework.mock.web.portlet.MockPortletResponse;
import org.springframework.mock.web.portlet.MockActionRequest;
import org.springframework.mock.web.portlet.MockActionResponse;

/**
 * User: kherm
 *
 * @author kherm manav.kher@semanticbits.com
 */
public class CreatePortalCommunityControllerTest extends PortalPortletIntegrationTestBase {


    protected MockActionRequest aReq = new MockActionRequest();
    protected MockActionResponse aRes = new MockActionResponse();

    public void testCreate() throws Exception{
        CreateCatalogEntryController createCatalogEntryController  = (CreateCatalogEntryController)getApplicationContext().getBean("createCatalogEntryController");
        assertNotNull(createCatalogEntryController);
        
        createCatalogEntryController.handleActionRequest(aReq,aRes);


    }
}

@@ -54,16 +54,149 @@
 unity;%0A%0A
+import gov.nih.nci.cagrid.portal.dao.catalog.CatalogEntryDao;%0Aimport gov.nih.nci.cagrid.portal.domain.catalog.CommunityCatalogEntry;%0A
 import g
@@ -258,24 +258,76 @@
 onTestBase;%0A
+import gov.nih.nci.cagrid.portal.portlet.UserModel;%0A
 import gov.n
@@ -403,128 +403,122 @@
 ort 
-org.springframework
+static org
 .mock
-.web.portlet.MockPortletRequest;%0Aimport org.springframework.mock.web.portlet.MockPortletResponse
+ito.Matchers.anyInt;%0Aimport static org.mockito.Mockito.mock;%0Aimport static org.mockito.Mockito.when
 ;%0Aim
@@ -984,16 +984,17 @@
 xception
+ 
 %7B%0A      
@@ -1025,34 +1025,16 @@
 roller c
-reateCatalogEntryC
 ontrolle
@@ -1035,17 +1035,16 @@
 troller 
- 
 = (Creat
@@ -1067,16 +1067,17 @@
 troller)
+ 
 getAppli
@@ -1160,74 +1160,532 @@
 ll(c
-reateCatalogEntryController);%0A        %0A        createCatalogEntryC
+ontroller);%0A%0A        CommunityCatalogEntry ce = (CommunityCatalogEntry) Class.forName(%22gov.nih.nci.cagrid.portal.domain.catalog.CommunityCatalogEntry%22).newInstance();%0A        CatalogEntryDao mockDao = mock(CatalogEntryDao.class);%0A        when(mockDao.getById(anyInt())).thenReturn(ce);%0A        UserModel mockUserModel = mock(UserModel.class);%0A        when(mockUserModel.getCurrentCatalogEntry()).thenReturn(ce);%0A        controller.setUserModel(mockUserModel);%0A%0A        aReq.setParameter(%22entryType%22, %22COMMUNITY%22);%0A%0A        c
 ontr
@@ -1715,16 +1715,17 @@
 st(aReq,
+ 
 aRes);%0A%0A

fix test