use of com.zimbra.soap.account.message.ModifyPrefsRequest in project zm-mailbox by Zimbra.
the class ModifyPrefsTest method testPrefCalendarInitialViewYear.
@Test
public void testPrefCalendarInitialViewYear() throws Exception {
Account acct1 = Provisioning.getInstance().get(Key.AccountBy.name, "test@zimbra.com");
Mailbox mbox = MailboxManager.getInstance().getMailboxByAccount(acct1);
ModifyPrefsRequest request = new ModifyPrefsRequest();
Pref pref = new Pref(Provisioning.A_zimbraPrefCalendarInitialView, "year");
request.addPref(pref);
Element req = JaxbUtil.jaxbToElement(request);
new ModifyPrefs().handle(req, ServiceTestUtil.getRequestContext(mbox.getAccount()));
new ModifyPrefs().handle(req, ServiceTestUtil.getRequestContext(mbox.getAccount()));
Assert.assertFalse(acct1.getPrefCalendarInitialView().isDay());
Assert.assertTrue(acct1.getPrefCalendarInitialView().isYear());
}
use of com.zimbra.soap.account.message.ModifyPrefsRequest in project zm-mailbox by Zimbra.
the class ModifyPrefsTest method testMsgMaxAttr.
@Test
public void testMsgMaxAttr() throws Exception {
Account acct1 = Provisioning.getInstance().get(Key.AccountBy.name, "test@zimbra.com");
Mailbox mbox = MailboxManager.getInstance().getMailboxByAccount(acct1);
acct1.setFeatureMailForwardingEnabled(true);
acct1.setFeatureAddressVerificationEnabled(true);
Assert.assertNull(acct1.getPrefMailForwardingAddress());
Assert.assertNull(acct1.getFeatureAddressUnderVerification());
ModifyPrefsRequest request = new ModifyPrefsRequest();
Pref pref = new Pref(Provisioning.A_zimbraPrefMailForwardingAddress, "test1@somedomain.com");
request.addPref(pref);
Element req = JaxbUtil.jaxbToElement(request);
new ModifyPrefs().handle(req, ServiceTestUtil.getRequestContext(mbox.getAccount()));
/*
* Verify that the forwarding address is not directly stored into
* 'zimbraPrefMailForwardingAddress' Instead, it is stored in
* 'zimbraFeatureAddressUnderVerification' till the time it
* gets verification
*/
Assert.assertNull(acct1.getPrefMailForwardingAddress());
Assert.assertEquals("test1@somedomain.com", acct1.getFeatureAddressUnderVerification());
/*
* disable the verification feature and check that the forwarding
* address is directly stored into 'zimbraPrefMailForwardingAddress'
*/
acct1.setPrefMailForwardingAddress(null);
acct1.setFeatureAddressUnderVerification(null);
acct1.setFeatureAddressVerificationEnabled(false);
new ModifyPrefs().handle(req, ServiceTestUtil.getRequestContext(mbox.getAccount()));
Assert.assertNull(acct1.getFeatureAddressUnderVerification());
Assert.assertEquals("test1@somedomain.com", acct1.getPrefMailForwardingAddress());
Assert.assertEquals(FeatureAddressVerificationStatus.pending, acct1.getFeatureAddressVerificationStatus());
}
use of com.zimbra.soap.account.message.ModifyPrefsRequest in project zm-mailbox by Zimbra.
the class JaxbToElementTest method modifyPrefs.
@Test
public void modifyPrefs() throws Exception {
ModifyPrefsRequest req = new ModifyPrefsRequest();
req.addPref(new Pref("zimbraPrefGroupMailBy", "message"));
req.addPref(new Pref("zimbraPrefMailItemsPerPage", "200"));
// method of adding to multivalue
req.addPref(new Pref("+zimbraPrefTimeZoneId", "Africa/Harare"));
// method of setting multivalue
req.addPref(new Pref("zimbraPrefSpellIgnoreWord", "zimbra"));
req.addPref(new Pref("zimbraPrefSpellIgnoreWord", "jaxb"));
Element jsonElem = JacksonUtil.jaxbToJSONElement(req);
Assert.assertNotNull("JSON Element", jsonElem);
Assert.assertEquals("JSON", modifyPrefsAsJson, jsonElem.toString());
req = JaxbUtil.elementToJaxb(jsonElem);
List<Pref> prefs = req.getPrefs();
Assert.assertEquals("Number of round tripped prefs", 5, prefs.size());
}
use of com.zimbra.soap.account.message.ModifyPrefsRequest in project zm-mailbox by Zimbra.
the class TestCalDav method setZimbraPrefAppleIcalDelegationEnabled.
private void setZimbraPrefAppleIcalDelegationEnabled(ZMailbox mbox, Boolean val) throws ServiceException {
ModifyPrefsRequest modPrefsReq = new ModifyPrefsRequest();
Pref pref = Pref.createPrefWithNameAndValue(ZAttrProvisioning.A_zimbraPrefAppleIcalDelegationEnabled, val.toString().toUpperCase());
modPrefsReq.addPref(pref);
ModifyPrefsResponse modPrefsResp = mbox.invokeJaxb(modPrefsReq);
assertNotNull("null ModifyPrefs Response for forwarding calendar invites/no auto-add", modPrefsResp);
}
use of com.zimbra.soap.account.message.ModifyPrefsRequest in project zm-mailbox by Zimbra.
the class TestInvite method testBug86864DelegateInboxInviteLooksLikeInvite.
public void testBug86864DelegateInboxInviteLooksLikeInvite() throws Exception {
TestUtil.createAccount(ORGANIZER);
Account attendee = TestUtil.createAccount(ATTENDEE);
Account delegate = TestUtil.createAccount(DELEGATE);
ZMailbox mboxOrganizer = TestUtil.getZMailbox(ORGANIZER);
ZMailbox mboxAttendee = TestUtil.getZMailbox(ATTENDEE);
ZMailbox mboxDelegate = TestUtil.getZMailbox(DELEGATE);
String subject = NAME_PREFIX + " for testing treatment at delegate inbox";
Date startDate = new Date(System.currentTimeMillis() + Constants.MILLIS_PER_DAY);
Date endDate = new Date(startDate.getTime() + Constants.MILLIS_PER_HOUR);
String calendarId = Integer.valueOf(Mailbox.ID_FOLDER_CALENDAR).toString();
FolderActionSelector action = new FolderActionSelector(calendarId, /* id */
"grant");
ActionGrantSelector grant = new ActionGrantSelector("rwidxa", /* perm */
"usr");
grant.setDisplayName(delegate.getName());
grant.setPassword("");
action.setGrant(grant);
FolderActionRequest folderActionReq = new FolderActionRequest(action);
FolderActionResponse folderActionResp = mboxAttendee.invokeJaxb(folderActionReq);
assertNotNull("null FolderAction Response used to share folder", folderActionResp);
ModifyPrefsRequest modPrefsReq = new ModifyPrefsRequest();
Pref fwdInvitesPref = Pref.createPrefWithNameAndValue(ZAttrProvisioning.A_zimbraPrefCalendarForwardInvitesTo, delegate.getName());
modPrefsReq.addPref(fwdInvitesPref);
Pref noAutoAddPref = Pref.createPrefWithNameAndValue(ZAttrProvisioning.A_zimbraPrefCalendarAutoAddInvites, Boolean.FALSE.toString().toUpperCase());
modPrefsReq.addPref(noAutoAddPref);
ModifyPrefsResponse modPrefsResp = mboxAttendee.invokeJaxb(modPrefsReq);
assertNotNull("null ModifyPrefs Response for forwarding calendar invites/no auto-add", modPrefsResp);
NewMountpointSpec mpSpec = new NewMountpointSpec("Shared Calendar");
mpSpec.setFlags("#");
mpSpec.setRemoteId(Mailbox.ID_FOLDER_CALENDAR);
mpSpec.setColor((byte) 4);
mpSpec.setOwnerId(attendee.getId());
mpSpec.setFolderId(Integer.valueOf(Mailbox.ID_FOLDER_USER_ROOT).toString());
mpSpec.setDefaultView(MailItem.Type.APPOINTMENT.toString());
CreateMountpointRequest createMpReq = new CreateMountpointRequest(mpSpec);
CreateMountpointResponse createMpResp = mboxDelegate.invokeJaxb(createMpReq);
assertNotNull("null ModifyPrefs Response for forwarding calendar invites", createMpResp);
TestUtil.createAppointment(mboxOrganizer, subject, attendee.getName(), startDate, endDate);
ZMessage inviteMsg = TestUtil.waitForMessage(mboxDelegate, "in:inbox " + subject);
assertNotNull("null inviteMsg in delegate inbox", inviteMsg);
MsgSpec msgSpec = new MsgSpec(inviteMsg.getId());
msgSpec.setWantHtml(true);
msgSpec.setNeedCanExpand(true);
msgSpec.setMaxInlinedLength(250000);
GetMsgRequest getMsgReq = new GetMsgRequest(msgSpec);
GetMsgResponse getMsgResp = mboxDelegate.invokeJaxb(getMsgReq);
assertNotNull("null GetMsgResponse in delegate inbox", getMsgResp);
MsgWithGroupInfo msg = getMsgResp.getMsg();
assertNotNull("null message in GetMsgResponse in delegate inbox", msg);
InviteWithGroupInfo invite = msg.getInvite();
assertNotNull("null invite in message in GetMsgResponse in delegate inbox regression to Bug 86864?", invite);
}
Aggregations