xref: /AOO41X/test/testuno/source/fvt/uno/sd/file/CheckFileProperties.java (revision 54628ca40d27d15cc98fe861da7fff7e60c2f7d6)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 /**
22  *
23  */
24 package fvt.uno.sd.file;
25 import static org.junit.Assert.*;
26 
27 import org.junit.After;
28 import org.junit.AfterClass;
29 import org.junit.Before;
30 import org.junit.BeforeClass;
31 import org.junit.Test;
32 import org.openoffice.test.uno.UnoApp;
33 import org.openoffice.test.common.FileUtil;
34 import org.openoffice.test.common.Testspace;
35 
36 import com.sun.star.beans.IllegalTypeException;
37 import com.sun.star.beans.Property;
38 import com.sun.star.beans.PropertyAttribute;
39 import com.sun.star.beans.PropertyExistException;
40 import com.sun.star.beans.PropertyValue;
41 import com.sun.star.beans.UnknownPropertyException;
42 import com.sun.star.beans.XPropertyContainer;
43 import com.sun.star.beans.XPropertySet;
44 import com.sun.star.beans.XPropertySetInfo;
45 import com.sun.star.container.XNameAccess;
46 import com.sun.star.document.XDocumentProperties;
47 import com.sun.star.document.XDocumentPropertiesSupplier;
48 import java.util.Calendar;
49 import com.sun.star.util.DateTime;
50 import com.sun.star.util.Date;
51 import com.sun.star.util.Duration;
52 import com.sun.star.lang.IllegalArgumentException;
53 import com.sun.star.lang.WrappedTargetException;
54 import com.sun.star.lang.XComponent;
55 import com.sun.star.lang.XMultiServiceFactory;
56 import com.sun.star.uno.UnoRuntime;
57 
58 /**
59  * @author LouQL
60  *
61  */
62 public class CheckFileProperties {
63 
64     private static final UnoApp app = new UnoApp();
65 
66     private XComponent m_xSDComponent = null;
67     private static String m_filePath = null;
68 
69     @Before
70     public void setUpDocument() throws Exception {
71         if (FileUtil.fileExists(m_filePath)) {//load
72             m_xSDComponent = app.loadDocument(m_filePath);
73         } else {//new
74             m_xSDComponent = (XComponent) UnoRuntime.queryInterface(
75                     XComponent.class, app.newDocument("simpress"));
76         }
77     }
78 
79     private String getUserName() throws com.sun.star.uno.Exception
80     {
81         Object configurationProvider = app.getServiceFactory().
82                 createInstance("com.sun.star.configuration.ConfigurationProvider");
83 
84         XMultiServiceFactory msFac = (XMultiServiceFactory)UnoRuntime.queryInterface(
85                 XMultiServiceFactory.class, configurationProvider);
86 
87         PropertyValue[] propValue = new PropertyValue[1];
88         propValue[0] = new PropertyValue();
89         propValue[0].Name = "nodepath";
90         propValue[0].Value = "/org.openoffice.UserProfile/Data";
91 
92         Object configurationAccess = msFac.createInstanceWithArguments(
93                 "com.sun.star.configuration.ConfigurationAccess", propValue);
94         XNameAccess nameAcc = (XNameAccess)UnoRuntime.queryInterface(XNameAccess.class, configurationAccess);
95         String givenname = (String)nameAcc.getByName("givenname");
96         String sn = (String)nameAcc.getByName("sn");
97         String name = null;
98         if(givenname.length() == 0) name = sn;
99         else    name = givenname+" "+sn;
100 
101         return name;
102     }
103 
104     private XDocumentProperties getDocumentProperties(){
105         XDocumentPropertiesSupplier xDocumentProSupplier = (XDocumentPropertiesSupplier)UnoRuntime.queryInterface(
106                 XDocumentPropertiesSupplier.class, this.m_xSDComponent);
107         return xDocumentProSupplier.getDocumentProperties();
108     }
109 
110     @After
111     public void tearDownDocument() {
112         app.closeDocument(m_xSDComponent);
113         m_filePath = Testspace.getPath("temp/CheckFileProperties.odp");
114         FileUtil.deleteFile(m_filePath);
115 
116     }
117 
118     @BeforeClass
119     public static void setUpConnection() throws Exception {
120         app.start();
121         m_filePath = Testspace.getPath("temp/CheckFileProperties.odp");
122         FileUtil.deleteFile(m_filePath);
123     }
124 
125     @AfterClass
126     public static void tearDownConnection() throws InterruptedException,
127             Exception {
128         app.close();
129     }
130 
131     /*
132      * UI entry: File->Properties->General->Created*/
133     @Test
134     public void testGeneralAuthor() throws Exception {
135         String author = getUserName();
136         XDocumentProperties xDocPro = getDocumentProperties();
137         xDocPro.setAuthor(author);
138 
139         app.saveDocument(m_xSDComponent, m_filePath);
140         app.closeDocument(m_xSDComponent);
141         m_xSDComponent = app.loadDocument(m_filePath);
142         XDocumentProperties xDocPro2 = getDocumentProperties();
143         assertEquals("Author should be "+ author, author, xDocPro2.getAuthor());
144     }
145 
146     private boolean DateTimeEquals(DateTime datetime1, DateTime datetime2){
147 
148         if(datetime1.Seconds == datetime2.Seconds &&
149                 datetime1.Minutes == datetime2.Minutes &&
150                 datetime1.Hours == datetime2.Hours &&
151                 datetime1.Day == datetime2.Day &&
152                 datetime1.Month == datetime2.Month &&
153                 datetime1.Year == datetime2.Year)
154             return true;
155         else
156             return false;
157     }
158 
159     private boolean DateEquals(Date date1, Date date2){
160 
161         if(date1.Day == date2.Day &&
162            date1.Month == date2.Month &&
163             date1.Year == date2.Year)
164             return true;
165         else
166             return false;
167     }
168 
169     private boolean DurationEquals(Duration d1, Duration d2){
170 
171         if(d1.Seconds == d2.Seconds &&
172                 d1.Minutes == d2.Minutes &&
173                 d1.Hours == d2.Hours &&
174                 d1.Days == d2.Days &&
175                 d1.Months == d2.Months &&
176                 d1.Years == d2.Years)
177             return true;
178         else
179             return false;
180     }
181 
182     private DateTime getCurrentDateTime(){
183         Calendar ca = Calendar.getInstance();
184         DateTime currentDateTime = new DateTime();
185         currentDateTime.Year = (short)ca.get(Calendar.YEAR);
186         currentDateTime.Month = (short)ca.get(Calendar.MONTH);
187         currentDateTime.Day = (short)ca.get(Calendar.DATE);
188         currentDateTime.Minutes = (short)ca.get(Calendar.MINUTE);
189         currentDateTime.Hours = (short)ca.get(Calendar.HOUR);
190         currentDateTime.Seconds = (short)ca.get(Calendar.SECOND);
191 
192         return currentDateTime;
193     }
194 
195     private Date getCurrentDate(){
196         Calendar ca = Calendar.getInstance();
197         Date currentDate = new Date();
198         currentDate.Year = (short)ca.get(Calendar.YEAR);
199         currentDate.Month = (short)ca.get(Calendar.MONTH);
200         currentDate.Day = (short)ca.get(Calendar.DATE);
201 
202         return currentDate;
203     }
204 
205     /*
206      * UI entry: File->Properties->General->Created*/
207     @Test
208     public void testGeneralCreationDate() throws Exception {
209         DateTime creationDate = getCurrentDateTime();
210 
211         XDocumentProperties xDocPro = getDocumentProperties();
212 
213         xDocPro.setCreationDate(creationDate);
214 
215         app.saveDocument(m_xSDComponent, m_filePath);
216         app.closeDocument(m_xSDComponent);
217         m_xSDComponent = app.loadDocument(m_filePath);
218         XDocumentProperties xDocPro2 = getDocumentProperties();
219         DateTime result = xDocPro2.getCreationDate();
220         assertTrue("CreationDate should be the same as set", this.DateTimeEquals(creationDate, result));
221     }
222 
223     /*
224      * UI entry: File->Properties->General->Modified*/
225     @Test
226     //ModifiedBy will be set each time the file loaded. The value is the one set in Tools->options->User data->Last name
227     public void testGeneralModifiedBy() throws Exception {
228         String modifiedBy = this.getUserName();
229         XDocumentProperties xDocPro = getDocumentProperties();
230         xDocPro.setModifiedBy(modifiedBy);
231 
232 
233         app.saveDocument(m_xSDComponent, m_filePath);
234         app.closeDocument(m_xSDComponent);
235         m_xSDComponent = app.loadDocument(m_filePath);
236         XDocumentProperties xDocPro2 = getDocumentProperties();
237         assertEquals("The file is modified by "+ modifiedBy, modifiedBy, xDocPro2.getModifiedBy());
238     }
239 
240     /*
241      * UI entry: File->Properties->General->Modified*/
242     @Test
243     public void testGeneralModificationDate() throws Exception {
244         //modification date will be set each time the file saved, so I don't save after set.
245         DateTime modificationDate = getCurrentDateTime();
246 
247         XDocumentProperties xDocPro = getDocumentProperties();
248 
249         xDocPro.setModificationDate(modificationDate);
250 
251         DateTime result = xDocPro.getModificationDate();
252         assertTrue("ModificationDate should be the same as set", this.DateTimeEquals(modificationDate, result));
253     }
254 
255     /*
256      * UI entry: File->Properties->General->Last printed*/
257     @Test
258     public void testGeneralPrintBy() throws Exception {
259         String printBy = "PrintBy";
260         XDocumentProperties xDocPro = getDocumentProperties();
261 
262         xDocPro.setPrintedBy(printBy);
263 
264         app.saveDocument(m_xSDComponent, m_filePath);
265         app.closeDocument(m_xSDComponent);
266         m_xSDComponent = app.loadDocument(m_filePath);
267         XDocumentProperties xDocPro2 = getDocumentProperties();
268         assertEquals("This document is printed by "+ printBy, printBy, xDocPro2.getPrintedBy());
269     }
270 
271     /*
272      * UI entry: File->Properties->General->Last printed*/
273     @Test
274     public void testGeneralPrintDate() throws Exception {
275         DateTime printDate = getCurrentDateTime();
276 
277         XDocumentProperties xDocPro = getDocumentProperties();
278 
279         xDocPro.setPrintDate(printDate);
280 
281         app.saveDocument(m_xSDComponent, m_filePath);
282         app.closeDocument(m_xSDComponent);
283         m_xSDComponent = app.loadDocument(m_filePath);
284         XDocumentProperties xDocPro2 = getDocumentProperties();
285         DateTime result = xDocPro2.getPrintDate();
286         assertTrue("PrintDate should be the same as set", this.DateTimeEquals(printDate, result));
287     }
288 
289     /*
290      * UI entry: File->Properties->General->Total editing time*/
291     @Test
292     public void testGeneralEditingDuration() throws Exception {
293         int editingDuration = 60;
294 
295         XDocumentProperties xDocPro = getDocumentProperties();
296 
297         xDocPro.setEditingDuration(editingDuration);
298 
299         app.saveDocument(m_xSDComponent, m_filePath);
300         app.closeDocument(m_xSDComponent);
301         m_xSDComponent = app.loadDocument(m_filePath);
302         XDocumentProperties xDocPro2 = getDocumentProperties();
303         assertEquals("Totally editing time should be "+ editingDuration, editingDuration, xDocPro2.getEditingDuration());
304     }
305 
306     /*
307      * UI entry: File->Properties->General->Revision number*/
308     @Test
309     public void testGeneralRevisionNumber() throws Exception {
310         short revisionNumber = 10;
311 
312         XDocumentProperties xDocPro = getDocumentProperties();
313 
314         xDocPro.setEditingCycles(revisionNumber);
315 
316         app.saveDocument(m_xSDComponent, m_filePath);
317         app.closeDocument(m_xSDComponent);
318         m_xSDComponent = app.loadDocument(m_filePath);
319         XDocumentProperties xDocPro2 = getDocumentProperties();
320         assertEquals("Revision number should be "+ revisionNumber+1, revisionNumber+1, xDocPro2.getEditingCycles());
321     }
322 
323     /*
324      * UI entry: File->Properties->General->template*/
325     @Test
326     public void testGeneralTemplateName() throws Exception {
327         String templateName = "I'm a template";
328 
329         XDocumentProperties xDocPro = getDocumentProperties();
330 
331         xDocPro.setTemplateName(templateName);
332 
333         app.saveDocument(m_xSDComponent, m_filePath);
334         app.closeDocument(m_xSDComponent);
335         m_xSDComponent = app.loadDocument(m_filePath);
336         XDocumentProperties xDocPro2 = getDocumentProperties();
337         assertEquals("Template name should be "+ templateName, templateName, xDocPro2.getTemplateName());
338     }
339 
340     /*
341      * UI entry: File->Properties->General->Reset*/
342     @Test
343     public void testGeneralReset() throws Exception {
344         String author = "ResetAuthor";
345         XDocumentProperties xDocPro = getDocumentProperties();
346         xDocPro.resetUserData(author);
347 
348         assertEquals("Author should be "+ author, author, xDocPro.getAuthor());
349         assertEquals("Modified should be empty", "", xDocPro.getModifiedBy());
350         assertTrue("ModificationDate should be empty",
351                 DateTimeEquals(new DateTime(), xDocPro.getModificationDate()));
352         assertEquals("PrintBy should be empty", "", xDocPro.getPrintedBy());
353         assertTrue("PrintDate should be empty",
354                 DateTimeEquals(new DateTime(), xDocPro.getPrintDate()));
355         assertEquals("Totally editing time should be empty", 0, xDocPro.getEditingDuration());
356         assertEquals("Revision number should be empty", 1, xDocPro.getEditingCycles());
357     }
358 
359     // UI entry: File->Properties->General->Apply user data
360 
361     // UI entry: File->Properties->General->digital signature
362 
363     //Description begin
364     /*
365      * UI entry: File->Properties->Description->Title*/
366     @Test
367     public void testDescriptionTitle() throws Exception{
368         String title = "titleForTest";
369         XDocumentProperties xDocPro = getDocumentProperties();
370         xDocPro.setTitle(title);
371 
372         app.saveDocument(m_xSDComponent, m_filePath);
373         app.closeDocument(m_xSDComponent);
374         m_xSDComponent = app.loadDocument(m_filePath);
375         XDocumentProperties xDocPro2 = getDocumentProperties();
376         assertEquals("Title should be "+ title, title, xDocPro2.getTitle());
377     }
378 
379     /*
380      * UI entry: File->Properties->Description->Subject*/
381     @Test
382     public void testDescriptionSubject() throws Exception{
383         String subject = "subjectForTest";
384         XDocumentProperties xDocPro = getDocumentProperties();
385         xDocPro.setSubject(subject);
386 
387         app.saveDocument(m_xSDComponent, m_filePath);
388         app.closeDocument(m_xSDComponent);
389         m_xSDComponent = app.loadDocument(m_filePath);
390         XDocumentProperties xDocPro2 = getDocumentProperties();
391         assertEquals("Subject should be "+ subject, subject, xDocPro2.getSubject());
392     }
393 
394     /*
395      * UI entry: File->Properties->Description->Keywords*/
396     @Test
397     public void testDescriptionKeywords() throws Exception{
398         String[] keywords = {"keyword1", "keyword2"};
399         XDocumentProperties xDocPro = getDocumentProperties();
400         xDocPro.setKeywords(keywords);
401 
402         app.saveDocument(m_xSDComponent, m_filePath);
403         app.closeDocument(m_xSDComponent);
404 
405         m_xSDComponent = app.loadDocument(m_filePath);
406         XDocumentProperties xDocPro2 = getDocumentProperties();
407         String[] keywordsResult = xDocPro2.getKeywords();
408         assertEquals("There should be 2 Keywords", 2, keywordsResult.length);
409         for(int i=0;i<keywordsResult.length;i++)
410         {
411             String num = Integer.toString(i+1);
412             assertEquals("The keywords should be keyword"+num, "keyword"+num, keywordsResult[i]);
413         }
414     }
415 
416     /*
417      * UI entry: File->Properties->Description->Comments*/
418     @Test
419     public void testDescriptionComments() throws Exception{
420         String comments = "This is the comment.";
421         XDocumentProperties xDocPro = getDocumentProperties();
422         xDocPro.setDescription(comments);
423 
424         app.saveDocument(m_xSDComponent, m_filePath);
425         app.closeDocument(m_xSDComponent);
426 
427         m_xSDComponent = app.loadDocument(m_filePath);
428         XDocumentProperties xDocPro2 = getDocumentProperties();
429 
430         assertEquals("Comments should be "+comments, comments, xDocPro2.getDescription());
431     }
432     //Description end
433 
434     //custom properties begin
435     //UI entry: File->Properties->Custom properties
436         private void addCustomPro(String propertyName, Object value) throws PropertyExistException, IllegalTypeException, IllegalArgumentException{
437             XDocumentProperties xDocPro = getDocumentProperties();
438             XPropertyContainer proContainer = xDocPro.getUserDefinedProperties();
439             proContainer.addProperty(propertyName, PropertyAttribute.REMOVEABLE, value);
440         }
441 
442         private Object getCustomPro(String propertyName) throws UnknownPropertyException, WrappedTargetException{
443             XDocumentProperties xDocPro = getDocumentProperties();
444             XPropertyContainer proContainer = xDocPro.getUserDefinedProperties();
445             XPropertySet xProSet = (XPropertySet)UnoRuntime.queryInterface(
446                     XPropertySet.class, proContainer);
447 
448             return xProSet.getPropertyValue(propertyName);
449         }
450 
451         @Test
452         public void testCustomAddPro_Text() throws Exception{
453             String addedProName = "TextPro";
454             String addedProDefaultValue = "testUser";
455 
456             addCustomPro(addedProName, addedProDefaultValue);
457 
458             app.saveDocument(m_xSDComponent, m_filePath);
459             app.closeDocument(m_xSDComponent);
460 
461             m_xSDComponent = app.loadDocument(m_filePath);
462 
463             String result = (String)getCustomPro(addedProName);
464 
465             assertTrue("added Text property \""+addedProName+"\" should exist", result != null);
466             assertEquals("value of added property should be "+addedProDefaultValue,
467                     addedProDefaultValue, result);
468         }
469 
470         @Test
471         public void testCustomAddPro_DateTime() throws Exception{
472             String addedProName = "DateTimePro";
473             DateTime addedProDefaultValue = getCurrentDateTime();
474 
475             addCustomPro(addedProName, addedProDefaultValue);
476 
477             app.saveDocument(m_xSDComponent, m_filePath);
478             app.closeDocument(m_xSDComponent);
479 
480             m_xSDComponent = app.loadDocument(m_filePath);
481 
482             DateTime result = (DateTime)getCustomPro(addedProName);
483             assertTrue("added DateTime property \""+addedProName+"\" should exist", result != null);
484             assertTrue("value of added property should be the same as set",
485                     this.DateTimeEquals(result, addedProDefaultValue));
486         }
487 
488         @Test
489         public void testCustomAddPro_Date() throws Exception{
490             String addedProName = "DatePro";
491             Date addedProDefaultValue = getCurrentDate();
492 
493             addCustomPro(addedProName, addedProDefaultValue);
494 
495             app.saveDocument(m_xSDComponent, m_filePath);
496             app.closeDocument(m_xSDComponent);
497 
498             m_xSDComponent = app.loadDocument(m_filePath);
499 
500             Date result = (Date)getCustomPro(addedProName);
501             assertTrue("added Date property \""+addedProName+"\" should exist", result != null);
502             assertTrue("value of added property should be the same as set",
503                     this.DateEquals(result, addedProDefaultValue));
504         }
505 
506         @Test
507         public void testCustomAddPro_Duration() throws Exception{
508             String addedProName = "DurationPro";
509             Duration addedProDefaultValue = new Duration();
510             addedProDefaultValue.Days = 1;
511 
512             addCustomPro(addedProName, addedProDefaultValue);
513 
514             app.saveDocument(m_xSDComponent, m_filePath);
515             app.closeDocument(m_xSDComponent);
516 
517             m_xSDComponent = app.loadDocument(m_filePath);
518 
519             Duration result = (Duration)getCustomPro(addedProName);
520             assertTrue("added Date property \""+addedProName+"\" should exist", result != null);
521             assertTrue("value of added property should the same as set", DurationEquals(addedProDefaultValue, result));
522         }
523 
524         @Test
525         public void testCustomAddPro_Number() throws Exception{
526             String addedProName = "NumberPro";
527             Double addedProDefaultValue = (double)10;
528 
529             addCustomPro(addedProName, addedProDefaultValue);
530 
531             app.saveDocument(m_xSDComponent, m_filePath);
532             app.closeDocument(m_xSDComponent);
533 
534             m_xSDComponent = app.loadDocument(m_filePath);
535 
536             Object oResult = getCustomPro(addedProName);
537 
538             Double result = (Double)oResult;
539             assertTrue("added Number property \""+addedProName+"\" should exist", oResult != null);
540             assertEquals("value of added property should be "+Double.toString(addedProDefaultValue),
541                     addedProDefaultValue, result);
542         }
543 
544         @Test
545         public void testCustomAddPro_Boolean() throws Exception{
546             String addedProName = "BooleanPro";
547             Boolean addedProDefaultValue = true;
548 
549             addCustomPro(addedProName, addedProDefaultValue);
550 
551             app.saveDocument(m_xSDComponent, m_filePath);
552             app.closeDocument(m_xSDComponent);
553 
554             m_xSDComponent = app.loadDocument(m_filePath);
555 
556             Object oResult = getCustomPro(addedProName);
557 
558             boolean result = (Boolean)oResult;
559             assertTrue("added Number property \""+addedProName+"\" should exist", oResult != null);
560             assertEquals("value of added property should be "+Boolean.toString(addedProDefaultValue),
561                     addedProDefaultValue, result);
562         }
563 
564         @Test
565         public void testCustomRemovePro() throws Exception{
566             addCustomPro("testPro", "value");
567             XDocumentProperties xDocPro = getDocumentProperties();
568             XPropertyContainer proContainer = xDocPro.getUserDefinedProperties();
569             XPropertySet xProSet = (XPropertySet)UnoRuntime.queryInterface(
570                     XPropertySet.class, proContainer);
571             XPropertySetInfo xproSetInfo = xProSet.getPropertySetInfo();
572             Property[] pros = xproSetInfo.getProperties();
573 
574             for(int i=0; i< pros.length;i++)
575             {
576                 proContainer.removeProperty(pros[i].Name);
577             }
578 
579             app.saveDocument(m_xSDComponent, m_filePath);
580             app.closeDocument(m_xSDComponent);
581 
582             m_xSDComponent = app.loadDocument(m_filePath);
583 
584             XDocumentProperties xDocPro2 = getDocumentProperties();
585             XPropertyContainer proContainer2 = xDocPro2.getUserDefinedProperties();
586             XPropertySet xProSet2 = (XPropertySet)UnoRuntime.queryInterface(
587                     XPropertySet.class, proContainer2);
588             XPropertySetInfo xproSetInfo2 = xProSet2.getPropertySetInfo();
589             Property[] pros2 = xproSetInfo2.getProperties();
590 
591             assertEquals("number of custom property should be zero ",
592                     0, pros2.length);
593         }
594     //custom properties end
595 
596         //Internet begin
597         private void setAutoLoad(String URL, int secs) throws IllegalArgumentException
598         {
599             XDocumentProperties xDocPro = getDocumentProperties();
600             xDocPro.setAutoloadURL(URL);
601             xDocPro.setAutoloadSecs(secs);
602             xDocPro.setDefaultTarget("_blank");
603         }
604 
605         @Test
606         public void testNoRefresh() throws Exception{
607             String autoLoadURL = "";
608             int autoLoadSecs = 0;
609             setAutoLoad(autoLoadURL, autoLoadSecs);
610 
611             app.saveDocument(m_xSDComponent, m_filePath);
612             app.closeDocument(m_xSDComponent);
613 
614             m_xSDComponent = app.loadDocument(m_filePath);
615             XDocumentProperties xDocPro2 = getDocumentProperties();
616 
617             assertEquals("AutoLoadURL should be empty", autoLoadURL, xDocPro2.getAutoloadURL());
618             assertEquals("AutoLoadSecs should be 0", autoLoadSecs, xDocPro2.getAutoloadSecs());
619         }
620 
621         @Test
622         public void testRefreshEvery60Secs() throws Exception{
623             String autoLoadURL = "";
624             int autoLoadSecs = 60;
625             setAutoLoad(autoLoadURL, autoLoadSecs);
626 
627             app.saveDocument(m_xSDComponent, m_filePath);
628             app.closeDocument(m_xSDComponent);
629 
630             m_xSDComponent = app.loadDocument(m_filePath);
631             XDocumentProperties xDocPro2 = getDocumentProperties();
632 
633             assertEquals("AutoLoadURL should be empty", autoLoadURL, xDocPro2.getAutoloadURL());
634             assertEquals("AutoLoadSecs should be "+Integer.toString(autoLoadSecs), autoLoadSecs, xDocPro2.getAutoloadSecs());
635         }
636 
637         @Test
638         public void testRedirect() throws Exception{
639             String autoLoadURL = "http://www.openoffice.com/";
640             int autoLoadSecs = 5;
641             setAutoLoad(autoLoadURL, autoLoadSecs);
642 
643             app.saveDocument(m_xSDComponent, m_filePath);
644             app.closeDocument(m_xSDComponent);
645 
646             m_xSDComponent = app.loadDocument(m_filePath);
647             XDocumentProperties xDocPro2 = getDocumentProperties();
648 
649             assertEquals("AutoLoadURL should be empty", autoLoadURL, xDocPro2.getAutoloadURL());
650             assertEquals("AutoLoadSecs should be "+Integer.toString(autoLoadSecs), autoLoadSecs, xDocPro2.getAutoloadSecs());
651         }
652         //Internet end
653 }
654