Unnamed: 0 int64 0 305k | body stringlengths 7 52.9k | name stringlengths 1 185 |
|---|---|---|
26,900 | void () { myFixture.copyDirectoryToProject(getTestName(true), getTestName(true)); final AbstractProjectViewPane pane = setupPane(true); String structure = """ -Project -PsiDirectory: src -PsiDirectory: bundle yyy.properties -Resource Bundle 'xxx' xxx.properties xxx_en.properties xxx_ru_RU.properties X.txt External Libraries """; PlatformTestUtil.assertTreeEqual(pane.getTree(), structure); } | testBundle |
26,901 | void () { myFixture.copyDirectoryToProject(getTestName(true), getTestName(true)); final AbstractProjectViewPane pane = setupPane(true); String structure = """ -Project -PsiDirectory: src -PsiDirectory: standAlone a.properties xxx.properties xxx2.properties yyy.properties X.txt External Libraries """; PlatformTestUtil.assertTreeEqual(pane.getTree(), structure); } | testStandAlone |
26,902 | void () { myFixture.copyDirectoryToProject(getTestName(true), getTestName(true)); AbstractProjectViewPane pane = setupPane(true); String structure = """ -Project -PsiDirectory: src -PsiDirectory: sortByType a.properties xxx2.properties yyy.properties -Resource Bundle 'xxx' xxx.properties xxx_en.properties X.txt External Libraries """; PlatformTestUtil.assertTreeEqual(pane.getTree(), structure); pane = setupPane(false); structure = """ -Project -PsiDirectory: src -PsiDirectory: sortByType a.properties X.txt -Resource Bundle 'xxx' xxx.properties xxx_en.properties xxx2.properties yyy.properties External Libraries """; PlatformTestUtil.assertTreeEqual(pane.getTree(), structure); } | testSortByType |
26,903 | void () { myFixture.copyDirectoryToProject(getTestName(true), getTestName(true)); List<PropertiesFile> customBundleFiles = new ArrayList<>(2); PropertiesReferenceManager.getInstance(getProject()).processAllPropertiesFiles((baseName, propertiesFile) -> { customBundleFiles.add(propertiesFile); return true; }); ResourceBundleManager.getInstance(getProject()).combineToResourceBundle(customBundleFiles, "some"); final AbstractProjectViewPane pane = setupPane(true); String structure = """ -Project -PsiDirectory: src -PsiDirectory: customBundle -PsiDirectory: dev some.dev.properties (custom RB: some) -PsiDirectory: prod some.prod.properties (custom RB: some) External Libraries """; PlatformTestUtil.assertTreeEqual(pane.getTree(), structure); } | testCustomBundle |
26,904 | void () { myFixture.copyDirectoryToProject(getTestName(true), getTestName(true)); List<PropertiesFile> customBundleFiles = new ArrayList<>(2); PropertiesReferenceManager.getInstance(getProject()).processAllPropertiesFiles((baseName, propertiesFile) -> { if (baseName.contains("custom")) { customBundleFiles.add(propertiesFile); } return true; }); ResourceBundleManager.getInstance(getProject()).combineToResourceBundle(customBundleFiles, "custom"); final AbstractProjectViewPane pane = setupPane(true); String structure = """ -Project -PsiDirectory: src -PsiDirectory: fewBundles -PsiDirectory: dev custom.prod.properties (custom RB: custom) custom.dev.properties (custom RB: custom) xxx.properties -Resource Bundle 'a' a.properties a_en.properties -Resource Bundle 'b' b.properties b_fr.properties External Libraries """; PlatformTestUtil.assertTreeEqual(pane.getTree(), structure); } | testFewBundles |
26,905 | AbstractProjectViewPane (final boolean sortByType) { myStructure.setProviders(new ResourceBundleGrouper(getProject())); final AbstractProjectViewPane pane = myStructure.createPane(); pane.installComparator(new GroupByTypeComparator(sortByType)); PropertiesReferenceManager.getInstance(getProject()).processAllPropertiesFiles((baseName, propertiesFile) -> { pane.select(propertiesFile, propertiesFile.getVirtualFile(), sortByType); return true; }); PlatformTestUtil.waitWhileBusy(pane.getTree()); PlatformTestUtil.expandAll(pane.getTree()); return pane; } | setupPane |
26,906 | String () { return PluginPathManager.getPluginHomePath("properties") + "/tests/testData"; } | getTestDataPath |
26,907 | void () { type('\n'); } | typeEnter |
26,908 | void () { doTest(); } | testEndLine |
26,909 | void () { doTest(); } | testComment |
26,910 | void () { doTest(); } | testKey |
26,911 | void () { doTest(); } | testValue |
26,912 | void () { doTest(); } | testBackslash |
26,913 | void () { doTest(); } | testBeforeComment |
26,914 | void () { String line = "some.relatively.long.property.name=And here's some property value for that really unique key, nice to have\n"; String text = StringUtil.repeat(line, 20000) + "<caret>\n" + StringUtil.repeat(line, 10000); configureFromFileText("performance.properties", text); PlatformTestUtil.startPerformanceTest("Property files editing", 2500, () -> { type("aaaa=bbb"); PsiDocumentManager.getInstance(getProject()).commitAllDocuments(); }).assertTiming(); } | testPerformance |
26,915 | void () { configureByFile(BASE_PATH + getTestName(false)+".properties"); typeEnter(); checkResultByFile(BASE_PATH + getTestName(false)+"_after.properties"); } | doTest |
26,916 | void () { final PropertiesFile propertiesFile = PropertiesImplUtil.getPropertiesFile(myFixture.configureByText(PropertiesFileType.INSTANCE, "#xxxxx")); WriteCommandAction.runWriteCommandAction(getProject(), () -> { propertiesFile.addProperty(myPropertyToAdd); }); PsiTestUtil.checkFileStructure((PsiFile)propertiesFile); List<IProperty> properties = propertiesFile.getProperties(); IProperty added = properties.get(0); assertPropertyEquals(added, myPropertyToAdd.getName(), myPropertyToAdd.getValue()); } | testAddPropertyAfterComment |
26,917 | void () { final PropertiesFile propertiesFile = PropertiesImplUtil.getPropertiesFile(myFixture.configureByText(PropertiesFileType.INSTANCE, "#xxxxx\n")); WriteCommandAction.runWriteCommandAction(getProject(), () -> { propertiesFile.addProperty(myPropertyToAdd); }); PsiTestUtil.checkFileStructure((PsiFile)propertiesFile); List<IProperty> properties = propertiesFile.getProperties(); IProperty added = properties.get(0); assertPropertyEquals(added, myPropertyToAdd.getName(), myPropertyToAdd.getValue()); } | testAddPropertyAfterComment2 |
26,918 | void (final IProperty property, @NonNls String name, @NonNls String value) { assertEquals(name, property.getName()); assertEquals(value, property.getValue()); } | assertPropertyEquals |
26,919 | void () { final PropertiesFile propertiesFile = PropertiesImplUtil.getPropertiesFile(myFixture.configureByText(PropertiesFileType.INSTANCE, "xxx=yyy")); WriteCommandAction.runWriteCommandAction(null, () -> { propertiesFile.addProperty(myPropertyToAdd); }); PsiTestUtil.checkFileStructure((PsiFile)propertiesFile); List<IProperty> properties = propertiesFile.getProperties(); assertEquals(2, properties.size()); assertPropertyEquals(properties.get(1), "xxx", "yyy"); assertPropertyEquals(properties.get(0), myPropertyToAdd.getName(), myPropertyToAdd.getValue()); } | testAddPropertyAfterProperty |
26,920 | void () { PropertiesFile propertiesFile = PropertiesImplUtil.getPropertiesFile(myFixture.configureByText(PropertiesFileType.INSTANCE, "xxx=yyy\n#s\nzzz=ttt\n\n")); final List<IProperty> properties = propertiesFile.getProperties(); assertEquals(2, properties.size()); assertPropertyEquals(properties.get(0), "xxx", "yyy"); assertPropertyEquals(properties.get(1), "zzz", "ttt"); WriteCommandAction.runWriteCommandAction(null, () -> properties.get(1).getPsiElement().delete()); List<IProperty> propertiesAfter = propertiesFile.getProperties(); assertEquals(1, propertiesAfter.size()); assertPropertyEquals(propertiesAfter.get(0), "xxx", "yyy"); } | testDeleteProperty |
26,921 | void () { PropertiesFile propertiesFile = PropertiesImplUtil.getPropertiesFile(myFixture.configureByText(PropertiesFileType.INSTANCE, "xxx=yyy\nxxx2=tyrt\nxxx3=ttt\n\n")); final Property property = (Property)propertiesFile.findPropertyByKey("xxx2"); WriteCommandAction.runWriteCommandAction(null, property::delete); PsiTestUtil.checkFileStructure((PsiFile)propertiesFile); assertEquals("xxx=yyy\nxxx3=ttt\n\n", propertiesFile.getContainingFile().getText()); } | testDeletePropertyWhitespaceAround |
26,922 | void () { PropertiesFile propertiesFile = PropertiesImplUtil.getPropertiesFile(myFixture.configureByText(PropertiesFileType.INSTANCE, "xxx=yyy\nxxx2=tyrt\nxxx3=ttt\n\n")); final Property property = (Property)propertiesFile.findPropertyByKey("xxx"); WriteCommandAction.runWriteCommandAction(null, property::delete); PsiTestUtil.checkFileStructure((PsiFile)propertiesFile); assertEquals("xxx2=tyrt\nxxx3=ttt\n\n", propertiesFile.getText()); } | testDeletePropertyWhitespaceAhead |
26,923 | void () { PropertiesFile propertiesFile = PropertiesImplUtil.getPropertiesFile(myFixture.configureByText(PropertiesFileType.INSTANCE, "a=b\\nc\\u0063c")); assertEquals("b\nccc", propertiesFile.getProperties().get(0).getUnescapedValue()); } | testUnescapedValue |
26,924 | void () { PropertiesFile propertiesFile = PropertiesImplUtil.getPropertiesFile(myFixture.configureByText(PropertiesFileType.INSTANCE, "a=b\\\n\t c")); assertEquals("bc", propertiesFile.getProperties().get(0).getUnescapedValue()); } | testUnescapedLineBreak |
26,925 | void () { final PropertiesCodeStyleSettings codeStyleSettings = PropertiesCodeStyleSettings.getInstance(getProject()); codeStyleSettings.KEY_VALUE_DELIMITER_CODE = 1; final PropertyImpl property = (PropertyImpl)PropertiesElementFactory.createProperty(getProject(), "xxx", "yyy", null); final char delimiter = property.getKeyValueDelimiter(); assertEquals(':', delimiter); assertEquals("xxx:yyy", property.getPsiElement().getText()); codeStyleSettings.KEY_VALUE_DELIMITER_CODE = 0; } | testNonDefaultKeyValueDelimiter |
26,926 | void (@NotNull ActionHint actionHint, @NotNull String testFullPath, @NotNull String testName) { executeAction("EditorEnter"); checkResult(testName); } | doAction |
26,927 | void (@NotNull final String testName) { final String expectedFilePath = getBasePath() + "/after" + testName; checkResultByFile("In file: " + expectedFilePath, expectedFilePath, false); } | checkResult |
26,928 | void (@NotNull ActionHint actionHint, @NotNull String testFullPath, @NotNull String testName) { executeAction("EditorStartNewLineBefore"); checkResult(testName); } | doAction |
26,929 | void (@NotNull final String testName) { final String expectedFilePath = getBasePath() + "/after" + testName; checkResultByFile("In file: " + expectedFilePath, expectedFilePath, false); } | checkResult |
26,930 | void (@NotNull ActionHint actionHint, @NotNull String testFullPath, @NotNull String testName) { executeAction("EditorJoinLines"); checkResult(testName); } | doAction |
26,931 | void (@NotNull final String testName) { final String expectedFilePath = getBasePath() + "/after" + testName; checkResultByFile("In file: " + expectedFilePath, expectedFilePath, false); } | checkResult |
26,932 | void () { doTextTest(""" qwe=asd #comment key1 = value1""", """ qwe=asd #comment key1=value1"""); } | testSimple1 |
26,933 | void () { mySettings.ALIGN_GROUP_FIELD_DECLARATIONS = true; doTextTest(""" qwe_very_big_property = asd #comment key1 = value1""", """ qwe_very_big_property=asd #comment key1 =value1"""); } | testSimple2 |
26,934 | void () { mySettings.ALIGN_GROUP_FIELD_DECLARATIONS = true; myCustomSettings.SPACES_AROUND_KEY_VALUE_DELIMITER = true; doTextTest(""" qwe_very_big_property = asd #comment key1 = value1""", """ qwe_very_big_property = asd #comment key1 = value1"""); } | testSimple3 |
26,935 | void () { doTextTest("k v", "k v"); } | testWhitespaceDelimiter |
26,936 | void () { myCustomSettings.KEEP_BLANK_LINES = true; String propertiesWithBlankLines = """ #comment key1=value1 key2=value2 """; doTextTest(propertiesWithBlankLines, propertiesWithBlankLines); } | testKeepBlankLines |
26,937 | void () { myCustomSettings.KEEP_BLANK_LINES = false; doTextTest(""" #comment key1=value1 key2=value2 """, """ #comment key1=value1 key2=value2 """); } | testDoNotKeepBlankLines |
26,938 | void (String text) { doTextTest(text, text); } | doTextTest |
26,939 | String () { return ""; } | getBasePath |
26,940 | String () { return PropertiesFileType.DEFAULT_EXTENSION; } | getFileExtension |
26,941 | void () { doTest(); } | testUnsorted |
26,942 | void () { doTest(); } | testSorted |
26,943 | void () { ExtensionTestUtil.maskExtensions(AlphaUnsortedPropertiesFileInspectionSuppressor.EP_NAME, Collections.<AlphaUnsortedPropertiesFileInspectionSuppressor>singletonList(new AlphaUnsortedPropertiesFileInspectionSuppressor() { @Override public boolean suppressInspectionFor(@NotNull PropertiesFile propertiesFile) { return propertiesFile.getName().toLowerCase(Locale.ENGLISH).contains("suppress"); } }), myFixture.getTestRootDisposable()); doTest(); } | testUnsortedSuppressed |
26,944 | boolean (@NotNull PropertiesFile propertiesFile) { return propertiesFile.getName().toLowerCase(Locale.ENGLISH).contains("suppress"); } | suppressInspectionFor |
26,945 | void () { myFixture.configureByText("p.properties", """ a= c= b=\\r\\n\\ f"""); myFixture.enableInspections(new AlphaUnsortedPropertiesFileInspection()); final IntentionAction intention = myFixture.getAvailableIntention("Sort resource bundle files", "p.properties"); assertNotNull(intention); myFixture.launchAction(intention); myFixture.checkResult(""" a= b=\\r\\n\\ f c="""); } | testFix |
26,946 | void () { myFixture.configureByText("p.properties", """ a=a d=d # some comment on "e" # this is multiline comment e=e b=b c=b"""); myFixture.enableInspections(new AlphaUnsortedPropertiesFileInspection()); final IntentionAction intention = myFixture.getAvailableIntention("Sort resource bundle files", "p.properties"); assertNotNull(intention); myFixture.launchAction(intention); myFixture.checkResult(""" a=a b=b c=b d=d # some comment on "e" # this is multiline comment e=e"""); } | testFixComments |
26,947 | void () { myFixture.testInspection(getTestName(true), new LocalInspectionToolWrapper(new AlphaUnsortedPropertiesFileInspection())); } | doTest |
26,948 | String () { return PluginPathManager.getPluginHomePath("properties") + "/tests/testData/alphaUnsorted/"; } | getTestDataPath |
26,949 | String () { return PluginPathManager.getPluginHomePath("properties") + "/tests/testData/propertiesFile/psi"; } | getTestDataPath |
26,950 | void () { doTest(true); } | testProp1 |
26,951 | void () { doTest(true); } | testComments |
26,952 | void () { doTest(true); } | testHeader |
26,953 | void (@NotNull ActionHint actionHint, @NotNull String testFullPath, @NotNull String testName) { final int offset = getEditor().getCaretModel().getOffset(); final PsiElement psiElement = getFile().findElementAt(offset); assert psiElement != null; final Property property = PsiTreeUtil.getParentOfType(psiElement, Property.class); final PsiComment comment = myParser.createLineCommentFromText(PropertiesFileType.INSTANCE, actionHint.getExpectedText()); WriteAction.runAndWait(() -> property.getParent().addBefore(comment, property)); final String expectedFilePath = getBasePath() + "/after" + testName; checkResultByFile("In file: " + expectedFilePath, expectedFilePath, false); } | doAction |
26,954 | String () { return PluginPathManager.getPluginHomePath("properties") + "/tests/testData"; } | getTestDataPath |
26,955 | void () { myFixture.configureByFile("/propertiesFile/highlighting/web-urls.properties"); myFixture.checkHighlighting(true, true, true); } | testSimple |
26,956 | void () { doTest("duplicateProperty/" + getTestName(true), myTool); } | doTest |
26,957 | void () { doTest(); } | testDuplicateValues |
26,958 | void () { doTest(); } | testDuplicateValuesCurrentFileAnalysis |
26,959 | void () { myTool.CURRENT_FILE = false; myTool.MODULE_WITH_DEPENDENCIES = true; doTest(); } | testDuplicateValuesInDifferentFiles |
26,960 | void () { myTool.CURRENT_FILE = false; myTool.MODULE_WITH_DEPENDENCIES = true; myTool.CHECK_DUPLICATE_KEYS = false; myTool.CHECK_DUPLICATE_VALUES = false; myTool.CHECK_DUPLICATE_KEYS_WITH_DIFFERENT_VALUES = true; doTest(); } | testDuplicateKeysWithDifferentValues |
26,961 | void () { myTool.CURRENT_FILE = false; myTool.MODULE_WITH_DEPENDENCIES = true; myTool.CHECK_DUPLICATE_KEYS = true; myTool.CHECK_DUPLICATE_VALUES = false; myTool.CHECK_DUPLICATE_KEYS_WITH_DIFFERENT_VALUES = false; doTest(); } | testDuplicateKeys |
26,962 | void () { myTool.CURRENT_FILE = false; myTool.MODULE_WITH_DEPENDENCIES = true; myTool.CHECK_DUPLICATE_KEYS = true; myTool.CHECK_DUPLICATE_VALUES = false; myTool.CHECK_DUPLICATE_KEYS_WITH_DIFFERENT_VALUES = true; doTest(); } | testDuplicateKeysWithAndWithoutDifferent |
26,963 | String () { return PluginPathManager.getPluginHomePath("properties") + "/tests/testData"; } | getTestDataPath |
26,964 | void () { EncodingProjectManager.getInstance(getProject()).setNative2AsciiForPropertiesFiles(null, false); EncodingProjectManager.getInstance(getProject()).setDefaultCharsetForPropertiesFiles(null, StandardCharsets.ISO_8859_1); PlatformTestUtil.withEncoding("UTF-8", () -> { configureByText("\\u1234\\uxxxx\\n\\t\\y=\\u3210\\uzzzz\\n\\t\\y"); List<IProperty> properties = ((PropertiesFile)myFile).getProperties(); assertEquals(1, properties.size()); final Property property = (Property)properties.get(0); assertEquals("\\u1234\\uxxxx\\n\\t\\y", property.getKey()); assertEquals("\\u3210\\uzzzz\\n\\t\\y", property.getValue()); ApplicationManager.getApplication().runWriteAction(() -> { property.setName("\u041f\\uyyyy\\n\\t\\y"); }); FileDocumentManager.getInstance().saveAllDocuments(); VirtualFile virtualFile = myFile.getVirtualFile(); // copy to other file type to stop charset mingling VirtualFile newFile = copy(virtualFile, virtualFile.getParent(), "xxx.txt"); String chars = VfsUtilCore.loadText(newFile); // 0x41f converted to '?' because it cannot be represented in ISO-8859-1 assertEquals("?\\uyyyy\\n\\t\\y=\\u3210\\uzzzz\\n\\t\\y", chars); }); } | testCharsetOff |
26,965 | void () { EncodingProjectManager.getInstance(getProject()).setNative2AsciiForPropertiesFiles(null, false); EncodingProjectManager.getInstance(getProject()).setDefaultCharsetForPropertiesFiles(null, null); EncodingProjectManager.getInstance(getProject()).setEncoding(null, StandardCharsets.UTF_8); PlatformTestUtil.withEncoding("UTF-8", () -> { configureByText("\\u1234\\uxxxx\\n\\t\\y=\\u3210\\uzzzz\\n\\t\\y"); List<IProperty> properties = ((PropertiesFile)myFile).getProperties(); assertEquals(1, properties.size()); final Property property = (Property)properties.get(0); assertEquals("\\u1234\\uxxxx\\n\\t\\y", property.getKey()); assertEquals("\\u3210\\uzzzz\\n\\t\\y", property.getValue()); ApplicationManager.getApplication().runWriteAction(() -> { property.setName("\\u041f\\uyyyy\\n\\t\\y"); }); FileDocumentManager.getInstance().saveAllDocuments(); VirtualFile virtualFile = myFile.getVirtualFile(); // copy to other file type to stop charset mingling VirtualFile newFile = copy(virtualFile, virtualFile.getParent(), "xxx.txt"); String chars = VfsUtilCore.loadText(newFile); assertEquals("\\u041f\\uyyyy\\n\\t\\y=\\u3210\\uzzzz\\n\\t\\y", chars); }); } | testDefaultCharset |
26,966 | void () { myFixture.enableInspections(new SpellCheckingInspection()); myFixture.configureByText("test.properties", """ valid.key=value # comment is <TYPO descr="Typo: In word 'cheked'">cheked</TYPO> validWord<TYPO descr="Typo: In word 'Buuundary'">Buuundary</TYPO>=value i3<TYPO descr="Typo: In word 'nvalid'">nvalid</TYPO>.key=i3<TYPO descr="Typo: In word 'nvalid'">nvalid</TYPO>Value"""); myFixture.testHighlighting(); } | testPropertiesSpellcheckingStrategy |
26,967 | void (@NotNull ActionHint actionHint, @NotNull String testFullPath, @NotNull String testName) { myPropertiesSettings.KEY_VALUE_DELIMITER_CODE = actionHint.getExpectedText().charAt(0); executeAction("ReformatCode"); checkResult(testName); } | doAction |
26,968 | void (@NotNull final String testName) { final String expectedFilePath = getBasePath() + "/after" + testName; checkResultByFile("In file: " + expectedFilePath, expectedFilePath, false); } | checkResult |
26,969 | void () { final PsiFile file = myFixture.addFileToProject("prop_core_en.properties", ""); final PsiFile file2 = myFixture.addFileToProject("prop_core_fi.properties", ""); final PropertiesFile propertiesFile = PropertiesImplUtil.getPropertiesFile(file); final PropertiesFile propertiesFile2 = PropertiesImplUtil.getPropertiesFile(file2); assertNotNull(propertiesFile); assertNotNull(propertiesFile2); final ResourceBundle bundle = propertiesFile.getResourceBundle(); final ResourceBundle bundle2 = propertiesFile2.getResourceBundle(); assertTrue(bundle.equals(bundle2)); assertSize(2, bundle.getPropertiesFiles()); assertTrue(bundle.getDefaultPropertiesFile().equals(bundle2.getDefaultPropertiesFile())); assertEquals("prop_core", bundle.getBaseName()); assertNotSame(propertiesFile.getLocale().getLanguage(), propertiesFile.getLocale().getDisplayLanguage()); assertNotSame(propertiesFile2.getLocale().getLanguage(), propertiesFile2.getLocale().getDisplayLanguage()); } | testPropertiesFilesDefaultCombiningToResourceBundle |
26,970 | void () { final PsiFile file = myFixture.addFileToProject("some_property_file.properties", ""); final PsiFile file2 = myFixture.addFileToProject("some_property_fil.properties", ""); final PropertiesFile propertiesFile = PropertiesImplUtil.getPropertiesFile(file); assertNotNull(propertiesFile); final ResourceBundle resourceBundle = propertiesFile.getResourceBundle(); assertSize(1, resourceBundle.getPropertiesFiles()); final PropertiesFile propertiesFile2 = PropertiesImplUtil.getPropertiesFile(file2); assertNotNull(propertiesFile2); final ResourceBundle resourceBundle2 = propertiesFile.getResourceBundle(); assertSize(1, resourceBundle2.getPropertiesFiles()); assertEquals(PropertiesUtil.DEFAULT_LOCALE, propertiesFile.getLocale()); } | testPropertiesFileNotAssociatedWhileLanguageCodeNotRecognized |
26,971 | void () { final PsiFile file = myFixture.addFileToProject("p.properties", ""); final PsiFile file2 = myFixture.addFileToProject("p_asd.properties", ""); final PropertiesFile propertiesFile = PropertiesImplUtil.getPropertiesFile(file); final PropertiesFile propertiesFile2 = PropertiesImplUtil.getPropertiesFile(file2); assertNotNull(propertiesFile); assertNotNull(propertiesFile2); final ResourceBundle bundle = propertiesFile.getResourceBundle(); final ResourceBundle bundle2 = propertiesFile2.getResourceBundle(); assertSize(1, bundle.getPropertiesFiles()); assertSize(1, bundle2.getPropertiesFiles()); assertEquals("p", bundle.getBaseName()); assertEquals("p_asd", bundle2.getBaseName()); final ResourceBundleManager manager = ResourceBundleManager.getInstance(getProject()); List<PropertiesFile> rawBundle = List.of(propertiesFile, propertiesFile2); final String suggestedBaseName = PropertiesUtil.getDefaultBaseName(rawBundle); assertEquals("p", suggestedBaseName); manager.combineToResourceBundle(rawBundle, suggestedBaseName); assertEquals("asd", propertiesFile2.getLocale().getLanguage()); } | testLanguageCodeNotRecognized |
26,972 | void () { final PropertiesFile file = PropertiesImplUtil.getPropertiesFile(myFixture.addFileToProject("resources-dev/my-app-dev.properties", "")); final PropertiesFile file2 = PropertiesImplUtil.getPropertiesFile(myFixture.addFileToProject("resources-prod/my-app-prod.properties", "")); assertNotNull(file); assertNotNull(file2); assertOneElement(file.getResourceBundle().getPropertiesFiles()); assertOneElement(file2.getResourceBundle().getPropertiesFiles()); final ResourceBundleManager resourceBundleBaseNameManager = ResourceBundleManager.getInstance(getProject()); final String newBaseName = "my-app"; resourceBundleBaseNameManager.combineToResourceBundle(Arrays.asList(file, file2), newBaseName); final ResourceBundle resourceBundle = file.getResourceBundle(); assertEquals(2, resourceBundle.getPropertiesFiles().size()); assertEquals(newBaseName, resourceBundle.getBaseName()); resourceBundleBaseNameManager.dissociateResourceBundle(resourceBundle); assertOneElement(file.getResourceBundle().getPropertiesFiles()); assertOneElement(file2.getResourceBundle().getPropertiesFiles()); } | testCombineToCustomResourceBundleAndDissociateAfter |
26,973 | void () { final PsiFile file = myFixture.addFileToProject("Base_Page.properties", ""); final PsiFile file2 = myFixture.addFileToProject("Base_Page_en.properties", ""); final String baseName = PropertiesUtil.getDefaultBaseName(map(Arrays.asList(file, file2), psiFile -> PropertiesImplUtil.getPropertiesFile(file))); assertEquals("Base_Page", baseName); } | testSuggestedCustomResourceBundleName |
26,974 | void () { myFixture.addFileToProject("qwe/asd/p.properties", ""); final PsiFile file = myFixture.addFileToProject("qwe/asd/p_en.properties", ""); final PropertiesFile propertiesFile = PropertiesImplUtil.getPropertiesFile(file); assertNotNull(propertiesFile); final ResourceBundleManager resourceBundleManager = ResourceBundleManager.getInstance(getProject()); resourceBundleManager.dissociateResourceBundle(propertiesFile.getResourceBundle()); final PropertiesFile propFile1 = PropertiesImplUtil.getPropertiesFile(myFixture.addFileToProject("qwe1/asd1/p.properties", "")); final PropertiesFile propFile2 = PropertiesImplUtil.getPropertiesFile(myFixture.addFileToProject("qwe1/asd1/p_abc.properties", "")); assertNotNull(propFile1); assertNotNull(propFile2); resourceBundleManager.combineToResourceBundle(List.of(propFile1, propFile2), "p"); final PsiFile someFile = myFixture.addFileToProject("to_remove/asd.txt", ""); final PsiDirectory toRemove = someFile.getParent(); assertNotNull(toRemove); ApplicationManager.getApplication().runWriteAction(toRemove::delete); final ResourceBundleManagerState state = resourceBundleManager.getState(); assertNotNull(state); assertSize(1, state.getCustomResourceBundles()); assertSize(2, state.getDissociatedFiles()); final PsiDirectory directory = propertiesFile.getParent().getParent(); assertNotNull(directory); ApplicationManager.getApplication().runWriteAction(directory::delete); assertSize(1, state.getCustomResourceBundles()); assertSize(0, state.getDissociatedFiles()); final PsiDirectory directory1 = propFile1.getParent().getParent(); assertNotNull(directory1); ApplicationManager.getApplication().runWriteAction(directory1::delete); assertSize(0, state.getCustomResourceBundles()); assertSize(0, state.getDissociatedFiles()); } | testResourceBundleManagerUpdatesProperlyWhileDirRemoval |
26,975 | void () { final PropertiesFile propFile1 = PropertiesImplUtil.getPropertiesFile(myFixture.addFileToProject("qwe/p.properties", "")); final PropertiesFile propFile2 = PropertiesImplUtil.getPropertiesFile(myFixture.addFileToProject("qwe/p_abc.properties", "")); assertNotNull(propFile1); assertNotNull(propFile2); myFixture.addFileToProject("qwe/q.properties", ""); final PropertiesFile propertiesFile = PropertiesImplUtil.getPropertiesFile(myFixture.addFileToProject("qwe/q_fr.properties", "")); assertNotNull(propertiesFile); assertSize(2, propertiesFile.getResourceBundle().getPropertiesFiles()); final ResourceBundleManager resourceBundleManager = ResourceBundleManager.getInstance(getProject()); resourceBundleManager.combineToResourceBundle(List.of(propFile1, propFile2), "p"); resourceBundleManager.dissociateResourceBundle(propertiesFile.getResourceBundle()); assertSize(1, propertiesFile.getResourceBundle().getPropertiesFiles()); assertSize(2, propFile2.getResourceBundle().getPropertiesFiles()); final PsiDirectory toMove = myFixture.addFileToProject("asd/temp.txt", "").getParent(); assertNotNull(toMove); ApplicationManager.getApplication().runWriteAction(() -> MoveFilesOrDirectoriesUtil.doMoveDirectory(propFile1.getParent(), toMove)); final PsiDirectory movedDir = toMove.findSubdirectory("qwe"); assertNotNull(movedDir); final PropertiesFile newPropFile1 = PropertiesImplUtil.getPropertiesFile(movedDir.findFile("p.properties")); assertNotNull(newPropFile1); assertSize(2, newPropFile1.getResourceBundle().getPropertiesFiles()); final PropertiesFile newPropertiesFile = PropertiesImplUtil.getPropertiesFile(movedDir.findFile("q_fr.properties")); assertNotNull(newPropertiesFile); assertSize(1, newPropertiesFile.getResourceBundle().getPropertiesFiles()); } | testResourceBundleManagerUpdatesProperlyWhileDirMove |
26,976 | String () { return PluginPathManager.getPluginHomePath("properties") + "/tests/testData/propertiesFile/joinLines/"; } | getTestDataPath |
26,977 | void () { doTest(); } | testProperties |
26,978 | void () { doTest(); } | testPropertiesBackSlash |
26,979 | void () { doTest(); } | testPropertiesBackSlashSlash |
26,980 | void () { configureByFile(getTestName(false) + ".properties"); performAction(); checkResultByFile(getTestName(false) + "_after.properties"); } | doTest |
26,981 | void () { EditorActionManager actionManager = EditorActionManager.getInstance(); EditorActionHandler actionHandler = actionManager.getActionHandler(IdeActions.ACTION_EDITOR_JOIN_LINES); actionHandler.execute(getEditor(), null, DataManager.getInstance().getDataContext()); } | performAction |
26,982 | String () { return PluginPathManager.getPluginHomePath("properties") + "/tests/testData/wrongPropertyKeyDelimiter"; } | getTestDataPath |
26,983 | void () { myFixture.configureByFile("Test1.properties"); myFixture.checkHighlighting(); } | testSimple |
26,984 | void (@NonNls String text, @NonNls String[] expectedTokens) { Lexer lexer = new PropertiesLexer(); doTest(text, expectedTokens, lexer); } | doTest |
26,985 | void (@NonNls String text, @NonNls String[] expectedTokens) { Lexer lexer = new PropertiesHighlightingLexer(); doTest(text, expectedTokens, lexer); } | doTestHL |
26,986 | void (String text, String[] expectedTokens,Lexer lexer) { lexer.start(text); int idx = 0; while (lexer.getTokenType() != null) { if (idx >= expectedTokens.length) fail("Too many tokens"); String tokenName = lexer.getTokenType().toString(); String expectedTokenType = expectedTokens[idx++]; String expectedTokenText = expectedTokens[idx++]; String tokenText = lexer.getBufferSequence().subSequence(lexer.getTokenStart(), lexer.getTokenEnd()).toString(); assertEquals(tokenText, expectedTokenType, tokenName); assertEquals("Token type: " + expectedTokenType, expectedTokenText, tokenText); lexer.advance(); } if (idx < expectedTokens.length) fail("Not enough tokens"); } | doTest |
26,987 | void () { doTest("xxx=yyy", new String[]{ "Properties:KEY_CHARACTERS", "xxx", "Properties:KEY_VALUE_SEPARATOR", "=", "Properties:VALUE_CHARACTERS", "yyy", }); } | testSimple |
26,988 | void () { doTest("xxx=yyy zzz", new String[]{ "Properties:KEY_CHARACTERS", "xxx", "Properties:KEY_VALUE_SEPARATOR", "=", "Properties:VALUE_CHARACTERS", "yyy zzz", }); } | testTwoWords |
26,989 | void () { doTest("a b\n \nx\ty", new String[]{ "Properties:KEY_CHARACTERS", "a", "WHITE_SPACE", " ", "Properties:VALUE_CHARACTERS", "b", "WHITE_SPACE", "\n \n", "Properties:KEY_CHARACTERS", "x", "WHITE_SPACE", "\t", "Properties:VALUE_CHARACTERS", "y" }); } | testMulti |
26,990 | void () { doTest("a", new String[]{ "Properties:KEY_CHARACTERS", "a" }); } | testIncompleteProperty |
26,991 | void () { doTest("a.2=", new String[]{ "Properties:KEY_CHARACTERS", "a.2", "Properties:KEY_VALUE_SEPARATOR", "=" }); } | testIncompleteProperty2 |
26,992 | void () { doTest("sdlfkjsd\\l\\\\\\:\\=gk = s\\nsssd", new String[]{ "Properties:KEY_CHARACTERS", "sdlfkjsd\\l\\\\\\:\\=gk", "WHITE_SPACE", " ", "Properties:KEY_VALUE_SEPARATOR", "=", "WHITE_SPACE", " ", "Properties:VALUE_CHARACTERS", "s\\nsssd" }); } | testEscaping |
26,993 | void () { doTest("sdlfkjsdsssd:a\\\nb", new String[]{ "Properties:KEY_CHARACTERS", "sdlfkjsdsssd", "Properties:KEY_VALUE_SEPARATOR", ":", "Properties:VALUE_CHARACTERS", "a\\\nb" }); } | testCRLFEscaping |
26,994 | void () { doTest("x\\\ny:z", new String[]{ "Properties:KEY_CHARACTERS", "x\\\ny", "Properties:KEY_VALUE_SEPARATOR", ":", "Properties:VALUE_CHARACTERS", "z" }); } | testCRLFEscapingKey |
26,995 | void () { doTest("x y", new String[]{ "Properties:KEY_CHARACTERS", "x", "WHITE_SPACE", " ", "Properties:VALUE_CHARACTERS", "y" }); } | testWhitespace |
26,996 | void () { doTest("x=# y", new String[]{ "Properties:KEY_CHARACTERS", "x", "Properties:KEY_VALUE_SEPARATOR", "=", "Properties:VALUE_CHARACTERS", "# y" }); } | testHashInValue |
26,997 | void () { doTest("#hhhh kkkk \n\n", new String[]{ "Properties:END_OF_LINE_COMMENT", "#hhhh kkkk ", "WHITE_SPACE", "\n\n", }); } | testComments |
26,998 | void () { doTest("install/htdocs/imcms/html/link_editor.jsp/1002 = URL\\n\\\n" + "\t\\t\\teller meta_id:", new String[]{ "Properties:KEY_CHARACTERS", "install/htdocs/imcms/html/link_editor.jsp/1002", "WHITE_SPACE", " ", "Properties:KEY_VALUE_SEPARATOR", "=", "WHITE_SPACE", " ", "Properties:VALUE_CHARACTERS", "URL\\n\\\n" + "\t\\t\\teller meta_id:" }); } | testTabs |
26,999 | void () { doTest(" #comm1\n#comm2=n\n\t#comm3", new String[]{ "WHITE_SPACE", " ", "Properties:END_OF_LINE_COMMENT", "#comm1", "WHITE_SPACE", "\n", "Properties:END_OF_LINE_COMMENT", "#comm2=n", "WHITE_SPACE", "\n\t", "Properties:END_OF_LINE_COMMENT", "#comm3", }); } | testIndentedComments |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.