private void ShouldComplainIfMissingFile(File file) { // given FileUtils.deleteFile(file); IDictionary <string, string> @params = stringMap(); SslPolicyConfig policyConfig = new SslPolicyConfig("default"); @params[neo4j_home.name()] = _home.AbsolutePath; @params[policyConfig.BaseDirectory.name()] = "certificates/default"; Config config = Config.defaults(@params); // when try { SslPolicyLoader.Create(config, NullLogProvider.Instance); fail(); } catch (Exception e) { assertTrue(e.InnerException is FileNotFoundException); } }
/// <summary> /// Loads all the SSL policies as defined by the config. /// </summary> /// <param name="config"> The configuration for the SSL policies. </param> /// <returns> A factory populated with SSL policies. </returns> public static SslPolicyLoader Create(Config config, LogProvider logProvider) { SslPolicyLoader policyFactory = new SslPolicyLoader(config, logProvider); policyFactory.Load(config, logProvider.GetLog(typeof(SslPolicyLoader))); return(policyFactory); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldReturnNullPolicyIfNullRequested() public virtual void ShouldReturnNullPolicyIfNullRequested() { // given SslPolicyLoader sslPolicyLoader = SslPolicyLoader.Create(Config.defaults(), NullLogProvider.Instance); // when SslPolicy sslPolicy = sslPolicyLoader.GetPolicy(null); // then assertNull(sslPolicy); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldNotAllowLegacyPolicyToBeConfigured() public virtual void ShouldNotAllowLegacyPolicyToBeConfigured() { // given IDictionary <string, string> @params = stringMap(); SslPolicyConfig policyConfig = new SslPolicyConfig(LegacySslPolicyConfig.LEGACY_POLICY_NAME); @params[neo4j_home.name()] = _home.AbsolutePath; @params[policyConfig.BaseDirectory.name()] = "certificates/default"; Config config = Config.defaults(@params); try { // when SslPolicyLoader.Create(config, NullLogProvider.Instance); fail(); } catch (System.ArgumentException) { // expected } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldLoadBaseCryptographicObjects() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldLoadBaseCryptographicObjects() { // given IDictionary <string, string> @params = stringMap(); SslPolicyConfig policyConfig = new SslPolicyConfig("default"); @params[neo4j_home.name()] = _home.AbsolutePath; @params[policyConfig.BaseDirectory.name()] = "certificates/default"; Config config = Config.defaults(@params); // when SslPolicyLoader sslPolicyLoader = SslPolicyLoader.Create(config, NullLogProvider.Instance); // then SslPolicy sslPolicy = sslPolicyLoader.GetPolicy("default"); assertNotNull(sslPolicy); assertNotNull(sslPolicy.PrivateKey()); assertNotNull(sslPolicy.CertificateChain()); assertNotNull(sslPolicy.NettyClientContext()); assertNotNull(sslPolicy.NettyServerContext()); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldThrowIfPolicyNameDoesNotExist() public virtual void ShouldThrowIfPolicyNameDoesNotExist() { // given IDictionary <string, string> @params = stringMap(); SslPolicyConfig policyConfig = new SslPolicyConfig("default"); @params[neo4j_home.name()] = _home.AbsolutePath; @params[policyConfig.BaseDirectory.name()] = "certificates/default"; Config config = Config.defaults(@params); SslPolicyLoader sslPolicyLoader = SslPolicyLoader.Create(config, NullLogProvider.Instance); // when try { sslPolicyLoader.GetPolicy("unknown"); fail(); } catch (System.ArgumentException) { // expected } }