root manager tests moved to community

This commit is contained in:
nik
2010-06-25 15:50:37 +04:00
parent 311e408b47
commit b175c1f8ff
52 changed files with 5909 additions and 1 deletions
+1 -1
View File
@@ -9,7 +9,7 @@
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module" module-name="testFramework-java" />
<orderEntry type="module" module-name="java-impl" />
<orderEntry type="module" module-name="idea-ui" scope="RUNTIME" />
<orderEntry type="module" module-name="idea-ui" />
<orderEntry type="module" module-name="community-resources" scope="RUNTIME" />
<orderEntry type="module" module-name="execution-impl" scope="RUNTIME" />
<orderEntry type="module" module-name="platform-api" />
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<module version="4" relativePaths="true">
<component name="NewModuleRootManager" />
</module>
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<module version="4" relativePaths="true">
<component name="NewModuleRootManager" />
</module>
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<application>
<component name="libraryTable">
<library name="xxx">
<CLASSES>
<root url="file:///bin" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</component>
</application>
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<application>
<component name="ProjectLibraryTable">
<library>
<name value="xxx" />
<roots>
<projectPath>
<root type="composite" />
</projectPath>
<sourcePath>
<root type="composite" />
</sourcePath>
<classPath>
<root type="composite">
<root type="simple" url="file:///bin" />
</root>
</classPath>
<excludePath>
<root type="composite" />
</excludePath>
<javadocPath>
<root type="composite" />
</javadocPath>
</roots>
</library>
</component>
</application>
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<module version="4" relativePaths="true">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$">
<sourceFolder isTestSource="false" url="file://$MODULE_DIR$/src" />
<sourceFolder isTestSource="false" url="file://$MODULE_DIR$/test/src" />
</content>
<orderEntry type="jdk" jdkName="java version &quot;1.3.1&quot;" />
<orderEntry type="sourceFolder" />
<orderEntry type="library" name="jakarta-commons-lang-2.0" level="application" />
<output url="file://$MODULE_DIR$/build" />
<output-test url="file://$MODULE_DIR$/build" />
<exclude-output />
</component>
</module>
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4" relativePaths="true">
<component name="ProjectModuleManager">
<modules>
<module filepath="$PROJECT_DIR$/se.mdh.html.iml" fileurl="file://$PROJECT_DIR$/se.mdh.html.iml" />
</modules>
</component>
</project>
@@ -0,0 +1,111 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="3" relativePaths="false">
<component name="ProjectRootManager" version="2">
<jdk name="java version &quot;1.3.1&quot;" />
<library name="jakarta-commons-lang-2.0" />
<projectPath>
<root type="composite">
<root type="simple" url="file://$PROJECT_DIR$" />
</root>
</projectPath>
<sourcePath>
<root type="composite">
<root type="jdk" rootType="sourcePath" name="java version &quot;1.3.1&quot;" />
<root type="simple" url="file://$PROJECT_DIR$/src" />
<root type="simple" url="file://$PROJECT_DIR$/test/src" />
<root type="library" rootType="sourcePath" name="jakarta-commons-lang-2.0" />
</root>
</sourcePath>
<classPath>
<root type="composite">
<root type="jdk" rootType="classPath" name="java version &quot;1.3.1&quot;" />
<root type="output" />
<root type="library" rootType="classPath" name="jakarta-commons-lang-2.0" />
</root>
</classPath>
<excludePath>
<root type="composite">
<root type="jdk" rootType="excludePath" name="java version &quot;1.3.1&quot;" />
<root type="excludedOutput" />
</root>
</excludePath>
<javadocPath>
<root type="composite">
<root type="jdk" rootType="javadocPath" name="java version &quot;1.3.1&quot;" />
<root type="library" rootType="javadocPath" name="jakarta-commons-lang-2.0" />
</root>
</javadocPath>
<assert_keyword enabled="no" />
<exclude_output enabled="yes" />
</component>
<component name="CompilerConfiguration">
<option name="DEFAULT_COMPILER" value="Javac" />
<option name="SYNCHRONIZE_OUTPUT_DIRECTORY" value="false" />
<option name="DEFAULT_OUTPUT_PATH" value="$PROJECT_DIR$/build" />
<option name="OUTPUT_MODE" value="single" />
<resourceExtensions />
</component>
<component name="JavacSettings">
<option name="DEBUGGING_INFO" value="true" />
<option name="GENERATE_NO_WARNINGS" value="false" />
<option name="DEPRECATION" value="true" />
<option name="ADDITIONAL_OPTIONS_STRING" value="" />
<option name="MAXIMUM_HEAP_SIZE" value="128" />
</component>
<component name="JikesSettings">
<option name="JIKES_PATH" value="" />
<option name="DEBUGGING_INFO" value="true" />
<option name="DEPRECATION" value="true" />
<option name="GENERATE_NO_WARNINGS" value="false" />
<option name="GENERATE_MAKE_FILE_DEPENDENCIES" value="false" />
<option name="DO_FULL_DEPENDENCE_CHECK" value="false" />
<option name="IS_EMACS_ERRORS_MODE" value="true" />
<option name="ADDITIONAL_OPTIONS_STRING" value="" />
</component>
<component name="AntConfiguration">
<option name="IS_AUTOSCROLL_TO_SOURCE" value="false" />
<option name="FILTER_TARGETS" value="false" />
</component>
<component name="JavadocGenerationManager">
<option name="OUTPUT_DIRECTORY" />
<option name="OPTION_SCOPE" value="protected" />
<option name="OPTION_HIERARCHY" value="false" />
<option name="OPTION_NAVIGATOR" value="false" />
<option name="OPTION_INDEX" value="false" />
<option name="OPTION_SEPARATE_INDEX" value="false" />
<option name="OPTION_DOCUMENT_TAG_USE" value="true" />
<option name="OPTION_DOCUMENT_TAG_AUTHOR" value="true" />
<option name="OPTION_DOCUMENT_TAG_VERSION" value="true" />
<option name="OPTION_DOCUMENT_TAG_DEPRECATED" value="true" />
<option name="OPTION_DEPRECATED_LIST" value="true" />
<option name="OTHER_OPTIONS" />
<option name="HEAP_SIZE" />
<option name="OPEN_IN_BROWSER" value="false" />
</component>
<component name="WebManager">
<option enabled="false" />
</component>
<component name="WebRootContainer" />
<component name="EjbManager" enabled="false" />
<component name="JUnitProjectSettings">
<option name="TEST_RUNNER" value="UI" />
</component>
<component name="EntryPointsManager">
<entry_points />
</component>
<component name="EjbActionsConfiguration">
<option name="NEW_MESSAGE_BEAN_LAST_PACKAGE" value="" />
<option name="NEW_ENTITY_BEAN_LAST_PACKAGE" value="" />
<option name="NEW_SESSION_BEAN_LAST_PACKAGE" value="" />
</component>
<component name="CodeStyleManager">
<option name="USE_DEFAULT_CODE_STYLE_SCHEME" value="true" />
<option name="CODE_STYLE_SCHEME" value="" />
</component>
<component name="ExportToHTMLSettings">
<option name="PRINT_LINE_NUMBERS" value="false" />
<option name="OPEN_IN_BROWSER" value="false" />
<option name="OUTPUT_DIRECTORY" />
</component>
</project>
@@ -0,0 +1,743 @@
<?xml version="1.0" encoding="UTF-8"?>
<application>
<component name="libraryTable">
<library name="activation">
<CLASSES>
<root url="jar://C:/lib/ext/jaf/1_0_1/activation.jar!/" />
</CLASSES>
<JAVADOC>
<root url="file://C:/lib/ext/jaf/1_0_1/docs/javadocs" />
</JAVADOC>
<SOURCES />
</library>
<library name="comm-2.0">
<CLASSES>
<root url="jar://C:/lib/ext/comm/comm.jar!/" />
<root url="file://C:/lib/ext/comm" />
</CLASSES>
<JAVADOC>
<root url="file://C:/lib/ext/comm/javadocs" />
</JAVADOC>
<SOURCES />
</library>
<library name="dennislundberg-codegeneration-2.0">
<CLASSES>
<root url="jar://C:/lib/dennislundberg-codegeneration/RELEASE-2_0/codegeneration.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
<library name="dennislundberg-skatt-1.0">
<CLASSES>
<root url="jar://C:/lib/dennislundberg-skatt/RELEASE-1_0/dennislundberg-skatt.jar!/" />
</CLASSES>
<JAVADOC>
<root url="file://C:/lib/dennislundberg-skatt/RELEASE-1_0/docs/api" />
</JAVADOC>
<SOURCES />
</library>
<library name="itext-1.00">
<CLASSES>
<root url="jar://C:/lib/ext/itext/itext-1.00.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
<library name="itext-1.01">
<CLASSES>
<root url="jar://C:/lib/ext/itext/itext-1.01.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
<library name="jakarta-commons-lang-1.0.1">
<CLASSES>
<root url="jar://C:/lib/ext/jakarta-commons/commons-lang-1.0.1/commons-lang-1.0.1.jar!/" />
</CLASSES>
<JAVADOC>
<root url="file://C:/lib/ext/jakarta-commons/commons-lang-1.0.1/docs/api" />
</JAVADOC>
<SOURCES />
</library>
<library name="jakarta-commons-lang-2.0">
<CLASSES>
<root url="jar://C:/lib/ext/jakarta-commons/commons-lang-2.0/commons-lang-2.0.jar!/" />
</CLASSES>
<JAVADOC>
<root url="file://C:/lib/ext/jakarta-commons/commons-lang-2.0/docs/api" />
</JAVADOC>
<SOURCES />
</library>
<library name="jakarta-commons-logging-1.0.2">
<CLASSES>
<root url="jar://C:/lib/ext/jakarta-commons/commons-logging-1.0.2/commons-logging.jar!/" />
</CLASSES>
<JAVADOC>
<root url="file://C:/lib/ext/jakarta-commons/commons-logging-1.0.2/docs/api" />
</JAVADOC>
<SOURCES />
</library>
<library name="jakarta-commons-logging-1.0.3">
<CLASSES>
<root url="jar://C:/lib/ext/jakarta-commons/commons-logging-1.0.3/commons-logging.jar!/" />
</CLASSES>
<JAVADOC>
<root url="file://C:/lib/ext/jakarta-commons/commons-logging-1.0.3/docs/api" />
</JAVADOC>
<SOURCES />
</library>
<library name="jndi">
<CLASSES>
<root url="jar://C:/lib/ext/jndi/1_2_1/lib/jndi.jar!/" />
</CLASSES>
<JAVADOC>
<root url="file://C:/lib/ext/jndi/1_2_1/ldap/doc/ldapcontrols" />
<root url="file://C:/lib/ext/jndi/1_2_1/ldap/doc/sasl" />
</JAVADOC>
<SOURCES />
</library>
<library name="jsse">
<CLASSES>
<root url="jar://C:/lib/ext/jsse/lib/jcert.jar!/" />
<root url="jar://C:/lib/ext/jsse/lib/jnet.jar!/" />
<root url="jar://C:/lib/ext/jsse/lib/jsse.jar!/" />
</CLASSES>
<JAVADOC>
<root url="file://C:/lib/ext/jsse/doc/apidoc" />
</JAVADOC>
<SOURCES />
</library>
<library name="jstl-1.0">
<CLASSES>
<root url="jar://C:/lib/ext/jakarta-taglibs/standard-1.0.3/lib/jstl.jar!/" />
</CLASSES>
<JAVADOC>
<root url="file://C:/lib/ext/jakarta-taglibs/standard-1.0.3/javadoc" />
</JAVADOC>
<SOURCES />
</library>
<library name="jta">
<CLASSES>
<root url="jar://C:/lib/ext/jta/jta20.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
<library name="junit">
<CLASSES>
<root url="jar://C:/lib/ext/junit/3_8_1/junit.jar!/" />
</CLASSES>
<JAVADOC>
<root url="file://C:/lib/ext/junit/3_8_1/javadoc" />
</JAVADOC>
<SOURCES />
</library>
<library name="log4j">
<CLASSES>
<root url="jar://C:/lib/ext/jakarta-log4j/1.2.8/dist/lib/log4j-1.2.8.jar!/" />
</CLASSES>
<JAVADOC>
<root url="file://C:/lib/ext/jakarta-log4j/1.2.8/docs/api" />
</JAVADOC>
<SOURCES />
</library>
<library name="mail-1.1.3">
<CLASSES>
<root url="jar://C:/lib/ext/javamail/javamail-1.1.3/mail.jar!/" />
</CLASSES>
<JAVADOC>
<root url="file://C:/lib/ext/javamail/javamail-1.1.3/docs/javadocs" />
</JAVADOC>
<SOURCES />
</library>
<library name="mail-1.2">
<CLASSES>
<root url="jar://C:/lib/ext/javamail/javamail-1.2/mail.jar!/" />
</CLASSES>
<JAVADOC>
<root url="file://C:/lib/ext/javamail/javamail-1.2/docs/javadocs" />
</JAVADOC>
<SOURCES />
</library>
<library name="mdh-application-1.1.3">
<CLASSES>
<root url="jar://C:/lib/application/RELEASE-1_1_3/application.jar!/" />
</CLASSES>
<JAVADOC>
<root url="file://C:/lib/application/RELEASE-1_1_3/docs/api" />
</JAVADOC>
<SOURCES />
</library>
<library name="mdh-awt-applet-2.2.4">
<CLASSES>
<root url="jar://C:/lib/awt/RELEASE-2_2_4/awt-applet.jar!/" />
</CLASSES>
<JAVADOC>
<root url="file://C:/lib/awt/RELEASE-2_2_4/docs/api" />
</JAVADOC>
<SOURCES />
</library>
<library name="mdh-databas-1.1.2">
<CLASSES>
<root url="jar://C:/lib/databas/RELEASE-1_1_2/databas.jar!/" />
</CLASSES>
<JAVADOC>
<root url="file://C:/lib/databas/RELEASE-1_1_2/docs/api" />
</JAVADOC>
<SOURCES />
</library>
<library name="mdh-databas-util-1.1.1">
<CLASSES>
<root url="jar://C:/lib/databas-util/RELEASE-1_1_1/databas-util.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
<library name="mdh-databas-util-1.1.2">
<CLASSES>
<root url="jar://C:/lib/databas-util/RELEASE-1_1_2/databas-util.jar!/" />
</CLASSES>
<JAVADOC>
<root url="file://C:/lib/databas-util/RELEASE-1_1_2/docs/api" />
</JAVADOC>
<SOURCES />
</library>
<library name="mdh-databas-util-applet-1.1.2">
<CLASSES>
<root url="jar://C:/lib/databas-util/RELEASE-1_1_2/databas-util-applet.jar!/" />
</CLASSES>
<JAVADOC>
<root url="file://C:/lib/databas-util/RELEASE-1_1_2/docs/api" />
</JAVADOC>
<SOURCES />
</library>
<library name="mdh-epost-1.0.1">
<CLASSES>
<root url="jar://C:/lib/epost/RELEASE-1_0_1/epost.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
<library name="mdh-epost-1.1.1">
<CLASSES>
<root url="jar://C:/lib/epost/RELEASE-1_1_1/epost.jar!/" />
</CLASSES>
<JAVADOC>
<root url="file://C:/lib/epost/RELEASE-1_1_1/docs/api" />
</JAVADOC>
<SOURCES />
</library>
<library name="mdh-epost-2.0">
<CLASSES>
<root url="jar://C:/lib/epost/RELEASE-2_0/shared/lib/epost-shared.jar!/" />
</CLASSES>
<JAVADOC>
<root url="file://C:/lib/epost/RELEASE-2_0/docs/api" />
</JAVADOC>
<SOURCES />
</library>
<library name="mdh-html-1.6.2">
<CLASSES>
<root url="jar://C:/lib/html/RELEASE-1_6_2/html.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
<library name="mdh-html-1.6.4">
<CLASSES>
<root url="jar://C:/lib/html/RELEASE-1_6_4/html.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
<library name="mdh-html-2.0.1">
<CLASSES>
<root url="jar://C:/lib/html/RELEASE-2_0_1/html.jar!/" />
</CLASSES>
<JAVADOC>
<root url="file://C:/lib/html/RELEASE-2_0_1/docs/api" />
</JAVADOC>
<SOURCES />
</library>
<library name="mdh-html-2.1">
<CLASSES>
<root url="jar://C:/lib/html/RELEASE-2_1/html.jar!/" />
</CLASSES>
<JAVADOC>
<root url="file://C:/lib/html/RELEASE-2_1/docs/api" />
</JAVADOC>
<SOURCES />
</library>
<library name="mdh-ladok-1.2">
<CLASSES>
<root url="jar://C:/lib/ladok/RELEASE-1_2/ladok.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
<library name="mdh-ladok-1.3">
<CLASSES>
<root url="jar://C:/lib/ladok/RELEASE-1_3/ladok.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
<library name="mdh-ladok-1.4">
<CLASSES>
<root url="jar://C:/lib/ladok/RELEASE-1_4/ladok.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
<library name="mdh-ladok-2.0">
<CLASSES>
<root url="jar://C:/lib/ladok/RELEASE-2_0/shared/lib/ladok-shared.jar!/" />
</CLASSES>
<JAVADOC>
<root url="file://C:/lib/ladok/RELEASE-2_0/shared/docs/api" />
</JAVADOC>
<SOURCES />
</library>
<library name="mdh-ladok-2.1">
<CLASSES>
<root url="jar://C:/lib/ladok/RELEASE-2_1/shared/lib/ladok-shared.jar!/" />
</CLASSES>
<JAVADOC>
<root url="file://C:/lib/ladok/RELEASE-2_1/shared/docs/api" />
</JAVADOC>
<SOURCES />
</library>
<library name="mdh-ladok-2.2">
<CLASSES>
<root url="jar://C:/lib/ladok/RELEASE-2_2/shared/lib/ladok-shared.jar!/" />
</CLASSES>
<JAVADOC>
<root url="file://C:/lib/ladok/RELEASE-2_2/shared/docs/api" />
</JAVADOC>
<SOURCES />
</library>
<library name="mdh-nds-2.3">
<CLASSES>
<root url="jar://C:/lib/nds/RELEASE-2_3/nds.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
<library name="mdh-nds-2.4">
<CLASSES>
<root url="jar://C:/lib/nds/RELEASE-2_4/nds.jar!/" />
</CLASSES>
<JAVADOC>
<root url="file://C:/lib/nds/RELEASE-2_4/docs/api" />
</JAVADOC>
<SOURCES />
</library>
<library name="mdh-nds-admin-2.3">
<CLASSES>
<root url="jar://C:/lib/nds/RELEASE-2_3/nds-admin.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
<library name="mdh-nds-admin-2.4">
<CLASSES>
<root url="jar://C:/lib/nds/RELEASE-2_4/nds-admin.jar!/" />
</CLASSES>
<JAVADOC>
<root url="file://C:/lib/nds/RELEASE-2_4/docs/api" />
</JAVADOC>
<SOURCES />
</library>
<library name="mdh-nyhet-2.5">
<CLASSES>
<root url="jar://C:/lib/nyhet/RELEASE-2_5/nyhet.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="file://C:/release/nyhet/src" />
</SOURCES>
</library>
<library name="mdh-nyhet-3.0.1">
<CLASSES>
<root url="jar://C:/lib/nyhet/RELEASE-3_0_1/shared/lib/nyhet-shared.jar!/" />
</CLASSES>
<JAVADOC>
<root url="file://C:/lib/nyhet/RELEASE-3_0_1/shared/docs/api" />
</JAVADOC>
<SOURCES />
</library>
<library name="mdh-pas-admin-1.2.1">
<CLASSES>
<root url="jar://C:/lib/pas/RELEASE-1_2_1/pas-admin.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="file://C:/release/pas/src" />
</SOURCES>
</library>
<library name="mdh-passage-admin-2.5">
<CLASSES>
<root url="jar://C:/lib/passage/RELEASE-2_5/passage-admin.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="file://C:/release/passage/src" />
</SOURCES>
</library>
<library name="mdh-personal-5.0">
<CLASSES>
<root url="jar://C:/lib/personal/RELEASE-5_0/shared/lib/personal-shared.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="file://C:/release/personal/shared/src" />
</SOURCES>
</library>
<library name="mdh-personal-5.3">
<CLASSES>
<root url="jar://C:/lib/personal/RELEASE-5_3/shared/lib/personal-shared.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="file://C:/release/personal/shared/src" />
</SOURCES>
</library>
<library name="mdh-personal-5.3.1">
<CLASSES>
<root url="jar://C:/lib/personal/RELEASE-5_3_1/shared/lib/personal-shared.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="file://C:/release/personal/shared/src" />
</SOURCES>
</library>
<library name="mdh-portal-2.1">
<CLASSES>
<root url="jar://C:/lib/portal/RELEASE-2_1/portal/lib/portal.jar!/" />
</CLASSES>
<JAVADOC>
<root url="file://C:/lib/portal/RELEASE-2_1/portal/docs/api" />
</JAVADOC>
<SOURCES />
</library>
<library name="mdh-robot-1.1">
<CLASSES>
<root url="jar://C:/lib/robot/RELEASE-1_1/robot.jar!/" />
</CLASSES>
<JAVADOC>
<root url="file://C:/lib/robot/RELEASE-1_1/docs/api" />
</JAVADOC>
<SOURCES />
</library>
<library name="mdh-schema-2.7">
<CLASSES>
<root url="jar://C:/lib/schema/RELEASE-2_7/schema.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="file://C:/release/schema/src" />
</SOURCES>
</library>
<library name="mdh-schema-3.0.2">
<CLASSES>
<root url="jar://C:/lib/schema/RELEASE-3_0_2/shared/lib/schema-shared.jar!/" />
</CLASSES>
<JAVADOC>
<root url="file://C:/lib/schema/RELEASE-3_0_2/shared/docs/api" />
</JAVADOC>
<SOURCES />
</library>
<library name="mdh-schema-3.0.3">
<CLASSES>
<root url="jar://C:/lib/schema/RELEASE-3_0_3/shared/lib/schema-shared.jar!/" />
</CLASSES>
<JAVADOC>
<root url="file://C:/lib/schema/RELEASE-3_0_3/shared/docs/api" />
</JAVADOC>
<SOURCES />
</library>
<library name="mdh-servlet-1.4.2">
<CLASSES>
<root url="jar://C:/lib/servlet/RELEASE-1_4_2/servlet.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
<library name="mdh-servlet-1.4.3">
<CLASSES>
<root url="jar://C:/lib/servlet/RELEASE-1_4_3/servlet.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
<library name="mdh-servlet-2.1">
<CLASSES>
<root url="jar://C:/lib/servlet/RELEASE-2_1/servlet.jar!/" />
</CLASSES>
<JAVADOC>
<root url="file://C:/lib/servlet/RELEASE-2_1_1/docs/api" />
</JAVADOC>
<SOURCES />
</library>
<library name="mdh-servlet-2.1.1">
<CLASSES>
<root url="jar://C:/lib/servlet/RELEASE-2_1_1/servlet.jar!/" />
</CLASSES>
<JAVADOC>
<root url="file://C:/lib/servlet/RELEASE-2_1_1/docs/api" />
</JAVADOC>
<SOURCES />
</library>
<library name="mdh-sic-3.1">
<CLASSES>
<root url="jar://C:/lib/sic/RELEASE-3_1/sic.jar!/" />
</CLASSES>
<JAVADOC>
<root url="file://C:/release/sic/src" />
</JAVADOC>
<SOURCES />
</library>
<library name="mdh-sic-4.1.1">
<CLASSES>
<root url="jar://C:/lib/sic/RELEASE-4_1_1/shared/lib/sic-shared.jar!/" />
</CLASSES>
<JAVADOC>
<root url="file://C:/lib/sic/RELEASE-4_1_1/shared/docs/api" />
</JAVADOC>
<SOURCES />
</library>
<library name="mdh-sic-4.2">
<CLASSES>
<root url="jar://C:/lib/sic/RELEASE-4_2/shared/lib/sic-shared.jar!/" />
</CLASSES>
<JAVADOC>
<root url="file://C:/lib/sic/RELEASE-4_2/shared/docs/api" />
</JAVADOC>
<SOURCES />
</library>
<library name="mdh-studieinformation-3.4">
<CLASSES>
<root url="jar://C:/lib/studieinformation/RELEASE-3_4/studieinformation.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
<library name="mdh-studieinformation-4.0">
<CLASSES>
<root url="jar://C:/lib/studieinformation/RELEASE-4_0/shared/lib/studieinformation-shared.jar!/" />
</CLASSES>
<JAVADOC>
<root url="file://C:/lib/studieinformation/RELEASE-4_0/shared/docs/api" />
</JAVADOC>
<SOURCES />
</library>
<library name="mdh-studieinformation-4.2.1">
<CLASSES>
<root url="jar://C:/lib/studieinformation/RELEASE-4_2_1/shared/lib/studieinformation-shared.jar!/" />
</CLASSES>
<JAVADOC>
<root url="file://C:/lib/studieinformation/RELEASE-4_2_1/shared/docs/api" />
</JAVADOC>
<SOURCES />
</library>
<library name="mdh-studieinformation-admin-3.5.2">
<CLASSES>
<root url="jar://C:/lib/studieinformation/RELEASE-3_5_2/studieinformation-admin.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
<library name="mdh-swing-1.1">
<CLASSES>
<root url="jar://C:/lib/swing/RELEASE-1_1/swing.jar!/" />
</CLASSES>
<JAVADOC>
<root url="file://C:/lib/swing/RELEASE-1_1/docs/api" />
</JAVADOC>
<SOURCES />
</library>
<library name="mdh-swing-1.2">
<CLASSES>
<root url="jar://C:/lib/swing/RELEASE-1_2/swing.jar!/" />
</CLASSES>
<JAVADOC>
<root url="file://C:/lib/swing/RELEASE-1_2/docs/api" />
</JAVADOC>
<SOURCES />
</library>
<library name="mdh-taglib-html-1.5">
<CLASSES>
<root url="jar://C:/lib/taglib/RELEASE-1_5/html/lib/taglib-html.jar!/" />
</CLASSES>
<JAVADOC>
<root url="file://C:/lib/taglib/RELEASE-1_5/html/docs/api" />
</JAVADOC>
<SOURCES />
</library>
<library name="mdh-taglib-html-1.6">
<CLASSES>
<root url="jar://C:/lib/taglib/RELEASE-1_6/html/lib/taglib-html.jar!/" />
</CLASSES>
<JAVADOC>
<root url="file://C:/lib/taglib/RELEASE-1_6/html/docs/api" />
</JAVADOC>
<SOURCES />
</library>
<library name="mdh-taglib-sprak-1.5">
<CLASSES>
<root url="jar://C:/lib/taglib/RELEASE-1_5/sprak/lib/taglib-sprak.jar!/" />
</CLASSES>
<JAVADOC>
<root url="file://C:/lib/taglib/RELEASE-1_5/sprak/docs/api" />
</JAVADOC>
<SOURCES />
</library>
<library name="mdh-taglib-sprak-1.6">
<CLASSES>
<root url="jar://C:/lib/taglib/RELEASE-1_6/sprak/lib/taglib-sprak.jar!/" />
</CLASSES>
<JAVADOC>
<root url="file://C:/lib/taglib/RELEASE-1_6/sprak/docs/api" />
</JAVADOC>
<SOURCES />
</library>
<library name="mdh-taglib-token-1.5">
<CLASSES>
<root url="jar://C:/lib/taglib/RELEASE-1_5/token/lib/taglib-token.jar!/" />
</CLASSES>
<JAVADOC>
<root url="file://C:/lib/taglib/RELEASE-1_5/token/docs/api" />
</JAVADOC>
<SOURCES />
</library>
<library name="mdh-taglib-token-1.6">
<CLASSES>
<root url="jar://C:/lib/taglib/RELEASE-1_6/token/lib/taglib-token.jar!/" />
</CLASSES>
<JAVADOC>
<root url="file://C:/lib/taglib/RELEASE-1_6/token/docs/api" />
</JAVADOC>
<SOURCES />
</library>
<library name="mdh-util-2.0.1">
<CLASSES>
<root url="jar://C:/lib/util/RELEASE-2_0_1/util.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
<library name="mdh-util-2.1">
<CLASSES>
<root url="jar://C:/lib/util/RELEASE-2_1/util.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
<library name="mdh-util-2.2">
<CLASSES>
<root url="jar://C:/lib/util/RELEASE-2_2/util.jar!/" />
</CLASSES>
<JAVADOC>
<root url="file://C:/lib/util/RELEASE-2_2/docs/api" />
</JAVADOC>
<SOURCES />
</library>
<library name="mdh-util-2.3">
<CLASSES>
<root url="jar://C:/lib/util/RELEASE-2_3/util.jar!/" />
</CLASSES>
<JAVADOC>
<root url="file://C:/lib/util/RELEASE-2_3/docs/api" />
</JAVADOC>
<SOURCES />
</library>
<library name="mdh-util-2.3.1">
<CLASSES>
<root url="jar://C:/lib/util/RELEASE-2_3_1/util.jar!/" />
</CLASSES>
<JAVADOC>
<root url="file://C:/lib/util/RELEASE-2_3_1/docs/api" />
</JAVADOC>
<SOURCES />
</library>
<library name="mdh-util-applet-2.2">
<CLASSES>
<root url="jar://C:/lib/util/RELEASE-2_2/util-applet.jar!/" />
</CLASSES>
<JAVADOC>
<root url="file://C:/lib/util/RELEASE-2_2/docs/api" />
</JAVADOC>
<SOURCES />
</library>
<library name="mdh-util-applet-2.3.1">
<CLASSES>
<root url="jar://C:/lib/util/RELEASE-2_3_1/util-applet.jar!/" />
</CLASSES>
<JAVADOC>
<root url="file://C:/lib/util/RELEASE-2_3_1/docs/api" />
</JAVADOC>
<SOURCES />
</library>
<library name="mysql-2.0">
<CLASSES>
<root url="jar://C:/lib/ext/mysql/2_0/mysql.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
<library name="mysql-3.0">
<CLASSES>
<root url="jar://C:/lib/ext/mysql/3_0/mysql.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
<library name="oracle">
<CLASSES>
<root url="jar://C:/lib/dist/classes12.zip!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
<library name="oracle-8.1">
<CLASSES>
<root url="jar://C:/lib/ext/oracle/8_1/oracle.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
<library name="oru-2.0.1">
<CLASSES>
<root url="jar://C:/lib/oru/RELEASE-2_0_1/oru.jar!/" />
</CLASSES>
<JAVADOC>
<root url="file://C:/lib/oru/RELEASE-2_0_1/docs/api" />
</JAVADOC>
<SOURCES />
</library>
<library name="servlet-api-2.3">
<CLASSES>
<root url="jar://C:/lib/ext/servlet/2_3/servlet.jar!/" />
</CLASSES>
<JAVADOC>
<root url="file://C:/lib/ext/servlet/2_3/servlet-2_3-fcs-docs" />
<root url="file://C:/lib/ext/servlet/2_3/jsp-1_2-fcs-docs" />
</JAVADOC>
<SOURCES />
</library>
<library name="westermarck-vcalendar">
<CLASSES>
<root url="jar://C:/lib/ext/westermarck-vcalendar/westermarck-vcalendar.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
<library name="log4jmonitor">
<CLASSES>
<root url="jar://C:/Program/IntelliJ-IDEA-3.0.5/lib/log4jmonitor.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</component>
</application>
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<module version="4" relativePaths="true">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$">
<sourceFolder isTestSource="false" url="file://$MODULE_DIR$/src" />
</content>
<orderEntry type="sourceFolder" />
<orderEntry type="jdk" jdkName="java version &quot;1.4.2&quot;" />
<output url="file://$MODULE_DIR$/classes" />
<output-test url="file://$MODULE_DIR$/classes" />
<exclude-output />
</component>
</module>
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4" relativePaths="true">
<component name="ProjectModuleManager">
<modules>
<module filepath="$PROJECT_DIR$/prj.iml" fileurl="file://$PROJECT_DIR$/prj.iml" />
</modules>
</component>
</project>
@@ -0,0 +1,108 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="3" relativePaths="false">
<component name="ProjectRootManager" version="2">
<jdk name="java version &quot;1.4.2&quot;" />
<projectPath>
<root type="composite">
<root type="simple" url="file://$PROJECT_DIR$" />
</root>
</projectPath>
<sourcePath>
<root type="composite">
<root type="simple" url="file://$PROJECT_DIR$/src" />
<root type="jdk" rootType="sourcePath" name="java version &quot;1.4.2&quot;" />
</root>
</sourcePath>
<classPath>
<root type="composite">
<root type="output" />
<root type="jdk" rootType="classPath" name="java version &quot;1.4.2&quot;" />
</root>
</classPath>
<excludePath>
<root type="composite">
<root type="excludedOutput" />
</root>
</excludePath>
<javadocPath>
<root type="composite">
<root type="jdk" rootType="javadocPath" name="java version &quot;1.4.2&quot;" />
</root>
</javadocPath>
<assert_keyword enabled="no" />
<exclude_output enabled="yes" />
</component>
<component name="CompilerConfiguration">
<option name="DEFAULT_COMPILER" value="Javac" />
<option name="SYNCHRONIZE_OUTPUT_DIRECTORY" value="false" />
<option name="DEFAULT_OUTPUT_PATH" value="$PROJECT_DIR$/classes" />
<option name="OUTPUT_MODE" value="single" />
<resourceExtensions>
<entry name=".+\.(properties|xml|html)" />
<entry name=".+\.(gif|png|jpeg|jpg)" />
</resourceExtensions>
</component>
<component name="JavacSettings">
<option name="DEBUGGING_INFO" value="true" />
<option name="GENERATE_NO_WARNINGS" value="false" />
<option name="DEPRECATION" value="true" />
<option name="ADDITIONAL_OPTIONS_STRING" value="" />
<option name="MAXIMUM_HEAP_SIZE" value="128" />
</component>
<component name="JikesSettings">
<option name="JIKES_PATH" value="" />
<option name="DEBUGGING_INFO" value="true" />
<option name="DEPRECATION" value="true" />
<option name="GENERATE_NO_WARNINGS" value="false" />
<option name="GENERATE_MAKE_FILE_DEPENDENCIES" value="false" />
<option name="DO_FULL_DEPENDENCE_CHECK" value="false" />
<option name="IS_EMACS_ERRORS_MODE" value="true" />
<option name="ADDITIONAL_OPTIONS_STRING" value="" />
</component>
<component name="AntConfiguration">
<option name="IS_AUTOSCROLL_TO_SOURCE" value="false" />
<option name="FILTER_TARGETS" value="false" />
</component>
<component name="JavadocGenerationManager">
<option name="OUTPUT_DIRECTORY" />
<option name="OPTION_SCOPE" value="protected" />
<option name="OPTION_HIERARCHY" value="true" />
<option name="OPTION_NAVIGATOR" value="true" />
<option name="OPTION_INDEX" value="true" />
<option name="OPTION_SEPARATE_INDEX" value="true" />
<option name="OPTION_DOCUMENT_TAG_USE" value="false" />
<option name="OPTION_DOCUMENT_TAG_AUTHOR" value="false" />
<option name="OPTION_DOCUMENT_TAG_VERSION" value="false" />
<option name="OPTION_DOCUMENT_TAG_DEPRECATED" value="true" />
<option name="OPTION_DEPRECATED_LIST" value="true" />
<option name="OTHER_OPTIONS" value="" />
<option name="HEAP_SIZE" />
<option name="OPEN_IN_BROWSER" value="true" />
</component>
<component name="WebManager">
<option enabled="false" />
</component>
<component name="WebRootContainer" />
<component name="EjbManager" enabled="false" />
<component name="JUnitProjectSettings">
<option name="TEST_RUNNER" value="UI" />
</component>
<component name="EntryPointsManager">
<entry_points />
</component>
<component name="EjbActionsConfiguration">
<option name="NEW_MESSAGE_BEAN_LAST_PACKAGE" value="" />
<option name="NEW_ENTITY_BEAN_LAST_PACKAGE" value="" />
<option name="NEW_SESSION_BEAN_LAST_PACKAGE" value="" />
</component>
<component name="CodeStyleManager">
<option name="USE_DEFAULT_CODE_STYLE_SCHEME" value="true" />
<option name="CODE_STYLE_SCHEME" value="" />
</component>
<component name="ExportToHTMLSettings">
<option name="PRINT_LINE_NUMBERS" value="false" />
<option name="OPEN_IN_BROWSER" value="false" />
<option name="OUTPUT_DIRECTORY" />
</component>
</project>
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<module version="4" relativePaths="true">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$">
<sourceFolder isTestSource="false" url="file://$MODULE_DIR$/src" />
</content>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/openapi.jar!/" />
</CLASSES>
</library>
</orderEntry>
<orderEntry type="jdk" jdkName="java version &quot;1.4.2&quot;" />
<orderEntry type="sourceFolder" />
<output url="file://$MODULE_DIR$/classes" />
<output-test url="file://$MODULE_DIR$/classes" />
<exclude-output />
</component>
</module>
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4" relativePaths="true">
<component name="ProjectModuleManager">
<modules>
<module filepath="$PROJECT_DIR$/prj2.iml" fileurl="file://$PROJECT_DIR$/prj2.iml"/>
</modules>
</component>
</project>
@@ -0,0 +1,109 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="3" relativePaths="false">
<component name="ProjectRootManager" version="2">
<jdk name="java version &quot;1.4.2&quot;" />
<projectPath>
<root type="composite">
<root type="simple" url="file://$PROJECT_DIR$" />
</root>
</projectPath>
<sourcePath>
<root type="composite">
<root type="simple" url="file://$PROJECT_DIR$/src" />
<root type="jdk" rootType="sourcePath" name="java version &quot;1.4.2&quot;" />
</root>
</sourcePath>
<classPath>
<root type="composite">
<root type="simple" url="jar://$PROJECT_DIR$/openapi.jar!/" />
<root type="jdk" rootType="classPath" name="java version &quot;1.4.2&quot;" />
<root type="output" />
</root>
</classPath>
<excludePath>
<root type="composite">
<root type="excludedOutput" />
</root>
</excludePath>
<javadocPath>
<root type="composite">
<root type="jdk" rootType="javadocPath" name="java version &quot;1.4.2&quot;" />
</root>
</javadocPath>
<assert_keyword enabled="no" />
<exclude_output enabled="yes" />
</component>
<component name="CompilerConfiguration">
<option name="DEFAULT_COMPILER" value="Javac" />
<option name="SYNCHRONIZE_OUTPUT_DIRECTORY" value="false" />
<option name="DEFAULT_OUTPUT_PATH" value="$PROJECT_DIR$/classes" />
<option name="OUTPUT_MODE" value="single" />
<resourceExtensions>
<entry name=".+\.(properties|xml|html)" />
<entry name=".+\.(gif|png|jpeg|jpg)" />
</resourceExtensions>
</component>
<component name="JavacSettings">
<option name="DEBUGGING_INFO" value="true" />
<option name="GENERATE_NO_WARNINGS" value="false" />
<option name="DEPRECATION" value="true" />
<option name="ADDITIONAL_OPTIONS_STRING" value="" />
<option name="MAXIMUM_HEAP_SIZE" value="128" />
</component>
<component name="JikesSettings">
<option name="JIKES_PATH" value="" />
<option name="DEBUGGING_INFO" value="true" />
<option name="DEPRECATION" value="true" />
<option name="GENERATE_NO_WARNINGS" value="false" />
<option name="GENERATE_MAKE_FILE_DEPENDENCIES" value="false" />
<option name="DO_FULL_DEPENDENCE_CHECK" value="false" />
<option name="IS_EMACS_ERRORS_MODE" value="true" />
<option name="ADDITIONAL_OPTIONS_STRING" value="" />
</component>
<component name="AntConfiguration">
<option name="IS_AUTOSCROLL_TO_SOURCE" value="false" />
<option name="FILTER_TARGETS" value="false" />
</component>
<component name="JavadocGenerationManager">
<option name="OUTPUT_DIRECTORY" />
<option name="OPTION_SCOPE" value="protected" />
<option name="OPTION_HIERARCHY" value="true" />
<option name="OPTION_NAVIGATOR" value="true" />
<option name="OPTION_INDEX" value="true" />
<option name="OPTION_SEPARATE_INDEX" value="true" />
<option name="OPTION_DOCUMENT_TAG_USE" value="false" />
<option name="OPTION_DOCUMENT_TAG_AUTHOR" value="false" />
<option name="OPTION_DOCUMENT_TAG_VERSION" value="false" />
<option name="OPTION_DOCUMENT_TAG_DEPRECATED" value="true" />
<option name="OPTION_DEPRECATED_LIST" value="true" />
<option name="OTHER_OPTIONS" value="" />
<option name="HEAP_SIZE" />
<option name="OPEN_IN_BROWSER" value="true" />
</component>
<component name="WebManager">
<option enabled="false" />
</component>
<component name="WebRootContainer" />
<component name="EjbManager" enabled="false" />
<component name="JUnitProjectSettings">
<option name="TEST_RUNNER" value="UI" />
</component>
<component name="EntryPointsManager">
<entry_points />
</component>
<component name="EjbActionsConfiguration">
<option name="NEW_MESSAGE_BEAN_LAST_PACKAGE" value="" />
<option name="NEW_ENTITY_BEAN_LAST_PACKAGE" value="" />
<option name="NEW_SESSION_BEAN_LAST_PACKAGE" value="" />
</component>
<component name="CodeStyleManager">
<option name="USE_DEFAULT_CODE_STYLE_SCHEME" value="true" />
<option name="CODE_STYLE_SCHEME" value="" />
</component>
<component name="ExportToHTMLSettings">
<option name="PRINT_LINE_NUMBERS" value="false" />
<option name="OPEN_IN_BROWSER" value="false" />
<option name="OUTPUT_DIRECTORY" />
</component>
</project>
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<module version="4" relativePaths="true">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$/p1">
<sourceFolder isTestSource="false" url="file://$MODULE_DIR$/p1/src" />
<excludeFolder url="file://$MODULE_DIR$/p1/excluded1" />
</content>
<content url="file://$MODULE_DIR$/p2">
<sourceFolder isTestSource="false" url="file://$MODULE_DIR$/p2/src" />
<excludeFolder url="file://$MODULE_DIR$/p2/src/excluded2" />
</content>
<orderEntry type="sourceFolder" />
<orderEntry type="jdk" jdkName="java version &quot;1.4.2&quot;" />
<orderEntry type="library" name="XYZ" level="application" />
<output url="file://$MODULE_DIR$/classes" />
<output-test url="file://$MODULE_DIR$/classes" />
<exclude-output />
</component>
</module>
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4" relativePaths="true">
<component name="ProjectModuleManager">
<modules>
<module filepath="$PROJECT_DIR$/prj3.iml" fileurl="file://$PROJECT_DIR$/prj3.iml" />
</modules>
</component>
</project>
@@ -0,0 +1,115 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="3" relativePaths="true">
<component name="ProjectRootManager" version="2">
<jdk name="java version &quot;1.4.2&quot;" />
<projectPath>
<root type="composite">
<root type="simple" url="file://$PROJECT_DIR$/p1" />
<root type="simple" url="file://$PROJECT_DIR$/p2" />
</root>
</projectPath>
<sourcePath>
<root type="composite">
<root type="simple" url="file://$PROJECT_DIR$/p1/src" />
<root type="jdk" rootType="sourcePath" name="java version &quot;1.4.2&quot;" />
<root type="simple" url="file://$PROJECT_DIR$/p2/src" />
<root type="library" rootType="sourcePath" name="XYZ" />
</root>
</sourcePath>
<classPath>
<root type="composite">
<root type="output" />
<root type="jdk" rootType="classPath" name="java version &quot;1.4.2&quot;" />
<root type="library" rootType="classPath" name="XYZ" />
</root>
</classPath>
<excludePath>
<root type="composite">
<root type="excludedOutput" />
<root type="simple" url="file://$PROJECT_DIR$/p2/src/excluded2" />
<root type="simple" url="file://$PROJECT_DIR$/p1/excluded1" />
<root type="simple" url="file://$PROJECT_DIR$/excludedTop" />
</root>
</excludePath>
<javadocPath>
<root type="composite">
<root type="jdk" rootType="javadocPath" name="java version &quot;1.4.2&quot;" />
</root>
</javadocPath>
<assert_keyword enabled="no" />
<exclude_output enabled="yes" />
</component>
<component name="CompilerConfiguration">
<option name="DEFAULT_COMPILER" value="Javac" />
<option name="SYNCHRONIZE_OUTPUT_DIRECTORY" value="false" />
<option name="DEFAULT_OUTPUT_PATH" value="$PROJECT_DIR$/classes" />
<option name="OUTPUT_MODE" value="single" />
<resourceExtensions>
<entry name=".+\.(properties|xml|html)" />
<entry name=".+\.(gif|png|jpeg|jpg)" />
</resourceExtensions>
</component>
<component name="JavacSettings">
<option name="DEBUGGING_INFO" value="true" />
<option name="GENERATE_NO_WARNINGS" value="false" />
<option name="DEPRECATION" value="true" />
<option name="ADDITIONAL_OPTIONS_STRING" value="" />
<option name="MAXIMUM_HEAP_SIZE" value="128" />
</component>
<component name="JikesSettings">
<option name="JIKES_PATH" value="" />
<option name="DEBUGGING_INFO" value="true" />
<option name="DEPRECATION" value="true" />
<option name="GENERATE_NO_WARNINGS" value="false" />
<option name="GENERATE_MAKE_FILE_DEPENDENCIES" value="false" />
<option name="DO_FULL_DEPENDENCE_CHECK" value="false" />
<option name="IS_EMACS_ERRORS_MODE" value="true" />
<option name="ADDITIONAL_OPTIONS_STRING" value="" />
</component>
<component name="AntConfiguration">
<option name="IS_AUTOSCROLL_TO_SOURCE" value="false" />
<option name="FILTER_TARGETS" value="false" />
</component>
<component name="JavadocGenerationManager">
<option name="OUTPUT_DIRECTORY" />
<option name="OPTION_SCOPE" value="protected" />
<option name="OPTION_HIERARCHY" value="true" />
<option name="OPTION_NAVIGATOR" value="true" />
<option name="OPTION_INDEX" value="true" />
<option name="OPTION_SEPARATE_INDEX" value="true" />
<option name="OPTION_DOCUMENT_TAG_USE" value="false" />
<option name="OPTION_DOCUMENT_TAG_AUTHOR" value="false" />
<option name="OPTION_DOCUMENT_TAG_VERSION" value="false" />
<option name="OPTION_DOCUMENT_TAG_DEPRECATED" value="true" />
<option name="OPTION_DEPRECATED_LIST" value="true" />
<option name="OTHER_OPTIONS" value="" />
<option name="HEAP_SIZE" />
<option name="OPEN_IN_BROWSER" value="true" />
</component>
<component name="WebManager">
<option enabled="false" />
</component>
<component name="WebRootContainer" />
<component name="EjbManager" enabled="false" />
<component name="JUnitProjectSettings">
<option name="TEST_RUNNER" value="UI" />
</component>
<component name="EntryPointsManager">
<entry_points />
</component>
<component name="EjbActionsConfiguration">
<option name="NEW_MESSAGE_BEAN_LAST_PACKAGE" value="" />
<option name="NEW_ENTITY_BEAN_LAST_PACKAGE" value="" />
<option name="NEW_SESSION_BEAN_LAST_PACKAGE" value="" />
</component>
<component name="CodeStyleManager">
<option name="USE_DEFAULT_CODE_STYLE_SCHEME" value="true" />
<option name="CODE_STYLE_SCHEME" value="" />
</component>
<component name="ExportToHTMLSettings">
<option name="PRINT_LINE_NUMBERS" value="false" />
<option name="OPEN_IN_BROWSER" value="false" />
<option name="OUTPUT_DIRECTORY" />
</component>
</project>
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<module version="4" relativePaths="true">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$">
<sourceFolder isTestSource="false" url="file://$MODULE_DIR$/src" />
</content>
<orderEntry type="sourceFolder" />
<orderEntry type="jdk" jdkName="java version &quot;1.4.1_02&quot;" />
<exclude-output />
</component>
</module>
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4" relativePaths="true">
<component name="ProjectModuleManager">
<modules>
<module filepath="$PROJECT_DIR$/prj4.iml" fileurl="file://$PROJECT_DIR$/prj4.iml" />
</modules>
</component>
</project>
@@ -0,0 +1,108 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="3" relativePaths="true">
<component name="ProjectRootManager" version="2">
<jdk name="java version &quot;1.4.1_02&quot;" />
<projectPath>
<root type="composite">
<root type="simple" url="file://$PROJECT_DIR$" />
</root>
</projectPath>
<sourcePath>
<root type="composite">
<root type="simple" url="file://$PROJECT_DIR$/src" />
<root type="jdk" rootType="sourcePath" name="java version &quot;1.4.1_02&quot;" />
</root>
</sourcePath>
<classPath>
<root type="composite">
<root type="output" />
<root type="jdk" rootType="classPath" name="java version &quot;1.4.1_02&quot;" />
</root>
</classPath>
<excludePath>
<root type="composite">
<root type="excludedOutput" />
</root>
</excludePath>
<javadocPath>
<root type="composite">
<root type="jdk" rootType="javadocPath" name="java version &quot;1.4.1_02&quot;" />
</root>
</javadocPath>
<assert_keyword enabled="no" />
<exclude_output enabled="yes" />
</component>
<component name="CompilerConfiguration">
<option name="DEFAULT_COMPILER" value="Javac" />
<option name="SYNCHRONIZE_OUTPUT_DIRECTORY" value="false" />
<option name="DEFAULT_OUTPUT_PATH" />
<option name="OUTPUT_MODE" value="single" />
<resourceExtensions>
<entry name=".+\.(properties|xml|html)" />
<entry name=".+\.(gif|png|jpeg|jpg)" />
</resourceExtensions>
</component>
<component name="JavacSettings">
<option name="DEBUGGING_INFO" value="true" />
<option name="GENERATE_NO_WARNINGS" value="false" />
<option name="DEPRECATION" value="true" />
<option name="ADDITIONAL_OPTIONS_STRING" value="" />
<option name="MAXIMUM_HEAP_SIZE" value="128" />
</component>
<component name="JikesSettings">
<option name="JIKES_PATH" value="" />
<option name="DEBUGGING_INFO" value="true" />
<option name="DEPRECATION" value="true" />
<option name="GENERATE_NO_WARNINGS" value="false" />
<option name="GENERATE_MAKE_FILE_DEPENDENCIES" value="false" />
<option name="DO_FULL_DEPENDENCE_CHECK" value="false" />
<option name="IS_EMACS_ERRORS_MODE" value="true" />
<option name="ADDITIONAL_OPTIONS_STRING" value="" />
</component>
<component name="AntConfiguration">
<option name="IS_AUTOSCROLL_TO_SOURCE" value="false" />
<option name="FILTER_TARGETS" value="false" />
</component>
<component name="JavadocGenerationManager">
<option name="OUTPUT_DIRECTORY" />
<option name="OPTION_SCOPE" value="protected" />
<option name="OPTION_HIERARCHY" value="true" />
<option name="OPTION_NAVIGATOR" value="true" />
<option name="OPTION_INDEX" value="true" />
<option name="OPTION_SEPARATE_INDEX" value="true" />
<option name="OPTION_DOCUMENT_TAG_USE" value="false" />
<option name="OPTION_DOCUMENT_TAG_AUTHOR" value="false" />
<option name="OPTION_DOCUMENT_TAG_VERSION" value="false" />
<option name="OPTION_DOCUMENT_TAG_DEPRECATED" value="true" />
<option name="OPTION_DEPRECATED_LIST" value="true" />
<option name="OTHER_OPTIONS" value="" />
<option name="HEAP_SIZE" />
<option name="OPEN_IN_BROWSER" value="true" />
</component>
<component name="WebManager">
<option enabled="false" />
</component>
<component name="WebRootContainer" />
<component name="EjbManager" enabled="false" />
<component name="JUnitProjectSettings">
<option name="TEST_RUNNER" value="UI" />
</component>
<component name="EntryPointsManager">
<entry_points />
</component>
<component name="EjbActionsConfiguration">
<option name="NEW_MESSAGE_BEAN_LAST_PACKAGE" value="" />
<option name="NEW_ENTITY_BEAN_LAST_PACKAGE" value="" />
<option name="NEW_SESSION_BEAN_LAST_PACKAGE" value="" />
</component>
<component name="CodeStyleManager">
<option name="USE_DEFAULT_CODE_STYLE_SCHEME" value="true" />
<option name="CODE_STYLE_SCHEME" value="" />
</component>
<component name="ExportToHTMLSettings">
<option name="PRINT_LINE_NUMBERS" value="false" />
<option name="OPEN_IN_BROWSER" value="false" />
<option name="OUTPUT_DIRECTORY" />
</component>
</project>
@@ -0,0 +1,4 @@
package p;
public class A {
}
@@ -0,0 +1,4 @@
package p;
public class B {
}
@@ -0,0 +1,4 @@
package p;
public class C {
}
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<module version="4" relativePaths="true">
<component name="NewModuleRootManager" />
</module>
@@ -0,0 +1,4 @@
package q;
class A {
}
@@ -0,0 +1,4 @@
package j;
class B {
}
@@ -0,0 +1 @@
zzzzz
@@ -0,0 +1 @@
blah blah blah
@@ -0,0 +1,133 @@
package com.intellij.project.convertors;
import com.intellij.application.options.PathMacrosImpl;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.components.ExpandMacroToPathMap;
import com.intellij.openapi.project.impl.convertors.Convertor34;
import com.intellij.openapi.util.JDOMUtil;
import com.intellij.openapi.vfs.LocalFileSystem;
import com.intellij.openapi.vfs.VfsUtil;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.refactoring.MultiFileTestCase;
import com.intellij.ide.highlighter.ProjectFileType;
import com.intellij.ide.highlighter.ModuleFileType;
import org.jdom.Document;
import org.jdom.Element;
import java.util.List;
/**
* @author dsl
*/
public class Convertor34Test extends MultiFileTestCase {
public Convertor34Test() {
myDoCompare = false;
}
protected String getTestRoot() {
return "/moduleRootManager/convertor34/";
}
public void testTest1() throws Exception { doTest(createPerformAction("prj")); }
public void testTest2() throws Exception { doTest(createPerformAction("prj2")); }
public void testTest3() throws Exception { doTest(createPerformAction("prj3")); }
public void testTest4() throws Exception { doTest(createPerformAction("prj4")); }
public void testScr24517() throws Exception { doTest(createPerformAction("se.mdh.html")); }
public void testLibraryTable() throws Exception { doTest(createPerformActionForLibraryTable());}
public void testScr25298() throws Exception { doTest(createPerformActionForLibraryTable());}
private PerformAction createPerformAction(final String projectName) {
return new PerformAction() {
public void performAction(VirtualFile rootDir, VirtualFile rootAfter) throws Exception {
final VirtualFile projectFile = rootDir.findChild(projectName + ProjectFileType.DOT_DEFAULT_EXTENSION);
final ExpandMacroToPathMap macros = new ExpandMacroToPathMap();
macros.addMacroExpand(PathMacrosImpl.PROJECT_DIR_MACRO_NAME, rootDir.getPath());
macros.addMacroExpand(PathMacrosImpl.MODULE_DIR_MACRO_NAME, rootDir.getPath());
final Document projectDocument = JDOMUtil.loadDocument(
VfsUtil.loadText(projectFile));
macros.substitute(projectDocument.getRootElement(), true);
Convertor34.execute(projectDocument.getRootElement(), projectFile.getPath(), null);
ApplicationManager.getApplication().runWriteAction(new Runnable() {
public void run() {
LocalFileSystem.getInstance().refresh(false);
}
});
final VirtualFile moduleFile = rootDir.findChild(projectName + ModuleFileType.DOT_DEFAULT_EXTENSION);
assertNotNull(moduleFile);
final Document moduleDocument = JDOMUtil.loadDocument(
VfsUtil.loadText(moduleFile));
macros.substitute(moduleDocument.getRootElement(), true);
final Document goldenProjectDocument = JDOMUtil.loadDocument(
VfsUtil.loadText(rootAfter.findChild(projectName + ProjectFileType.DOT_DEFAULT_EXTENSION))
);
macros.substitute(goldenProjectDocument.getRootElement(), true);
final Document goldenModuleDocument = JDOMUtil.loadDocument(
VfsUtil.loadText(rootAfter.findChild(projectName + ModuleFileType.DOT_DEFAULT_EXTENSION))
);
macros.substitute(goldenModuleDocument.getRootElement(), true);
assertConfigsEqual("ProjectModuleManager", goldenProjectDocument, projectDocument);
assertConfigsEqual("NewModuleRootManager", goldenModuleDocument, moduleDocument);
}
};
}
private PerformAction createPerformActionForLibraryTable() {
return new PerformAction() {
public void performAction(VirtualFile rootDir, VirtualFile rootAfter) throws Exception {
final VirtualFile libFile = rootDir.findChild("library.table.xml");
final ExpandMacroToPathMap macros = new ExpandMacroToPathMap();
macros.addMacroExpand("DIR", rootDir.getPath());
final Document oldTable = JDOMUtil.loadDocument(
VfsUtil.loadText(libFile));
macros.substitute(oldTable.getRootElement(), true);
Convertor34.convertLibraryTable34(oldTable.getRootElement(), libFile.getPath());
ApplicationManager.getApplication().runWriteAction(new Runnable() {
public void run() {
LocalFileSystem.getInstance().refresh(false);
}
});
final VirtualFile applicationLibraries = rootDir.findChild("applicationLibraries.xml");
assertNotNull(applicationLibraries);
final Document newTable = JDOMUtil.loadDocument(
VfsUtil.loadText(applicationLibraries));
final Document goldenNewTable = JDOMUtil.loadDocument(
VfsUtil.loadText(rootAfter.findChild("applicationLibraries.xml")));
macros.substitute(goldenNewTable.getRootElement(), true);
assertElementsEqual(goldenNewTable.getRootElement(), newTable.getRootElement());
}
};
}
private void assertConfigsEqual(String componentName, Document goldenDocument, Document document) {
final Element goldenElement = getComponentElement(goldenDocument, componentName);
final Element element = getComponentElement(document, componentName);
assertElementsEqual(goldenElement, element);
}
private void assertElementsEqual(final Element goldenElement, final Element element) {
assertEquals(JDOMUtil.createOutputter("\n").outputString(goldenElement),
JDOMUtil.createOutputter("\n").outputString(element));
}
private static Element getComponentElement(Document root, String componentName) {
final List children = root.getRootElement().getChildren("component");
for (Object aChildren : children) {
Element element = (Element)aChildren;
if (componentName.equals(element.getAttributeValue("name"))) return element;
}
assertTrue(componentName + " not found", false);
return null;
}
}
@@ -0,0 +1,153 @@
package com.intellij.roots;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.module.StdModuleTypes;
import com.intellij.openapi.roots.*;
import com.intellij.openapi.roots.libraries.Library;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.testFramework.ModuleTestCase;
import com.intellij.testFramework.fixtures.impl.LightTempDirTestFixtureImpl;
import com.intellij.util.PathsList;
import java.io.IOException;
/**
* @author yole
*/
public class DependencyScopeTest extends ModuleTestCase {
private LightTempDirTestFixtureImpl myFixture;
@Override
protected void setUp() throws Exception {
super.setUp();
myFixture = new LightTempDirTestFixtureImpl();
}
@Override
protected void tearDown() throws Exception {
super.tearDown();
myFixture.deleteAll();
}
public void testTestOnlyModuleDependency() throws Exception {
Module moduleA = createModule("a.iml", StdModuleTypes.JAVA);
Module moduleB = addDependentModule(moduleA, DependencyScope.TEST);
VirtualFile classB = myFixture.createFile("b/Test.java", "public class Test { }");
assertTrue(moduleA.getModuleWithDependenciesAndLibrariesScope(true).contains(classB));
assertFalse(moduleA.getModuleWithDependenciesAndLibrariesScope(false).contains(classB));
assertFalse(moduleA.getModuleWithDependenciesAndLibrariesScope(false).isSearchInModuleContent(moduleB));
final VirtualFile[] compilationClasspath = ModuleRootManager.getInstance(moduleA).getFiles(OrderRootType.COMPILATION_CLASSES);
assertEquals(1, compilationClasspath.length);
final VirtualFile[] productionCompilationClasspath = ModuleRootManager.getInstance(moduleA).getFiles(OrderRootType.PRODUCTION_COMPILATION_CLASSES);
assertEquals(0, productionCompilationClasspath.length);
final PathsList pathsList = ProjectRootsTraversing.collectRoots(moduleA, ProjectClasspathTraversing.FULL_CLASSPATH_RECURSIVE);
assertEquals(1, pathsList.getPathList().size());
final PathsList pathsListWithoutTests = ProjectRootsTraversing.collectRoots(moduleA, ProjectClasspathTraversing.FULL_CLASSPATH_WITHOUT_TESTS);
assertEquals(0, pathsListWithoutTests.getPathList().size());
}
private Module addDependentModule(Module moduleA, final DependencyScope scope) {
Module moduleB = createModule("b.iml", StdModuleTypes.JAVA);
VirtualFile rootB = myFixture.findOrCreateDir("b");
VirtualFile outB = myFixture.findOrCreateDir("out");
final ModifiableRootModel modelA = ModuleRootManager.getInstance(moduleA).getModifiableModel();
modelA.addModuleOrderEntry(moduleB).setScope(scope);
modelA.commit();
final ModifiableRootModel modelB = ModuleRootManager.getInstance(moduleB).getModifiableModel();
final ContentEntry contentEntry = modelB.addContentEntry(rootB);
contentEntry.addSourceFolder(rootB, false);
final CompilerModuleExtension extension = modelB.getModuleExtension(CompilerModuleExtension.class);
extension.inheritCompilerOutputPath(false);
extension.setCompilerOutputPath(outB);
modelB.commit();
return moduleB;
}
public void testTestOnlyLibraryDependency() throws IOException {
Module m = createModule("a.iml", StdModuleTypes.JAVA);
addLibrary(m, DependencyScope.TEST);
VirtualFile libraryClass = myFixture.createFile("lib/Test.java", "public class Test { }");
assertTrue(m.getModuleWithDependenciesAndLibrariesScope(true).contains(libraryClass));
assertFalse(m.getModuleWithDependenciesAndLibrariesScope(false).contains(libraryClass));
final VirtualFile[] compilationClasspath = ModuleRootManager.getInstance(m).getFiles(OrderRootType.COMPILATION_CLASSES);
assertEquals(1, compilationClasspath.length);
final VirtualFile[] productionCompilationClasspath = ModuleRootManager.getInstance(m).getFiles(OrderRootType.PRODUCTION_COMPILATION_CLASSES);
assertEquals(0, productionCompilationClasspath.length);
}
public void testRuntimeModuleDependency() throws IOException {
Module moduleA = createModule("a.iml", StdModuleTypes.JAVA);
addDependentModule(moduleA, DependencyScope.RUNTIME);
final VirtualFile[] runtimeClasspath = ModuleRootManager.getInstance(moduleA).getFiles(OrderRootType.CLASSES_AND_OUTPUT);
assertEquals(1, runtimeClasspath.length);
final VirtualFile[] compilationClasspath = ModuleRootManager.getInstance(moduleA).getFiles(OrderRootType.COMPILATION_CLASSES);
assertEquals(1, compilationClasspath.length);
VirtualFile[] production = ModuleRootManager.getInstance(moduleA).getFiles(OrderRootType.PRODUCTION_COMPILATION_CLASSES);
assertEquals(0, production.length);
}
public void testRuntimeLibraryDependency() throws IOException {
Module m = createModule("a.iml", StdModuleTypes.JAVA);
VirtualFile libraryRoot = addLibrary(m, DependencyScope.RUNTIME);
final VirtualFile[] runtimeClasspath = ModuleRootManager.getInstance(m).getFiles(OrderRootType.CLASSES_AND_OUTPUT);
assertEquals(1, runtimeClasspath.length);
assertEquals(libraryRoot, runtimeClasspath [0]);
final VirtualFile[] compilationClasspath = ModuleRootManager.getInstance(m).getFiles(OrderRootType.COMPILATION_CLASSES);
assertEquals(1, compilationClasspath.length);
VirtualFile[] production = ModuleRootManager.getInstance(m).getFiles(OrderRootType.PRODUCTION_COMPILATION_CLASSES);
assertEquals(0, production.length);
VirtualFile libraryClass = myFixture.createFile("lib/Test.java", "public class Test { }");
assertTrue(m.getModuleWithDependenciesAndLibrariesScope(true).contains(libraryClass));
assertFalse(m.getModuleWithDependenciesAndLibrariesScope(false).contains(libraryClass));
}
public void testProvidedModuleDependency() throws IOException {
Module moduleA = createModule("a.iml", StdModuleTypes.JAVA);
addDependentModule(moduleA, DependencyScope.PROVIDED);
final VirtualFile[] runtimeClasspath = ModuleRootManager.getInstance(moduleA).getFiles(OrderRootType.CLASSES_AND_OUTPUT);
assertEquals(0, runtimeClasspath.length);
final VirtualFile[] compilationClasspath = ModuleRootManager.getInstance(moduleA).getFiles(OrderRootType.COMPILATION_CLASSES);
assertEquals(1, compilationClasspath.length);
}
public void testProvidedLibraryDependency() throws IOException {
Module m = createModule("a.iml", StdModuleTypes.JAVA);
VirtualFile libraryRoot = addLibrary(m, DependencyScope.PROVIDED);
final VirtualFile[] runtimeClasspath = ModuleRootManager.getInstance(m).getFiles(OrderRootType.CLASSES_AND_OUTPUT);
assertEquals(0, runtimeClasspath.length);
final VirtualFile[] compilationClasspath = ModuleRootManager.getInstance(m).getFiles(OrderRootType.COMPILATION_CLASSES);
assertEquals(1, compilationClasspath.length);
assertEquals(libraryRoot, compilationClasspath [0]);
VirtualFile libraryClass = myFixture.createFile("lib/Test.java", "public class Test { }");
assertTrue(m.getModuleWithDependenciesAndLibrariesScope(true).contains(libraryClass));
assertTrue(m.getModuleWithDependenciesAndLibrariesScope(false).contains(libraryClass));
}
private VirtualFile addLibrary(Module m, final DependencyScope scope) {
VirtualFile libraryRoot = myFixture.findOrCreateDir("lib");
final ModifiableRootModel model = ModuleRootManager.getInstance(m).getModifiableModel();
final Library library = model.getModuleLibraryTable().createLibrary("l");
final Library.ModifiableModel libraryModel = library.getModifiableModel();
libraryModel.addRoot(libraryRoot, OrderRootType.CLASSES);
libraryModel.commit();
model.findLibraryOrderEntry(library).setScope(scope);
model.commit();
return libraryRoot;
}
}
@@ -0,0 +1,524 @@
package com.intellij.roots;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.fileTypes.FileTypeManager;
import com.intellij.openapi.fileTypes.ex.FileTypeManagerEx;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.module.ModuleManager;
import com.intellij.openapi.module.StdModuleTypes;
import com.intellij.openapi.roots.*;
import com.intellij.openapi.roots.ex.ProjectRootManagerEx;
import com.intellij.openapi.roots.impl.DirectoryIndex;
import com.intellij.openapi.roots.impl.DirectoryInfo;
import com.intellij.openapi.roots.libraries.Library;
import com.intellij.openapi.util.EmptyRunnable;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.vfs.*;
import com.intellij.testFramework.IdeaTestCase;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
public class DirectoryIndexImplTest extends IdeaTestCase {
private static final Logger LOG = Logger.getInstance("#com.intellij.openapi.roots.impl.DirectoryIndexTest");
private DirectoryIndex myIndex;
private Module myModule2;
private Module myModule3;
private VirtualFile myRootVFile;
private VirtualFile myModule1Dir;
private VirtualFile myModule2Dir;
private VirtualFile myModule3Dir;
private VirtualFile mySrcDir1;
private VirtualFile mySrcDir2;
private VirtualFile myTestSrc1;
private VirtualFile myPack1Dir;
private VirtualFile myPack2Dir;
private VirtualFile myLibDir;
private VirtualFile myLibSrcDir;
private VirtualFile myLibClsDir;
private VirtualFile myCvsDir;
private VirtualFile myExcludeDir;
private VirtualFile myOutputDir;
private VirtualFile myModule1OutputDir;
public DirectoryIndexImplTest() {
myRunCommandForTest = true;
}
protected void setUp() throws Exception {
super.setUp();
final File root = createTempDirectory();
ApplicationManager.getApplication().runWriteAction(new Runnable() {
public void run() {
try {
myRootVFile = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(root);
/*
root
module1
src1
pack1
testSrc
pack2
lib
src
cls
module2
src2
CVS
excluded
module3
out
module1
*/
myModule1Dir = myRootVFile.createChildDirectory(null, "module1");
mySrcDir1 = myModule1Dir.createChildDirectory(null, "src1");
myPack1Dir = mySrcDir1.createChildDirectory(null, "pack1");
myTestSrc1 = mySrcDir1.createChildDirectory(null, "testSrc");
myPack2Dir = myTestSrc1.createChildDirectory(null, "pack2");
myLibDir = myModule1Dir.createChildDirectory(null, "lib");
myLibSrcDir = myLibDir.createChildDirectory(null, "src");
myLibClsDir = myLibDir.createChildDirectory(null, "cls");
myModule2Dir = myModule1Dir.createChildDirectory(null, "module2");
mySrcDir2 = myModule2Dir.createChildDirectory(null, "src2");
myCvsDir = mySrcDir2.createChildDirectory(null, "CVS");
myExcludeDir = mySrcDir2.createChildDirectory(null, "excluded");
myModule3Dir = myRootVFile.createChildDirectory(null, "module3");
myOutputDir = myRootVFile.createChildDirectory(null, "out");
myModule1OutputDir = myOutputDir.createChildDirectory(null, "module1");
CompilerProjectExtension.getInstance(myProject).setCompilerOutputUrl(myOutputDir.getUrl());
// fill roots of module1
{
ModifiableRootModel rootModel = ModuleRootManager.getInstance(myModule).getModifiableModel();
rootModel.setSdk(null);
ContentEntry contentEntry1 = rootModel.addContentEntry(myModule1Dir);
contentEntry1.addSourceFolder(myTestSrc1, true);
contentEntry1.addSourceFolder(mySrcDir1, false);
rootModel.commit();
}
ModuleManager moduleManager = ModuleManager.getInstance(myProject);
// fill roots of module2
{
VirtualFile moduleFile = myModule2Dir.createChildData(null, "module2.iml");
myModule2 = moduleManager.newModule(moduleFile.getPath(), StdModuleTypes.JAVA);
ModifiableRootModel rootModel = ModuleRootManager.getInstance(myModule2).getModifiableModel();
ContentEntry contentEntry = rootModel.addContentEntry(myModule2Dir);
contentEntry.addSourceFolder(mySrcDir2, false);
contentEntry.addExcludeFolder(myExcludeDir);
Library.ModifiableModel libraryModel = rootModel.getModuleLibraryTable().createLibrary().getModifiableModel();
libraryModel.addRoot(myLibClsDir, OrderRootType.CLASSES);
libraryModel.addRoot(myLibSrcDir, OrderRootType.SOURCES);
libraryModel.commit();
rootModel.commit();
}
// fill roots of module3
{
VirtualFile moduleFile = myModule3Dir.createChildData(null, "module3.iml");
myModule3 = moduleManager.newModule(moduleFile.getPath(), StdModuleTypes.JAVA);
ModifiableRootModel rootModel = ModuleRootManager.getInstance(myModule3).getModifiableModel();
rootModel.addContentEntry(myModule3Dir);
rootModel.addModuleOrderEntry(myModule2); // module3 depends on module2
rootModel.commit();
}
}
catch (IOException e) {
LOG.error(e);
}
}
});
myIndex = DirectoryIndex.getInstance(myProject);
}
public void testDirInfos() {
checkInfoNull(myRootVFile);
checkInfo(myModule1Dir, myModule, false, false, false, false, null, new Module[]{});
checkInfo(mySrcDir1, myModule, true, false, false, false, "", new Module[]{myModule});
checkInfo(myPack1Dir, myModule, true, false, false, false, "pack1", new Module[]{myModule});
checkInfo(myTestSrc1, myModule, true, true, false, false, "", new Module[]{myModule});
checkInfo(myPack2Dir, myModule, true, true, false, false, "pack2", new Module[]{myModule});
checkInfo(myLibDir, myModule, false, false, false, false, null, new Module[]{});
checkInfo(myLibSrcDir, myModule, false, false, false, true, "", new Module[]{myModule2});
checkInfo(myLibClsDir, myModule, false, false, true, false, "", new Module[]{myModule2});
checkInfo(myModule2Dir, myModule2, false, false, false, false, null, new Module[]{});
checkInfo(mySrcDir2, myModule2, true, false, false, false, "", new Module[]{myModule2, myModule3});
checkInfoNull(myCvsDir);
checkInfoNull(myExcludeDir);
checkInfo(myModule3Dir, myModule3, false, false, false, false, null, new Module[]{});
}
public void testDirsByPackageName() {
checkPackage(new VirtualFile[]{mySrcDir1, myTestSrc1, myLibSrcDir, myLibClsDir, mySrcDir2}, "");
checkPackage(new VirtualFile[]{myPack1Dir}, "pack1");
checkPackage(new VirtualFile[]{myPack2Dir}, "pack2");
}
public void testCreateDir() throws Exception {
String path = mySrcDir1.getPath().replace('/', File.separatorChar);
assertTrue(new File(path + File.separatorChar + "dir1" + File.separatorChar + "dir2").mkdirs());
assertTrue(new File(path + File.separatorChar + "CVS").mkdirs());
VirtualFileManager.getInstance().refresh(false);
myIndex.checkConsistency();
}
public void testDeleteDir() throws Exception {
VirtualFile subdir1 = mySrcDir1.createChildDirectory(null, "subdir1");
VirtualFile subdir2 = subdir1.createChildDirectory(null, "subdir2");
subdir2.createChildDirectory(null, "subdir3");
myIndex.checkConsistency();
subdir1.delete(null);
myIndex.checkConsistency();
}
public void testMoveDir() throws Exception {
VirtualFile subdir = mySrcDir2.createChildDirectory(null, "subdir1");
subdir.createChildDirectory(null, "subdir2");
myIndex.checkConsistency();
subdir.move(null, mySrcDir1);
myIndex.checkConsistency();
}
public void testRenameDir() throws Exception {
VirtualFile subdir = mySrcDir2.createChildDirectory(null, "subdir1");
subdir.createChildDirectory(null, "subdir2");
myIndex.checkConsistency();
subdir.rename(null, "abcd");
myIndex.checkConsistency();
}
public void testRenameRoot() throws Exception {
myModule1Dir.rename(null, "newName");
myIndex.checkConsistency();
}
public void testMoveRoot() throws Exception {
myModule1Dir.move(null, myModule3Dir);
myIndex.checkConsistency();
}
public void testAddProjectDir() throws Exception {
VirtualFile newDir = myModule1Dir.getParent().createChildDirectory(null, "newDir");
newDir.createChildDirectory(null, "subdir");
myIndex.checkConsistency();
ModifiableRootModel rootModel = ModuleRootManager.getInstance(myModule).getModifiableModel();
rootModel.addContentEntry(newDir);
rootModel.commit();
myIndex.checkConsistency();
}
public void testChangeIgnoreList() throws Exception {
myModule1Dir.createChildDirectory(null, "newDir");
myIndex.checkConsistency();
final FileTypeManagerEx fileTypeManager = (FileTypeManagerEx)FileTypeManager.getInstance();
final String list = fileTypeManager.getIgnoredFilesList();
final String list1 = list + ";" + "newDir";
try {
ApplicationManager.getApplication().runWriteAction(new Runnable() {
public void run() {
fileTypeManager.setIgnoredFilesList(list1);
}
});
myIndex.checkConsistency();
}
finally {
ApplicationManager.getApplication().runWriteAction(new Runnable() {
public void run() {
fileTypeManager.setIgnoredFilesList(list);
}
});
}
}
public void testAddModule() throws Exception {
myIndex.checkConsistency();
VirtualFile newModuleContent = myRootVFile.createChildDirectory(null, "newModule");
newModuleContent.createChildDirectory(null, "subDir");
ModuleManager moduleManager = ModuleManager.getInstance(myProject);
Module module = moduleManager.newModule(myRootVFile.getPath() + "/newModule.iml", StdModuleTypes.JAVA);
ModifiableRootModel rootModel = ModuleRootManager.getInstance(module).getModifiableModel();
rootModel.addContentEntry(newModuleContent);
rootModel.commit();
myIndex.checkConsistency();
}
public void testExplicitExcludeOfInner() throws Exception {
ModifiableRootModel rootModel = ModuleRootManager.getInstance(myModule).getModifiableModel();
ContentEntry[] contentEntries = rootModel.getContentEntries();
assertEquals(1, contentEntries.length);
ContentEntry contentEntry = contentEntries[0];
contentEntry.addExcludeFolder(myModule2Dir);
rootModel.commit();
myIndex.checkConsistency();
checkInfo(myModule2Dir, myModule2, false, false, false, false, null, new Module[]{});
checkInfo(mySrcDir2, myModule2, true, false, false, false, "", new Module[]{myModule2, myModule3});
}
public void testResettingProjectOutputPath() throws Exception {
VirtualFile output1 = myModule1Dir.createChildDirectory(null, "output1");
VirtualFile output2 = myModule1Dir.createChildDirectory(null, "output2");
assertNotNull(myIndex.getInfoForDirectory(output1));
assertNotNull(myIndex.getInfoForDirectory(output2));
CompilerProjectExtension.getInstance(myProject).setCompilerOutputUrl(output1.getUrl());
fireRootsChanged();
assertNull(myIndex.getInfoForDirectory(output1));
assertNotNull(myIndex.getInfoForDirectory(output2));
CompilerProjectExtension.getInstance(myProject).setCompilerOutputUrl(output2.getUrl());
fireRootsChanged();
assertNotNull(myIndex.getInfoForDirectory(output1));
assertNull(myIndex.getInfoForDirectory(output2));
}
private void fireRootsChanged() {
ProjectRootManagerEx.getInstanceEx(getProject()).makeRootsChange(EmptyRunnable.getInstance(), false, true);
}
public void testExcludedDirShouldBeExcludedRightAfterItsCreation() throws Exception {
VirtualFile excluded = myModule1Dir.createChildDirectory(null, "excluded");
VirtualFile projectOutput = myModule1Dir.createChildDirectory(null, "projectOutput");
VirtualFile module2Output = myModule1Dir.createChildDirectory(null, "module2Output");
VirtualFile module2TestOutput = myModule2Dir.createChildDirectory(null, "module2TestOutput");
assertNotNull(myIndex.getInfoForDirectory(excluded));
assertNotNull(myIndex.getInfoForDirectory(projectOutput));
assertNotNull(myIndex.getInfoForDirectory(module2Output));
assertNotNull(myIndex.getInfoForDirectory(module2TestOutput));
CompilerProjectExtension.getInstance(myProject).setCompilerOutputUrl(projectOutput.getUrl());
ModifiableRootModel m = ModuleRootManager.getInstance(myModule).getModifiableModel();
ContentEntry[] ee = m.getContentEntries();
assertEquals(1, ee.length);
ee[0].addExcludeFolder(excluded);
m.commit();
m = ModuleRootManager.getInstance(myModule2).getModifiableModel();
final CompilerModuleExtension compilerModuleExtension = m.getModuleExtension(CompilerModuleExtension.class);
compilerModuleExtension.setCompilerOutputPath(module2Output);
compilerModuleExtension.setCompilerOutputPathForTests(module2TestOutput);
compilerModuleExtension.setExcludeOutput(true);
compilerModuleExtension.inheritCompilerOutputPath(false);
m.commit();
assertNull(myIndex.getInfoForDirectory(excluded));
assertNull(myIndex.getInfoForDirectory(projectOutput));
assertNull(myIndex.getInfoForDirectory(module2Output));
assertNull(myIndex.getInfoForDirectory(module2TestOutput));
excluded.delete(null);
projectOutput.delete(null);
module2Output.delete(null);
module2TestOutput.delete(null);
final List<Boolean> isExcluded = new ArrayList<Boolean>();
VirtualFileListener l = new VirtualFileAdapter() {
@Override
public void fileCreated(VirtualFileEvent e) {
isExcluded.add(myIndex.getInfoForDirectory(e.getFile()) == null);
}
};
VirtualFileManager.getInstance().addVirtualFileListener(l);
try {
excluded = myModule1Dir.createChildDirectory(null, excluded.getName());
projectOutput = myModule1Dir.createChildDirectory(null, projectOutput.getName());
module2Output = myModule1Dir.createChildDirectory(null, module2Output.getName());
module2TestOutput = myModule2Dir.createChildDirectory(null, module2TestOutput.getName());
}
finally {
VirtualFileManager.getInstance().removeVirtualFileListener(l);
}
assertNull(myIndex.getInfoForDirectory(excluded));
assertNull(myIndex.getInfoForDirectory(projectOutput));
assertNull(myIndex.getInfoForDirectory(module2Output));
assertNull(myIndex.getInfoForDirectory(module2TestOutput));
assertEquals(4, isExcluded.size());
assertTrue(isExcluded.get(0));
assertTrue(isExcluded.get(1));
assertTrue(isExcluded.get(2));
assertTrue(isExcluded.get(3));
}
public void testExcludesShouldBeRecognizedRightOnRefresh() throws Exception {
VirtualFile dir = myModule1Dir.createChildDirectory(null, "dir");
VirtualFile excluded = dir.createChildDirectory(null, "excluded");
ModifiableRootModel m = ModuleRootManager.getInstance(myModule).getModifiableModel();
ContentEntry[] ee = m.getContentEntries();
assertEquals(1, ee.length);
ee[0].addExcludeFolder(excluded);
m.commit();
dir.delete(null);
new File(myModule1Dir.getPath(), "dir/excluded/foo").mkdirs();
final List<Boolean> isExcluded = new ArrayList<Boolean>();
VirtualFileListener l = new VirtualFileAdapter() {
@Override
public void fileCreated(VirtualFileEvent e) {
assertEquals("dir", e.getFileName());
isExcluded.add(myIndex.getInfoForDirectory(e.getFile()) == null);
isExcluded.add(myIndex.getInfoForDirectory(e.getFile().findFileByRelativePath("excluded")) == null);
isExcluded.add(myIndex.getInfoForDirectory(e.getFile().findFileByRelativePath("excluded/foo")) == null);
}
};
VirtualFileManager.getInstance().addVirtualFileListener(l);
try {
VirtualFileManager.getInstance().refresh(false);
}
finally {
VirtualFileManager.getInstance().removeVirtualFileListener(l);
}
assertEquals(Arrays.asList(false, true, true), isExcluded);
}
public void testProcessingNestedContentRootsOfExcludedDirsOnCreation() {
String rootPath = myModule1Dir.getPath();
File f = new File(rootPath, "excludedDir/dir/anotherContentRoot");
ModifiableRootModel rootModel = ModuleRootManager.getInstance(myModule).getModifiableModel();
rootModel.getContentEntries()[0].addExcludeFolder(VfsUtil.pathToUrl(FileUtil.toSystemIndependentName(f.getParentFile().getParent())));
rootModel.commit();
rootModel = ModuleRootManager.getInstance(myModule2).getModifiableModel();
rootModel.addContentEntry(VfsUtil.pathToUrl(FileUtil.toSystemIndependentName(f.getPath())));
rootModel.commit();
f.mkdirs();
LocalFileSystem.getInstance().refresh(false);
assertNull(myIndex.getInfoForDirectory(LocalFileSystem.getInstance().findFileByIoFile(f.getParentFile().getParentFile())));
assertNotNull(myIndex.getInfoForDirectory(LocalFileSystem.getInstance().findFileByIoFile(f)));
}
public void testLibraryDirInContent() throws Exception {
ModifiableRootModel rootModel = ModuleRootManager.getInstance(myModule).getModifiableModel();
Library.ModifiableModel libraryModel = rootModel.getModuleLibraryTable().createLibrary().getModifiableModel();
libraryModel.addRoot(myModule1Dir, OrderRootType.CLASSES);
libraryModel.commit();
rootModel.commit();
myIndex.checkConsistency();
checkInfo(myModule1Dir, myModule, false, false, true, false, "", new Module[]{myModule});
checkInfo(mySrcDir1, myModule, true, false, true, false, "", new Module[]{myModule});
}
public void testExcludeCompilerOutputOutsideOfContentRoot() throws Exception {
final ProjectFileIndex fileIndex = ProjectRootManager.getInstance(myProject).getFileIndex();
assertTrue(fileIndex.isIgnored(myOutputDir));
assertTrue(fileIndex.isIgnored(myModule1OutputDir));
assertFalse(fileIndex.isIgnored(myOutputDir.getParent()));
}
private void checkInfo(VirtualFile dir,
Module module,
boolean isInModuleSource,
boolean isTestSource,
boolean isInLibrary,
boolean isInLibrarySource,
String packageName,
Module[] modulesOfOrderEntries) {
DirectoryInfo info = myIndex.getInfoForDirectory(dir);
assertNotNull(info);
assertEquals(module, info.module);
assertEquals(isInModuleSource, info.isInModuleSource);
assertEquals(isTestSource, info.isTestSource);
assertEquals(isInLibrary, info.libraryClassRoot != null);
assertEquals(isInLibrarySource, info.isInLibrarySource);
final ProjectFileIndex fileIndex = ProjectRootManager.getInstance(myProject).getFileIndex();
assertEquals(packageName, fileIndex.getPackageNameByDirectory(dir));
assertEquals(modulesOfOrderEntries.length, info.getOrderEntries().size());
for (Module aModule : modulesOfOrderEntries) {
boolean found = false;
for (OrderEntry orderEntry : info.getOrderEntries()) {
if (orderEntry.getOwnerModule() == aModule) {
found = true;
break;
}
}
assertTrue(found);
}
}
private void checkInfoNull(VirtualFile dir) {
DirectoryInfo info = myIndex.getInfoForDirectory(dir);
assertNull(info);
}
private void checkPackage(VirtualFile[] expectedDirs, String packageName) {
VirtualFile[] actualDirs = myIndex.getDirectoriesByPackageName(packageName, true).toArray(VirtualFile.EMPTY_ARRAY);
assertNotNull(actualDirs);
HashSet<VirtualFile> set1 = new HashSet<VirtualFile>();
set1.addAll(Arrays.asList(expectedDirs));
HashSet<VirtualFile> set2 = new HashSet<VirtualFile>();
set2.addAll(Arrays.asList(actualDirs));
assertEquals(set1, set2);
}
}
@@ -0,0 +1,74 @@
/*
* Copyright (c) 2000-2004 by JetBrains s.r.o. All Rights Reserved.
* Use is subject to license terms.
*/
package com.intellij.roots;
import com.intellij.openapi.application.ex.PathManagerEx;
import com.intellij.openapi.module.ModifiableModuleModel;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.module.ModuleManager;
import com.intellij.openapi.module.StdModuleTypes;
import com.intellij.openapi.roots.ContentEntry;
import com.intellij.openapi.roots.ModifiableRootModel;
import com.intellij.openapi.roots.ModuleOrderEntry;
import com.intellij.openapi.roots.ModuleRootManager;
import com.intellij.openapi.vfs.LocalFileSystem;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.JavaPsiFacade;
import com.intellij.psi.PsiClass;
import com.intellij.psi.search.GlobalSearchScope;
import com.intellij.testFramework.IdeaTestCase;
import java.io.File;
/**
* @author dsl
*/
public class ExportingModulesTest extends IdeaTestCase {
public void test1() throws Exception {
final String rootPath = PathManagerEx.getTestDataPath().replace(File.separatorChar, '/') + "/moduleRootManager/exportedModules/";
final VirtualFile testRoot = LocalFileSystem.getInstance().refreshAndFindFileByPath(rootPath);
assertNotNull(testRoot);
final ModifiableModuleModel moduleModel = ModuleManager.getInstance(myProject).getModifiableModel();
final Module moduleA = moduleModel.newModule("A.iml", StdModuleTypes.JAVA);
final Module moduleB = moduleModel.newModule("B.iml", StdModuleTypes.JAVA);
final Module moduleC = moduleModel.newModule("C.iml", StdModuleTypes.JAVA);
moduleModel.commit();
configureModule(moduleA, testRoot, "A");
configureModule(moduleB, testRoot, "B");
configureModule(moduleC, testRoot, "C");
final ModifiableRootModel rootModelB = ModuleRootManager.getInstance(moduleB).getModifiableModel();
final ModuleOrderEntry moduleBAentry = rootModelB.addModuleOrderEntry(moduleA);
moduleBAentry.setExported(true);
rootModelB.commit();
final ModifiableRootModel rootModelC = ModuleRootManager.getInstance(moduleC).getModifiableModel();
rootModelC.addModuleOrderEntry(moduleB);
rootModelC.commit();
final PsiClass pCClass =
JavaPsiFacade.getInstance(myProject).findClass("p.C", GlobalSearchScope.moduleWithDependenciesAndLibrariesScope(moduleC));
assertNotNull(pCClass);
final PsiClass pAClass =
JavaPsiFacade.getInstance(myProject).findClass("p.A", GlobalSearchScope.moduleWithDependenciesAndLibrariesScope(moduleB));
assertNotNull(pAClass);
final PsiClass pAClass2 =
JavaPsiFacade.getInstance(myProject).findClass("p.A", GlobalSearchScope.moduleWithDependenciesAndLibrariesScope(moduleC));
assertNotNull(pAClass2);
}
private void configureModule(final Module module, final VirtualFile testRoot, final String name) {
final ModifiableRootModel rootModel = ModuleRootManager.getInstance(module).getModifiableModel();
final VirtualFile contentRoot = testRoot.findChild(name);
final ContentEntry contentEntry = rootModel.addContentEntry(contentRoot);
contentEntry.addSourceFolder(contentRoot.findChild("src"), false);
rootModel.commit();
}
}
@@ -0,0 +1,129 @@
package com.intellij.roots;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.projectRoots.ProjectJdkTable;
import com.intellij.openapi.projectRoots.Sdk;
import com.intellij.openapi.projectRoots.impl.JavaSdkImpl;
import com.intellij.openapi.roots.InheritedJdkOrderEntry;
import com.intellij.openapi.roots.ModifiableRootModel;
import com.intellij.openapi.roots.ModuleRootManager;
import com.intellij.openapi.roots.RootPolicy;
import com.intellij.openapi.roots.ex.ProjectRootManagerEx;
import com.intellij.testFramework.ModuleTestCase;
import junit.framework.Assert;
/**
* @author dsl
*/
public class InheritedJdkTest extends ModuleTestCase {
protected void setUpJdk() {
}
public void test1() throws Exception {
final Sdk jdk = JavaSdkImpl.getMockJdk("java 1.4");
ApplicationManager.getApplication().runWriteAction(new Runnable() {
public void run() {
ProjectJdkTable.getInstance().addJdk(jdk);
}
});
final ModuleRootManager rootManager = ModuleRootManager.getInstance(myModule);
ApplicationManager.getApplication().runWriteAction(new Runnable() {
public void run() {
final ProjectRootManagerEx rootManagerEx = ProjectRootManagerEx.getInstanceEx(myProject);
rootManagerEx.setProjectJdkName(jdk.getName());
final ModifiableRootModel rootModel = rootManager.getModifiableModel();
rootModel.inheritSdk();
rootModel.commit();
}
});
assertTrue("JDK is inherited after explicit inheritSdk()", rootManager.isSdkInherited());
assertTrue("Correct jdk inherited", jdk.equals(rootManager.getSdk()));
ApplicationManager.getApplication().runWriteAction(new Runnable() {
public void run() {
final ModifiableRootModel rootModel = rootManager.getModifiableModel();
rootModel.setSdk(null);
rootModel.commit();
}
});
assertFalse("JDK is not inherited after setJdk(null)", rootManager.isSdkInherited());
assertTrue("No JDK assigned", null == rootManager.getSdk());
final Sdk jdk1 = JavaSdkImpl.getMockJdk("jjj");
ApplicationManager.getApplication().runWriteAction(new Runnable() {
public void run() {
ProjectJdkTable.getInstance().addJdk(jdk1);
}
});
ApplicationManager.getApplication().runWriteAction(new Runnable() {
public void run() {
final ModifiableRootModel rootModel = rootManager.getModifiableModel();
rootModel.setSdk(jdk1);
rootModel.commit();
}
});
assertFalse("JDK is not inherited after setJdk(jdk1)", rootManager.isSdkInherited());
assertTrue("jdk1 is assigned", jdk1.equals(rootManager.getSdk()));
}
public void test2() throws Exception {
final ModuleRootManager rootManager = ModuleRootManager.getInstance(myModule);
final ModifiableRootModel rootModel = rootManager.getModifiableModel();
rootModel.inheritSdk();
ApplicationManager.getApplication().runWriteAction(new Runnable() {
public void run() {
rootModel.commit();
}
});
assertTrue("JDK is inherited after inheritSdk()", rootManager.isSdkInherited());
assertTrue("No JDK assigned", null == rootManager.getSdk());
final Sdk mockJdk = JavaSdkImpl.getMockJdk("mock 1.4");
ApplicationManager.getApplication().runWriteAction(new Runnable() {
public void run() {
ProjectJdkTable.getInstance().addJdk(mockJdk);
}
});
final ProjectRootManagerEx projectRootManager = ProjectRootManagerEx.getInstanceEx(myProject);
ApplicationManager.getApplication().runWriteAction(new Runnable() {
public void run() {
projectRootManager.setProjectJdk(mockJdk);
}
});
assertTrue(rootManager.isSdkInherited());
assertTrue("mockJdk inherited", mockJdk.equals(rootManager.getSdk()));
ApplicationManager.getApplication().runWriteAction(new Runnable() {
public void run() {
projectRootManager.setProjectJdkName("jdk1");
}
});
assertTrue(rootManager.isSdkInherited());
Assert.assertEquals("Correct non-existing JDK inherited", "jdk1",
rootManager.processOrder(new RootPolicy<String>() {
public String visitInheritedJdkOrderEntry(InheritedJdkOrderEntry inheritedJdkOrderEntry, String s) {
return inheritedJdkOrderEntry.getJdkName();
}
}, null));
assertNull("Non-existing JDK", rootManager.getSdk());
final Sdk jdk1 = JavaSdkImpl.getMockJdk("jdk1");
ApplicationManager.getApplication().runWriteAction(new Runnable() {
public void run() {
ProjectJdkTable.getInstance().addJdk(jdk1);
}
});
assertTrue(rootManager.isSdkInherited());
assertNotNull("JDK appeared", rootManager.getSdk());
assertTrue("jdk1 found", jdk1.equals(rootManager.getSdk()));
}
}
@@ -0,0 +1,139 @@
package com.intellij.roots;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.roots.ContentEntry;
import com.intellij.openapi.roots.ContentFolder;
import com.intellij.openapi.roots.ModifiableRootModel;
import com.intellij.openapi.roots.ModuleRootManager;
import com.intellij.openapi.vfs.LocalFileSystem;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.testFramework.IdeaTestCase;
import com.intellij.testFramework.PsiTestUtil;
import java.io.File;
import java.io.IOException;
public class ManagingContentRootFoldersTest extends IdeaTestCase {
private VirtualFile root;
private ContentEntry entry;
private ModifiableRootModel myModel;
@Override
protected void setUp() throws Exception {
super.setUp();
ApplicationManager.getApplication().runWriteAction(new Runnable() {
public void run() {
initContentRoot();
initModifiableModel();
}
});
}
@Override
protected void tearDown() throws Exception {
if (myModel != null && myModel.isWritable()) {
myModel.dispose();
}
myModel = null;
super.tearDown();
}
private void initContentRoot() {
try {
File dir = createTempDirectory();
root = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(dir);
PsiTestUtil.addContentRoot(myModule, root);
}
catch (IOException e) {
throw new RuntimeException(e);
}
}
private void initModifiableModel() {
myModel = ModuleRootManager.getInstance(myModule).getModifiableModel();
for (ContentEntry e : myModel.getContentEntries()) {
if (e.getFile() == root) entry = e;
}
}
public void testCreationOfSourceFolderWithFile() throws IOException {
VirtualFile dir = root.createChildDirectory(null, "src");
String url = dir.getUrl();
ContentFolder f = entry.addSourceFolder(dir, false);
assertSame(dir, f.getFile());
assertEquals(url, f.getUrl());
dir.delete(null);
assertNull(f.getFile());
assertEquals(url, f.getUrl());
dir = root.createChildDirectory(null, "src");
assertSame(dir, f.getFile());
assertEquals(url, f.getUrl());
}
public void testCreationOfSourceFolderWithUrl() throws IOException {
VirtualFile dir = root.createChildDirectory(null, "src");
String url = dir.getUrl();
dir.delete(null);
ContentFolder f = entry.addSourceFolder(url, false);
assertNull(f.getFile());
assertEquals(url, f.getUrl());
dir = root.createChildDirectory(null, "src");
assertSame(dir, f.getFile());
assertEquals(url, f.getUrl());
}
public void testCreationOfSourceFolderWithUrlWhenFileExists() throws IOException {
VirtualFile dir = root.createChildDirectory(null, "src");
String url = dir.getUrl();
ContentFolder f = entry.addSourceFolder(url, false);
assertSame(dir, f.getFile());
assertEquals(url, f.getUrl());
}
public void testCreationOfExcludedFolderWithFile() throws IOException {
VirtualFile dir = root.createChildDirectory(null, "src");
String url = dir.getUrl();
ContentFolder f = entry.addExcludeFolder(dir);
assertSame(dir, f.getFile());
assertEquals(url, f.getUrl());
dir.delete(null);
assertNull(f.getFile());
assertEquals(url, f.getUrl());
dir = root.createChildDirectory(null, "src");
assertSame(dir, f.getFile());
assertEquals(url, f.getUrl());
}
public void testCreationOfExcludedFolderWithUrl() throws IOException {
VirtualFile dir = root.createChildDirectory(null, "src");
String url = dir.getUrl();
dir.delete(null);
ContentFolder f = entry.addExcludeFolder(url);
assertNull(f.getFile());
assertEquals(url, f.getUrl());
dir = root.createChildDirectory(null, "src");
assertSame(dir, f.getFile());
assertEquals(url, f.getUrl());
}
public void testCreationOfExcludedFolderWithUrlWhenFileExists() throws IOException {
VirtualFile dir = root.createChildDirectory(null, "src");
String url = dir.getUrl();
ContentFolder f = entry.addExcludeFolder(url);
assertSame(dir, f.getFile());
assertEquals(url, f.getUrl());
}
}
@@ -0,0 +1,103 @@
package com.intellij.roots;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.roots.ContentEntry;
import com.intellij.openapi.roots.ModifiableRootModel;
import com.intellij.openapi.roots.ModuleRootManager;
import com.intellij.openapi.roots.ModuleRootModel;
import com.intellij.openapi.roots.impl.ContentEntryImpl;
import com.intellij.openapi.vfs.LocalFileSystem;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.testFramework.IdeaTestCase;
import java.io.IOException;
public class ManagingContentRootsTest extends IdeaTestCase {
private VirtualFile dir;
@Override
protected void setUp() throws Exception {
super.setUp();
ApplicationManager.getApplication().runWriteAction(new Runnable() {
public void run() {
try {
LocalFileSystem fs = LocalFileSystem.getInstance();
dir = fs.refreshAndFindFileByIoFile(createTempDirectory());
}
catch (IOException e) {
throw new RuntimeException(e);
}
}
});
}
public void testCreationOfContentRootWithFile() throws IOException {
VirtualFile root = dir.createChildDirectory(null, "root");
String url = root.getUrl();
ModifiableRootModel m = getRootManager().getModifiableModel();
m.addContentEntry(root);
m.commit();
assertSame(root, findContentEntry(url).getFile());
root.delete(null);
assertNotNull(findContentEntry(url));
root = dir.createChildDirectory(null, "root");
assertSame(root, findContentEntry(url).getFile());
}
public void testCreationOfContentRootWithUrl() throws IOException {
VirtualFile root = dir.createChildDirectory(null, "root");
String url = root.getUrl();
root.delete(null);
ModifiableRootModel m = getRootManager().getModifiableModel();
m.addContentEntry(url);
m.commit();
assertNotNull(findContentEntry(url));
root = dir.createChildDirectory(null, "root");
assertSame(root, findContentEntry(url).getFile());
}
public void testCreationOfContentRootWithUrlWhenFileExists() throws IOException {
VirtualFile root = dir.createChildDirectory(null, "root");
String url = root.getUrl();
ModifiableRootModel m = getRootManager().getModifiableModel();
m.addContentEntry(url);
m.commit();
assertSame(root, findContentEntry(url).getFile());
}
public void testGettingMofifiableModelCorrectlySetsRootModelForContentEntries() throws Exception {
ModifiableRootModel m = getRootManager().getModifiableModel();
m.addContentEntry(dir);
m.commit();
m = getRootManager().getModifiableModel();
ContentEntry e = findContentEntry(dir.getUrl(), m);
assertSame(m, ((ContentEntryImpl)e).getRootModel());
m.dispose();
}
private ContentEntry findContentEntry(String url) {
return findContentEntry(url, getRootManager());
}
private static ContentEntry findContentEntry(String url, ModuleRootModel m) {
for (ContentEntry e : m.getContentEntries()) {
if (e.getUrl().equals(url)) return e;
}
return null;
}
private ModuleRootManager getRootManager() {
return ModuleRootManager.getInstance(myModule);
}
}
@@ -0,0 +1,137 @@
package com.intellij.roots;
import com.intellij.openapi.application.PathManager;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.projectRoots.Sdk;
import com.intellij.openapi.projectRoots.SdkModificator;
import com.intellij.openapi.roots.*;
import com.intellij.openapi.roots.libraries.Library;
import com.intellij.openapi.roots.libraries.LibraryTablesRegistrar;
import com.intellij.openapi.vfs.JarFileSystem;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.testFramework.ModuleTestCase;
import com.intellij.testFramework.PsiTestUtil;
import com.intellij.util.PathsList;
import java.io.IOException;
/**
* @author nik
*/
public abstract class ModuleRootManagerTestCase extends ModuleTestCase {
protected static void assertRoots(PathsList pathsList, VirtualFile... files) {
assertOrderedEquals(pathsList.getRootDirs(), files);
}
@Override
protected Sdk getTestProjectJdk() {
final Sdk jdk = super.getTestProjectJdk();
final SdkModificator modificator = jdk.getSdkModificator();
VirtualFile rtJar = null;
for (VirtualFile root : modificator.getRoots(OrderRootType.CLASSES)) {
if (root.getName().equals("rt.jar")) {
rtJar = root;
break;
}
}
assertNotNull("rt.jar not found in jdk: " + jdk, rtJar);
modificator.removeAllRoots();
modificator.addRoot(rtJar, OrderRootType.CLASSES);
modificator.commitChanges();
return jdk;
}
protected VirtualFile getRtJar() {
return getTestProjectJdk().getRootProvider().getFiles(OrderRootType.CLASSES)[0];
}
protected VirtualFile getJDomJar() {
return getJarFromLibDir("jdom.jar");
}
protected VirtualFile getJDomSources() {
return getJarFromLibDir("src/jdom.zip");
}
protected VirtualFile getJarFromLibDir(final String name) {
final VirtualFile file = getVirtualFile(PathManager.findFileInLibDirectory(name));
assertNotNull(name + " not found", file);
final VirtualFile jarFile = JarFileSystem.getInstance().getJarRootForLocalFile(file);
assertNotNull(name + " is not jar", jarFile);
return jarFile;
}
protected VirtualFile addSourceRoot(Module module, boolean testSource) throws IOException {
final VirtualFile root = getVirtualFile(createTempDir(module.getName() + (testSource ? "Test" : "Prod") + "Src"));
PsiTestUtil.addSourceContentToRoots(module, root, testSource);
return root;
}
protected VirtualFile setModuleOutput(Module module, boolean test) throws IOException {
final VirtualFile output = getVirtualFile(createTempDir(module.getName() + (test ? "Test" : "Prod") + "Output"));
final ModifiableRootModel model = ModuleRootManager.getInstance(module).getModifiableModel();
final CompilerModuleExtension extension = model.getModuleExtension(CompilerModuleExtension.class);
assertNotNull(extension);
extension.inheritCompilerOutputPath(false);
if (test) {
extension.setCompilerOutputPathForTests(output);
}
else {
extension.setCompilerOutputPath(output);
}
model.commit();
return output;
}
protected void addLibraryDependency(Module module, Library dependency) {
addLibraryDependency(module, dependency, DependencyScope.COMPILE, false);
}
protected void addLibraryDependency(Module module, Library dependency, DependencyScope scope, boolean exported) {
final ModifiableRootModel model = ModuleRootManager.getInstance(module).getModifiableModel();
final LibraryOrderEntry entry = model.addLibraryEntry(dependency);
entry.setScope(scope);
entry.setExported(exported);
model.commit();
}
protected void addModuleDependency(Module module, Module dependency) {
addModuleDependency(module, dependency, DependencyScope.COMPILE, false);
}
protected void addModuleDependency(Module module, Module dependency, DependencyScope scope, boolean exported) {
final ModifiableRootModel model = ModuleRootManager.getInstance(module).getModifiableModel();
final ModuleOrderEntry entry = model.addModuleOrderEntry(dependency);
entry.setScope(scope);
entry.setExported(exported);
model.commit();
}
protected Library createLibrary(final String name, final VirtualFile classesRoot) {
return createLibrary(name, classesRoot, null);
}
protected Library createLibrary(final String name, final VirtualFile classesRoot, final VirtualFile sourceRoot) {
final Library library = LibraryTablesRegistrar.getInstance().getLibraryTable(myProject).createLibrary(name);
final Library.ModifiableModel model = library.getModifiableModel();
model.addRoot(classesRoot, OrderRootType.CLASSES);
if (sourceRoot != null) {
model.addRoot(sourceRoot, OrderRootType.SOURCES);
}
model.commit();
return library;
}
protected Library createJDomLibrary() {
return createLibrary("jdom", getJDomJar(), getJDomSources());
}
protected Library createAsmLibrary() {
return createLibrary("asm", getAsmJar(), null);
}
protected VirtualFile getAsmJar() {
return getJarFromLibDir("asm.jar");
}
}
@@ -0,0 +1,273 @@
package com.intellij.roots;
import com.intellij.application.options.ReplacePathToMacroMap;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.application.ex.PathManagerEx;
import com.intellij.openapi.components.ExpandMacroToPathMap;
import com.intellij.openapi.components.PathMacroManager;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.projectRoots.impl.JavaSdkImpl;
import com.intellij.openapi.roots.*;
import com.intellij.openapi.roots.impl.ModuleRootManagerImpl;
import com.intellij.openapi.roots.libraries.Library;
import com.intellij.openapi.roots.libraries.LibraryTable;
import com.intellij.openapi.vfs.LocalFileSystem;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.testFramework.ModuleTestCase;
import com.intellij.ide.highlighter.ModuleFileType;
import org.jdom.Element;
import org.jdom.output.XMLOutputter;
import java.io.File;
import java.io.IOException;
import java.util.Iterator;
/**
* @author dsl
*/
public class ModuleRootsExternalizationTest extends ModuleTestCase {
private static final Logger LOG = Logger.getInstance("#com.intellij.openapi.roots.impl.ExternalizationTest");
public void testEmptyModuleWrite() throws Exception {
try {
ModuleRootManagerImpl moduleRootManager = createTempModuleRootManager();
Element root = new Element("root");
moduleRootManager.getState().writeExternal(root);
assertEquals(root.getText(), "");
}
catch (IOException e) {
LOG.error(e);
}
}
private ModuleRootManagerImpl createTempModuleRootManager() throws IOException {
File tmpModule = File.createTempFile("tst", ModuleFileType.DOT_DEFAULT_EXTENSION);
myFilesToDelete.add(tmpModule);
final Module module = createModule(tmpModule);
final ModuleRootManagerImpl moduleRootManager =
(ModuleRootManagerImpl)ModuleRootManager.getInstance(module);
return moduleRootManager;
}
public void testContentWrite() throws Exception {
File content = getTestRoot();
File source = new File(content, "source");
File testSource = new File(content, "testSource");
File exclude = new File(content, "exclude");
File classes = new File(content, "classes");
File testClasses = new File(content, "testClasses");
final VirtualFile contentFile = LocalFileSystem.getInstance().findFileByIoFile(content);
assertTrue(contentFile != null);
final VirtualFile sourceFile = LocalFileSystem.getInstance().findFileByIoFile(source);
assertTrue(sourceFile != null);
final VirtualFile testSourceFile = LocalFileSystem.getInstance().findFileByIoFile(testSource);
assertTrue(testSourceFile != null);
final VirtualFile excludeFile = LocalFileSystem.getInstance().findFileByIoFile(exclude);
assertTrue(excludeFile != null);
final VirtualFile classesFile = LocalFileSystem.getInstance().findFileByIoFile(classes);
assertTrue(classesFile != null);
final VirtualFile testClassesFile = LocalFileSystem.getInstance().findFileByIoFile(testClasses);
assertTrue(testClassesFile != null);
final File moduleFile = new File(content, "test.iml");
final Module module = createModule(moduleFile);
final ModuleRootManagerImpl moduleRootManager =
(ModuleRootManagerImpl)ModuleRootManager.getInstance(module);
final Runnable action = new Runnable() {
public void run() {
final ModifiableRootModel rootModel = moduleRootManager.getModifiableModel();
final ContentEntry contentEntry = rootModel.addContentEntry(contentFile);
final CompilerModuleExtension compilerModuleExtension = rootModel.getModuleExtension(CompilerModuleExtension.class);
compilerModuleExtension.setCompilerOutputPath(classesFile);
compilerModuleExtension.setCompilerOutputPathForTests(testClassesFile);
compilerModuleExtension.inheritCompilerOutputPath(false);
rootModel.setSdk(JavaSdkImpl.getMockJdk("java 1.4"));
contentEntry.addSourceFolder(sourceFile, false);
contentEntry.addSourceFolder(testSourceFile, true);
contentEntry.addExcludeFolder(excludeFile);
rootModel.commit();
}
};
ApplicationManager.getApplication().runWriteAction(action);
final Element element = new Element("root");
moduleRootManager.getState().writeExternal(element);
assertElementEquals(element,
"<root inherit-compiler-output=\"false\">" +
"<output url=\"file://$MODULE_DIR$/classes\" />" +
"<output-test url=\"file://$MODULE_DIR$/testClasses\" />" +
"<exclude-output />" +
"<content url=\"file://$MODULE_DIR$\">" +
"<sourceFolder url=\"file://$MODULE_DIR$/source\" isTestSource=\"false\" />" +
"<sourceFolder url=\"file://$MODULE_DIR$/testSource\" isTestSource=\"true\" />" +
"<excludeFolder url=\"file://$MODULE_DIR$/exclude\" />" +
"</content>" +
"<orderEntry type=\"jdk\" jdkName=\"java 1.4\" jdkType=\"JavaSDK\" />" +
"<orderEntry type=\"sourceFolder\" forTests=\"false\" />" +
"</root>",
module);
}
public void testModuleLibraries() throws Exception {
File moduleFile = new File(getTestRoot(), "test.iml");
Module module = createModule(moduleFile);
final ModuleRootManagerImpl moduleRootManager =
(ModuleRootManagerImpl)ModuleRootManager.getInstance(module);
final ModifiableRootModel rootModel = moduleRootManager.getModifiableModel();
final LibraryTable moduleLibraryTable = rootModel.getModuleLibraryTable();
final Library unnamedLibrary = moduleLibraryTable.createLibrary();
final File unnamedLibClasses = new File(getTestRoot(), "unnamedLibClasses");
final VirtualFile unnamedLibClassesRoot = LocalFileSystem.getInstance().findFileByIoFile(unnamedLibClasses);
final Library.ModifiableModel libraryModifyableModel = unnamedLibrary.getModifiableModel();
libraryModifyableModel.addRoot(unnamedLibClassesRoot.getUrl(), OrderRootType.CLASSES);
final Library namedLibrary = moduleLibraryTable.createLibrary("namedLibrary");
final File namedLibClasses = new File(getTestRoot(), "namedLibClasses");
final VirtualFile namedLibClassesRoot = LocalFileSystem.getInstance().findFileByIoFile(namedLibClasses);
final Library.ModifiableModel namedLibraryModel = namedLibrary.getModifiableModel();
namedLibraryModel.addRoot(namedLibClassesRoot.getUrl(), OrderRootType.CLASSES);
ApplicationManager.getApplication().runWriteAction(new Runnable() {
public void run() {
libraryModifyableModel.commit();
namedLibraryModel.commit();
}
});
final Iterator libraryIterator = moduleLibraryTable.getLibraryIterator();
assertTrue(libraryIterator.next().equals(unnamedLibrary));
assertTrue(libraryIterator.next().equals(namedLibrary));
ApplicationManager.getApplication().runWriteAction(new Runnable() {
public void run() {
rootModel.commit();
}
});
final Element element = new Element("root");
moduleRootManager.getState().writeExternal(element);
assertElementEquals(element,
"<root inherit-compiler-output=\"true\">" +
"<exclude-output />" +
"<orderEntry type=\"sourceFolder\" forTests=\"false\" />" +
"<orderEntry type=\"module-library\">" +
"<library>" +
"<CLASSES><root url=\"file://$MODULE_DIR$/unnamedLibClasses\" /></CLASSES>" +
"<JAVADOC /><SOURCES />" +
"</library>" +
"</orderEntry>" +
"<orderEntry type=\"module-library\">" +
"<library name=\"namedLibrary\">" +
"<CLASSES><root url=\"file://$MODULE_DIR$/namedLibClasses\" /></CLASSES>" +
"<JAVADOC /><SOURCES />" +
"</library>" +
"</orderEntry>" +
"</root>", module);
}
public void testCompilerOutputInheritance() throws Exception {
File moduleFile = new File(getTestRoot(), "test.iml");
Module module = createModule(moduleFile);
final ModuleRootManagerImpl moduleRootManager =
(ModuleRootManagerImpl)ModuleRootManager.getInstance(module);
final ModifiableRootModel rootModel = moduleRootManager.getModifiableModel();
rootModel.getModuleExtension(CompilerModuleExtension.class).inheritCompilerOutputPath(true);
ApplicationManager.getApplication().runWriteAction(new Runnable() {
public void run() {
rootModel.commit();
}
});
Element element = new Element("root");
moduleRootManager.getState().writeExternal(element);
assertElementEquals(element,
"<root inherit-compiler-output=\"true\">" +
"<exclude-output />" +
"<orderEntry type=\"sourceFolder\" forTests=\"false\" />" +
"</root>", module);
}
public void testMacroSubstituteWin() {
final ReplacePathToMacroMap map = new ReplacePathToMacroMap();
final String path = "jar://C:/idea/lib/forms_rt.jar!/";
map.put("jar://C:/", "jar://$MODULE_DIR$/../../");
final String substituted = map.substitute(path, false);
assertEquals("jar://$MODULE_DIR$/../../idea/lib/forms_rt.jar!/", substituted);
}
public void testExpandMacro1() {
final ExpandMacroToPathMap map = new ExpandMacroToPathMap();
map.addMacroExpand("MACRO", "C:/idea");
final String expanded = map.substitute("jar://$MACRO$/lib/forms_rt.jar!/", false);
assertEquals("jar://C:/idea/lib/forms_rt.jar!/", expanded);
}
public void testExpandMacro2() {
final ExpandMacroToPathMap map = new ExpandMacroToPathMap();
map.addMacroExpand("MACRO", "forms_rt.jar!/");
final String expanded = map.substitute("jar://C:/idea/lib/$MACRO$", false);
assertEquals("jar://C:/idea/lib/forms_rt.jar!/", expanded);
}
public void testExpandMacro3() {
final ExpandMacroToPathMap map = new ExpandMacroToPathMap();
map.addMacroExpand("MACRO1", "C:/idea");
map.addMacroExpand("MACRO2", "forms_rt.jar!/");
final String expanded = map.substitute("jar://$MACRO1$/lib/$MACRO2$", false);
assertEquals("jar://C:/idea/lib/forms_rt.jar!/", expanded);
}
public void testExpandMacroNoExpand() {
final ExpandMacroToPathMap map = new ExpandMacroToPathMap();
map.addMacroExpand("MACRO", "C:/idea");
final String expanded = map.substitute("jar://C:/idea$/lib/forms_rt.jar!/", false);
assertEquals("jar://C:/idea$/lib/forms_rt.jar!/", expanded);
}
public void testExpandMacroNoExpand2() {
final ExpandMacroToPathMap map = new ExpandMacroToPathMap();
map.addMacroExpand("MACRO", "C:/idea");
final String expanded = map.substitute("jar://C:/idea/lib/forms_rt.jar!/$", false);
assertEquals("jar://C:/idea/lib/forms_rt.jar!/$", expanded);
}
public void testExpandMacroNoExpand3() {
final ExpandMacroToPathMap map = new ExpandMacroToPathMap();
map.addMacroExpand("MACRO", "C:/idea");
final String expanded = map.substitute("jar://$UNKNOWN$/lib/forms_rt.jar!/", false);
assertEquals("jar://$UNKNOWN$/lib/forms_rt.jar!/", expanded);
}
public void testMacroSubstitute2() {
final ReplacePathToMacroMap map = new ReplacePathToMacroMap();
final String path = "jar://C:/idea/lib/forms_rt.jar!/";
map.put("jar://C:/id", "*SUBST*");
final String substituted = map.substitute(path, false);
assertEquals(path, substituted);
}
public static void assertElementEquals(final Element element, String value, Module module) {
PathMacroManager.getInstance(module).collapsePaths(element);
assertEquals(value, new XMLOutputter().outputString(element));
}
private File getTestRoot() {
File testRoot = new File(PathManagerEx.getTestDataPath());
File moduleRootManagerRoot = new File(testRoot, "moduleRootManager");
File thisTestRoot = new File(moduleRootManagerRoot, getTestName(true));
return thisTestRoot;
}
}
@@ -0,0 +1,216 @@
package com.intellij.roots;
import com.intellij.ProjectTopics;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.application.ex.PathManagerEx;
import com.intellij.openapi.module.ModifiableModuleModel;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.module.ModuleManager;
import com.intellij.openapi.module.StdModuleTypes;
import com.intellij.openapi.project.ModuleListener;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.roots.*;
import com.intellij.openapi.roots.ex.ProjectRootManagerEx;
import com.intellij.openapi.util.Computable;
import com.intellij.openapi.vfs.LocalFileSystem;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.JavaPsiFacade;
import com.intellij.psi.search.GlobalSearchScope;
import com.intellij.testFramework.ModuleTestCase;
import com.intellij.util.messages.MessageBusConnection;
import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
/**
* @author dsl
*/
public class MultiModuleEditingTest extends ModuleTestCase {
private static final String TEST_PATH = PathManagerEx.getTestDataPath() +
"/moduleRootManager/multiModuleEditing".replace('/', File.separatorChar);
protected void setUpModule() {
}
protected void setUpJdk() {
}
public void testAddTwoModules() throws Exception {
final MessageBusConnection connection = myProject.getMessageBus().connect();
final MyModuleListener moduleListener = new MyModuleListener();
connection.subscribe(ProjectTopics.MODULES, moduleListener);
final ModuleManager moduleManager = ModuleManager.getInstance(myProject);
final Module moduleA;
final Module moduleB;
{
final ModifiableModuleModel modifiableModel = moduleManager.getModifiableModel();
moduleA = modifiableModel.newModule("a.iml", StdModuleTypes.JAVA);
moduleB = modifiableModel.newModule("b.iml", StdModuleTypes.JAVA);
assertEquals("Changes are not applied until commit", 0, moduleManager.getModules().length);
//noinspection SSBasedInspection
moduleListener.assertCorrectEvents(new String[0][]);
ApplicationManager.getApplication().runWriteAction(new Runnable() {
public void run() {
modifiableModel.commit();
}
});
}
assertEquals(2, moduleManager.getModules().length);
assertTrue(moduleManager.findModuleByName("a").equals(moduleA));
assertTrue(moduleManager.findModuleByName("b").equals(moduleB));
moduleListener.assertCorrectEvents(new String[][]{{"+a", "+b"}});
{
final ModifiableModuleModel modifiableModel = moduleManager.getModifiableModel();
modifiableModel.disposeModule(moduleA);
modifiableModel.disposeModule(moduleB);
assertEquals("Changes are not applied until commit", 2, moduleManager.getModules().length);
moduleListener.assertCorrectEvents(new String[][]{{"+a", "+b"}});
ApplicationManager.getApplication().runWriteAction(new Runnable() {
public void run() {
modifiableModel.commit();
}
});
}
assertEquals(0, moduleManager.getModules().length);
moduleListener.assertCorrectEvents(new String[][]{{"+a", "+b"}, {"-a", "-b"}});
connection.disconnect();
}
public void testRootsEditing() {
final MessageBusConnection connection = myProject.getMessageBus().connect();
final ModuleManager moduleManager = ModuleManager.getInstance(myProject);
final MyModuleListener moduleListener = new MyModuleListener();
connection.subscribe(ProjectTopics.MODULES, moduleListener);
final Module moduleA;
final Module moduleB;
{
final ModifiableModuleModel moduleModel = moduleManager.getModifiableModel();
moduleA = moduleModel.newModule("a.iml", StdModuleTypes.JAVA);
moduleB = moduleModel.newModule("b.iml", StdModuleTypes.JAVA);
final ModifiableRootModel rootModelA = ModuleRootManager.getInstance(moduleA).getModifiableModel();
final ModifiableRootModel rootModelB = ModuleRootManager.getInstance(moduleB).getModifiableModel();
rootModelB.addModuleOrderEntry(moduleA);
final ContentEntry contentEntryA = rootModelA.addContentEntry(getVirtualFileInTestData("a"));
contentEntryA.addSourceFolder(getVirtualFileInTestData("a/src"), false);
final ContentEntry contentEntryB = rootModelB.addContentEntry(getVirtualFileInTestData("b"));
contentEntryB.addSourceFolder(getVirtualFileInTestData("b/src"), false);
ApplicationManager.getApplication().runWriteAction(new Runnable() {
public void run() {
ProjectRootManagerEx.getInstanceEx(myProject).multiCommit(moduleModel, new ModifiableRootModel[]{rootModelB, rootModelA});
}
});
}
final JavaPsiFacade psiManager = getJavaFacade();
assertNull(psiManager.findClass("j.B", GlobalSearchScope.moduleWithDependenciesScope(moduleA)));
assertNull(psiManager.findClass("q.A", GlobalSearchScope.moduleScope(moduleB)));
assertNotNull(psiManager.findClass("q.A", GlobalSearchScope.moduleScope(moduleA)));
assertNotNull(psiManager.findClass("q.A", GlobalSearchScope.moduleWithDependenciesScope(moduleB)));
assertNotNull(psiManager.findClass("j.B", GlobalSearchScope.moduleScope(moduleB)));
assertNotNull(psiManager.findClass("j.B", GlobalSearchScope.moduleWithDependenciesScope(moduleB)));
moduleManager.disposeModule(moduleB);
moduleManager.disposeModule(moduleA);
moduleListener.assertCorrectEvents(new String[][]{{"+b", "+a"}, {"-b"}, {"-a"}});
connection.disconnect();
}
public void testRenaming() throws Exception{
final ModuleManager moduleManager = ModuleManager.getInstance(myProject);
final Module moduleA;
final Module moduleB;
{
final ModifiableModuleModel moduleModel = moduleManager.getModifiableModel();
moduleA = moduleModel.newModule("a.iml", StdModuleTypes.JAVA);
moduleB = moduleModel.newModule("b.iml", StdModuleTypes.JAVA);
final Module moduleC = moduleModel.newModule("c.iml", StdModuleTypes.JAVA);
final ModifiableRootModel rootModelB = ModuleRootManager.getInstance(moduleB).getModifiableModel();
rootModelB.addModuleOrderEntry(moduleC);
moduleModel.disposeModule(moduleC);
ApplicationManager.getApplication().runWriteAction(new Runnable() {
public void run() {
ProjectRootManager.getInstance(myProject).multiCommit(moduleModel, new ModifiableRootModel[]{rootModelB});
}
});
}
final ModuleRootManager rootManagerB = ModuleRootManager.getInstance(moduleB);
assertEquals(0, rootManagerB.getDependencies().length);
final String[] dependencyModuleNames = rootManagerB.getDependencyModuleNames();
assertEquals(1, dependencyModuleNames.length);
assertEquals("c", dependencyModuleNames[0]);
{
final ModifiableModuleModel moduleModel = moduleManager.getModifiableModel();
moduleModel.renameModule(moduleA, "c");
moduleModel.commit();
}
assertEquals(1, rootManagerB.getDependencies().length);
assertEquals(moduleA, rootManagerB.getDependencies()[0]);
assertEquals("c", moduleA.getName());
moduleManager.disposeModule(moduleA);
moduleManager.disposeModule(moduleB);
}
private VirtualFile getVirtualFileInTestData(final String relativeVfsPath) {
return ApplicationManager.getApplication().runWriteAction(new Computable<VirtualFile>() {
public VirtualFile compute() {
final String path = TEST_PATH + File.separatorChar + getTestName(true) + File.separatorChar + relativeVfsPath.replace('/', File.separatorChar);
final VirtualFile result = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(new File(path));
assertNotNull("File " + path + " doen\'t exist", result);
return result;
}
});
}
private class MyModuleListener implements ModuleListener {
private final List<String> myLog = new ArrayList<String>();
public void moduleRemoved(Project project, Module module) {
myLog.add("-" + module.getName());
}
public void modulesRenamed(Project project, List<Module> modules) {
// write something
}
public void moduleAdded(Project project, Module module) {
myLog.add("+" + module.getName());
}
public void beforeModuleRemoved(Project project, Module module) {
}
public void assertCorrectEvents(String[][] expected) {
int runningIndex = 0;
for (int chunkIndex = 0; chunkIndex < expected.length; chunkIndex++) {
String[] chunk = expected[chunkIndex];
final List<String> expectedChunkList = new ArrayList<String>(Arrays.asList(chunk));
int nextIndex = runningIndex + chunk.length;
assertTrue("Expected chunk " + expectedChunkList.toString(), nextIndex <= myLog.size());
final List<String> actualChunkList = new ArrayList<String>(myLog.subList(runningIndex, nextIndex));
Collections.sort(expectedChunkList);
Collections.sort(actualChunkList);
assertEquals("Chunk " + chunkIndex, expectedChunkList.toString(), actualChunkList.toString());
runningIndex = nextIndex;
}
assertEquals("More events than needed", runningIndex, myLog.size());
}
}
}
@@ -0,0 +1,90 @@
package com.intellij.roots;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.roots.DependencyScope;
import com.intellij.openapi.roots.ModuleRootManager;
import com.intellij.openapi.roots.OrderRootType;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.roots.ModuleRootManagerTestCase;
/**
* @author nik
*/
public class OrderEntriesTest extends ModuleRootManagerTestCase {
public void testLibrary() throws Exception {
addLibraryDependency(myModule, createJDomLibrary());
assertOrderFiles(OrderRootType.CLASSES, getRtJar(), getJDomJar());
assertOrderFiles(OrderRootType.SOURCES, getJDomSources());
assertOrderFiles(OrderRootType.CLASSES_AND_OUTPUT, getRtJar(), getJDomJar());
assertOrderFiles(OrderRootType.COMPILATION_CLASSES, getRtJar(), getJDomJar());
assertOrderFiles(OrderRootType.PRODUCTION_COMPILATION_CLASSES, getRtJar(), getJDomJar());
}
public void testModuleSources() throws Exception {
final VirtualFile srcRoot = addSourceRoot(myModule, false);
final VirtualFile testRoot = addSourceRoot(myModule, true);
final VirtualFile output = setModuleOutput(myModule, false);
final VirtualFile testOutput = setModuleOutput(myModule, true);
assertOrderFiles(OrderRootType.CLASSES, getRtJar());
assertOrderFiles(OrderRootType.SOURCES, srcRoot, testRoot);
assertOrderFiles(OrderRootType.CLASSES_AND_OUTPUT, getRtJar(), output, testOutput);
assertOrderFiles(OrderRootType.COMPILATION_CLASSES, getRtJar(), output, testOutput);
assertOrderFiles(OrderRootType.PRODUCTION_COMPILATION_CLASSES, getRtJar(), output);
}
public void testLibraryScope() throws Exception {
addLibraryDependency(myModule, createJDomLibrary(), DependencyScope.TEST, false);
assertOrderFiles(OrderRootType.CLASSES, getRtJar(), getJDomJar());
assertOrderFiles(OrderRootType.SOURCES, getJDomSources());
assertOrderFiles(OrderRootType.CLASSES_AND_OUTPUT, getRtJar(), getJDomJar());
assertOrderFiles(OrderRootType.COMPILATION_CLASSES, getRtJar(), getJDomJar());
assertOrderFiles(OrderRootType.PRODUCTION_COMPILATION_CLASSES, getRtJar());
}
public void testModuleDependency() throws Exception {
final Module dep = createModule("dep");
final VirtualFile srcRoot = addSourceRoot(dep, false);
final VirtualFile testRoot = addSourceRoot(dep, true);
final VirtualFile output = setModuleOutput(dep, false);
final VirtualFile testOutput = setModuleOutput(dep, true);
addLibraryDependency(dep, createJDomLibrary(), DependencyScope.COMPILE, true);
addModuleDependency(myModule, dep);
assertOrderFiles(OrderRootType.CLASSES, getRtJar(), getJDomJar());
assertOrderFiles(OrderRootType.SOURCES, srcRoot, testRoot, getJDomSources());
assertOrderFiles(OrderRootType.CLASSES_AND_OUTPUT, getRtJar(), output, testOutput, getJDomJar());
assertOrderFiles(OrderRootType.COMPILATION_CLASSES, getRtJar(), output, testOutput, getJDomJar());
assertOrderFiles(OrderRootType.PRODUCTION_COMPILATION_CLASSES, getRtJar(), output, getJDomJar());
}
public void testModuleDependencyScope() throws Exception {
final Module dep = createModule("dep");
addLibraryDependency(dep, createJDomLibrary(), DependencyScope.COMPILE, true);
addModuleDependency(myModule, dep, DependencyScope.TEST, true);
assertOrderFiles(OrderRootType.CLASSES, getRtJar(), getJDomJar());
assertOrderFiles(OrderRootType.SOURCES, getJDomSources());
assertOrderFiles(OrderRootType.CLASSES_AND_OUTPUT, getRtJar(), getJDomJar());
assertOrderFiles(OrderRootType.COMPILATION_CLASSES, getRtJar(), getJDomJar());
assertOrderFiles(OrderRootType.PRODUCTION_COMPILATION_CLASSES, getRtJar());
}
public void testNotExportedLibraryDependency() throws Exception {
final Module dep = createModule("dep");
addLibraryDependency(dep, createJDomLibrary(), DependencyScope.COMPILE, false);
addModuleDependency(myModule, dep);
assertOrderFiles(OrderRootType.CLASSES, getRtJar());
assertOrderFiles(OrderRootType.SOURCES);
assertOrderFiles(OrderRootType.CLASSES_AND_OUTPUT, getRtJar(), getJDomJar());
assertOrderFiles(OrderRootType.COMPILATION_CLASSES, getRtJar());
assertOrderFiles(OrderRootType.PRODUCTION_COMPILATION_CLASSES, getRtJar());
}
private void assertOrderFiles(final OrderRootType type, VirtualFile... files) {
assertOrderedEquals(ModuleRootManager.getInstance(myModule).getFiles(type), files);
}
}
@@ -0,0 +1,51 @@
package com.intellij.roots;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.roots.ProjectRootsTraversing;
import com.intellij.openapi.vfs.VirtualFile;
/**
* @author nik
*/
public class ProjectRootsTraversingTest extends ModuleRootManagerTestCase {
public void testLibrary() throws Exception {
addLibraryDependency(myModule, createJDomLibrary());
assertRoots(ProjectRootsTraversing.collectRoots(myModule, ProjectRootsTraversing.LIBRARIES_AND_JDK),
getRtJar(), getJDomJar());
assertRoots(ProjectRootsTraversing.collectRoots(myModule, ProjectRootsTraversing.PROJECT_LIBRARIES),
getJDomJar());
assertRoots(ProjectRootsTraversing.collectRoots(myModule, ProjectRootsTraversing.PROJECT_SOURCES));
}
public void testModuleSources() throws Exception {
final VirtualFile srcRoot = addSourceRoot(myModule, false);
final VirtualFile testRoot = addSourceRoot(myModule, true);
assertRoots(ProjectRootsTraversing.collectRoots(myModule, ProjectRootsTraversing.LIBRARIES_AND_JDK),
getRtJar());
assertRoots(ProjectRootsTraversing.collectRoots(myModule, ProjectRootsTraversing.PROJECT_SOURCES),
srcRoot, testRoot);
}
public void testModuleOutput() throws Exception {
setModuleOutput(myModule, false);
setModuleOutput(myModule, true);
assertRoots(ProjectRootsTraversing.collectRoots(myModule, ProjectRootsTraversing.LIBRARIES_AND_JDK),
getRtJar());
assertRoots(ProjectRootsTraversing.collectRoots(myModule, ProjectRootsTraversing.PROJECT_SOURCES));
}
public void testModuleDependency() throws Exception {
final Module dep = createModule("b");
setModuleOutput(dep, false);
setModuleOutput(dep, true);
addSourceRoot(dep, false);
addSourceRoot(dep, true);
addLibraryDependency(dep, createJDomLibrary());
addModuleDependency(myModule, dep);
assertRoots(ProjectRootsTraversing.collectRoots(myModule, ProjectRootsTraversing.PROJECT_LIBRARIES),
getJDomJar());
assertRoots(ProjectRootsTraversing.collectRoots(myModule, ProjectRootsTraversing.PROJECT_SOURCES));
}
}
@@ -0,0 +1,228 @@
package com.intellij.roots;
import com.intellij.ProjectTopics;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.projectRoots.ProjectJdkTable;
import com.intellij.openapi.projectRoots.Sdk;
import com.intellij.openapi.projectRoots.SdkModificator;
import com.intellij.openapi.projectRoots.impl.JavaSdkImpl;
import com.intellij.openapi.roots.*;
import com.intellij.openapi.roots.libraries.Library;
import com.intellij.openapi.roots.libraries.LibraryTable;
import com.intellij.openapi.roots.libraries.LibraryTablesRegistrar;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.vfs.LocalFileSystem;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.testFramework.ModuleTestCase;
import com.intellij.util.messages.MessageBusConnection;
import java.io.File;
import java.io.IOException;
/**
* @author dsl
*/
public class RootsChangedTest extends ModuleTestCase {
private MessageBusConnection myConnection;
private RootsChangedTest.MyModuleRootListener myModuleRootListener;
protected void setUp() throws Exception {
super.setUp();
myConnection = myProject.getMessageBus().connect();
myModuleRootListener = new MyModuleRootListener();
myConnection.subscribe(ProjectTopics.PROJECT_ROOTS, myModuleRootListener);
}
protected void tearDown() throws Exception {
myConnection.disconnect();
super.tearDown();
}
public void testProjectLibraryChangeEvent() throws Exception {
final LibraryTable projectLibraryTable = LibraryTablesRegistrar.getInstance().getLibraryTable(myProject);
verifyLibraryTableEditing(projectLibraryTable);
}
public void testGlobalLibraryChangeEvent() throws Exception {
final LibraryTable globalLibraryTable = LibraryTablesRegistrar.getInstance().getLibraryTable();
verifyLibraryTableEditing(globalLibraryTable);
}
public void testProjectLibraryEventsInUncommitedModel() throws Exception {
final LibraryTable projectLibraryTable = LibraryTablesRegistrar.getInstance().getLibraryTable(myProject);
verifyLibraryTableEditingInUncommitedModel(projectLibraryTable);
}
public void testGlobalLibraryEventsInUncommitedModel() throws Exception {
final LibraryTable globalLibraryTable = LibraryTablesRegistrar.getInstance().getLibraryTable();
verifyLibraryTableEditingInUncommitedModel(globalLibraryTable);
}
public void testModuleJdkEditing() throws Exception {
final Module moduleA = createModule("a.iml");
final Module moduleB = createModule("b.iml");
assertEventsCount(2);
final Sdk jdk = JavaSdkImpl.getMockJdk("AAA");
ProjectJdkTable.getInstance().addJdk(jdk);
assertEventsCount(0);
final ModifiableRootModel rootModelA = ModuleRootManager.getInstance(moduleA).getModifiableModel();
final ModifiableRootModel rootModelB = ModuleRootManager.getInstance(moduleB).getModifiableModel();
rootModelA.setSdk(jdk);
rootModelB.setSdk(jdk);
ProjectRootManager.getInstance(myProject).multiCommit(new ModifiableRootModel[]{rootModelA, rootModelB});
assertEventsCount(1);
final SdkModificator sdkModificator = jdk.getSdkModificator();
sdkModificator.addRoot(getVirtualFile(createTempDirectory()), OrderRootType.CLASSES);
sdkModificator.commitChanges();
assertEventsCount(1);
ProjectJdkTable.getInstance().removeJdk(jdk);
assertEventsCount(1);
}
public void testInheritedJdkEditing() throws Exception {
final Module moduleA = createModule("a.iml");
final Module moduleB = createModule("b.iml");
assertEventsCount(2);
final Sdk jdk = JavaSdkImpl.getMockJdk("AAA");
ProjectJdkTable.getInstance().addJdk(jdk);
assertEventsCount(0);
final Sdk jdkBBB = JavaSdkImpl.getMockJdk("BBB");
ProjectJdkTable.getInstance().addJdk(jdk);
assertEventsCount(0);
ProjectRootManager.getInstance(myProject).setProjectJdk(jdkBBB);
assertEventsCount(0);
final ModifiableRootModel rootModelA = ModuleRootManager.getInstance(moduleA).getModifiableModel();
final ModifiableRootModel rootModelB = ModuleRootManager.getInstance(moduleB).getModifiableModel();
rootModelA.inheritSdk();
rootModelB.inheritSdk();
ProjectRootManager.getInstance(myProject).multiCommit(new ModifiableRootModel[]{rootModelA, rootModelB});
assertEventsCount(1);
ProjectRootManager.getInstance(myProject).setProjectJdk(jdk);
assertEventsCount(1);
final SdkModificator sdkModificator = jdk.getSdkModificator();
sdkModificator.addRoot(getVirtualFile(createTempDirectory()), OrderRootType.CLASSES);
sdkModificator.commitChanges();
assertEventsCount(1);
ProjectJdkTable.getInstance().removeJdk(jdk);
assertEventsCount(1);
}
private void verifyLibraryTableEditing(final LibraryTable libraryTable) throws IOException {
final Module moduleA = createModule("a.iml");
final Module moduleB = createModule("b.iml");
assertEventsCount(2);
final Library libraryA = libraryTable.createLibrary("A");
final Library.ModifiableModel libraryModifiableModel = libraryA.getModifiableModel();
libraryModifiableModel.addRoot("file:///a", OrderRootType.CLASSES);
libraryModifiableModel.commit();
assertEventsCount(0);
final ModifiableRootModel rootModelA = ModuleRootManager.getInstance(moduleA).getModifiableModel();
final ModifiableRootModel rootModelB = ModuleRootManager.getInstance(moduleB).getModifiableModel();
rootModelA.addLibraryEntry(libraryA);
rootModelB.addLibraryEntry(libraryA);
rootModelA.addInvalidLibrary("Q", libraryTable.getTableLevel());
rootModelB.addInvalidLibrary("Q", libraryTable.getTableLevel());
ProjectRootManager.getInstance(myProject).multiCommit(new ModifiableRootModel[]{rootModelA, rootModelB});
assertEventsCount(1);
final Library.ModifiableModel libraryModifiableModel2 = libraryA.getModifiableModel();
final File tmpDir = FileUtil.createTempDirectory(getTestName(true), "");
try {
final VirtualFile file = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(tmpDir);
assertNotNull(file);
libraryModifiableModel2.addRoot(file.getUrl(), OrderRootType.CLASSES);
libraryModifiableModel2.commit();
assertEventsCount(1);
}
finally {
FileUtil.delete(tmpDir);
}
libraryTable.removeLibrary(libraryA);
assertEventsCount(1);
final Library libraryQ = libraryTable.createLibrary("Q");
assertEventsCount(1);
libraryTable.removeLibrary(libraryQ);
assertEventsCount(1);
}
private void verifyLibraryTableEditingInUncommitedModel(final LibraryTable libraryTable) {
final Module moduleA = createModule("a.iml");
final Module moduleB = createModule("b.iml");
assertEventsCount(2);
final Library libraryA = libraryTable.createLibrary("A");
final Library.ModifiableModel libraryModifiableModel = libraryA.getModifiableModel();
libraryModifiableModel.addRoot("file:///a", OrderRootType.CLASSES);
libraryModifiableModel.commit();
assertEventsCount(0);
final ModifiableRootModel rootModelA = ModuleRootManager.getInstance(moduleA).getModifiableModel();
final ModifiableRootModel rootModelB = ModuleRootManager.getInstance(moduleB).getModifiableModel();
rootModelA.addLibraryEntry(libraryA);
rootModelB.addLibraryEntry(libraryA);
final Library.ModifiableModel libraryModifiableModel2 = libraryA.getModifiableModel();
libraryModifiableModel2.addRoot("file:///b", OrderRootType.CLASSES);
libraryModifiableModel2.commit();
assertEventsCount(0);
libraryTable.removeLibrary(libraryA);
assertEventsCount(0);
rootModelA.addInvalidLibrary("Q", libraryTable.getTableLevel());
rootModelB.addInvalidLibrary("Q", libraryTable.getTableLevel());
assertEventsCount(0);
final Library libraryQ = libraryTable.createLibrary("Q");
assertEventsCount(0);
ProjectRootManager.getInstance(myProject).multiCommit(new ModifiableRootModel[]{rootModelA, rootModelB});
assertEventsCount(1);
libraryTable.removeLibrary(libraryQ);
assertEventsCount(1);
}
private void assertEventsCount(int count) {
final int beforeCount = myModuleRootListener.beforeCount;
final int afterCount = myModuleRootListener.afterCount;
assertEquals("beforeCount = " + beforeCount + ", afterCount = " + afterCount, beforeCount, afterCount);
assertEquals(count, beforeCount);
myModuleRootListener.reset();
}
private static class MyModuleRootListener implements ModuleRootListener {
private int beforeCount = 0;
private int afterCount = 0;
public void beforeRootsChange(ModuleRootEvent event) {
beforeCount++;
}
public void rootsChanged(ModuleRootEvent event) {
afterCount++;
}
private void reset() {
beforeCount = 0;
afterCount = 0;
}
}
}
@@ -0,0 +1,61 @@
package com.intellij.roots;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.application.ex.PathManagerEx;
import com.intellij.openapi.roots.CompilerModuleExtension;
import com.intellij.openapi.roots.ModifiableRootModel;
import com.intellij.openapi.roots.ModuleRootManager;
import com.intellij.openapi.vfs.LocalFileSystem;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.testFramework.PsiTestCase;
import java.io.File;
/**
* @author dsl
*/
public class RootsTest extends PsiTestCase {
public void testTest1() {
final String rootPath = PathManagerEx.getTestDataPath() + "/moduleRootManager/roots/" + "test1";
final VirtualFile[] rootFileBox = new VirtualFile[1];
ApplicationManager.getApplication().runWriteAction(new Runnable() {
public void run() {
rootFileBox[0] =
LocalFileSystem.getInstance().refreshAndFindFileByPath(rootPath.replace(File.separatorChar, '/'));
}
});
final VirtualFile rootFile = rootFileBox[0];
final VirtualFile classesFile = rootFile.findChild("classes");
assertNotNull(classesFile);
final VirtualFile childOfContent = rootFile.findChild("x.txt");
assertNotNull(childOfContent);
final VirtualFile childOfClasses = classesFile.findChild("y.txt");
assertNotNull(childOfClasses);
final ModuleRootManager rootManager = ModuleRootManager.getInstance(myModule);
ApplicationManager.getApplication().runWriteAction(new Runnable() {
public void run() {
final ModifiableRootModel rootModel = rootManager.getModifiableModel();
rootModel.addContentEntry(rootFile);
rootModel.getModuleExtension(CompilerModuleExtension.class).inheritCompilerOutputPath(false);
rootModel.getModuleExtension(CompilerModuleExtension.class).setCompilerOutputPath(classesFile);
rootModel.getModuleExtension(CompilerModuleExtension.class).setExcludeOutput(false);
rootModel.commit();
}
});
assertTrue(rootManager.getFileIndex().isInContent(childOfContent));
assertTrue(rootManager.getFileIndex().isInContent(childOfClasses));
ApplicationManager.getApplication().runWriteAction(new Runnable() {
public void run() {
final ModifiableRootModel rootModel = rootManager.getModifiableModel();
rootModel.getModuleExtension(CompilerModuleExtension.class).setExcludeOutput(true);
rootModel.commit();
}
});
assertTrue(rootManager.getFileIndex().isInContent(childOfContent));
assertFalse(rootManager.getFileIndex().isInContent(childOfClasses));
}
}
@@ -0,0 +1,61 @@
package com.intellij.roots.libraries;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.roots.OrderRootType;
import com.intellij.openapi.roots.RootProvider;
import com.intellij.openapi.roots.libraries.Library;
import com.intellij.openapi.roots.libraries.LibraryTable;
import com.intellij.openapi.roots.libraries.LibraryTablesRegistrar;
import com.intellij.testFramework.IdeaTestCase;
import org.jdom.Element;
import org.jdom.output.XMLOutputter;
/**
* @author dsl
*/
public class LibraryTest extends IdeaTestCase {
public void testModification() throws Exception {
final LibraryTable libraryTable = LibraryTablesRegistrar.getInstance().getLibraryTable();
final Library library = libraryTable.createLibrary("NewLibrary");
final boolean[] listenerNotifiedOnChange = new boolean[1];
library.getRootProvider().addRootSetChangedListener(new RootProvider.RootSetChangedListener() {
public void rootSetChanged(RootProvider wrapper) {
listenerNotifiedOnChange[0] = true;
}
});
final Library.ModifiableModel modifyableModel = library.getModifiableModel();
modifyableModel.addRoot("file://x.jar", OrderRootType.CLASSES);
modifyableModel.addRoot("file://x-src.jar", OrderRootType.SOURCES);
ApplicationManager.getApplication().runWriteAction(new Runnable() {
public void run() {
modifyableModel.commit();
}
});
assertTrue(listenerNotifiedOnChange[0]);
listenerNotifiedOnChange[0] = false;
final Library.ModifiableModel modifyableModel1 = library.getModifiableModel();
modifyableModel1.setName("library");
ApplicationManager.getApplication().runWriteAction(new Runnable() {
public void run() {
modifyableModel1.commit();
}
});
assertFalse(listenerNotifiedOnChange[0]);
final Element element = new Element("root");
library.writeExternal(element);
assertEquals("<root><library name=\"library\"><CLASSES><root url=\"file://x.jar\" /></CLASSES><JAVADOC /><SOURCES><root url=\"file://x-src.jar\" /></SOURCES></library></root>",
new XMLOutputter().outputString(element));
ApplicationManager.getApplication().runWriteAction(new Runnable() {
public void run() {
final LibraryTable.ModifiableModel modifiableModel = libraryTable.getModifiableModel();
modifiableModel.removeLibrary(library);
modifiableModel.commit();
}
});
}
}