Logo Search packages:      
Sourcecode: pcalendar version File versions  Download package

void net::sf::linuxorg::pcal::engine::EngineTest::testEncryptedLoadSave (  ) [inline]

Test method for load and save of the encrypted files

Definition at line 926 of file EngineTest.java.

References net::sf::linuxorg::pcal::engine::Engine::loadFromFile(), net::sf::linuxorg::pcal::engine::Engine::saveToFile(), and testGetDayInfo().

                                          {
            // encrypted files
            final char password[] = {'g','g','g'};
            final char badPassword[] = {'b','b','b'};

            try {
                  File file = File.createTempFile("LORG_TEST", ""); //$NON-NLS-1$ //$NON-NLS-2$

                  engine.saveToFile(file, password);
                  try {
                        engine.loadFromFile(file, null);
                        fail("PasswordRequiredException not thrown"); //$NON-NLS-1$
                  } catch (PasswordRequiredException e) {
                        // expected exception
                  }

                  try {
                        engine.loadFromFile(file, badPassword);
                        fail("SAXException for bad password not thrown"); //$NON-NLS-1$
                  } catch (IOException e) {
                        // expected exception
                  } catch (PasswordRequiredException e) {
                        fail(e.getMessage());
                  }

                  engine.loadFromFile(file, password);
                  testGetDayInfo();

                  file.deleteOnExit();

            } catch (IOException e) {
                  fail(e.getMessage());
            } catch (SAXException e) {
                  fail(e.getMessage());
            } catch (ParserConfigurationException e) {
                  fail(e.getMessage());
            } catch (PasswordRequiredException e) {
                  fail(e.getMessage());
            }
      }

Here is the call graph for this function:


Generated by  Doxygen 1.6.0   Back to index