@SafeVarargs public static Iterable<DataFactory> datas( DataFactory... factories ) { return Iterables.iterable( factories ); }
public static <T> Function<String, T> optionsObeyCase( T... optionValues ) { return options( Iterables.iterable( optionValues ), false ); }
public static <T> Function<String, T> optionsIgnoreCase( T... optionValues ) { return options( Iterables.iterable( optionValues ), true ); }
private Iterable<DataFactory> dataIterable( DataFactory... data ) { return Iterables.iterable( data ); }
@Override public void moveMigratedFiles( DatabaseLayout migrationLayout, DatabaseLayout directoryLayout, String versionToUpgradeFrom, String versionToUpgradeTo ) throws IOException { // Move the migrated ones into the store directory fileOperation( MOVE, fileSystem, migrationLayout, directoryLayout, Iterables.iterable( DatabaseFile.values() ), true, // allow to skip non existent source files ExistingTargetStrategy.OVERWRITE ); }
@Test public void shouldConsultUnsatisfiedDependencyHandlerOnFailingDependencyClasses() { // GIVEN KernelContext context = mock( KernelContext.class ); KernelExtensionFailureStrategy handler = mock( KernelExtensionFailureStrategy.class ); Dependencies dependencies = new Dependencies(); // that hasn't got anything. UninitializableKernelExtensionFactory extensionFactory = new UninitializableKernelExtensionFactory(); GlobalKernelExtensions extensions = new GlobalKernelExtensions( context, iterable( extensionFactory ), dependencies, handler ); // WHEN LifeSupport life = new LifeSupport(); life.add( extensions ); try { life.start(); // THEN verify( handler ).handle( eq( extensionFactory ), any( IllegalArgumentException.class ) ); } finally { life.shutdown(); } }
@Test public void shouldConsultUnsatisfiedDependencyHandlerOnMissingDependencies() { // GIVEN KernelContext context = mock( KernelContext.class ); KernelExtensionFailureStrategy handler = mock( KernelExtensionFailureStrategy.class ); Dependencies dependencies = new Dependencies(); // that hasn't got anything. TestingExtensionFactory extensionFactory = new TestingExtensionFactory(); GlobalKernelExtensions extensions = new GlobalKernelExtensions( context, iterable( extensionFactory ), dependencies, handler ); // WHEN LifeSupport life = new LifeSupport(); life.add( extensions ); try { life.start(); // THEN verify( handler ).handle( eq( extensionFactory ), any( UnsatisfiedDependencyException.class ) ); } finally { life.shutdown(); } }
@Test void shouldCountAllIndexFiles() throws Exception { // Explicit index file File explicitIndex = testDirectory.databaseLayout().file( "explicitIndex" ); createFileOfSize( explicitIndex, 1 ); IndexImplementation indexImplementation = mock( IndexImplementation.class ); when( indexImplementation.getIndexImplementationDirectory( any() ) ).thenReturn( explicitIndex ); when( explicitIndexProviderLookup.allIndexProviders() ).thenReturn( iterable( indexImplementation ) ); // Schema index files File schemaIndex = testDirectory.databaseLayout().file( "schemaIndex" ); createFileOfSize( schemaIndex, 2 ); IndexDirectoryStructure directoryStructure = mock( IndexDirectoryStructure.class ); when( directoryStructure.rootDirectory() ).thenReturn( schemaIndex ); when( indexProvider.directoryStructure() ).thenReturn( directoryStructure ); File schemaIndex2 = testDirectory.databaseLayout().file( "schemaIndex2" ); createFileOfSize( schemaIndex2, 3 ); IndexDirectoryStructure directoryStructure2 = mock( IndexDirectoryStructure.class ); when( directoryStructure2.rootDirectory() ).thenReturn( schemaIndex2 ); when( indexProvider2.directoryStructure() ).thenReturn( directoryStructure2 ); // Label scan store File labelScan = testDirectory.databaseLayout().labelScanStore(); createFileOfSize( labelScan, 4 ); when( labelScanStore.getLabelScanStoreFile() ).thenReturn( labelScan ); // Count all files assertEquals( 10, storeSizeBean.getIndexStoreSize() ); }
private EntityUpdates convert( long[] labelsBefore, long[] labelsAfter, PropertyRecordChange... changes ) { EntityUpdates.Builder updates = EntityUpdates.forEntity( (long) 0 ).withTokens( labelsBefore ).withTokensAfter( labelsAfter ); converter.convertPropertyRecord( 0, Iterables.iterable( changes ), updates ); return updates.build(); }
final File migrationDirNeoStore = migrationStructure.metadataStore(); fileOperation( COPY, fileSystem, sourceDirectoryStructure, migrationStructure, Iterables.iterable( DatabaseFile.METADATA_STORE ), true, ExistingTargetStrategy.SKIP );
equalTo( Iterables.iterable( label( labelName ) ) ) );
@Parameters(name = "{index}: {0} -> {1}") public static Iterable<Object[]> data() { return Arrays.asList(new Object[][] { {null, iterable(Pair.of(null, BOTH))}, {"", iterable(Pair.of(null, BOTH))}, {">", iterable(Pair.of(null, OUTGOING))}, {"<", iterable(Pair.of(null, INCOMING))}, {"SIMPLE", iterable(Pair.of(withName("SIMPLE"), BOTH))}, {"SIMPLE>", iterable(Pair.of(withName("SIMPLE"), OUTGOING))}, {"SIMPLE<", iterable(Pair.of(withName("SIMPLE"), INCOMING))}, {"<SIMPLE", iterable(Pair.of(withName("SIMPLE"), INCOMING))}, {">SIMPLE", iterable(Pair.of(withName("SIMPLE"), OUTGOING))}, {"SIMPLE", iterable(Pair.of(withName("SIMPLE"), BOTH))}, {"TYPE1|TYPE2", iterable( Pair.of(withName("TYPE1"), BOTH), Pair.of(withName("TYPE2"), BOTH)) }, {"TYPE1>|TYPE2<", iterable( Pair.of(withName("TYPE1"), OUTGOING), Pair.of(withName("TYPE2"), INCOMING)) }, }); }
@SafeVarargs public static Iterable<DataFactory> datas( DataFactory... factories ) { return Iterables.iterable( factories ); }
public static <T> Function<String, T> optionsIgnoreCase( T... optionValues ) { return options( Iterables.iterable( optionValues ), true ); }
public static <T> Function<String, T> optionsObeyCase( T... optionValues ) { return options( Iterables.iterable( optionValues ), false ); }
@Override public void moveMigratedFiles( DatabaseLayout migrationLayout, DatabaseLayout directoryLayout, String versionToUpgradeFrom, String versionToUpgradeTo ) throws IOException { // Move the migrated ones into the store directory fileOperation( MOVE, fileSystem, migrationLayout, directoryLayout, Iterables.iterable( DatabaseFile.values() ), true, // allow to skip non existent source files ExistingTargetStrategy.OVERWRITE ); }
final File migrationDirNeoStore = migrationStructure.metadataStore(); fileOperation( COPY, fileSystem, sourceDirectoryStructure, migrationStructure, Iterables.iterable( DatabaseFile.METADATA_STORE ), true, ExistingTargetStrategy.SKIP );