/** * Parses an option name into the Enumeration type it represents. * * @param name The lowercase name to parse. * @return The <code>AutoIndexMode</code> this name represents. */ public static AutoIndexMode fromString(String name) { if (name != null) { for (AutoIndexMode mode : AutoIndexMode.values()) { if (name.equalsIgnoreCase(mode.name)) { return mode; } } } return null; }
this.connectionLivenessCheckTimeout = builder.connectionLivenessCheckTimeout; this.verifyConnection = builder.verifyConnection != null ? builder.verifyConnection : false; this.autoIndex = builder.autoIndex != null ? AutoIndexMode.fromString(builder.autoIndex) : AutoIndexMode.NONE; this.generatedIndexesOutputDir = builder.generatedIndexesOutputDir != null ? builder.generatedIndexesOutputDir : ".";
@Test public void indexesShouldBeCreatedForLoadableClassesInHierarchy() { final IndexDescription[] expectedIndexes = new IndexDescription[] { new IndexDescription("DefaultUser", "id"), new IndexDescription("Admin", "id"), new IndexDescription("ChildA", "uuid"), new IndexDescription("ChildB", "uuid"), new IndexDescription("ChildC", "uuid"), new IndexDescription("LabeledEntity", "uuid"), new IndexDescription("EntityWithImplicitPlusAdditionalLabels", "id") }; sessionFactory.runAutoIndexManager(getBaseConfiguration().autoIndex(AutoIndexMode.UPDATE.name()).build()); GraphDatabaseService service = getGraphDatabaseService(); try (Transaction tx = service.beginTx()) { IndexDescription[] indexes = StreamSupport.stream(service.schema().getIndexes().spliterator(), false) .map(IndexDescription::new).toArray(IndexDescription[]::new); assertThat(indexes).containsExactlyInAnyOrder(expectedIndexes); tx.success(); } }