Author: piergiorgio
Date: Thu Sep 28 13:18:02 2017
New Revision: 1809990
URL: http://svn.apache.org/viewvc?rev=1809990&view=rev
Log:
- applied the new approach using the sourcePath field for content migration
purpose (CONNECTORS-1356)
- removed the Content Migration Flag from the CMIS Repository Connector
Added:
manifoldcf/branches/CONNECTORS-1356-2.7.1/connectors/cmis/connector/src/test/java/org/apache/manifoldcf/agents/output/cmisoutput/tests/BaseITSanityTestUtils.java
(with props)
Modified:
manifoldcf/branches/CONNECTORS-1356-2.7.1/connectors/cmis/connector/src/main/java/org/apache/manifoldcf/agents/output/cmisoutput/CmisOutputConnector.java
manifoldcf/branches/CONNECTORS-1356-2.7.1/connectors/cmis/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/cmis/CmisConfig.java
manifoldcf/branches/CONNECTORS-1356-2.7.1/connectors/cmis/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/cmis/CmisRepositoryConnector.java
manifoldcf/branches/CONNECTORS-1356-2.7.1/connectors/cmis/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/cmis/CmisRepositoryConnectorUtils.java
manifoldcf/branches/CONNECTORS-1356-2.7.1/connectors/cmis/connector/src/main/resources/org/apache/manifoldcf/crawler/connectors/cmis/editSpecification_CMISQuery.html
manifoldcf/branches/CONNECTORS-1356-2.7.1/connectors/cmis/connector/src/main/resources/org/apache/manifoldcf/crawler/connectors/cmis/viewSpecification.html
manifoldcf/branches/CONNECTORS-1356-2.7.1/connectors/cmis/connector/src/test/java/org/apache/manifoldcf/agents/output/cmisoutput/tests/APISanityHSQLDBIT.java
manifoldcf/branches/CONNECTORS-1356-2.7.1/connectors/cmis/connector/src/test/java/org/apache/manifoldcf/agents/output/cmisoutput/tests/BaseITHSQLDB.java
Modified:
manifoldcf/branches/CONNECTORS-1356-2.7.1/connectors/cmis/connector/src/main/java/org/apache/manifoldcf/agents/output/cmisoutput/CmisOutputConnector.java
URL:
http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-1356-2.7.1/connectors/cmis/connector/src/main/java/org/apache/manifoldcf/agents/output/cmisoutput/CmisOutputConnector.java?rev=1809990&r1=1809989&r2=1809990&view=diff
==============================================================================
---
manifoldcf/branches/CONNECTORS-1356-2.7.1/connectors/cmis/connector/src/main/java/org/apache/manifoldcf/agents/output/cmisoutput/CmisOutputConnector.java
(original)
+++
manifoldcf/branches/CONNECTORS-1356-2.7.1/connectors/cmis/connector/src/main/java/org/apache/manifoldcf/agents/output/cmisoutput/CmisOutputConnector.java
Thu Sep 28 13:18:02 2017
@@ -32,6 +32,8 @@ import java.util.List;
import java.util.Locale;
import java.util.Map;
+import org.apache.chemistry.opencmis.client.api.CmisObject;
+import org.apache.chemistry.opencmis.client.api.Document;
import org.apache.chemistry.opencmis.client.api.Folder;
import org.apache.chemistry.opencmis.client.api.ItemIterable;
import org.apache.chemistry.opencmis.client.api.ObjectId;
@@ -155,9 +157,6 @@ public class CmisOutputConnector extends
/** Document remove permanently rejected */
private final static String DOCUMENT_DELETION_STATUS_REJECTED = "Remove
request rejected";
- /** The standard Path property for ManifoldCF used for migrate contents
**/
- private static final String CONTENT_MIGRATION_PATH_PROPERTY =
"manifoldcf:path";
-
/**
* Constructor
*/
@@ -885,7 +884,13 @@ public class CmisOutputConnector extends
String resultDescription = StringUtils.EMPTY;
Folder leafParent = null;
String fileName = StringUtils.EMPTY;
+ InputStream inputStream = null;
ContentStream contentStream = null;
+ // properties
+ // (minimal set: name and object type id)
+ Map<String, Object> properties = new HashMap<String, Object>();
+ Long binaryLength = null;
+ String mimeType = StringUtils.EMPTY;
try {
if (isDropZoneFolder) {
@@ -893,20 +898,18 @@ public class CmisOutputConnector extends
fileName = document.getFileName();
Date creationDate = document.getCreatedDate();
Date lastModificationDate =
document.getModifiedDate();
- String mimeType = document.getMimeType();
- Long binaryLength = document.getBinaryLength();
String objectId = StringUtils.EMPTY;
+ mimeType = document.getMimeType();
+ binaryLength = document.getBinaryLength();
//check if the repository connector includes
the content path
String primaryPath = StringUtils.EMPTY;
-
if(document.getField(CONTENT_MIGRATION_PATH_PROPERTY) != null) {
- primaryPath = ((String[])
document.getField(CONTENT_MIGRATION_PATH_PROPERTY))[0];
+ List<String> sourcePath =
document.getSourcePath();
+ if(sourcePath != null && !sourcePath.isEmpty())
{
+ primaryPath = sourcePath.get(0);
}
-
-
- // properties
- // (minimal set: name and object type id)
- Map<String, Object> properties = new
HashMap<String, Object>();
+
+
//if the source is CMIS Repository Connector we
override the objectId for synchronizing with removeDocument method
if(isSourceRepoCmisCompliant(document)) {
@@ -942,7 +945,7 @@ public class CmisOutputConnector extends
}
// Content Stream
- InputStream inputStream =
document.getBinaryStream();
+ inputStream = document.getBinaryStream();
contentStream = new ContentStreamImpl(fileName,
BigInteger.valueOf(binaryLength), mimeType,
inputStream);
@@ -957,19 +960,39 @@ public class CmisOutputConnector extends
return DOCUMENT_STATUS_REJECTED;
}
- } catch (CmisContentAlreadyExistsException |
CmisNameConstraintViolationException e) {
+ } catch (CmisContentAlreadyExistsException e) {
- String documentFullPath = leafParent.getPath() +
CmisOutputConnectorUtils.SLASH + fileName;
- Logging.connectors.warn(
- "CMIS: Document already exists: " +
documentFullPath);
+ //updating the existing content
+ if(leafParent != null) {
+ String documentFullPath = leafParent.getPath()
+ CmisOutputConnectorUtils.SLASH + fileName;
+ String newFileName =
fileName+System.currentTimeMillis();
+
+ Document currentContent = (Document)
session.getObjectByPath(documentFullPath);
+ currentContent.updateProperties(properties);
+ contentStream = new
ContentStreamImpl(newFileName, BigInteger.valueOf(binaryLength), mimeType,
inputStream);
+ currentContent.setContentStream(contentStream,
true);
+
+ Logging.connectors.warn(
+ "CMIS: Document already exists
- Updating: " + documentFullPath);
+ }
resultDescription = DOCUMENT_STATUS_ACCEPTED_DESC;
return DOCUMENT_STATUS_ACCEPTED;
+ } catch (CmisNameConstraintViolationException e) {
+ resultDescription = DOCUMENT_STATUS_REJECTED_DESC;
+ throw new ManifoldCFException(e.getMessage(), e);
+
} catch (Exception e) {
resultDescription = DOCUMENT_STATUS_REJECTED_DESC;
throw new ManifoldCFException(e.getMessage(), e);
+
} finally {
+
+ if(inputStream != null) {
+ inputStream.close();
+ }
+
activities.recordActivity(startTime,
ACTIVITY_INJECTION, document.getBinaryLength(), documentURI, resultDescription,
resultDescription);
}
@@ -1036,6 +1059,8 @@ public class CmisOutputConnector extends
return folder;
}
+
+
@Override
public void removeDocument(String documentURI, String
outputDescription, IOutputRemoveActivity activities)
throws ManifoldCFException, ServiceInterruption {
Modified:
manifoldcf/branches/CONNECTORS-1356-2.7.1/connectors/cmis/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/cmis/CmisConfig.java
URL:
http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-1356-2.7.1/connectors/cmis/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/cmis/CmisConfig.java?rev=1809990&r1=1809989&r2=1809990&view=diff
==============================================================================
---
manifoldcf/branches/CONNECTORS-1356-2.7.1/connectors/cmis/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/cmis/CmisConfig.java
(original)
+++
manifoldcf/branches/CONNECTORS-1356-2.7.1/connectors/cmis/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/cmis/CmisConfig.java
Thu Sep 28 13:18:02 2017
@@ -52,9 +52,6 @@ public class CmisConfig {
/** CMIS Query */
public static final String CMIS_QUERY_PARAM = "cmisQuery";
- /** Content Migration Flag */
- public static final String CONTENT_MIGRATION_PARAM = "contentMigration";
-
//default values
public static final String USERNAME_DEFAULT_VALUE = "dummyuser";
public static final String PASSWORD_DEFAULT_VALUE = "dummysecrect";
Modified:
manifoldcf/branches/CONNECTORS-1356-2.7.1/connectors/cmis/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/cmis/CmisRepositoryConnector.java
URL:
http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-1356-2.7.1/connectors/cmis/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/cmis/CmisRepositoryConnector.java?rev=1809990&r1=1809989&r2=1809990&view=diff
==============================================================================
---
manifoldcf/branches/CONNECTORS-1356-2.7.1/connectors/cmis/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/cmis/CmisRepositoryConnector.java
(original)
+++
manifoldcf/branches/CONNECTORS-1356-2.7.1/connectors/cmis/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/cmis/CmisRepositoryConnector.java
Thu Sep 28 13:18:02 2017
@@ -49,7 +49,6 @@ import org.apache.commons.io.input.NullI
import org.apache.commons.lang.StringUtils;
import org.apache.manifoldcf.agents.interfaces.RepositoryDocument;
import org.apache.manifoldcf.agents.interfaces.ServiceInterruption;
-import org.apache.manifoldcf.agents.output.cmisoutput.CmisOutputConnectorUtils;
import org.apache.manifoldcf.core.interfaces.ConfigParams;
import org.apache.manifoldcf.core.interfaces.IHTTPOutput;
import org.apache.manifoldcf.core.interfaces.IPasswordMapperActivity;
@@ -132,11 +131,7 @@ public class CmisRepositoryConnector ext
protected static final long timeToRelease = 300000L;
protected long lastSessionFetch = -1L;
-
- private boolean enableContentMigration = false;
-
- private static final char SLASH = '/';
-
+
/**
* Constructor
*/
@@ -659,9 +654,6 @@ public class CmisRepositoryConnector ext
SpecificationNode sn = spec.getChild(i);
if (sn.getType().equals(JOB_STARTPOINT_NODE_TYPE)) {
cmisQuery = sn.getAttributeValue(CmisConfig.CMIS_QUERY_PARAM);
-
if(StringUtils.isNotEmpty(sn.getAttributeValue(CmisConfig.CONTENT_MIGRATION_PARAM))){
- enableContentMigration =
Boolean.valueOf(sn.getAttributeValue(CmisConfig.CONTENT_MIGRATION_PARAM));
- }
break;
}
}
@@ -915,18 +907,14 @@ public class CmisRepositoryConnector ext
{
int i = 0;
String cmisQuery = StringUtils.EMPTY;
- String contentMigration = StringUtils.EMPTY;
while (i < ds.getChildCount()) {
SpecificationNode sn = ds.getChild(i);
if (sn.getType().equals(JOB_STARTPOINT_NODE_TYPE)) {
cmisQuery = sn.getAttributeValue(CmisConfig.CMIS_QUERY_PARAM);
- contentMigration =
sn.getAttributeValue(CmisConfig.CONTENT_MIGRATION_PARAM);
}
i++;
}
newMap.put(CmisConfig.CMIS_QUERY_PARAM, cmisQuery);
- newMap.put(CmisConfig.CONTENT_MIGRATION_PARAM, contentMigration);
-
}
/** View specification.
@@ -972,8 +960,7 @@ public class CmisRepositoryConnector ext
String seqPrefix = "s"+connectionSequenceNumber+"_";
String cmisQuery = variableContext.getParameter(seqPrefix +
CmisConfig.CMIS_QUERY_PARAM);
- String contentMigration = variableContext.getParameter(seqPrefix +
CmisConfig.CONTENT_MIGRATION_PARAM);
- if (cmisQuery != null || contentMigration != null) {
+ if (cmisQuery != null) {
int i = 0;
while (i < ds.getChildCount()) {
SpecificationNode oldNode = ds.getChild(i);
@@ -988,19 +975,6 @@ public class CmisRepositoryConnector ext
node.setAttribute(CmisConfig.CMIS_QUERY_PARAM, cmisQuery);
variableContext.setParameter(CmisConfig.CMIS_QUERY_PARAM, cmisQuery);
- //Content Migration
- if(StringUtils.isEmpty(contentMigration)
- || StringUtils.equalsIgnoreCase(contentMigration,
Boolean.FALSE.toString()) ){
- contentMigration = Boolean.FALSE.toString();
- enableContentMigration = false;
- } else {
- contentMigration = Boolean.TRUE.toString();
- enableContentMigration = true;
- }
-
- node.setAttribute(CmisConfig.CONTENT_MIGRATION_PARAM, contentMigration);
- variableContext.setParameter(CmisConfig.CONTENT_MIGRATION_PARAM,
contentMigration);
-
ds.addChild(ds.getChildCount(), node);
}
return null;
@@ -1172,42 +1146,41 @@ public class CmisRepositoryConnector ext
String mimeType = document.getContentStreamMimeType();
//documentURI
- String documentURI = getDocumentURI(cmisObject,
enableContentMigration);
+ String documentURI = getDocumentURI(cmisObject);
// Do any filtering (which will save us work)
- if(!enableContentMigration) {
- if (!activities.checkURLIndexable(documentURI))
- {
- activities.noDocument(documentIdentifier,versionString);
- errorCode = IProcessActivity.EXCLUDED_URL;
- errorDesc = "Excluding due to URL ('"+documentURI+"')";
- continue;
- }
-
- if (!activities.checkMimeTypeIndexable(mimeType))
- {
- activities.noDocument(documentIdentifier,versionString);
- errorCode = IProcessActivity.EXCLUDED_MIMETYPE;
- errorDesc = "Excluding due to mime type ("+mimeType+")";
- continue;
- }
-
- if (!activities.checkLengthIndexable(fileLength))
- {
- activities.noDocument(documentIdentifier,versionString);
- errorCode = IProcessActivity.EXCLUDED_LENGTH;
- errorDesc = "Excluding due to length ("+fileLength+")";
- continue;
- }
-
- if (!activities.checkDateIndexable(modifiedDate))
- {
- activities.noDocument(documentIdentifier,versionString);
- errorCode = IProcessActivity.EXCLUDED_DATE;
- errorDesc = "Excluding due to date ("+modifiedDate+")";
- continue;
- }
+ if (!activities.checkURLIndexable(documentURI))
+ {
+ activities.noDocument(documentIdentifier,versionString);
+ errorCode = IProcessActivity.EXCLUDED_URL;
+ errorDesc = "Excluding due to URL ('"+documentURI+"')";
+ continue;
+ }
+
+ if (!activities.checkMimeTypeIndexable(mimeType))
+ {
+ activities.noDocument(documentIdentifier,versionString);
+ errorCode = IProcessActivity.EXCLUDED_MIMETYPE;
+ errorDesc = "Excluding due to mime type ("+mimeType+")";
+ continue;
+ }
+
+ if (!activities.checkLengthIndexable(fileLength))
+ {
+ activities.noDocument(documentIdentifier,versionString);
+ errorCode = IProcessActivity.EXCLUDED_LENGTH;
+ errorDesc = "Excluding due to length ("+fileLength+")";
+ continue;
}
+
+ if (!activities.checkDateIndexable(modifiedDate))
+ {
+ activities.noDocument(documentIdentifier,versionString);
+ errorCode = IProcessActivity.EXCLUDED_DATE;
+ errorDesc = "Excluding due to date ("+modifiedDate+")";
+ continue;
+ }
+
RepositoryDocument rd = new RepositoryDocument();
rd.setFileName(fileName);
@@ -1215,7 +1188,7 @@ public class CmisRepositoryConnector ext
rd.setCreatedDate(createdDate);
rd.setModifiedDate(modifiedDate);
- InputStream is;
+ InputStream is = null;
try {
if (fileLength > 0)
is = document.getContentStream().getStream();
@@ -1285,22 +1258,20 @@ public class CmisRepositoryConnector ext
}
- private String getDocumentURI(CmisObject cmisObject, boolean
enableContentMigration) throws ManifoldCFException {
+ private String getDocumentURI(CmisObject cmisObject) throws
ManifoldCFException {
String documentURI = StringUtils.EMPTY;
String currentBaseTypeId = cmisObject.getBaseTypeId().value();
if(StringUtils.equals(currentBaseTypeId,
BaseTypeId.CMIS_DOCUMENT.value())) {
Document currentDocument = (Document) cmisObject;
- if(enableContentMigration) {
- if(currentDocument.getParents() != null
- &&
!currentDocument.getParents().isEmpty()) {
- String path =
currentDocument.getParents().get(0).getPath();
- String name = currentDocument.getName();
- String fullContentPath = path +
CmisRepositoryConnectorUtils.SLASH + name;
- documentURI = fullContentPath;
- }
- } else {
- documentURI =
CmisRepositoryConnectorUtils.getDocumentURL(currentDocument, session);
- }
+ if(currentDocument.getParents() != null
+ &&
!currentDocument.getParents().isEmpty()) {
+ String path =
currentDocument.getParents().get(0).getPath();
+ String name = currentDocument.getName();
+ String fullContentPath = path + CmisRepositoryConnectorUtils.SLASH +
name;
+ documentURI = fullContentPath;
+ } else {
+ documentURI =
CmisRepositoryConnectorUtils.getDocumentURL(currentDocument, session);
+ }
} else if(StringUtils.equals(currentBaseTypeId,
BaseTypeId.CMIS_FOLDER.value())) {
Folder currentFolder = (Folder) cmisObject;
String path = currentFolder.getPath();
Modified:
manifoldcf/branches/CONNECTORS-1356-2.7.1/connectors/cmis/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/cmis/CmisRepositoryConnectorUtils.java
URL:
http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-1356-2.7.1/connectors/cmis/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/cmis/CmisRepositoryConnectorUtils.java?rev=1809990&r1=1809989&r2=1809990&view=diff
==============================================================================
---
manifoldcf/branches/CONNECTORS-1356-2.7.1/connectors/cmis/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/cmis/CmisRepositoryConnectorUtils.java
(original)
+++
manifoldcf/branches/CONNECTORS-1356-2.7.1/connectors/cmis/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/cmis/CmisRepositoryConnectorUtils.java
Thu Sep 28 13:18:02 2017
@@ -21,13 +21,19 @@ package org.apache.manifoldcf.crawler.co
import java.lang.reflect.Method;
import java.math.BigDecimal;
import java.math.BigInteger;
-import java.util.*;
+import java.util.GregorianCalendar;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+import java.util.StringTokenizer;
import org.apache.chemistry.opencmis.client.api.Document;
import org.apache.chemistry.opencmis.client.api.Property;
import org.apache.chemistry.opencmis.client.api.Session;
import
org.apache.chemistry.opencmis.client.bindings.spi.atompub.AbstractAtomPubService;
import org.apache.chemistry.opencmis.client.bindings.spi.atompub.AtomPubParser;
+import org.apache.chemistry.opencmis.commons.PropertyIds;
import org.apache.chemistry.opencmis.commons.definitions.PropertyDefinition;
import org.apache.chemistry.opencmis.commons.enums.Cardinality;
import org.apache.chemistry.opencmis.commons.enums.PropertyType;
@@ -50,19 +56,16 @@ public class CmisRepositoryConnectorUtil
private static final String FROM_TOKEN = "from";
private static final String SEP = " ";
private static final String SELECT_STAR_CLAUSE = "select *";
- private static final String OBJECT_ID_PROPERTY = "cmis:objectId";
- private static final String OBJECT_ID_TERM = OBJECT_ID_PROPERTY + ",";
+ private static final String OBJECT_ID_TERM = PropertyIds.OBJECT_ID + ",";
private static final String SELECT_CLAUSE_TERM_SEP = ",";
private static final String SELECT_PREFIX = "select ";
private final static String TOKENIZER_SEP = ",\n\t";
public static final String SLASH = "/";
-
- /** The standard Path property for ManifoldCF used for migrate contents **/
- private static final String CONTENT_MIGRATION_PATH_PROPERTY =
"manifoldcf:path";
public static final String getDocumentURL(final Document document, final
Session session)
throws ManifoldCFException {
- String link = null;
+
+ String link = null;
try {
Method loadLink =
AbstractAtomPubService.class.getDeclaredMethod(LOAD_LINK_METHOD_NAME,
new Class[]{String.class, String.class, String.class,
String.class});
@@ -105,7 +108,7 @@ public class CmisRepositoryConnectorUtil
selectTerm = term;
firstTermSelectClause = false;
} else {
- if (term.contains(OBJECT_ID_PROPERTY)){
+ if (term.contains(PropertyIds.OBJECT_ID)){
foundObjIdClause = true;
cmisQueryResult = cmisQuery;
break;
@@ -173,14 +176,9 @@ public class CmisRepositoryConnectorUtil
* @param cmisQuery : cmis query
*/
public static void addValuesOfProperties(Document document,
RepositoryDocument rd, String cmisQuery) {
- String primaryPath = StringUtils.EMPTY;
if(document.getPaths() != null) {
- primaryPath = document.getPaths().get(0);
- try {
-
rd.addField(CONTENT_MIGRATION_PATH_PROPERTY, primaryPath);
- } catch (ManifoldCFException e) {
- Logging.connectors.error("Error when adding property[" +
CONTENT_MIGRATION_PATH_PROPERTY + "] msg=[" + e.getMessage() + "]", e);
- }
+ List<String> sourcePath = document.getPaths();
+ rd.setSourcePath(sourcePath);
}
List<Property<?>> props = document.getProperties();
Modified:
manifoldcf/branches/CONNECTORS-1356-2.7.1/connectors/cmis/connector/src/main/resources/org/apache/manifoldcf/crawler/connectors/cmis/editSpecification_CMISQuery.html
URL:
http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-1356-2.7.1/connectors/cmis/connector/src/main/resources/org/apache/manifoldcf/crawler/connectors/cmis/editSpecification_CMISQuery.html?rev=1809990&r1=1809989&r2=1809990&view=diff
==============================================================================
---
manifoldcf/branches/CONNECTORS-1356-2.7.1/connectors/cmis/connector/src/main/resources/org/apache/manifoldcf/crawler/connectors/cmis/editSpecification_CMISQuery.html
(original)
+++
manifoldcf/branches/CONNECTORS-1356-2.7.1/connectors/cmis/connector/src/main/resources/org/apache/manifoldcf/crawler/connectors/cmis/editSpecification_CMISQuery.html
Thu Sep 28 13:18:02 2017
@@ -35,28 +35,10 @@
</nobr>
</td>
</tr>
- <tr>
- <td class="description">
- <nobr>
-
$Encoder.bodyEscape($ResourceBundle.getString('CmisRepositoryConnector.ContentMigrationColon'))
- </nobr>
- </td>
- <td class="value">
- <nobr>
- <input type="checkbox"
- name="s${SEQNUM}_contentMigration"
- value="true"
- #if($CONTENTMIGRATION==true) checked
- #end
- />
- </nobr>
- </td>
- </tr>
</table>
#else
<input type="hidden" name="s${SEQNUM}_cmisQuery"
value="$Encoder.attributeEscape($CMISQUERY)" />
-<input type="hidden" name="s${SEQNUM}_contentMigration"
value="$CONTENTMIGRATION" />
#end
Modified:
manifoldcf/branches/CONNECTORS-1356-2.7.1/connectors/cmis/connector/src/main/resources/org/apache/manifoldcf/crawler/connectors/cmis/viewSpecification.html
URL:
http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-1356-2.7.1/connectors/cmis/connector/src/main/resources/org/apache/manifoldcf/crawler/connectors/cmis/viewSpecification.html?rev=1809990&r1=1809989&r2=1809990&view=diff
==============================================================================
---
manifoldcf/branches/CONNECTORS-1356-2.7.1/connectors/cmis/connector/src/main/resources/org/apache/manifoldcf/crawler/connectors/cmis/viewSpecification.html
(original)
+++
manifoldcf/branches/CONNECTORS-1356-2.7.1/connectors/cmis/connector/src/main/resources/org/apache/manifoldcf/crawler/connectors/cmis/viewSpecification.html
Thu Sep 28 13:18:02 2017
@@ -26,14 +26,4 @@
$Encoder.bodyEscape($CMISQUERY)
</td>
</tr>
- <tr>
- <td class="description">
- <nobr>
-
$Encoder.bodyEscape($ResourceBundle.getString('CmisRepositoryConnector.ContentMigrationColon'))
- </nobr>
- </td>
- <td class="value">
- $CONTENTMIGRATION
- </td>
- </tr>
</table>
Modified:
manifoldcf/branches/CONNECTORS-1356-2.7.1/connectors/cmis/connector/src/test/java/org/apache/manifoldcf/agents/output/cmisoutput/tests/APISanityHSQLDBIT.java
URL:
http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-1356-2.7.1/connectors/cmis/connector/src/test/java/org/apache/manifoldcf/agents/output/cmisoutput/tests/APISanityHSQLDBIT.java?rev=1809990&r1=1809989&r2=1809990&view=diff
==============================================================================
---
manifoldcf/branches/CONNECTORS-1356-2.7.1/connectors/cmis/connector/src/test/java/org/apache/manifoldcf/agents/output/cmisoutput/tests/APISanityHSQLDBIT.java
(original)
+++
manifoldcf/branches/CONNECTORS-1356-2.7.1/connectors/cmis/connector/src/test/java/org/apache/manifoldcf/agents/output/cmisoutput/tests/APISanityHSQLDBIT.java
Thu Sep 28 13:18:02 2017
@@ -29,7 +29,6 @@ import java.util.Map;
import org.apache.chemistry.opencmis.client.api.Document;
import org.apache.chemistry.opencmis.client.api.Folder;
import org.apache.chemistry.opencmis.client.api.ItemIterable;
-import org.apache.chemistry.opencmis.client.api.ObjectId;
import org.apache.chemistry.opencmis.client.api.QueryResult;
import org.apache.chemistry.opencmis.client.api.Session;
import org.apache.chemistry.opencmis.client.api.SessionFactory;
@@ -40,7 +39,6 @@ import org.apache.chemistry.opencmis.com
import org.apache.chemistry.opencmis.commons.enums.BindingType;
import
org.apache.chemistry.opencmis.commons.impl.dataobjects.ContentStreamImpl;
import org.apache.chemistry.opencmis.commons.impl.jaxb.EnumBaseObjectTypeIds;
-import org.apache.chemistry.opencmis.commons.spi.ObjectService;
import org.apache.commons.lang.StringUtils;
import org.apache.manifoldcf.agents.output.cmisoutput.CmisOutputConfig;
import org.apache.manifoldcf.core.interfaces.Configuration;
@@ -57,10 +55,6 @@ import org.junit.Test;
*/
public class APISanityHSQLDBIT extends BaseITHSQLDB {
- private static final String REPLACER = "?";
- private static final String CMIS_TEST_QUERY_CHANGE_DOC = "SELECT * FROM
cmis:document WHERE cmis:name='"+REPLACER+"'";
- private static final String CMIS_TEST_QUERY_TARGET_REPO_ALL = "SELECT *
FROM cmis:document WHERE CONTAINS('testdata')";
-
private Session cmisSourceClientSession = null;
private Session cmisTargetClientSession = null;
@@ -72,15 +66,15 @@ public class APISanityHSQLDBIT extends B
Map<String, String> parameters = new HashMap<String, String>();
// user credentials
- parameters.put(SessionParameter.USER, CmisConfig.USERNAME_DEFAULT_VALUE);
- parameters.put(SessionParameter.PASSWORD,
CmisConfig.PASSWORD_DEFAULT_VALUE);
+ parameters.put(SessionParameter.USER,
BaseITSanityTestUtils.SOURCE_USERNAME_VALUE);
+ parameters.put(SessionParameter.PASSWORD,
BaseITSanityTestUtils.SOURCE_PASSWORD_VALUE);
// connection settings
String endpoint =
- CmisConfig.PROTOCOL_DEFAULT_VALUE + "://" +
- CmisConfig.SERVER_DEFAULT_VALUE + ":" +
- CmisConfig.PORT_DEFAULT_VALUE +
- CmisConfig.PATH_DEFAULT_VALUE;
+ BaseITSanityTestUtils.SOURCE_PROTOCOL_VALUE + "://" +
+ BaseITSanityTestUtils.SOURCE_SERVER_VALUE + ":" +
+ BaseITSanityTestUtils.SOURCE_PORT_VALUE +
+ BaseITSanityTestUtils.SOURCE_PATH_VALUE;
parameters.put(SessionParameter.ATOMPUB_URL, endpoint);
parameters.put(SessionParameter.BINDING_TYPE, BindingType.ATOMPUB.value());
@@ -95,15 +89,15 @@ public class APISanityHSQLDBIT extends B
Map<String, String> parameters = new HashMap<String, String>();
// user credentials
- parameters.put(SessionParameter.USER,
CmisOutputConfig.USERNAME_DEFAULT_VALUE);
- parameters.put(SessionParameter.PASSWORD,
CmisOutputConfig.PASSWORD_DEFAULT_VALUE);
+ parameters.put(SessionParameter.USER,
BaseITSanityTestUtils.TARGET_USERNAME_VALUE);
+ parameters.put(SessionParameter.PASSWORD,
BaseITSanityTestUtils.TARGET_PASSWORD_VALUE);
// connection settings
String endpoint =
- CmisOutputConfig.PROTOCOL_DEFAULT_VALUE + "://" +
- CmisOutputConfig.SERVER_DEFAULT_VALUE + ":" +
- CmisOutputConfig.PORT_DEFAULT_VALUE +
- CmisOutputConfig.PATH_DEFAULT_VALUE;
+ BaseITSanityTestUtils.TARGET_PROTOCOL_VALUE + "://" +
+ BaseITSanityTestUtils.TARGET_SERVER_VALUE + ":" +
+ BaseITSanityTestUtils.TARGET_PORT_VALUE +
+ BaseITSanityTestUtils.TARGET_PATH_VALUE;
parameters.put(SessionParameter.ATOMPUB_URL, endpoint);
parameters.put(SessionParameter.BINDING_TYPE, BindingType.ATOMPUB.value());
@@ -123,7 +117,7 @@ public class APISanityHSQLDBIT extends B
}
private long queryTestContents(Session session) {
- ItemIterable<QueryResult> results =
session.query(CMIS_TEST_QUERY_TARGET_REPO_ALL, false);
+ ItemIterable<QueryResult> results =
session.query(BaseITSanityTestUtils.CMIS_TEST_QUERY_TARGET_REPO_ALL, false);
return results.getTotalNumItems();
}
@@ -132,7 +126,7 @@ public class APISanityHSQLDBIT extends B
// properties
// (minimal set: name and object type id)
Map<String, Object> contentProperties = new HashMap<String, Object>();
- contentProperties.put(PropertyIds.OBJECT_TYPE_ID, "cmis:document");
+ contentProperties.put(PropertyIds.OBJECT_TYPE_ID,
EnumBaseObjectTypeIds.CMIS_DOCUMENT.value());
contentProperties.put(PropertyIds.NAME, name);
// content
@@ -215,7 +209,7 @@ public class APISanityHSQLDBIT extends B
public void removeTestArea()
throws Exception
{
- // we don't need to remove anything
+ // we don't need to remove anything from the CMIS In-Memory Server, each
bootstrap will create a new repo from scratch
}
@Test
@@ -258,43 +252,43 @@ public class APISanityHSQLDBIT extends B
//binding
ConfigurationNode cmisBindingNode = new ConfigurationNode("_PARAMETER_");
cmisBindingNode.setAttribute("name", CmisConfig.BINDING_PARAM);
- cmisBindingNode.setValue(CmisConfig.BINDING_DEFAULT_VALUE);
+ cmisBindingNode.setValue(BaseITSanityTestUtils.SOURCE_BINDING_VALUE);
child.addChild(child.getChildCount(), cmisBindingNode);
//username
ConfigurationNode cmisUsernameNode = new
ConfigurationNode("_PARAMETER_");
cmisUsernameNode.setAttribute("name", CmisConfig.USERNAME_PARAM);
- cmisUsernameNode.setValue(CmisConfig.USERNAME_DEFAULT_VALUE);
+ cmisUsernameNode.setValue(BaseITSanityTestUtils.SOURCE_USERNAME_VALUE);
child.addChild(child.getChildCount(), cmisUsernameNode);
//password
ConfigurationNode cmisPasswordNode = new
ConfigurationNode("_PARAMETER_");
cmisPasswordNode.setAttribute("name", CmisConfig.PASSWORD_PARAM);
- cmisPasswordNode.setValue(CmisConfig.PASSWORD_DEFAULT_VALUE);
+ cmisPasswordNode.setValue(BaseITSanityTestUtils.SOURCE_PASSWORD_VALUE);
child.addChild(child.getChildCount(), cmisPasswordNode);
//protocol
ConfigurationNode cmisProtocolNode = new
ConfigurationNode("_PARAMETER_");
cmisProtocolNode.setAttribute("name", CmisConfig.PROTOCOL_PARAM);
- cmisProtocolNode.setValue(CmisConfig.PROTOCOL_DEFAULT_VALUE);
+ cmisProtocolNode.setValue(BaseITSanityTestUtils.SOURCE_PROTOCOL_VALUE);
child.addChild(child.getChildCount(), cmisProtocolNode);
//server
ConfigurationNode cmisServerNode = new ConfigurationNode("_PARAMETER_");
cmisServerNode.setAttribute("name", CmisConfig.SERVER_PARAM);
- cmisServerNode.setValue(CmisConfig.SERVER_DEFAULT_VALUE);
+ cmisServerNode.setValue(BaseITSanityTestUtils.SOURCE_SERVER_VALUE);
child.addChild(child.getChildCount(), cmisServerNode);
//port
ConfigurationNode cmisPortNode = new ConfigurationNode("_PARAMETER_");
cmisPortNode.setAttribute("name", CmisConfig.PORT_PARAM);
- cmisPortNode.setValue(CmisConfig.PORT_DEFAULT_VALUE);
+ cmisPortNode.setValue(BaseITSanityTestUtils.SOURCE_PORT_VALUE);
child.addChild(child.getChildCount(), cmisPortNode);
//path
ConfigurationNode cmisPathNode = new ConfigurationNode("_PARAMETER_");
cmisPathNode.setAttribute("name", CmisConfig.PATH_PARAM);
- cmisPathNode.setValue(CmisConfig.PATH_DEFAULT_VALUE);
+ cmisPathNode.setValue(BaseITSanityTestUtils.SOURCE_PATH_VALUE);
child.addChild(child.getChildCount(), cmisPathNode);
connectionObject.addChild(connectionObject.getChildCount(),child);
@@ -336,43 +330,43 @@ public class APISanityHSQLDBIT extends B
//binding
ConfigurationNode cmisOutputBindingNode = new
ConfigurationNode("_PARAMETER_");
cmisOutputBindingNode.setAttribute("name",
CmisOutputConfig.BINDING_PARAM);
- cmisOutputBindingNode.setValue(CmisOutputConfig.BINDING_DEFAULT_VALUE);
+
cmisOutputBindingNode.setValue(BaseITSanityTestUtils.TARGET_BINDING_VALUE);
child.addChild(child.getChildCount(), cmisOutputBindingNode);
//username
ConfigurationNode cmisOutputUsernameNode = new
ConfigurationNode("_PARAMETER_");
cmisOutputUsernameNode.setAttribute("name",
CmisOutputConfig.USERNAME_PARAM);
- cmisOutputUsernameNode.setValue(CmisOutputConfig.USERNAME_DEFAULT_VALUE);
+
cmisOutputUsernameNode.setValue(BaseITSanityTestUtils.TARGET_USERNAME_VALUE);
child.addChild(child.getChildCount(), cmisOutputUsernameNode);
//password
ConfigurationNode cmisOutputPasswordNode = new
ConfigurationNode("_PARAMETER_");
cmisOutputPasswordNode.setAttribute("name",
CmisOutputConfig.PASSWORD_PARAM);
- cmisOutputPasswordNode.setValue(CmisOutputConfig.PASSWORD_DEFAULT_VALUE);
+
cmisOutputPasswordNode.setValue(BaseITSanityTestUtils.TARGET_PASSWORD_VALUE);
child.addChild(child.getChildCount(), cmisOutputPasswordNode);
//protocol
ConfigurationNode cmisOutputProtocolNode = new
ConfigurationNode("_PARAMETER_");
cmisOutputProtocolNode.setAttribute("name",
CmisOutputConfig.PROTOCOL_PARAM);
- cmisOutputProtocolNode.setValue(CmisOutputConfig.PROTOCOL_DEFAULT_VALUE);
+
cmisOutputProtocolNode.setValue(BaseITSanityTestUtils.TARGET_PROTOCOL_VALUE);
child.addChild(child.getChildCount(), cmisOutputProtocolNode);
//server
ConfigurationNode cmisOutputServerNode = new
ConfigurationNode("_PARAMETER_");
cmisOutputServerNode.setAttribute("name", CmisOutputConfig.SERVER_PARAM);
- cmisOutputServerNode.setValue(CmisOutputConfig.SERVER_DEFAULT_VALUE);
+ cmisOutputServerNode.setValue(BaseITSanityTestUtils.TARGET_SERVER_VALUE);
child.addChild(child.getChildCount(), cmisOutputServerNode);
//port
ConfigurationNode cmisOutputPortNode = new
ConfigurationNode("_PARAMETER_");
cmisOutputPortNode.setAttribute("name", CmisConfig.PORT_PARAM);
- cmisOutputPortNode.setValue(CmisOutputConfig.PORT_DEFAULT_VALUE);
+ cmisOutputPortNode.setValue(BaseITSanityTestUtils.TARGET_PORT_VALUE);
child.addChild(child.getChildCount(), cmisOutputPortNode);
//path
ConfigurationNode cmisOutputPathNode = new
ConfigurationNode("_PARAMETER_");
cmisOutputPathNode.setAttribute("name", CmisOutputConfig.PATH_PARAM);
- cmisOutputPathNode.setValue(CmisOutputConfig.PATH_DEFAULT_VALUE);
+ cmisOutputPathNode.setValue(BaseITSanityTestUtils.TARGET_PATH_VALUE);
child.addChild(child.getChildCount(), cmisOutputPathNode);
//cmisQuery
@@ -444,7 +438,6 @@ public class APISanityHSQLDBIT extends B
//Job configuration
ConfigurationNode sn = new ConfigurationNode("startpoint");
sn.setAttribute(CmisOutputConfig.CMIS_QUERY_PARAM,
CmisOutputConfig.CMIS_QUERY_DEFAULT_VALUE);
- sn.setAttribute(CmisConfig.CONTENT_MIGRATION_PARAM,
Boolean.TRUE.toString());
child.addChild(child.getChildCount(),sn);
jobObject.addChild(jobObject.getChildCount(),child);
@@ -532,7 +525,6 @@ public class APISanityHSQLDBIT extends B
// Check to be sure we actually processed the right number of documents.
// The test data area has 3 documents and one directory, and we have to
count the root directory too.
count = getJobDocumentsProcessed(jobIDString);
- waitJobInactive(jobIDString, 240000L);
if (count != 4)
throw new ManifoldCFException("Wrong number of documents processed
after delete - expected 4, saw "+new Long(count).toString());
@@ -637,7 +629,7 @@ public class APISanityHSQLDBIT extends B
}
public void removeDocument(Session session, String name){
- String cmisQuery = StringUtils.replace(CMIS_TEST_QUERY_CHANGE_DOC,
REPLACER, name);
+ String cmisQuery =
StringUtils.replace(BaseITSanityTestUtils.CMIS_TEST_QUERY_CHANGE_DOC,
BaseITSanityTestUtils.REPLACER, name);
ItemIterable<QueryResult> results = session.query(cmisQuery, false);
String objectId = null;
for (QueryResult result : results) {
@@ -674,7 +666,7 @@ public class APISanityHSQLDBIT extends B
* @param newContent
*/
public void changeDocument(Session session, String name, String newContent){
- String cmisQuery = StringUtils.replace(CMIS_TEST_QUERY_CHANGE_DOC,
REPLACER, name);
+ String cmisQuery =
StringUtils.replace(BaseITSanityTestUtils.CMIS_TEST_QUERY_CHANGE_DOC,
BaseITSanityTestUtils.REPLACER, name);
ItemIterable<QueryResult> results = session.query(cmisQuery, false);
String objectId = StringUtils.EMPTY;
for (QueryResult result : results) {
@@ -683,6 +675,7 @@ public class APISanityHSQLDBIT extends B
byte[] newContentByteArray = newContent.getBytes(StandardCharsets.UTF_8);
InputStream stream = new ByteArrayInputStream(newContentByteArray);
+
ContentStream contentStream = new ContentStreamImpl(name, new
BigInteger(newContentByteArray), "text/plain", stream);
Document documentToUpdate = (Document) session.getObject(objectId);
documentToUpdate.setContentStream(contentStream, true);
Modified:
manifoldcf/branches/CONNECTORS-1356-2.7.1/connectors/cmis/connector/src/test/java/org/apache/manifoldcf/agents/output/cmisoutput/tests/BaseITHSQLDB.java
URL:
http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-1356-2.7.1/connectors/cmis/connector/src/test/java/org/apache/manifoldcf/agents/output/cmisoutput/tests/BaseITHSQLDB.java?rev=1809990&r1=1809989&r2=1809990&view=diff
==============================================================================
---
manifoldcf/branches/CONNECTORS-1356-2.7.1/connectors/cmis/connector/src/test/java/org/apache/manifoldcf/agents/output/cmisoutput/tests/BaseITHSQLDB.java
(original)
+++
manifoldcf/branches/CONNECTORS-1356-2.7.1/connectors/cmis/connector/src/test/java/org/apache/manifoldcf/agents/output/cmisoutput/tests/BaseITHSQLDB.java
Thu Sep 28 13:18:02 2017
@@ -66,12 +66,12 @@ public class BaseITHSQLDB extends org.ap
openCmisServerWarPath = System.getProperty("openCmisServerWarPath");
}
- //CMIS Source repo server on port 9090
- sourceCmisServer = new CMISServer(9090, openCmisServerWarPath);
+ //CMIS Source repo server on port 9091
+ sourceCmisServer = new CMISServer(9091, openCmisServerWarPath);
sourceCmisServer.start();
- //CMIS target repo server on port 9091
- targetCmisServer = new CMISServer(9091, openCmisServerWarPath);
+ //CMIS target repo server on port 9092
+ targetCmisServer = new CMISServer(9092, openCmisServerWarPath);
targetCmisServer.start();
}
Added:
manifoldcf/branches/CONNECTORS-1356-2.7.1/connectors/cmis/connector/src/test/java/org/apache/manifoldcf/agents/output/cmisoutput/tests/BaseITSanityTestUtils.java
URL:
http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-1356-2.7.1/connectors/cmis/connector/src/test/java/org/apache/manifoldcf/agents/output/cmisoutput/tests/BaseITSanityTestUtils.java?rev=1809990&view=auto
==============================================================================
---
manifoldcf/branches/CONNECTORS-1356-2.7.1/connectors/cmis/connector/src/test/java/org/apache/manifoldcf/agents/output/cmisoutput/tests/BaseITSanityTestUtils.java
(added)
+++
manifoldcf/branches/CONNECTORS-1356-2.7.1/connectors/cmis/connector/src/test/java/org/apache/manifoldcf/agents/output/cmisoutput/tests/BaseITSanityTestUtils.java
Thu Sep 28 13:18:02 2017
@@ -0,0 +1,58 @@
+/* $Id$ */
+
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.manifoldcf.agents.output.cmisoutput.tests;
+
+import org.apache.commons.lang.StringUtils;
+
+/**
+ * Utility class dedicated to integration tests for the CMIS Output Connector
+ * @author piergiorgiolucidi
+ *
+ */
+public class BaseITSanityTestUtils {
+
+ public static final String REPLACER = "?";
+
+ public static final String CMIS_TEST_QUERY_CHANGE_DOC =
+ "SELECT * FROM cmis:document WHERE
cmis:name='"+BaseITSanityTestUtils.REPLACER+"'";
+
+ public static final String CMIS_TEST_QUERY_TARGET_REPO_ALL = "SELECT *
FROM cmis:document WHERE CONTAINS('testdata')";
+
+
+ //Test values for the source repository
+ public static final String SOURCE_USERNAME_VALUE = "dummyuser";
+ public static final String SOURCE_PASSWORD_VALUE = "dummysecrect";
+ public static final String SOURCE_PROTOCOL_VALUE = "http";
+ public static final String SOURCE_SERVER_VALUE = "localhost";
+ public static final String SOURCE_PORT_VALUE = "9091";
+ public static final String SOURCE_BINDING_VALUE = "atom";
+ public static final String SOURCE_PATH_VALUE =
"/chemistry-opencmis-server-inmemory/atom";
+ public static final String SOURCE_REPOSITORY_ID_VALUE = StringUtils.EMPTY;
+
+ //Test values for the source repository
+ public static final String TARGET_USERNAME_VALUE = "dummyuser";
+ public static final String TARGET_PASSWORD_VALUE = "dummysecrect";
+ public static final String TARGET_PROTOCOL_VALUE = "http";
+ public static final String TARGET_SERVER_VALUE = "localhost";
+ public static final String TARGET_PORT_VALUE = "9092";
+ public static final String TARGET_BINDING_VALUE = "atom";
+ public static final String TARGET_PATH_VALUE =
"/chemistry-opencmis-server-inmemory/atom";
+ public static final String TARGET_REPOSITORY_ID_VALUE = StringUtils.EMPTY;
+
+}
Propchange:
manifoldcf/branches/CONNECTORS-1356-2.7.1/connectors/cmis/connector/src/test/java/org/apache/manifoldcf/agents/output/cmisoutput/tests/BaseITSanityTestUtils.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
manifoldcf/branches/CONNECTORS-1356-2.7.1/connectors/cmis/connector/src/test/java/org/apache/manifoldcf/agents/output/cmisoutput/tests/BaseITSanityTestUtils.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange:
manifoldcf/branches/CONNECTORS-1356-2.7.1/connectors/cmis/connector/src/test/java/org/apache/manifoldcf/agents/output/cmisoutput/tests/BaseITSanityTestUtils.java
------------------------------------------------------------------------------
svn:mime-type = text/plain