Пример #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testScanClassPath_multipleRoots() throws java.net.MalformedURLException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
        public virtual void testScanClassPath_multipleRoots()
        {
            // define a classloader with multiple roots.
            URLClassLoader classLoader = new URLClassLoader(new URL[]
            {
                new URL("file:src/test/resources/org/camunda/bpm/container/impl/jmx/deployment/util/ClassPathScannerTest.testScanClassPathWithFiles/"),
                new URL("file:src/test/resources/org/camunda/bpm/container/impl/jmx/deployment/util/ClassPathScannerTest.testScanClassPathWithFilesRecursive/"),
                new URL("file:src/test/resources/org/camunda/bpm/container/impl/jmx/deployment/util/ClassPathScannerTest.testScanClassPathRecursiveTwoDirectories.jar")
            });

            ClassPathProcessApplicationScanner scanner = new ClassPathProcessApplicationScanner();

            IDictionary <string, sbyte[]> scanResult = new Dictionary <string, sbyte[]>();

            scanner.scanPaResourceRootPath(classLoader, null, "classpath:directory/", scanResult);

            assertTrue("'testDeployProcessArchive.bpmn20.xml' not found", contains(scanResult, "testDeployProcessArchive.bpmn20.xml"));
            assertTrue("'testDeployProcessArchive.png' not found", contains(scanResult, "testDeployProcessArchive.png"));
            assertEquals(2, scanResult.Count);     // only finds two files since the resource name of the processes (and diagrams) is the same

            scanResult.Clear();
            scanner.scanPaResourceRootPath(classLoader, null, "directory/", scanResult);

            assertTrue("'testDeployProcessArchive.bpmn20.xml' not found", contains(scanResult, "testDeployProcessArchive.bpmn20.xml"));
            assertTrue("'testDeployProcessArchive.png' not found", contains(scanResult, "testDeployProcessArchive.png"));
            assertEquals(2, scanResult.Count);     // only finds two files since the resource name of the processes (and diagrams) is the same

            scanResult.Clear();
            scanner.scanPaResourceRootPath(classLoader, new URL("file:src/test/resources/org/camunda/bpm/container/impl/jmx/deployment/util/ClassPathScannerTest.testScanClassPathWithFilesRecursive/META-INF/processes.xml"), "pa:directory/", scanResult);

            assertTrue("'testDeployProcessArchive.bpmn20.xml' not found", contains(scanResult, "testDeployProcessArchive.bpmn20.xml"));
            assertTrue("'testDeployProcessArchive.png' not found", contains(scanResult, "testDeployProcessArchive.png"));
            assertEquals(2, scanResult.Count);     // only finds two files since a PA-local resource root path is provided
        }
Пример #2
0
        /// <summary>
        /// Test method for <seealso cref="org.camunda.bpm.container.impl.deployment.scanning.ClassPathProcessApplicationScanner.scanClassPath(java.lang.ClassLoader)"/>. </summary>
        /// <exception cref="MalformedURLException">  </exception>
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testScanClassPath() throws java.net.MalformedURLException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
        public virtual void testScanClassPath()
        {
            URLClassLoader classLoader = Classloader;

            IDictionary <string, sbyte[]> scanResult = new Dictionary <string, sbyte[]>();

            scanner.scanPaResourceRootPath(classLoader, new URL(url + "/META-INF/processes.xml"), null, scanResult);

            assertTrue("'testDeployProcessArchive.bpmn20.xml' not found", contains(scanResult, "testDeployProcessArchive.bpmn20.xml"));
            assertTrue("'testDeployProcessArchive.png' not found", contains(scanResult, "testDeployProcessArchive.png"));
            if (url.Contains("TwoDirectories"))
            {
                assertEquals(4, scanResult.Count);
            }
            else
            {
                assertEquals(2, scanResult.Count);
            }
        }