Exemple #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void validateNodePropertiesOnPopulation()
        internal virtual void ValidateNodePropertiesOnPopulation()
        {
            setUp();
            Label  label        = Label.label("populationTestNodeLabel");
            string propertyName = "populationTestPropertyName";

            using (Transaction transaction = _database.beginTx())
            {
                Node node = _database.createNode(label);
                node.SetProperty(propertyName, StringUtils.repeat("a", IndexWriter.MAX_TERM_LENGTH + 1));
                transaction.Success();
            }

            IndexDefinition indexDefinition = CreateIndex(label, propertyName);

            try
            {
                using (Transaction ignored = _database.beginTx())
                {
                    _database.schema().awaitIndexesOnline(5, TimeUnit.MINUTES);
                }
            }
            catch (System.InvalidOperationException)
            {
                using (Transaction ignored = _database.beginTx())
                {
                    string indexFailure = _database.schema().getIndexFailure(indexDefinition);
                    assertThat(indexFailure, allOf(containsString("java.lang.IllegalArgumentException:"), containsString("Please see index documentation for limitations.")));
                }
            }
        }
Exemple #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void validateExplicitIndexedRelationshipProperties()
        internal virtual void ValidateExplicitIndexedRelationshipProperties()
        {
            setUp();
            Label            label        = Label.label("explicitIndexedRelationshipPropertiesTestLabel");
            string           propertyName = "explicitIndexedRelationshipProperties";
            string           explicitIndexedRelationshipIndex = "explicitIndexedRelationshipIndex";
            RelationshipType indexType = RelationshipType.withName("explicitIndexType");

            using (Transaction transaction = _database.beginTx())
            {
                Node         source       = _database.createNode(label);
                Node         destination  = _database.createNode(label);
                Relationship relationship = source.CreateRelationshipTo(destination, indexType);
                _database.index().forRelationships(explicitIndexedRelationshipIndex).add(relationship, propertyName, "shortString");
                transaction.Success();
            }

            System.ArgumentException argumentException = assertThrows(typeof(System.ArgumentException), () =>
            {
                using (Transaction transaction = _database.beginTx())
                {
                    Node source               = _database.createNode(label);
                    Node destination          = _database.createNode(label);
                    Relationship relationship = source.createRelationshipTo(destination, indexType);
                    string longValue          = StringUtils.repeat("a", IndexWriter.MAX_TERM_LENGTH + 1);
                    _database.index().forRelationships(explicitIndexedRelationshipIndex).add(relationship, propertyName, longValue);
                    transaction.Success();
                }
            });
            assertEquals("Property value size is too large for index. Please see index documentation for limitations.", argumentException.Message);
        }
Exemple #3
0
        public static LocksFactory CreateLockFactory(Config config, LogService logging)
        {
            string key = config.Get(GraphDatabaseSettings.LockManager);

            foreach (DynamicLocksFactory candidate in Service.load(typeof(DynamicLocksFactory)))
            {
                string candidateId = candidate.Keys.GetEnumerator().next();
                if (key.Equals(candidateId))
                {
                    return(candidate);
                }
                else if ("".Equals(key))
                {
                    logging.GetInternalLog(typeof(CommunityEditionModule)).info("No locking implementation specified, defaulting to '" + candidateId + "'");
                    return(candidate);
                }
            }

            if ("community".Equals(key))
            {
                return(new CommunityLocksFactory());
            }
            else if (StringUtils.isEmpty(key))
            {
                logging.GetInternalLog(typeof(CommunityEditionModule)).info("No locking implementation specified, defaulting to 'community'");
                return(new CommunityLocksFactory());
            }

            throw new System.ArgumentException("No lock manager found with the name '" + key + "'.");
        }
Exemple #4
0
        private static HttpField CreateHstsResponseField(Config config)
        {
            string configuredValue = config.Get(http_strict_transport_security);

            if (StringUtils.isBlank(configuredValue))
            {
                return(null);
            }
            return(new PreEncodedHttpField(STRICT_TRANSPORT_SECURITY, configuredValue));
        }
Exemple #5
0
 /// <summary>
 /// Creates a new field and initializes its components with content from the parameter tag.
 /// The value is parsed with <seealso cref="#parse(String)"/> </summary>
 /// <exception cref="IllegalArgumentException"> if the parameter tag is null or its tagname does not match the field name
 /// @since 7.8 </exception>
 //JAVA TO C# CONVERTER WARNING: 'final' parameters are not allowed in .NET:
 //ORIGINAL LINE: public Field27(final com.prowidesoftware.swift.model.Tag tag)
 public Field27(Tag tag)
     : this()
 {
     if (tag == null)
     {
         throw new System.ArgumentException("tag cannot be null.");
     }
     if (!StringUtils.Equals(tag.Name, "27"))
     {
         throw new System.ArgumentException("cannot create field 27 from tag " + tag.Name + ", tagname must match the name of the field.");
     }
     parse(tag.Value);
 }
Exemple #6
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void validateIndexedNodePropertiesInLucene()
        internal virtual void ValidateIndexedNodePropertiesInLucene()
        {
            setUp(default_schema_provider.name(), GraphDatabaseSettings.SchemaIndex.NATIVE10.providerName());
            Label  label        = Label.label("indexedNodePropertiesTestLabel");
            string propertyName = "indexedNodePropertyName";

            CreateIndex(label, propertyName);

            using (Transaction ignored = _database.beginTx())
            {
                _database.schema().awaitIndexesOnline(5, TimeUnit.MINUTES);
            }

            System.ArgumentException argumentException = assertThrows(typeof(System.ArgumentException), () =>
            {
                using (Transaction transaction = _database.beginTx())
                {
                    Node node = _database.createNode(label);
                    node.setProperty(propertyName, StringUtils.repeat("a", IndexWriter.MAX_TERM_LENGTH + 1));
                    transaction.success();
                }
            });
            assertThat(argumentException.Message, equalTo("Property value size is too large for index. Please see index documentation for limitations."));
        }
Exemple #7
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void validateIndexedNodePropertiesInNativeBtree()
        internal virtual void ValidateIndexedNodePropertiesInNativeBtree()
        {
            setUp();
            Label  label        = Label.label("indexedNodePropertiesTestLabel");
            string propertyName = "indexedNodePropertyName";

            CreateIndex(label, propertyName);

            using (Transaction ignored = _database.beginTx())
            {
                _database.schema().awaitIndexesOnline(5, TimeUnit.MINUTES);
            }

            System.ArgumentException argumentException = assertThrows(typeof(System.ArgumentException), () =>
            {
                using (Transaction transaction = _database.beginTx())
                {
                    Node node = _database.createNode(label);
                    node.setProperty(propertyName, StringUtils.repeat("a", keyValueSizeCapFromPageSize(PAGE_SIZE) + 1));
                    transaction.success();
                }
            });
            assertThat(argumentException.Message, containsString("is too large to index into this particular index. Please see index documentation for limitations."));
        }
Exemple #8
0
        protected override void setDefaults()
        {
            base.setDefaults();

            this.setDefault("application.name", Application.ProductName);
            this.setDefault("application.datafolder.name", Application.ProductName);
            this.setDefault("oauth.handler.scheme",
                            String.Format("x-{0}-action", StringUtils.deleteWhitespace(Application.ProductName.ToLower())));

            this.setDefault("application.version", ApplicationVersion);
            this.setDefault("application.revision", ApplicationRevision);
            this.setDefault("application.language.custom", false.ToString());
            this.setDefault("application.localization.enable", true.ToString());

            this.setDefault("update.feed.release", "https://version.cyberduck.io/windows/changelog.rss");
            this.setDefault("update.feed.beta", "https://version.cyberduck.io/windows/beta/changelog.rss");
            this.setDefault("update.feed.nightly", "https://version.cyberduck.io/windows/nightly/changelog.rss");

            // Importers
            this.setDefault("bookmark.import.winscp.location",
                            Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "WinSCP.ini"));
            this.setDefault("bookmark.import.filezilla.location",
                            Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "FileZilla",
                                         "sitemanager.xml"));
            this.setDefault("bookmark.import.smartftp.location",
                            Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "SmartFTP",
                                         "Client 2.0", "Favorites"));
            this.setDefault("bookmark.import.totalcommander.location",
                            Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "GHISLER",
                                         "wcx_ftp.ini"));
            this.setDefault("bookmark.import.flashfxp3.location",
                            Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "FlashFXP", "3",
                                         "Sites.dat"));
            this.setDefault("bookmark.import.flashfxp4.location",
                            Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "FlashFXP", "4",
                                         "Sites.dat"));
            this.setDefault("bookmark.import.flashfxp4.common.location",
                            Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "FlashFXP",
                                         "4",
                                         "Sites.dat"));
            this.setDefault("bookmark.import.wsftp.location",
                            Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Ipswitch", "WS_FTP",
                                         "Sites"));
            this.setDefault("bookmark.import.fireftp.location",
                            Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Mozilla", "Firefox",
                                         "Profiles"));
            this.setDefault("bookmark.import.s3browser.location",
                            Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "S3Browser",
                                         "settings.ini"));
            this.setDefault("bookmark.import.crossftp.location", Path.Combine(HomeFolder, ".crossftp", "sites.xml"));
            this.setDefault("bookmark.import.cloudberry.s3.location",
                            Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData),
                                         "CloudBerry S3 Explorer for Amazon S3", "settings.list"));
            this.setDefault("bookmark.import.cloudberry.google.location",
                            Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData),
                                         "CloudBerry Explorer for Google Storage", "settings.list"));
            this.setDefault("bookmark.import.cloudberry.azure.location",
                            Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData),
                                         "CloudBerry Explorer for Azure Blob Storage", "settings.list"));
            this.setDefault("bookmark.import.expandrive3.location",
                            Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData),
                                         "ExpanDrive", "favorites.js"));
            this.setDefault("bookmark.import.expandrive4.location",
                            Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData),
                                         "ExpanDrive", "expandrive4.favorites.js"));
            this.setDefault("bookmark.import.expandrive5.location",
                            Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData),
                                         "ExpanDrive", "expandrive5.favorites.js"));
            this.setDefault("bookmark.import.expandrive6.location",
                            Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData),
                                         "ExpanDrive", "expandrive6.favorites.js"));
            this.setDefault("bookmark.import.netdrive2.location",
                            Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
                                         "NetDrive2", "drives.dat"));

            //disable reminder for protocol handler registration
            this.setDefault("defaulthandler.reminder", false.ToString());

            this.setDefault("update.check.last", "0");
            this.setDefault("update.check.privilege", true.ToString());

            this.setDefault("queue.download.folder", DefaultDownloadPath);
            this.setDefault("queue.upload.permissions.default", true.ToString());

            this.setDefault("queue.dock.badge", true.ToString());

            this.setDefault("ssh.knownhosts",
                            Path.Combine(new RoamingSupportDirectoryFinder().find().getAbsolute(), "known_hosts"));
            this.setDefault("browser.enterkey.rename", false.ToString());
            this.setDefault("terminal.openssh.enable", true.ToString());
            this.setDefault("terminal.windowssubsystemlinux.enable", true.ToString());
            this.setDefault("terminal.command.ssh", Path.Combine(HomeFolder, "putty.exe"));
            this.setDefault("terminal.command.ssh.args", "-ssh {0} {1}@{2} -t -P {3} -m \"{4}\"");
            this.setDefault("terminal.command.openssh.args", "{1} {0}@{2} -t -p {3} \"cd '{4}'; $SHELL\"");

            this.setDefault("notifications.timeout.milliseconds", "300");

            //default browser toolbar set
            this.setDefault("browser.toolbar", true.ToString());
            this.setDefault("browser.toolbar.openconnection", true.ToString());
            this.setDefault("browser.toolbar.quickconnect", true.ToString());
            this.setDefault("browser.toolbar.action", true.ToString());
            this.setDefault("browser.toolbar.info", true.ToString());
            this.setDefault("browser.toolbar.refresh", true.ToString());
            this.setDefault("browser.toolbar.edit", true.ToString());
            this.setDefault("browser.toolbar.openinbrowser", false.ToString());
            this.setDefault("browser.toolbar.openinterminal", false.ToString());
            this.setDefault("browser.toolbar.newfolder", false.ToString());
            this.setDefault("browser.toolbar.delete", false.ToString());
            this.setDefault("browser.toolbar.download", false.ToString());
            this.setDefault("browser.toolbar.upload", true.ToString());
            this.setDefault("browser.toolbar.transfers", true.ToString());

            //default transfer toolbar set
            this.setDefault("transfer.toolbar.resume", true.ToString());
            this.setDefault("transfer.toolbar.reload", true.ToString());
            this.setDefault("transfer.toolbar.stop", true.ToString());
            this.setDefault("transfer.toolbar.remove", true.ToString());
            this.setDefault("transfer.toolbar.cleanup", false.ToString());
            this.setDefault("transfer.toolbar.log", false.ToString());
            this.setDefault("transfer.toolbar.open", true.ToString());
            this.setDefault("transfer.toolbar.show", true.ToString());

            // Resolve symbolic links downloading target file instead. Cannot create symbolic links on FAT.
            this.setDefault("path.symboliclink.resolve", true.ToString());
            // Resolve local links uploading target file instead. Currently not supporting shortcuts on Windows.
            this.setDefault("local.symboliclink.resolve", true.ToString());

            this.setDefault("local.user.home", HomeFolder);
            this.setDefault("local.delimiter", "\\");
            this.setDefault("local.normalize.tilde", false.ToString());

            // SSL Keystore
            // Add mscapi security provider
            Security.addProvider(new SunMSCAPI());
            this.setDefault("connection.ssl.keystore.type", "Windows-MY");
            this.setDefault("connection.ssl.keystore.provider", "SunMSCAPI");

            // Override secure random strong algorithm. Outputs bytes from the Windows CryptGenRandom() API
            this.setDefault("connection.ssl.securerandom.algorithm", "Windows-PRNG");
            this.setDefault("connection.ssl.securerandom.provider", "SunMSCAPI");
            // Set secure random algorithms for BC
            Security.setProperty("securerandom.strongAlgorithms", "Windows-PRNG:SunMSCAPI,SHA1PRNG:SUN");

            // Enable Integrated Windows Authentication
            this.setDefault("connection.proxy.windows.authentication.enable", true.ToString());

            this.setDefault("webdav.ntlm.environment", true.ToString());
            if (getBoolean("webdav.ntlm.environment"))
            {
                // NTLM Windows Domain
                try
                {
                    // Gets the network domain name associated with the current user
                    this.setDefault("webdav.ntlm.domain", Environment.UserDomainName);
                }
                catch (PlatformNotSupportedException e)
                {
                    // The operating system does not support retrieving the network domain name.
                }
                catch (InvalidOperationException e)
                {
                    // The network domain name cannot be retrieved.
                }
                try
                {
                    this.setDefault("webdav.ntlm.workstation", Environment.MachineName);
                }
                catch (InvalidOperationException e)
                {
                    // The name of this computer cannot be obtained.
                }
            }
            if (Utils.IsRunningAsUWP)
            {
                SetUWPDefaults();
            }
        }
Exemple #9
0
 private static ReplicatedString ReplicatedStringOfBytes(int size)
 {
     return(new ReplicatedString(StringUtils.repeat("i", size)));
 }
Exemple #10
0
 private static string Whitespace(int numberOfWhitespaces)
 {
     return(StringUtils.repeat(" ", numberOfWhitespaces));
 }
Exemple #11
0
 public static bool IsBranchedDataDirectory(File file)
 {
     return(file.Directory && file.ParentFile.Name.Equals(BRANCH_SUBDIRECTORY) && StringUtils.isNumeric(file.Name));
 }