Fixed several failing Publishing tests.

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@28961 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
N Smith
2011-07-12 16:08:06 +00:00
parent 90102ca33e
commit a750e322f7
5 changed files with 32 additions and 19 deletions

View File

@@ -43,6 +43,7 @@ import org.alfresco.util.BaseSpringTest;
import org.alfresco.util.GUID;
import org.junit.After;
import org.junit.Before;
import org.mockito.Mockito;
/**
* @author Nick Smith
@@ -118,9 +119,14 @@ public abstract class AbstractPublishingIntegrationTest extends BaseSpringTest
protected ChannelType mockChannelType()
{
ChannelType channelType = mock(ChannelType.class);
when(channelType.getId()).thenReturn(channelTypeId);
when(channelType.getChannelNodeType()).thenReturn(TYPE_DELIVERY_CHANNEL);
mockChannelTypeBehaviour(channelType);
return channelType;
}
protected void mockChannelTypeBehaviour(ChannelType channelType)
{
when(channelType.getId()).thenReturn(channelTypeId);
when(channelType.getChannelNodeType()).thenReturn(TYPE_DELIVERY_CHANNEL);
}
}

View File

@@ -19,11 +19,6 @@
package org.alfresco.repo.publishing;
import static junit.framework.Assert.assertEquals;
import static junit.framework.Assert.assertFalse;
import static junit.framework.Assert.assertNotNull;
import static junit.framework.Assert.assertNull;
import static junit.framework.Assert.assertTrue;
import static org.alfresco.model.ContentModel.ASPECT_GEOGRAPHIC;
import static org.alfresco.model.ContentModel.ASPECT_TEMPORARY;
import static org.alfresco.model.ContentModel.PROP_CONTENT;
@@ -67,6 +62,7 @@ import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.namespace.QName;
import org.alfresco.service.namespace.RegexQNamePattern;
import org.junit.Test;
import org.mockito.Mockito;
import org.springframework.beans.factory.annotation.Autowired;
/**
@@ -139,7 +135,7 @@ public class PublishEventActionTest extends AbstractPublishingIntegrationTest
assertEquals(publishEventNode, assocs.get(0).getChildRef());
}
public void xtestUpdatePublishedNode() throws Exception
public void testUpdatePublishedNode() throws Exception
{
// Create content node without aspects
NodeRef source = createContentNode(contentNodeName, content);
@@ -152,8 +148,8 @@ public class PublishEventActionTest extends AbstractPublishingIntegrationTest
// Verify properties set correctly.
Map<QName, Serializable> publishedProps = nodeService.getProperties(publishedNode);
assertNull(publishedProps.containsKey(PROP_LATITUDE));
assertNull(publishedProps.containsKey(PROP_LONGITUDE));
assertFalse(publishedProps.containsKey(PROP_LATITUDE));
assertFalse(publishedProps.containsKey(PROP_LONGITUDE));
assertEquals(contentNodeName, publishedProps.get(PROP_NAME));
assertEquals(content, readContent(source));
@@ -235,7 +231,7 @@ public class PublishEventActionTest extends AbstractPublishingIntegrationTest
}
@SuppressWarnings("unchecked")
public void xtestChannelTypePublishIsCalledOnUpdate() throws Exception
public void testChannelTypePublishIsCalledOnUpdate() throws Exception
{
// Create content node with appropriate aspects added.
NodeRef source = createContentNode(contentNodeName, content);
@@ -327,7 +323,7 @@ public class PublishEventActionTest extends AbstractPublishingIntegrationTest
}
@SuppressWarnings("unchecked")
public void xtestStatusUpdate() throws Exception
public void testStatusUpdate() throws Exception
{
NodeRef source = createContentNode(contentNodeName, content);
@@ -336,6 +332,8 @@ public class PublishEventActionTest extends AbstractPublishingIntegrationTest
StatusUpdate status = queue.createStatusUpdate(message, source, channelName);
String url = "http://test/url";
when(channelType.getNodeUrl(any(NodeRef.class))).thenReturn(url);
when(channelType.canPublishStatusUpdates()).thenReturn(true);
publishNode(source, status);
@@ -414,6 +412,11 @@ public class PublishEventActionTest extends AbstractPublishingIntegrationTest
this.channelType = mockChannelType();
channelService.register(channelType);
}
else
{
Mockito.reset(channelType);
mockChannelTypeBehaviour(channelType);
}
channelService.createChannel(siteId, channelTypeId, channelName, null);
this.channel = channelHelper.getChannelNodeForEnvironment(environment.getNodeRef(), channelName);

View File

@@ -92,12 +92,8 @@ public class PublishWebContentJbpmTest extends BaseSpringTest
};
}
public void testBlank() throws Exception
{
}
@Test
public void xtestProcessTimers() throws Exception
public void testProcessTimers() throws Exception
{
final Calendar scheduledTime = Calendar.getInstance();
scheduledTime.add(Calendar.SECOND, 5);
@@ -127,7 +123,7 @@ public class PublishWebContentJbpmTest extends BaseSpringTest
}
@Test
public void xtestProcessPublishPath() throws Exception
public void testProcessPublishPath() throws Exception
{
// Set Status to IN_PROGRESS
nodeService.setProperty(event, PROP_PUBLISHING_EVENT_STATUS, Status.IN_PROGRESS.name());

View File

@@ -166,7 +166,7 @@ public class PublishingEventHelperTest
@SuppressWarnings({ "unchecked", "rawtypes" })
@Test
public void xtestCreateNode() throws Exception
public void testCreateNode() throws Exception
{
// Mock serializer since this behaviour is already tested in PublishingPackageSerializerTest.
ContentWriter writer = mock(ContentWriter.class);

View File

@@ -28,6 +28,7 @@ import java.io.Serializable;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -43,6 +44,7 @@ import org.alfresco.service.cmr.repository.ChildAssociationRef;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.service.namespace.QName;
import org.alfresco.service.namespace.RegexQNamePattern;
import org.alfresco.util.GUID;
import org.alfresco.util.ParameterCheck;
@@ -194,6 +196,12 @@ public class PublishingEventProcessor
// Add new aspects
addAspects(publishedNode, newAspects);
List<ChildAssociationRef> assocs = nodeService.getChildAssocs(publishedNode, ASSOC_LAST_PUBLISHING_EVENT, RegexQNamePattern.MATCH_ALL);
for (ChildAssociationRef assoc : assocs)
{
nodeService.removeChildAssociation(assoc);
}
}
/**