mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
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:
@@ -43,6 +43,7 @@ import org.alfresco.util.BaseSpringTest;
|
|||||||
import org.alfresco.util.GUID;
|
import org.alfresco.util.GUID;
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
|
import org.mockito.Mockito;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Nick Smith
|
* @author Nick Smith
|
||||||
@@ -118,9 +119,14 @@ public abstract class AbstractPublishingIntegrationTest extends BaseSpringTest
|
|||||||
protected ChannelType mockChannelType()
|
protected ChannelType mockChannelType()
|
||||||
{
|
{
|
||||||
ChannelType channelType = mock(ChannelType.class);
|
ChannelType channelType = mock(ChannelType.class);
|
||||||
when(channelType.getId()).thenReturn(channelTypeId);
|
mockChannelTypeBehaviour(channelType);
|
||||||
when(channelType.getChannelNodeType()).thenReturn(TYPE_DELIVERY_CHANNEL);
|
|
||||||
return channelType;
|
return channelType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void mockChannelTypeBehaviour(ChannelType channelType)
|
||||||
|
{
|
||||||
|
when(channelType.getId()).thenReturn(channelTypeId);
|
||||||
|
when(channelType.getChannelNodeType()).thenReturn(TYPE_DELIVERY_CHANNEL);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -19,11 +19,6 @@
|
|||||||
|
|
||||||
package org.alfresco.repo.publishing;
|
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_GEOGRAPHIC;
|
||||||
import static org.alfresco.model.ContentModel.ASPECT_TEMPORARY;
|
import static org.alfresco.model.ContentModel.ASPECT_TEMPORARY;
|
||||||
import static org.alfresco.model.ContentModel.PROP_CONTENT;
|
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.QName;
|
||||||
import org.alfresco.service.namespace.RegexQNamePattern;
|
import org.alfresco.service.namespace.RegexQNamePattern;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
import org.mockito.Mockito;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -139,7 +135,7 @@ public class PublishEventActionTest extends AbstractPublishingIntegrationTest
|
|||||||
assertEquals(publishEventNode, assocs.get(0).getChildRef());
|
assertEquals(publishEventNode, assocs.get(0).getChildRef());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void xtestUpdatePublishedNode() throws Exception
|
public void testUpdatePublishedNode() throws Exception
|
||||||
{
|
{
|
||||||
// Create content node without aspects
|
// Create content node without aspects
|
||||||
NodeRef source = createContentNode(contentNodeName, content);
|
NodeRef source = createContentNode(contentNodeName, content);
|
||||||
@@ -152,8 +148,8 @@ public class PublishEventActionTest extends AbstractPublishingIntegrationTest
|
|||||||
|
|
||||||
// Verify properties set correctly.
|
// Verify properties set correctly.
|
||||||
Map<QName, Serializable> publishedProps = nodeService.getProperties(publishedNode);
|
Map<QName, Serializable> publishedProps = nodeService.getProperties(publishedNode);
|
||||||
assertNull(publishedProps.containsKey(PROP_LATITUDE));
|
assertFalse(publishedProps.containsKey(PROP_LATITUDE));
|
||||||
assertNull(publishedProps.containsKey(PROP_LONGITUDE));
|
assertFalse(publishedProps.containsKey(PROP_LONGITUDE));
|
||||||
assertEquals(contentNodeName, publishedProps.get(PROP_NAME));
|
assertEquals(contentNodeName, publishedProps.get(PROP_NAME));
|
||||||
assertEquals(content, readContent(source));
|
assertEquals(content, readContent(source));
|
||||||
|
|
||||||
@@ -235,7 +231,7 @@ public class PublishEventActionTest extends AbstractPublishingIntegrationTest
|
|||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public void xtestChannelTypePublishIsCalledOnUpdate() throws Exception
|
public void testChannelTypePublishIsCalledOnUpdate() throws Exception
|
||||||
{
|
{
|
||||||
// Create content node with appropriate aspects added.
|
// Create content node with appropriate aspects added.
|
||||||
NodeRef source = createContentNode(contentNodeName, content);
|
NodeRef source = createContentNode(contentNodeName, content);
|
||||||
@@ -327,7 +323,7 @@ public class PublishEventActionTest extends AbstractPublishingIntegrationTest
|
|||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public void xtestStatusUpdate() throws Exception
|
public void testStatusUpdate() throws Exception
|
||||||
{
|
{
|
||||||
NodeRef source = createContentNode(contentNodeName, content);
|
NodeRef source = createContentNode(contentNodeName, content);
|
||||||
|
|
||||||
@@ -336,6 +332,8 @@ public class PublishEventActionTest extends AbstractPublishingIntegrationTest
|
|||||||
StatusUpdate status = queue.createStatusUpdate(message, source, channelName);
|
StatusUpdate status = queue.createStatusUpdate(message, source, channelName);
|
||||||
|
|
||||||
String url = "http://test/url";
|
String url = "http://test/url";
|
||||||
|
when(channelType.getNodeUrl(any(NodeRef.class))).thenReturn(url);
|
||||||
|
when(channelType.canPublishStatusUpdates()).thenReturn(true);
|
||||||
|
|
||||||
publishNode(source, status);
|
publishNode(source, status);
|
||||||
|
|
||||||
@@ -414,6 +412,11 @@ public class PublishEventActionTest extends AbstractPublishingIntegrationTest
|
|||||||
this.channelType = mockChannelType();
|
this.channelType = mockChannelType();
|
||||||
channelService.register(channelType);
|
channelService.register(channelType);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Mockito.reset(channelType);
|
||||||
|
mockChannelTypeBehaviour(channelType);
|
||||||
|
}
|
||||||
channelService.createChannel(siteId, channelTypeId, channelName, null);
|
channelService.createChannel(siteId, channelTypeId, channelName, null);
|
||||||
|
|
||||||
this.channel = channelHelper.getChannelNodeForEnvironment(environment.getNodeRef(), channelName);
|
this.channel = channelHelper.getChannelNodeForEnvironment(environment.getNodeRef(), channelName);
|
||||||
|
@@ -92,12 +92,8 @@ public class PublishWebContentJbpmTest extends BaseSpringTest
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testBlank() throws Exception
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void xtestProcessTimers() throws Exception
|
public void testProcessTimers() throws Exception
|
||||||
{
|
{
|
||||||
final Calendar scheduledTime = Calendar.getInstance();
|
final Calendar scheduledTime = Calendar.getInstance();
|
||||||
scheduledTime.add(Calendar.SECOND, 5);
|
scheduledTime.add(Calendar.SECOND, 5);
|
||||||
@@ -127,7 +123,7 @@ public class PublishWebContentJbpmTest extends BaseSpringTest
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void xtestProcessPublishPath() throws Exception
|
public void testProcessPublishPath() throws Exception
|
||||||
{
|
{
|
||||||
// Set Status to IN_PROGRESS
|
// Set Status to IN_PROGRESS
|
||||||
nodeService.setProperty(event, PROP_PUBLISHING_EVENT_STATUS, Status.IN_PROGRESS.name());
|
nodeService.setProperty(event, PROP_PUBLISHING_EVENT_STATUS, Status.IN_PROGRESS.name());
|
||||||
|
@@ -166,7 +166,7 @@ public class PublishingEventHelperTest
|
|||||||
|
|
||||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||||
@Test
|
@Test
|
||||||
public void xtestCreateNode() throws Exception
|
public void testCreateNode() throws Exception
|
||||||
{
|
{
|
||||||
// Mock serializer since this behaviour is already tested in PublishingPackageSerializerTest.
|
// Mock serializer since this behaviour is already tested in PublishingPackageSerializerTest.
|
||||||
ContentWriter writer = mock(ContentWriter.class);
|
ContentWriter writer = mock(ContentWriter.class);
|
||||||
|
@@ -28,6 +28,7 @@ import java.io.Serializable;
|
|||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
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.NodeRef;
|
||||||
import org.alfresco.service.cmr.repository.NodeService;
|
import org.alfresco.service.cmr.repository.NodeService;
|
||||||
import org.alfresco.service.namespace.QName;
|
import org.alfresco.service.namespace.QName;
|
||||||
|
import org.alfresco.service.namespace.RegexQNamePattern;
|
||||||
import org.alfresco.util.GUID;
|
import org.alfresco.util.GUID;
|
||||||
import org.alfresco.util.ParameterCheck;
|
import org.alfresco.util.ParameterCheck;
|
||||||
|
|
||||||
@@ -194,6 +196,12 @@ public class PublishingEventProcessor
|
|||||||
|
|
||||||
// Add new aspects
|
// Add new aspects
|
||||||
addAspects(publishedNode, newAspects);
|
addAspects(publishedNode, newAspects);
|
||||||
|
|
||||||
|
List<ChildAssociationRef> assocs = nodeService.getChildAssocs(publishedNode, ASSOC_LAST_PUBLISHING_EVENT, RegexQNamePattern.MATCH_ALL);
|
||||||
|
for (ChildAssociationRef assoc : assocs)
|
||||||
|
{
|
||||||
|
nodeService.removeChildAssociation(assoc);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user