Skip to content

Commit

Permalink
Merge branch 'release/8.8.5'
Browse files Browse the repository at this point in the history
  • Loading branch information
grishick committed Nov 28, 2017
2 parents 55db2ef + 9df3008 commit 013d906
Show file tree
Hide file tree
Showing 214 changed files with 8,596 additions and 2,441 deletions.
70 changes: 12 additions & 58 deletions build-common.xml
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,7 @@
</target>

<target name="test" depends="test-compile" description="Run unit tests">
<property name="test-results-file" value="${zm-mailbox.basedir}/build/test-results.txt"/>
<antcontrib:if>
<available file="${test.src.dir}" type="dir"/>
<then>
Expand All @@ -312,60 +313,10 @@
<batchtest todir="${test.dir}/output">
<fileset dir="${test.src.dir}">
<include name="${test.pattern}"/>
<exclude name="**/*ITest.java"/>
<exclude name="**/Abstract*Test.java"/>
<exclude name="**/ZimletUtilTest.java"/>
<exclude name="**/RuleManagerWithCustomActionFilterTest.java"/>
<exclude name="**/ExtShareInfoTest.java"/>
<exclude name="**/ZimbraAuthTokenTest.java"/>
<exclude name="**/DbMailItemTest.java"/>
<exclude name="**/DbSearchTest.java"/>
<exclude name="**/DbVolumeBlobsTest.java"/>
<exclude name="**/cs/ephemeral/EphemeralAttributesTest.java"/>
<exclude name="**/cs/ephemeral/EphemeralStoreTest.java"/>
<exclude name="**/cs/ephemeral/migrate/MigrateAttributesTest.java"/>
<exclude name="**/cs/filter/HeaderTest.java"/>
<exclude name="**/cs/html/DefangFilterTest.java"/>
<exclude name="**/cs/html/DefangFilterTest.java"/>
<exclude name="**/cs/imap/ImapCommandThrottleTest.java"/>
<exclude name="**/cs/imap/ImapPartSpecifierTest.java"/>
<exclude name="**/cs/index/AbstractIndexStoreTest.java"/>
<exclude name="**/cs/index/IntersectionQueryOperationTest.java"/>
<exclude name="**/cs/index/LuceneIndexTest.java"/>
<exclude name="**/cs/index/LuceneQueryOperationTest.java"/>
<exclude name="**/cs/index/ZimbraAnalyzerTest.java"/>
<exclude name="**/cs/index/ZimbraQueryTest.java"/>
<exclude name="**/cs/index/analysis/UniversalAnalyzerTest.java"/>
<exclude name="**/cs/index/query/AttachmentQueryTest.java"/>
<exclude name="**/cs/index/query/ContactQueryTest.java"/>
<exclude name="**/cs/index/query/ConvQueryTest.java"/>
<exclude name="**/cs/index/query/FieldQueryTest.java"/>
<exclude name="**/cs/index/query/InQueryTest.java"/>
<exclude name="**/cs/index/query/QueryParserTest.java"/>
<exclude name="**/cs/index/query/SubjectQueryTest.java"/>
<exclude name="**/cs/index/query/TextQueryTest.java"/>
<exclude name="**/cs/mailbox/*.java"/>
<exclude name="**/cs/mailbox/acl/AclPushTest.java"/>
<exclude name="**/cs/mailclient/smtp/SmtpTransportTest.java"/>
<exclude name="**/cs/mime/FixedMimeMessageTest.java"/>
<exclude name="**/cs/mime/MimeTest.java"/>
<exclude name="**/cs/mime/ParsedMessageTest.java"/>
<exclude name="**/octosync/PatchInputStreamTest.java"/>
<exclude name="**/octosync/store/*.java"/>
<exclude name="**/redolog/op/*.java"/>
<exclude name="**/service/FeedManagerTest.java"/>
<exclude name="**/service/FileUploadServletTest.java"/>
<exclude name="**/service/GetMsgTest.java"/>
<exclude name="**/service/formatter/ArchiveFormatterTest.java"/>
<exclude name="**/service/mail/*.java"/>
<exclude name="**/util/CsrfUtilTest.java"/>
<exclude name="**/store/AbstractBlobConsistencyCheckTest.java"/>
<exclude name="**/store/AbstractStoreManagerTest.java"/>
<exclude name="**/store/FileBlobStoreTest.java"/>
<exclude name="**/store/external/*.java"/>
<exclude name="**/FileBlobStoreConsistencyCheckTest.java"/>
<exclude name="**/HttpStoreManagerTest.java"/>
<exclude name="**/ZimletUserPropertiesTest.java"/>
<exclude name="**/cs/mailbox/ContactTest.java"/>
<exclude name="**/cs/imap/ImapHandlerTest.java"/>
<exclude name="**/cs/filter/FileIntoCopyTest.java"/>
</fileset>
</batchtest>
</junit>
Expand All @@ -374,11 +325,11 @@
<report todir="${test.dir}/report"/>
</junitreport>
<echo>Test Report: ${test.dir}/report/index.html</echo>
<antcontrib:if>
<isset property="junit.failure"/>
<then><echo append="true" file="${test-results-file}" message="${test.dir} - FAILED&#xD;&#xA;"/></then>
<else><echo append="true" file="${test-results-file}" message="${test.dir} - PASSED&#xD;&#xA;"/></else>
</antcontrib:if>
<antcontrib:if>
<isset property="junit.failure"/>
<then><echo append="true" file="${test-results-file}" message="${test.dir} - FAILED&#xD;&#xA;"/></then>
<else><echo append="true" file="${test-results-file}" message="${test.dir} - PASSED&#xD;&#xA;"/></else>
</antcontrib:if>
</then>
<else>
<echo>${test.src.dir} not found. Will not run unit tests</echo>
Expand Down Expand Up @@ -435,6 +386,9 @@
<assertions><enable/></assertions>
<formatter type="xml"/>
<jvmarg value="-Xverify:none"/>
<jvmarg value="-Dserver.dir=${server.dir}"/>
<jvmarg value="-Dzimbra.config=${server.dir}/src/java-test/localconfig-test.xml"/>
<jvmarg value="-Dfile.encoding=UTF-8"/>
<test name="${test.name}" todir="${single.test.dir}/output" />
</junit>
<junitreport todir="${single.test.dir}/report">
Expand Down
42 changes: 25 additions & 17 deletions client/src/java/com/zimbra/client/ZCalDataSource.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,18 @@

import org.json.JSONException;

import com.zimbra.soap.admin.type.DataSourceType;
import com.zimbra.common.soap.Element;
import com.zimbra.common.soap.MailConstants;
import com.zimbra.common.util.SystemUtil;
import com.zimbra.soap.admin.type.DataSourceType;
import com.zimbra.soap.mail.type.CalDataSourceNameOrId;
import com.zimbra.soap.mail.type.DataSourceNameOrId;
import com.zimbra.soap.mail.type.MailCalDataSource;
import com.zimbra.soap.type.CalDataSource;
import com.zimbra.soap.type.DataSource;
import com.zimbra.soap.type.DataSources;

public class ZCalDataSource implements ZDataSource, ToZJSONObject {
public class ZCalDataSource extends ZDataSource implements ToZJSONObject {

private CalDataSource data;

public ZCalDataSource(String name, String folderId, boolean enabled) {
data = DataSources.newCalDataSource();
data.setName(name);
Expand All @@ -40,26 +41,16 @@ public ZCalDataSource(CalDataSource data) {
this.data = DataSources.newCalDataSource(data);
}

public String getId() {
return data.getId();
}

public String getName() {
return data.getName();
}

@Override
public DataSourceType getType() {
return DataSourceType.cal;
}

public String getFolderId() {
return data.getFolderId();
}

public boolean isEnabled() {
return SystemUtil.coalesce(data.isEnabled(), Boolean.FALSE);
}

@Deprecated
public Element toElement(Element parent) {
Element src = parent.addElement(MailConstants.E_DS_CAL);
src.addAttribute(MailConstants.A_ID, data.getId());
Expand All @@ -69,12 +60,29 @@ public Element toElement(Element parent) {
return src;
}

@Deprecated
public Element toIdElement(Element parent) {
Element src = parent.addElement(MailConstants.E_DS_CAL);
src.addAttribute(MailConstants.A_ID, getId());
return src;
}

@Override
public DataSource toJaxb() {
MailCalDataSource jaxbObject = new MailCalDataSource();
jaxbObject.setId(data.getId());
jaxbObject.setName(data.getName());
jaxbObject.setFolderId(data.getFolderId());
jaxbObject.setEnabled(data.isEnabled());
return jaxbObject;
}

@Override
public DataSourceNameOrId toJaxbNameOrId() {
CalDataSourceNameOrId jaxbObject = CalDataSourceNameOrId.createForId(data.getId());
return jaxbObject;
}

public ZJSONObject toZJSONObject() throws JSONException {
ZJSONObject zjo = new ZJSONObject();
zjo.put("id", data.getId());
Expand Down
122 changes: 114 additions & 8 deletions client/src/java/com/zimbra/client/ZDataSource.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,121 @@

package com.zimbra.client;

import org.json.JSONException;

import com.zimbra.common.util.SystemUtil;
import com.zimbra.soap.admin.type.DataSourceType;
import com.zimbra.common.soap.Element;
import com.zimbra.soap.mail.type.DataSourceNameOrId;
import com.zimbra.soap.mail.type.MailDataSource;
import com.zimbra.soap.mail.type.MailUnknownDataSource;
import com.zimbra.soap.type.DataSource;
import com.zimbra.soap.type.DataSources;

public class ZDataSource implements ToZJSONObject {
protected DataSource data;
public static String SOURCE_HOST_YAHOO = "yahoo.com";

public ZDataSource() {
data = DataSources.newDataSource();
data.setEnabled(false);
}

public ZDataSource(String name, boolean enabled) {
data = DataSources.newDataSource();
data.setName(name);
data.setEnabled(enabled);
}

public ZDataSource(String name, boolean enabled, Iterable<String> attributes) {
data = DataSources.newDataSource();
data.setAttributes(attributes);
data.setName(name);
data.setEnabled(enabled);
}

public ZDataSource(DataSource data) {
this.data = DataSources.newDataSource(data);
}

public DataSource toJaxb() {
MailUnknownDataSource jaxbObject = new MailUnknownDataSource();
jaxbObject.setId(data.getId());
jaxbObject.setName(data.getName());
jaxbObject.setEnabled(data.isEnabled());
jaxbObject.setFolderId(data.getFolderId());
jaxbObject.setRefreshToken(data.getRefreshToken());
jaxbObject.setRefreshTokenUrl(data.getRefreshTokenUrl());
jaxbObject.setImportOnly(data.isImportOnly());
jaxbObject.setImportClass(data.getImportClass());
jaxbObject.setHost(data.getHost());
return jaxbObject;
}

public DataSourceNameOrId toJaxbNameOrId() {
DataSourceNameOrId jaxbObject = DataSourceNameOrId.createForId(data.getId());
return jaxbObject;
}

public interface ZDataSource {

public Element toElement(Element parent);
public Element toIdElement(Element parent);
@Override
public ZJSONObject toZJSONObject() throws JSONException {
ZJSONObject zjo = new ZJSONObject();
zjo.put("id", data.getId());
zjo.put("name", data.getName());
zjo.put("enabled", data.isEnabled());
zjo.put("folderId", data.getFolderId());
zjo.put("refreshToken", data.getRefreshToken());
zjo.put("refreshTokenUrl", data.getRefreshTokenUrl());
zjo.put("importOnly", data.isImportOnly());
zjo.put("importClass", data.getImportClass());
zjo.put("host", data.getHost());
return zjo;
}

public DataSourceType getType();
public String getName();
public String getId();
public String getName() {
return data.getName();
}
public void setName(String name) {
data.setName(name);
}
public DataSourceType getType() {
return DataSourceType.unknown;
}
public String getId() {
return data.getId();
}
public void setId(String id) {
data.setId(id);
}
public String getFolderId() { return data.getFolderId(); }
public void setFolderId(String folderid) {
data.setFolderId(folderid);
}
public void setRefreshToken(String val) {
data.setRefreshToken(val);
}
public void setRefreshTokenURL(String val) {
data.setRefreshTokenUrl(val);
}
public String getRefreshToken() {
return data.getRefreshToken();
}
public String getRefreshTokenUrl() {
return data.getRefreshTokenUrl();
}
public String getImportClass() {
return data.getImportClass();
}
public void setImportClass(String importClass) {
data.setImportClass(importClass);
}
public String getHost() {
return data.getHost();
}
public void setHost(String host) {
data.setHost(host);
}
public void setEnabled(boolean enabled) { data.setEnabled(enabled); }
public boolean isEnabled() {
return SystemUtil.coalesce(data.isEnabled(), Boolean.FALSE);
}
}
2 changes: 2 additions & 0 deletions client/src/java/com/zimbra/client/ZGetInfoResult.java
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ public List<ZDataSource> getDataSources() {
newList.add(new ZCalDataSource((CalDataSource) ds));
} else if (ds instanceof RssDataSource) {
newList.add(new ZRssDataSource((RssDataSource) ds));
} else {
newList.add(new ZDataSource(ds));
}
}
return newList;
Expand Down
Loading

0 comments on commit 013d906

Please sign in to comment.