Exemplo n.º 1
0
 public PrefetchingRawIteratorAnonymousInnerClass(ProcedureJarLoader outerInstance, URL jar, ClassLoader loader, ZipInputStream zip)
 {
     this.outerInstance = outerInstance;
     this._jar          = jar;
     this._loader       = loader;
     this._zip          = zip;
 }
Exemplo n.º 2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldReturnEmptySetOnNullArgument() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldReturnEmptySetOnNullArgument()
        {
            // given
            ProcedureJarLoader jarloader = new ProcedureJarLoader(new ReflectiveProcedureCompiler(new TypeMappers(), new ComponentRegistry(), RegistryWithUnsafeAPI(), _log, ProcedureConfig()), NullLog.Instance);

            // when
            ProcedureJarLoader.Callables callables = jarloader.LoadProceduresFromDir(null);

            // then
            assertEquals(0, callables.Procedures().Count + callables.Functions().Count);
        }
Exemplo n.º 3
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public void start() throws Throwable
        public override void Start()
        {
            ProcedureJarLoader loader = new ProcedureJarLoader(_compiler, _log);

            ProcedureJarLoader.Callables callables = loader.LoadProceduresFromDir(_pluginDir);
            foreach (CallableProcedure procedure in callables.Procedures())
            {
                Register(procedure);
            }

            foreach (CallableUserFunction function in callables.Functions())
            {
                Register(function);
            }

            foreach (CallableUserAggregationFunction function in callables.AggregationFunctions())
            {
                Register(function);
            }

            // And register built-in procedures
            _builtin.accept(this);
        }
Exemplo n.º 4
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldLogHelpfullyWhenPluginJarIsCorrupt() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldLogHelpfullyWhenPluginJarIsCorrupt()
        {
            // given
            URL theJar = CreateJarFor(typeof(ClassWithOneProcedure), typeof(ClassWithAnotherProcedure), typeof(ClassWithNoProcedureAtAll));

            CorruptJar(theJar);

            AssertableLogProvider logProvider = new AssertableLogProvider(true);

            ProcedureJarLoader jarloader = new ProcedureJarLoader(new ReflectiveProcedureCompiler(new TypeMappers(), new ComponentRegistry(), RegistryWithUnsafeAPI(), _log, ProcedureConfig()), logProvider.GetLog(typeof(ProcedureJarLoader)));

            // when
            try
            {
                jarloader.LoadProceduresFromDir(ParentDir(theJar));
                fail("Should have logged and thrown exception.");
            }
            catch (ZipException)
            {
                // then
                logProvider.InternalToStringMessageMatcher().assertContains(escapeJava(string.Format("Plugin jar file: {0} corrupted.", (new File(theJar.toURI())).toPath())));
            }
        }
Exemplo n.º 5
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldWorkOnPathsWithSpaces() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldWorkOnPathsWithSpaces()
        {
            // given
            File fileWithSpacesInName = Tmpdir.newFile((new Random()).Next() + "  some spaces in the filename" + ".jar");
            URL  theJar = (new JarBuilder()).CreateJarFor(fileWithSpacesInName, typeof(ClassWithOneProcedure));

            CorruptJar(theJar);

            AssertableLogProvider logProvider = new AssertableLogProvider(true);

            ProcedureJarLoader jarloader = new ProcedureJarLoader(new ReflectiveProcedureCompiler(new TypeMappers(), new ComponentRegistry(), RegistryWithUnsafeAPI(), _log, ProcedureConfig()), logProvider.GetLog(typeof(ProcedureJarLoader)));

            // when
            try
            {
                jarloader.LoadProceduresFromDir(ParentDir(theJar));
                fail("Should have logged and thrown exception.");
            }
            catch (ZipException)
            {
                // then
                logProvider.InternalToStringMessageMatcher().assertContains(escapeJava(string.Format("Plugin jar file: {0} corrupted.", fileWithSpacesInName.toPath())));
            }
        }
Exemplo n.º 6
0
 private void InitializeInstanceFields()
 {
     _jarloader = new ProcedureJarLoader(new ReflectiveProcedureCompiler(new TypeMappers(), new ComponentRegistry(), RegistryWithUnsafeAPI(), _log, ProcedureConfig()), NullLog.Instance);
 }