Пример #1
0
 @Test
 public void testBasicExport() {
   final ExportRecord aRecordWithAllTypes =
       new ExportRecord()
           .addField("Hallo")
           .addField(PDTFactory.getCurrentLocalTime())
           .addField(PDTFactory.getCurrentLocalDate())
           .addField(PDTFactory.getCurrentLocalDateTime())
           .addField(PDTFactory.getCurrentDateTime())
           .addField(true)
           .addField(4711)
           .addField(-123456789012345L)
           .addField(new BigInteger("1234512345123451234512345123451234512345123451234512345"))
           .addField(3.1145)
           .addField(new BigDecimal("12345123451234512345123451234512345123451234512345.12345"));
   final ExportRecord aEmptyRecord = new ExportRecord();
   final ExporterCSV aExporter = new ExporterCSV(CCharset.CHARSET_ISO_8859_1_OBJ);
   // Fails because no record is present
   assertTrue(
       aExporter
           .exportRecords(new EmptyExportRecordProvider(), new NonBlockingByteArrayOutputStream())
           .isFailure());
   assertTrue(
       aExporter
           .exportRecords(
               new ConstantExportRecordProvider(CollectionHelper.newList(aRecordWithAllTypes)),
               new NonBlockingByteArrayOutputStream())
           .isSuccess());
   assertTrue(
       aExporter
           .exportRecords(
               new ConstantExportRecordProvider(
                   CollectionHelper.newList(
                       aRecordWithAllTypes, aRecordWithAllTypes, aEmptyRecord)),
               new NonBlockingByteArrayOutputStream())
           .isSuccess());
   assertTrue(
       aExporter
           .exportRecords(
               new ConstantExportRecordProvider(
                   null,
                   CollectionHelper.newList(
                       aRecordWithAllTypes, aRecordWithAllTypes, aEmptyRecord),
                   aRecordWithAllTypes),
               new NonBlockingByteArrayOutputStream())
           .isSuccess());
   assertTrue(
       aExporter
           .exportRecords(
               new ConstantExportRecordProvider(
                   aRecordWithAllTypes,
                   CollectionHelper.newList(
                       aRecordWithAllTypes, aRecordWithAllTypes, aEmptyRecord),
                   aRecordWithAllTypes),
               new NonBlockingByteArrayOutputStream())
           .isSuccess());
 }
Пример #2
0
 /**
  * @return A non-<code>null</code> but maybe empty collection with the details of all currently
  *     logged in users.
  */
 @Nonnull
 @ReturnsMutableCopy
 public Collection<LoginInfo> getAllLoginInfos() {
   m_aRWLock.readLock().lock();
   try {
     return CollectionHelper.newList(m_aLoggedInUsers.values());
   } finally {
     m_aRWLock.readLock().unlock();
   }
 }
Пример #3
0
 @Nonnull
 @ReturnsMutableCopy
 public Collection<FormState> getAllFormStates() {
   m_aRWLock.readLock().lock();
   try {
     return CollectionHelper.newList(m_aMap.values());
   } finally {
     m_aRWLock.readLock().unlock();
   }
 }
 public void clearCertificates() throws OpenAS2Exception {
   final KeyStore aKeyStore = getKeyStore();
   try {
     // Make a copy to be sure
     for (final String sAlias : CollectionHelper.newList(aKeyStore.aliases()))
       aKeyStore.deleteEntry(sAlias);
     save(getFilename(), getPassword());
   } catch (final GeneralSecurityException ex) {
     throw WrappedOpenAS2Exception.wrap(ex);
   }
 }
Пример #5
0
 @Nonnull
 @ReturnsMutableCopy
 public List<CSSValue> getAllContainedValues() {
   return CollectionHelper.newList(m_aValues);
 }
 @Nonnull
 @ReturnsMutableCopy
 public Collection<VALUETYPE> getAllAttributeValues() {
   return CollectionHelper.newList(m_aAttrs.values());
 }