1 /******************************************************************************** 2 * InternetCafe is a software solution that helps the management of Cybercafes 3 * according with the ITALIAN DECREE LAW ON ANTI-TERROR MEASURES, 27 JULY 2005. 4 * Copyright (C) 2006 Guido Angelo Ingenito 5 6 * This program is free software; you can redistribute it and/or 7 * modify it under the terms of the GNU General Public License 8 * as published by the Free Software Foundation; either version 2 9 * of the License, or (at your option) any later version. 10 11 * This program is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with this program; if not, write to the Free Software 18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 *******************************************************************************/ 20 21 package test; 22 23 import junit.framework.TestCase; 24 25 /* 26 import java.util.Date; 27 import java.util.GregorianCalendar; 28 29 import junit.framework.TestCase; 30 31 import org.ietf.mimedir.MimeDir; 32 import org.ietf.mimedir.impl.MimeDirImpl; 33 import org.ietf.mimedir.vcard.impl.VCardImpl; 34 35 import test.base.user.User; 36 import test.base.user.UserFactory; 37 */ 38 /*** 39 * @author skunk 40 * 41 */ 42 public class ExportUserAsVCardCommandTest extends TestCase { 43 44 /* 45 * Test method for 'ui.command.IO.ExportUserAsVCardCommand.execution()' 46 */ 47 public void testExecution() throws Exception { 48 /* 49 final MimeDir.ContentLine fn = new MimeDirImpl.ContentLine(null, "FN", 50 null, new MimeDirImpl.TextValueType( 51 new String[] { "Chris Hubick" })); 52 final MimeDir.TextValueType familyName = new MimeDirImpl.TextValueType( 53 new String[] { "Hubick" }); 54 final MimeDir.TextValueType givenName = new MimeDirImpl.TextValueType( 55 new String[] { "Christopher" }); 56 final MimeDir.ContentLine n = new MimeDirImpl.ContentLine(null, "N", 57 null, new VCardImpl.StructuredValueType( 58 new MimeDir.ListValueType[] { familyName, givenName })); 59 final MimeDir.ContentLine version = new MimeDirImpl.ContentLine(null, 60 "VERSION", null, new MimeDirImpl.TextValueType( 61 new String[] { "3.0" })); 62 VCardImpl vCard = new VCardImpl(new MimeDir.ContentLine[] { fn, n, 63 version }); 64 System.out.println(vCard.toString()); 65 66 /* 67 * name,surname,gender,birthday,nickname,password,credential, Document 68 * document, String imagePath 69 */ 70 /* User user = UserFactory.newUser("Guido Angelo", "Ingenito", "Male", 71 new GregorianCalendar().getTime(), "skunk", "password", 72 "Administrator", null, ""); 73 */ 74 /* 75 * MimeDir.ContentLine(String group, String name, 76 * MimeDir.ContentLine.Parameter[] parameters, MimeDir.ValueType 77 * valueType 78 */ 79 /* 80 MimeDir.ContentLine firstName = new MimeDirImpl.ContentLine(null, 81 "First Name", null, new MimeDirImpl.TextValueType( 82 new String[] { user.getName() })); 83 MimeDir.ContentLine lastName = new MimeDirImpl.ContentLine(null, 84 "Last Name", null, new MimeDirImpl.TextValueType( 85 new String[] { user.getSurname() })); 86 MimeDir.ContentLine nickname = new MimeDirImpl.ContentLine(null, 87 "Nickname", null, new MimeDirImpl.TextValueType( 88 new String[] { user.getNickname() })); 89 90 MimeDir.DateValueType birthdayDateValueType = new MimeDirImpl.DateValueType( 91 new Date[] { user.getBirthday() }); 92 MimeDir.ContentLine birthdayContentLine = new MimeDirImpl.ContentLine( 93 null, "Birthday", null, new VCardImpl.StructuredValueType( 94 new MimeDir.ListValueType[] { birthdayDateValueType })); 95 MimeDir.ContentLine credential = new MimeDirImpl.ContentLine(null, 96 "Credential", null, new MimeDirImpl.TextValueType( 97 new String[] { user.getCredential() })); 98 */ 99 /* 100 * BufferedImage bufferedImage = ImageIO.read(new 101 * File(user.getImagePath())); javax.imageio. VCard.BinaryValueType 102 * photo = new VCardImpl.BinaryValueType(Image().getBytes()); 103 */ 104 105 /*vCard = new VCardImpl(new MimeDir.ContentLine[] { firstName, lastName, 106 nickname, birthdayContentLine, credential, version }); 107 System.out.println(vCard.toString()); 108 */ 109 110 } 111 112 }