Search in sources :

Example 1 with SearchCalendarResourcesResponse

use of com.zimbra.soap.account.message.SearchCalendarResourcesResponse in project zm-mailbox by Zimbra.

the class TestSearchCalendarResources method chineseChar.

@Test
public void chineseChar() throws Exception {
    Map<String, Object> attrs = Maps.newHashMap();
    attrs.put(Provisioning.A_displayName, "\u4e2d\u6587");
    attrs.put(Provisioning.A_zimbraCalResType, Provisioning.CalResType.Location.name());
    attrs.put(Provisioning.A_zimbraCalResSite, "\u4e2d\u6587");
    CalendarResource cr = provUtil.createCalendarResource("chineseChar", domain, attrs);
    String crName = cr.getName();
    /*
         * 
         filter="(&(&(&(|(displayName=*\E4\B8\AD\E6\96\87*)(cn=*\E4\B8\AD\E6\96\87*)(sn=*\E4\B8\AD\E6\96\87*)(givenName=*\E4\B8\AD\E6\96\87*)(?mail=*\E4\B8\AD\E6\96\87*)(?zimbraMailDeliveryAddress=*\E4\B8\AD\E6\96\87*)(?zimbraMailAlias=*\E4\B8\AD\E6\96\87*))(objectClass=zimbraCalendarResource)(zimbraAccountStatus=active))(!(zimbraHideInGal=TRUE))(!(zimbraIsSystemResource=TRUE)))(&(zimbraCalResType=location)(zimbraCalResSite=*\E4\B8\AD\E6\96\87*)))"
         */
    SoapTransport transport = authUser("user1@phoebe.mbp");
    SearchCalendarResourcesRequest req = new SearchCalendarResourcesRequest("\u4e2d\u6587");
    EntrySearchFilterMultiCond conds = new EntrySearchFilterMultiCond();
    EntrySearchFilterSingleCond cond;
    cond = new EntrySearchFilterSingleCond();
    cond.setAttr(Provisioning.A_zimbraCalResType);
    cond.setOp("eq");
    cond.setValue("Location");
    conds.addCondition(cond);
    cond = new EntrySearchFilterSingleCond();
    cond.setAttr(Provisioning.A_zimbraCalResSite);
    cond.setOp("has");
    cond.setValue("\u4e2d\u6587");
    conds.addCondition(cond);
    EntrySearchFilterInfo filter = new EntrySearchFilterInfo();
    filter.setCondition(conds);
    req.setSearchFilter(filter);
    SearchCalendarResourcesResponse resp = invokeJaxb(transport, req);
    List<CalendarResourceInfo> crInfo = resp.getCalendarResources();
    assertEquals(1, crInfo.size());
    assertEquals(crName, crInfo.get(0).getName());
}
Also used : SearchCalendarResourcesResponse(com.zimbra.soap.account.message.SearchCalendarResourcesResponse) CalendarResourceInfo(com.zimbra.soap.account.type.CalendarResourceInfo) EntrySearchFilterMultiCond(com.zimbra.soap.account.type.EntrySearchFilterMultiCond) SearchCalendarResourcesRequest(com.zimbra.soap.account.message.SearchCalendarResourcesRequest) CalendarResource(com.zimbra.cs.account.CalendarResource) EntrySearchFilterInfo(com.zimbra.soap.account.type.EntrySearchFilterInfo) SoapTransport(com.zimbra.common.soap.SoapTransport) EntrySearchFilterSingleCond(com.zimbra.soap.account.type.EntrySearchFilterSingleCond) Test(org.junit.Test)

Example 2 with SearchCalendarResourcesResponse

use of com.zimbra.soap.account.message.SearchCalendarResourcesResponse in project zm-mailbox by Zimbra.

the class TestSearchCalendarResources method reservedChar.

@Test
@Bug(bug = 67045)
public void reservedChar() throws Exception {
    Map<String, Object> attrs = Maps.newHashMap();
    attrs.put(Provisioning.A_displayName, "name()");
    attrs.put(Provisioning.A_zimbraCalResType, Provisioning.CalResType.Location.name());
    attrs.put(Provisioning.A_zimbraCalResSite, "Site()");
    attrs.put(Provisioning.A_zimbraCalResCapacity, "10");
    attrs.put(Provisioning.A_zimbraCalResBuilding, "Building()");
    attrs.put(Provisioning.A_zimbraNotes, "Notes()");
    attrs.put(Provisioning.A_zimbraCalResFloor, "()");
    CalendarResource cr = provUtil.createCalendarResource("reservedChar", domain, attrs);
    String crName = cr.getName();
    /*
        <SearchCalendarResourcesRequest xmlns="urn:zimbraAccount" 
            attrs="fullName,email,zimbraCalResLocationDisplayName,zimbraCalResContactEmail,notes,zimbraCalResType">
            <name>()</name>
            <searchFilter>
                <conds>
                  <cond op="eq" value="Location" attr="zimbraCalResType"/>
                  <cond op="has" value="()" attr="zimbraCalResSite"/>
                  <cond op="ge" value="9" attr="zimbraCalResCapacity"/>
                  <cond op="has" value="()" attr="zimbraCalResBuilding"/>
                  <cond op="has" value="()" attr="zimbraNotes"/>
                  <cond op="eq" value="()" attr="zimbraCalResFloor"/>
                </conds>
            </searchFilter>
        </SearchCalendarResourcesRequest>
        
        Expected filer:
        filter="(&(&(&(|(displayName=*\28\29*)(cn=*\28\29*)(sn=*\28\29*)(givenName=*\28\29*)(mail=*\28\29*)(zimbraMailDeliveryAddress=*\28\29*)(zimbraMailAlias=*\28\29*))(objectClass=zimbraCalendarResource)(zimbraAccountStatus=active))(!(zimbraHideInGal=TRUE))(!(zimbraIsSystemResource=TRUE)))(&(zimbraCalResType=location)(zimbraCalResSite=*\28\29*)(zimbraCalResCapacity>=9)(zimbraCalResBuilding=*\28\29*)(zimbraNotes=*\28\29*)(zimbraCalResFloor=\28\29)))"
        */
    SoapTransport transport = authUser("user1@phoebe.mbp");
    SearchCalendarResourcesRequest req = new SearchCalendarResourcesRequest("()");
    EntrySearchFilterMultiCond conds = new EntrySearchFilterMultiCond();
    EntrySearchFilterSingleCond cond;
    cond = new EntrySearchFilterSingleCond();
    cond.setAttr(Provisioning.A_zimbraCalResType);
    cond.setOp("eq");
    cond.setValue("Location");
    conds.addCondition(cond);
    cond = new EntrySearchFilterSingleCond();
    cond.setAttr(Provisioning.A_zimbraCalResSite);
    cond.setOp("has");
    cond.setValue("()");
    conds.addCondition(cond);
    cond = new EntrySearchFilterSingleCond();
    cond.setAttr(Provisioning.A_zimbraCalResCapacity);
    cond.setOp("ge");
    cond.setValue("9");
    conds.addCondition(cond);
    cond = new EntrySearchFilterSingleCond();
    cond.setAttr(Provisioning.A_zimbraCalResBuilding);
    cond.setOp("has");
    cond.setValue("()");
    conds.addCondition(cond);
    cond = new EntrySearchFilterSingleCond();
    cond.setAttr(Provisioning.A_zimbraNotes);
    cond.setOp("has");
    cond.setValue("()");
    conds.addCondition(cond);
    cond = new EntrySearchFilterSingleCond();
    cond.setAttr(Provisioning.A_zimbraCalResFloor);
    cond.setOp("eq");
    cond.setValue("()");
    conds.addCondition(cond);
    EntrySearchFilterInfo filter = new EntrySearchFilterInfo();
    filter.setCondition(conds);
    req.setSearchFilter(filter);
    SearchCalendarResourcesResponse resp = invokeJaxb(transport, req);
    List<CalendarResourceInfo> crInfo = resp.getCalendarResources();
    assertEquals(1, crInfo.size());
    assertEquals(crName, crInfo.get(0).getName());
}
Also used : SearchCalendarResourcesResponse(com.zimbra.soap.account.message.SearchCalendarResourcesResponse) CalendarResourceInfo(com.zimbra.soap.account.type.CalendarResourceInfo) EntrySearchFilterMultiCond(com.zimbra.soap.account.type.EntrySearchFilterMultiCond) SearchCalendarResourcesRequest(com.zimbra.soap.account.message.SearchCalendarResourcesRequest) CalendarResource(com.zimbra.cs.account.CalendarResource) EntrySearchFilterInfo(com.zimbra.soap.account.type.EntrySearchFilterInfo) SoapTransport(com.zimbra.common.soap.SoapTransport) EntrySearchFilterSingleCond(com.zimbra.soap.account.type.EntrySearchFilterSingleCond) Test(org.junit.Test) Bug(com.zimbra.qa.QA.Bug)

Aggregations

SoapTransport (com.zimbra.common.soap.SoapTransport)2 CalendarResource (com.zimbra.cs.account.CalendarResource)2 SearchCalendarResourcesRequest (com.zimbra.soap.account.message.SearchCalendarResourcesRequest)2 SearchCalendarResourcesResponse (com.zimbra.soap.account.message.SearchCalendarResourcesResponse)2 CalendarResourceInfo (com.zimbra.soap.account.type.CalendarResourceInfo)2 EntrySearchFilterInfo (com.zimbra.soap.account.type.EntrySearchFilterInfo)2 EntrySearchFilterMultiCond (com.zimbra.soap.account.type.EntrySearchFilterMultiCond)2 EntrySearchFilterSingleCond (com.zimbra.soap.account.type.EntrySearchFilterSingleCond)2 Test (org.junit.Test)2 Bug (com.zimbra.qa.QA.Bug)1