@Inject public Export2iCalConverter( TimeZoneConverter timezoneConverter, RaplaLocale raplaLocale, Logger logger, ClientFacade facade) throws RaplaException { this.timezoneConverter = timezoneConverter; this.facade = facade; this.raplaLocale = raplaLocale; this.logger = logger; TimeZone zone = timezoneConverter.getImportExportTimeZone(); calendar = raplaLocale.createCalendar(); DynamicType[] dynamicTypes = facade.getDynamicTypes(DynamicTypeAnnotations.VALUE_CLASSIFICATION_TYPE_RESOURCE); for (DynamicType type : dynamicTypes) { if (type.getAnnotation(DynamicTypeAnnotations.KEY_LOCATION) != null) { hasLocationType = true; } } CompatibilityHints.setHintEnabled(CompatibilityHints.KEY_RELAXED_VALIDATION, true); RaplaConfiguration config = facade .getSystemPreferences() .getEntry(Export2iCalPlugin.ICAL_CONFIG, new RaplaConfiguration()); global_export_attendees = config .getChild(Export2iCalPlugin.EXPORT_ATTENDEES) .getValueAsBoolean(Export2iCalPlugin.DEFAULT_exportAttendees); global_export_attendees_participation_status = config .getChild(Export2iCalPlugin.EXPORT_ATTENDEES_PARTICIPATION_STATUS) .getValue(Export2iCalPlugin.DEFAULT_attendee_participation_status); try { exportAttendeesAttribute = config.getChild(Export2iCalPlugin.EXPORT_ATTENDEES_EMAIL_ATTRIBUTE).getValue(); } catch (ConfigurationException e) { exportAttendeesAttribute = ""; getLogger().info("ExportAttendeesMailAttribute is not set. So do not export as meeting"); } if (zone != null) { final String timezoneId = zone.getID(); try { TimeZoneRegistry registry = TimeZoneRegistryFactory.getInstance().createRegistry(); timeZone = registry.getTimeZone(timezoneId); } catch (Exception rc) { final VTimeZone vTimeZone = new VTimeZone(); timeZone = new net.fortuna.ical4j.model.TimeZone(vTimeZone); final int rawOffset = zone.getRawOffset(); timeZone.setRawOffset(rawOffset); } } }
@Parameters public static Collection<Object[]> parameters() throws IOException, ParserException { VCardOutputter outputter = new VCardOutputter(false, 1000); VCardBuilder builder = null; List<Object[]> params = new ArrayList<Object[]>(); File[] testFiles = new File("src/test/resources/samples/valid") .listFiles((FileFilter) VCardFileFilter.INSTANCE); // enable relaxed parsing for non-standard GEO support.. CompatibilityHints.setHintEnabled(CompatibilityHints.KEY_RELAXED_PARSING, true); for (int i = 0; i < testFiles.length; i++) { builder = new VCardBuilder(new FileReader(testFiles[i])); VCard card = builder.build(); params.add(new Object[] {outputter, card, card.toString()}); } CompatibilityHints.setHintEnabled(CompatibilityHints.KEY_RELAXED_PARSING, false); return params; }
@After public void tearDown() { CompatibilityHints.setHintEnabled(CompatibilityHints.KEY_RELAXED_PARSING, false); }
@Before public void setUp() { CompatibilityHints.setHintEnabled(CompatibilityHints.KEY_RELAXED_PARSING, true); }