Skip to content

Commit

Permalink
Restore helper method, fix new tests, switch helper method in Iterabl…
Browse files Browse the repository at this point in the history
…es to use Iterable
  • Loading branch information
MishaDemianenko committed Jan 21, 2016
1 parent 5e70224 commit 8974070
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 3 deletions.
Expand Up @@ -414,7 +414,7 @@ public static <T> Iterator<T> concat( Iterator<? extends T>... iterables )
return concat( Arrays.asList( (Iterator<T>[]) iterables ).iterator() ); return concat( Arrays.asList( (Iterator<T>[]) iterables ).iterator() );
} }


public static <T> ResourceIterator<T> concatResourceIterators( List<ResourceIterator<T>> iteratorList ) public static <T> ResourceIterator<T> concatResourceIterators( Iterable<ResourceIterator<T>> iteratorList )
{ {
return concatResourceIterators( iteratorList.iterator() ); return concatResourceIterators( iteratorList.iterator() );
} }
Expand Down
19 changes: 19 additions & 0 deletions community/kernel/src/main/java/org/neo4j/helpers/Exceptions.java
Expand Up @@ -290,4 +290,23 @@ public static Predicate<StackTraceElement> forMethod( final String name )
{ {
return item -> item.getMethodName().equals( name ); return item -> item.getMethodName().equals( name );
} }

public static String briefOneLineStackTraceInformation( Predicate<StackTraceElement> toInclude )
{
StringBuilder builder = new StringBuilder();
for ( StackTraceElement element : Thread.currentThread().getStackTrace() )
{
if ( toInclude.test( element ) )
{
builder.append( builder.length() > 0 ? "," : "" )
.append( simpleClassName( element.getClassName() ) + "#" + element.getMethodName() );
}
}
return builder.toString();
}

private static String simpleClassName( String className )
{
return className.substring( className.lastIndexOf( '.' ) );
}
} }
Expand Up @@ -50,7 +50,7 @@ public class LuceneLabelScanStoreIT extends LabelScanStoreIT
public void scanStoreStartWithoutExistentIndex() throws IOException public void scanStoreStartWithoutExistentIndex() throws IOException
{ {
NeoStoreDataSource dataSource = getDataSource(); NeoStoreDataSource dataSource = getDataSource();
LabelScanStore labelScanStore = dataSource.getLabelScanStore(); LabelScanStore labelScanStore = getLabelScanStore();
labelScanStore.shutdown(); labelScanStore.shutdown();


File labelScanStoreDirectory = getLabelScanStoreDirectory( dataSource ); File labelScanStoreDirectory = getLabelScanStoreDirectory( dataSource );
Expand All @@ -66,7 +66,7 @@ public void scanStoreStartWithoutExistentIndex() throws IOException
public void scanStoreRecreateCorruptedIndexOnStartup() throws IOException public void scanStoreRecreateCorruptedIndexOnStartup() throws IOException
{ {
NeoStoreDataSource dataSource = getDataSource(); NeoStoreDataSource dataSource = getDataSource();
LabelScanStore labelScanStore = dataSource.getLabelScanStore(); LabelScanStore labelScanStore = getLabelScanStore();


Node node = createTestNode(); Node node = createTestNode();
List<Long> labels = readNodeLabels( labelScanStore, node ); List<Long> labels = readNodeLabels( labelScanStore, node );
Expand Down Expand Up @@ -128,6 +128,12 @@ private NeoStoreDataSource getDataSource()
return dataSourceManager.getDataSource(); return dataSourceManager.getDataSource();
} }


private LabelScanStore getLabelScanStore()
{
DependencyResolver dependencyResolver = dbRule.getDependencyResolver();
return dependencyResolver.resolveDependency( LabelScanStore.class );
}

private void checkLabelScanStoreAccessible( LabelScanStore labelScanStore ) throws IOException private void checkLabelScanStoreAccessible( LabelScanStore labelScanStore ) throws IOException
{ {
try ( LabelScanWriter labelScanWriter = labelScanStore.newWriter() ) try ( LabelScanWriter labelScanWriter = labelScanStore.newWriter() )
Expand Down

0 comments on commit 8974070

Please sign in to comment.