package org.wso2.carbon.device.mgt.ios.payload.beans;

import org.testng.Assert;
import org.testng.annotations.Test;
import org.wso2.carbon.device.mgt.ios.payload.dto.PayloadOperationWrapper;
import org.wso2.carbon.device.mgt.ios.payload.exception.PListException;
import org.wso2.carbon.device.mgt.ios.payload.exception.ProfileConfigurationException;
import org.wso2.carbon.device.mgt.ios.payload.operation.CalendarOperations;

public class CalDAVTestSuite {


    @Test(expectedExceptions = ProfileConfigurationException.class)
    public void testHostName() throws ProfileConfigurationException {

        CalDAV calDAV = new CalDAV();
        calDAV.setHostName("");
        calDAV.validateRequest();

    }

    @Test(expectedExceptions = ProfileConfigurationException.class)
    public void testUsername() throws ProfileConfigurationException {

        CalDAV calDAV = new CalDAV();
        calDAV.setHostName("hostname");
        calDAV.setUsername("");
        calDAV.validateRequest();

    }

    @Test
    public void testCalDAVPayload() throws ProfileConfigurationException, PListException {

        CalDAV calDAV = new CalDAV();
        calDAV.setAccountDescription("Account description");
        calDAV.setHostName("hostname");
        calDAV.setUsername("username");
        calDAV.setPassword("password");
        calDAV.setUseSSL(true);
        calDAV.setPort(123);
        calDAV.setPrincipalURL("principal_url");
        calDAV.validateRequest();

        CalendarOperations calendarOperations = new CalendarOperations();
        PayloadOperationWrapper payload = calendarOperations.createCalDAVPayload(calDAV);

        Assert.assertNotNull(payload);

    }
}
