Editor[] editors = EditorFactory.getInstance().getAllEditors(); FileDocumentManager fileDocManager = FileDocumentManager.getInstance(); for(Editor editor : editors) { VirtualFile vf = fileDocManager.getFile(editor.getDocument()); String path = vf.getCanonicalPath(); System.out.println("path = " + path); }
EditableDocument sequencing = editor.getDocument(FieldName.SEQUENCING); EditableDocument sequencers = sequencing.getDocument(FieldName.SEQUENCERS); EditableDocument sequencerA = sequencers.getDocument("CND sequencer");
EditableDocument externalSources = editor.getDocument(FieldName.EXTERNAL_SOURCES); externalSources.set("files", files.unwrap());
@Test @FixFor( {"MODE-2575", "MODE-2635"} ) public void shouldSuccessfullyValidateMongoBinaryStorageConfiguration() throws Exception { RepositoryConfiguration config = assertValid("config/mongo-binary-storage-full-config.json"); Document storageDoc = config.getDocument().getDocument(FieldName.STORAGE).getDocument(FieldName.BINARY_STORAGE); assertEquals(Arrays.asList("192.1.68.1.1:90", "143.22.33.123:120"), storageDoc.get(FieldName.HOST_ADDRESSES)); RepositoryConfiguration.BinaryStorage storage = config.getBinaryStorage(); assertEquals(RepositoryConfiguration.FieldValue.BINARY_STORAGE_TYPE_MONGO, storage.getType()); assertTrue(storage.getBinaryStore() instanceof MongodbBinaryStore); // remove host and port, check that the config is still valid Editor editor = config.edit(); EditableDocument storageDocEditable = editor.getDocument(FieldName.STORAGE).getDocument(FieldName.BINARY_STORAGE); storageDocEditable.remove(FieldName.HOST); storageDocEditable.remove(FieldName.PORT); RepositoryConfiguration configWithoutHostPort = new RepositoryConfiguration(editor.unwrap(), "mongo-config-1"); assertValid(configWithoutHostPort); // remove host addresses as well and check that what remains is not valid storageDocEditable.remove(FieldName.HOST_ADDRESSES); RepositoryConfiguration invalidConfig = new RepositoryConfiguration(editor.unwrap(), "mongo-config-2"); try { invalidConfig.getBinaryStorage().getBinaryStore(); fail("Should not allow a Mongo binary storage without host, port and host addresses"); } catch (IllegalArgumentException e) { //expected } }
EditableArray predefinedWs = editor.getDocument(RepositoryConfiguration.FieldName.WORKSPACES) .getArray(RepositoryConfiguration.FieldName.PREDEFINED); predefinedWs.add("ws3");