This is an automated email from the ASF dual-hosted git repository. solomax pushed a commit to branch java11-modules in repository https://gitbox.apache.org/repos/asf/openmeetings.git
commit c7cc0e2e3e277ef482a5a8d9be98638047e363a0 Author: Maxim Solodovnik <solomax...@gmail.com> AuthorDate: Thu Apr 21 15:52:27 2022 +0700 The build is green --- .../openmeetings/db/util/ApplicationHelper.java | 6 ++- .../apache/openmeetings/backup/BackupImport.java | 48 +++++++++++++++------- .../service/scheduler/ReminderJob.java | 4 +- .../org/apache/openmeetings/backup/TestExport.java | 6 +-- .../mail/template/subject/TestSubjTemplate.java | 2 +- 5 files changed, 44 insertions(+), 22 deletions(-) diff --git a/openmeetings-db/src/main/java/org/apache/openmeetings/db/util/ApplicationHelper.java b/openmeetings-db/src/main/java/org/apache/openmeetings/db/util/ApplicationHelper.java index d63c6c20a..89f3bee09 100644 --- a/openmeetings-db/src/main/java/org/apache/openmeetings/db/util/ApplicationHelper.java +++ b/openmeetings-db/src/main/java/org/apache/openmeetings/db/util/ApplicationHelper.java @@ -123,7 +123,11 @@ public class ApplicationHelper { } catch(IllegalStateException e) { app.setServletContext(new MockServletContext(app, null)); } - app.setConfigurationType(RuntimeConfigurationType.DEPLOYMENT); + try { + app.setConfigurationType(RuntimeConfigurationType.DEPLOYMENT); + } catch (IllegalStateException e) { + // no-op, might be already set + } OMContextListener omcl = new OMContextListener(); omcl.contextInitialized(new ServletContextEvent(app.getServletContext())); ThreadContext.setApplication(app); diff --git a/openmeetings-install/src/main/java/org/apache/openmeetings/backup/BackupImport.java b/openmeetings-install/src/main/java/org/apache/openmeetings/backup/BackupImport.java index 6ec134772..0ac284644 100644 --- a/openmeetings-install/src/main/java/org/apache/openmeetings/backup/BackupImport.java +++ b/openmeetings-install/src/main/java/org/apache/openmeetings/backup/BackupImport.java @@ -523,7 +523,8 @@ public class BackupImport { messageFolderMap.put(TRASH_FOLDER_ID, TRASH_FOLDER_ID); } - static BackupVersion getVersion(File base) { + // public for testing + public static BackupVersion getVersion(File base) { List<BackupVersion> list = new ArrayList<>(1); readList(base, "version.xml", VERSION_LIST_NODE, VERSION_NODE, BackupVersion.class, list::add, true); return list.isEmpty() ? new BackupVersion() : list.get(0); @@ -532,7 +533,8 @@ public class BackupImport { /* * ##################### Import Configs */ - void importConfigs(File base) throws Exception { + // public for testing + public void importConfigs(File base) throws Exception { final Map<Integer, String> keyMap = new HashMap<>(); Arrays.stream(KeyEvent.class.getDeclaredFields()) .filter(fld -> fld.getName().startsWith("VK_")) @@ -595,7 +597,8 @@ public class BackupImport { /* * ##################### Import Groups */ - void importGroups(File base) { + // public for testing + public void importGroups(File base) { log.info("Configs import complete, starting group import"); readList(base, "organizations.xml", GROUP_LIST_NODE, GROUP_NODE, Group.class, g -> { Long oldId = g.getId(); @@ -608,7 +611,8 @@ public class BackupImport { /* * ##################### Import LDAP Configs */ - Long importLdap(File base) { + // public for testing + public Long importLdap(File base) { log.info("Groups import complete, starting LDAP config import"); Long[] defaultLdapId = {cfgDao.getLong(CONFIG_DEFAULT_LDAP_ID, null)}; readList(base, "ldapconfigs.xml", "ldapconfigs", "ldapconfig", LdapConfig.class, c -> { @@ -631,7 +635,8 @@ public class BackupImport { /* * ##################### OAuth2 servers */ - void importOauth(File base) { + // public for testing + public void importOauth(File base) { log.info("Ldap config import complete, starting OAuth2 server import"); readList(base, "oauth2servers.xml", OAUTH_LIST_NODE, OAUTH_NODE, OAuthServer.class , s -> { @@ -676,7 +681,8 @@ public class BackupImport { /* * ##################### Import Users */ - void importUsers(File base) throws Exception { + // public for testing + public void importUsers(File base) throws Exception { log.info("OAuth2 servers import complete, starting user import"); String jNameTimeZone = getDefaultTimezone(); //add existent emails from database @@ -740,7 +746,8 @@ public class BackupImport { /* * ##################### Import Rooms */ - void importRooms(File base) throws Exception { + // public for testing + public void importRooms(File base) throws Exception { log.info("Users import complete, starting room import"); Class<Room> eClazz = Room.class; JAXBContext jc = JAXBContext.newInstance(eClazz); @@ -775,7 +782,8 @@ public class BackupImport { /* * ##################### Import Room Groups */ - void importRoomGroups(File base) throws Exception { + // public for testing + public void importRoomGroups(File base) throws Exception { log.info("Room import complete, starting room groups import"); Class<RoomGroup> eClazz = RoomGroup.class; JAXBContext jc = JAXBContext.newInstance(eClazz); @@ -804,7 +812,8 @@ public class BackupImport { /* * ##################### Import Chat messages */ - void importChat(File base) throws Exception { + // public for testing + public void importChat(File base) throws Exception { log.info("Room groups import complete, starting chat messages import"); Class<ChatMessage> eClazz = ChatMessage.class; JAXBContext jc = JAXBContext.newInstance(eClazz); @@ -827,7 +836,8 @@ public class BackupImport { /* * ##################### Import Calendars */ - void importCalendars(File base) throws Exception { + // public for testing + public void importCalendars(File base) throws Exception { log.info("Chat messages import complete, starting calendar import"); Class<OmCalendar> eClazz = OmCalendar.class; JAXBContext jc = JAXBContext.newInstance(eClazz); @@ -845,7 +855,8 @@ public class BackupImport { /* * ##################### Import Appointments */ - void importAppointments(File base) throws Exception { + // public for testing + public void importAppointments(File base) throws Exception { log.info("Calendar import complete, starting appointement import"); Class<Appointment> eClazz = Appointment.class; JAXBContext jc = JAXBContext.newInstance(eClazz); @@ -880,7 +891,8 @@ public class BackupImport { * * Reminder Invitations will be NOT send! */ - void importMeetingMembers(File base) throws Exception { + // public for testing + public void importMeetingMembers(File base) throws Exception { log.info("Appointement import complete, starting meeting members import"); Class<MeetingMember> eClazz = MeetingMember.class; JAXBContext jc = JAXBContext.newInstance(eClazz); @@ -970,10 +982,16 @@ public class BackupImport { remain.entrySet().forEach(e -> log.warn("Doungling file/recording: {}", e.getValue())); tree.process(f -> isInvalidFile(f, folders), save); } + /* * ##################### Import Recordings */ +<<<<<<< HEAD void importRecordings(File base) { +======= + // public for testing + public void importRecordings(File base) throws Exception { +>>>>>>> 2590e5123 (The build is green) log.info("Meeting members import complete, starting recordings server import"); final Map<Long, Long> folders = new HashMap<>(); saveTree(base, "flvRecordings.xml", RECORDING_LIST_NODE, RECORDING_NODE, Recording.class, folders, r -> { @@ -1016,7 +1034,8 @@ public class BackupImport { /* * ##################### Import Private Message Folders */ - void importPrivateMsgFolders(File base) { + // public for testing + public void importPrivateMsgFolders(File base) { log.info("Recording import complete, starting private message folder import"); readList(base, "privateMessageFolder.xml", MSG_FOLDER_LIST_NODE, MSG_FOLDER_NODE, PrivateMessageFolder.class, p -> { Long folderId = p.getId(); @@ -1161,7 +1180,8 @@ public class BackupImport { }, true); } - void importExtraMenus(File base) throws Exception { + // public for testing + public void importExtraMenus(File base) throws Exception { log.info("Room files complete, starting extra menus import"); Class<ExtraMenu> eClazz = ExtraMenu.class; JAXBContext jc = JAXBContext.newInstance(eClazz); diff --git a/openmeetings-service/src/main/java/org/apache/openmeetings/service/scheduler/ReminderJob.java b/openmeetings-service/src/main/java/org/apache/openmeetings/service/scheduler/ReminderJob.java index 7bfd134a6..c0ceb43b1 100644 --- a/openmeetings-service/src/main/java/org/apache/openmeetings/service/scheduler/ReminderJob.java +++ b/openmeetings-service/src/main/java/org/apache/openmeetings/service/scheduler/ReminderJob.java @@ -65,8 +65,8 @@ public class ReminderJob extends AbstractJob { @Autowired private GroupUserDao groupUserDao; - //package private for testing - Map<Long, LocalDateTime> groupNotifications = new HashMap<>(); + // public for testing + public Map<Long, LocalDateTime> groupNotifications = new HashMap<>(); public void remindMeetings() { log.trace("ReminderJob.remindMeetings"); diff --git a/openmeetings-web/src/test/java/org/apache/openmeetings/backup/TestExport.java b/openmeetings-web/src/test/java/org/apache/openmeetings/backup/TestExport.java index 6a22356d3..5e51cb8de 100644 --- a/openmeetings-web/src/test/java/org/apache/openmeetings/backup/TestExport.java +++ b/openmeetings-web/src/test/java/org/apache/openmeetings/backup/TestExport.java @@ -26,9 +26,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue; import java.io.ByteArrayOutputStream; import java.io.File; -import java.io.IOException; import java.io.StringWriter; -import java.io.Writer; import java.nio.file.Paths; import java.time.LocalDate; @@ -45,8 +43,6 @@ import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; -import com.sun.xml.bind.marshaller.CharacterEscapeHandler; - class TestExport extends AbstractOmServerTest { @Autowired private FileItemDao fileItemDao; @@ -68,12 +64,14 @@ class TestExport extends AbstractOmServerTest { JAXBContext jc = JAXBContext.newInstance(eClazz); Marshaller marshaller = jc.createMarshaller(); marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); + /* FIXME TODO marshaller.setProperty(CharacterEscapeHandler.class.getName(), new CharacterEscapeHandler() { @Override public void escape(char[] ac, int i, int j, boolean flag, Writer writer) throws IOException { writer.write(ac, i, j); } }); + */ StringWriter writer = new StringWriter(); marshaller.marshal(u, writer); Assertions.assertNotNull(writer.getBuffer()); diff --git a/openmeetings-web/src/test/java/org/apache/openmeetings/service/mail/template/subject/TestSubjTemplate.java b/openmeetings-web/src/test/java/org/apache/openmeetings/service/mail/template/subject/TestSubjTemplate.java index d57918187..e7ed63470 100644 --- a/openmeetings-web/src/test/java/org/apache/openmeetings/service/mail/template/subject/TestSubjTemplate.java +++ b/openmeetings-web/src/test/java/org/apache/openmeetings/service/mail/template/subject/TestSubjTemplate.java @@ -85,7 +85,7 @@ class TestSubjTemplate extends AbstractWicketTesterTest { private static final long serialVersionUID = 1L; @Override - String getPrefix() { + public String getPrefix() { return null; } };