1 | package org.expressolivre.cte.calendar.compartilhar; |
---|
2 | |
---|
3 | import java.text.ParseException; |
---|
4 | import java.text.SimpleDateFormat; |
---|
5 | import java.util.Calendar; |
---|
6 | import java.util.Date; |
---|
7 | |
---|
8 | import org.expressolivre.cte.common.BaseCalendarTestCase; |
---|
9 | import org.expressolivre.cte.common.Config; |
---|
10 | import org.expressolivre.cte.pages.calendar.AppointmentPage; |
---|
11 | import org.expressolivre.cte.pages.calendar.CalendarTodayViewPage; |
---|
12 | import org.testng.annotations.Optional; |
---|
13 | import org.testng.annotations.Parameters; |
---|
14 | import org.testng.annotations.Test; |
---|
15 | |
---|
16 | /** |
---|
17 | * Suite:[FUN03.7] Compartilhar agenda |
---|
18 | * |
---|
19 | * Caso de Teste: EL-985:Adicionar evento à agenda compartilhada com permissão |
---|
20 | * |
---|
21 | * Link: http://testlink.expressolivre.org/linkto.php?tprojectPrefix=EL&item= |
---|
22 | * testcase&id=EL-985 |
---|
23 | * |
---|
24 | * @author L.F.Estivalet (Serpro) |
---|
25 | * |
---|
26 | * Created on Aug 24, 2011 at 2:52:19 PM |
---|
27 | * |
---|
28 | */ |
---|
29 | public class AdicionarCompromissoAgendaTestCase extends BaseCalendarTestCase { |
---|
30 | |
---|
31 | @Parameters({ "owner", "tipo", "titulo", "descricao", "local", |
---|
32 | "dataInicial", "horaInicial", "minutoInicial", "dataFinal", |
---|
33 | "horaFinal", "minutoFinal", "prioridade" }) |
---|
34 | @Test |
---|
35 | public void adicionarCompromissoAgendaCompartilhada(String owner, |
---|
36 | @Optional("Normal") String tipo, String titulo, |
---|
37 | @Optional("") String descricao, @Optional("") String local, |
---|
38 | @Optional("") String dataInicial, String horaInicial, |
---|
39 | String minutoInicial, @Optional("") String dataFinal, |
---|
40 | String horaFinal, String minutoFinal, |
---|
41 | @Optional("Normal") String prioridade) throws ParseException { |
---|
42 | CalendarTodayViewPage ctvp = super.openTodayView(); |
---|
43 | |
---|
44 | // Busca o nome do usuario do arquivo de confirguracao. |
---|
45 | String userName = Config.getInstance().getConfig(owner + ".name"); |
---|
46 | // Muda dono do compromisso. |
---|
47 | ctvp.setOwner(userName); |
---|
48 | |
---|
49 | Calendar cal = Calendar.getInstance(); |
---|
50 | SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd"); |
---|
51 | SimpleDateFormat sdf2 = new SimpleDateFormat("dd/MM/yyyy"); |
---|
52 | |
---|
53 | // Se a data inicial nao for informada, pega data corrente. |
---|
54 | if ("".equals(dataInicial)) { |
---|
55 | dataInicial = sdf2.format(cal.getTime()); |
---|
56 | } |
---|
57 | |
---|
58 | // Se a data final nao for informada, pega data corrente. |
---|
59 | if ("".equals(dataFinal)) { |
---|
60 | dataFinal = sdf2.format(cal.getTime()); |
---|
61 | } |
---|
62 | |
---|
63 | // Transforma a data inicial informada (dd/MM/yyyy) para (yyyyMMdd) |
---|
64 | Date dtIni = sdf2.parse(dataInicial); |
---|
65 | |
---|
66 | AppointmentPage ap = super.newAppointment(sdf.format(dtIni)); |
---|
67 | ap.setType(tipo); |
---|
68 | ap.setTitle(titulo); |
---|
69 | ap.setDescription(descricao); |
---|
70 | ap.setLocation(local); |
---|
71 | ap.setStartDate(dataInicial); |
---|
72 | ap.setStartHour(horaInicial); |
---|
73 | ap.setStartMinute(minutoInicial); |
---|
74 | ap.setEndDate(dataFinal); |
---|
75 | ap.setEndHour(horaFinal); |
---|
76 | ap.setEndMinute(minutoFinal); |
---|
77 | ap.setPriority(prioridade); |
---|
78 | ap.saveAppointment(); |
---|
79 | } |
---|
80 | |
---|
81 | } |
---|