[4890] | 1 | package org.expressolivre.cte.calendar.adicionar; |
---|
[3745] | 2 | |
---|
[4917] | 3 | import java.text.ParseException; |
---|
[3745] | 4 | import java.text.SimpleDateFormat; |
---|
| 5 | import java.util.Calendar; |
---|
[4917] | 6 | import java.util.Date; |
---|
[3745] | 7 | |
---|
[3782] | 8 | import org.expressolivre.cte.common.BaseCalendarTestCase; |
---|
| 9 | import org.expressolivre.cte.pages.calendar.AppointmentPage; |
---|
[4864] | 10 | import org.testng.annotations.Optional; |
---|
[3745] | 11 | import org.testng.annotations.Parameters; |
---|
| 12 | import org.testng.annotations.Test; |
---|
| 13 | |
---|
| 14 | /** |
---|
[3799] | 15 | * Suite:[FUN03.2] Adicionar Compromisso |
---|
| 16 | * |
---|
[4890] | 17 | * Caso de Teste: EL-940:Adicionar compromisso sem repeticao |
---|
| 18 | * |
---|
| 19 | * Link: http://testlink.expressolivre.org/linkto.php?tprojectPrefix=EL&item= |
---|
| 20 | * testcase&id=EL-940 |
---|
| 21 | * |
---|
[3745] | 22 | * @author L.F.Estivalet (Serpro) |
---|
| 23 | * |
---|
| 24 | * Created on Feb 8, 2011 at 9:36:08 AM |
---|
| 25 | * |
---|
| 26 | */ |
---|
[5099] | 27 | public class AdicionarCompromissoSemRepeticaoTestCase extends |
---|
| 28 | BaseCalendarTestCase { |
---|
[3745] | 29 | |
---|
[4917] | 30 | @Parameters({ "tipo", "titulo", "descricao", "local", "dataInicial", |
---|
| 31 | "horaInicial", "minutoInicial", "dataFinal", "horaFinal", |
---|
| 32 | "minutoFinal", "prioridade" }) |
---|
[4864] | 33 | @Test |
---|
[5099] | 34 | public void adicionarCompromissoSemRepeticao( |
---|
| 35 | @Optional("Normal") String tipo, String titulo, |
---|
| 36 | @Optional("") String descricao, @Optional("") String local, |
---|
| 37 | @Optional("") String dataInicial, String horaInicial, |
---|
| 38 | String minutoInicial, @Optional("") String dataFinal, |
---|
| 39 | String horaFinal, String minutoFinal, |
---|
| 40 | @Optional("Normal") String prioridade) throws ParseException { |
---|
[3745] | 41 | |
---|
| 42 | Calendar cal = Calendar.getInstance(); |
---|
| 43 | SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd"); |
---|
| 44 | SimpleDateFormat sdf2 = new SimpleDateFormat("dd/MM/yyyy"); |
---|
| 45 | |
---|
[4917] | 46 | // Se a data inicial nao for informada, pega data corrente. |
---|
| 47 | if ("".equals(dataInicial)) { |
---|
| 48 | dataInicial = sdf2.format(cal.getTime()); |
---|
| 49 | } |
---|
| 50 | |
---|
| 51 | // Se a data final nao for informada, pega data corrente. |
---|
| 52 | if ("".equals(dataFinal)) { |
---|
| 53 | dataFinal = sdf2.format(cal.getTime()); |
---|
| 54 | } |
---|
| 55 | |
---|
| 56 | // Transforma a data inicial informada (dd/MM/yyyy) para (yyyyMMdd) |
---|
| 57 | Date dtIni = sdf2.parse(dataInicial); |
---|
| 58 | |
---|
| 59 | AppointmentPage ap = super.newAppointment(sdf.format(dtIni)); |
---|
[4902] | 60 | ap.setType(tipo); |
---|
| 61 | ap.setTitle(titulo); |
---|
| 62 | ap.setDescription(descricao); |
---|
| 63 | ap.setLocation(local); |
---|
[4917] | 64 | ap.setStartDate(dataInicial); |
---|
[4902] | 65 | ap.setStartHour(horaInicial); |
---|
| 66 | ap.setStartMinute(minutoInicial); |
---|
[4917] | 67 | ap.setEndDate(dataFinal); |
---|
[4902] | 68 | ap.setEndHour(horaFinal); |
---|
| 69 | ap.setEndMinute(minutoFinal); |
---|
| 70 | ap.setPriority(prioridade); |
---|
[3745] | 71 | ap.saveAppointment(); |
---|
| 72 | } |
---|
| 73 | } |
---|