Skip to content

Commit

Permalink
Add more license files and update test to ignore directory traversal …
Browse files Browse the repository at this point in the history
…order
  • Loading branch information
MishaDemianenko committed Dec 5, 2015
1 parent 3299958 commit 94a2299
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
Expand Up @@ -19,9 +19,7 @@
*/
package org.neo4j.upgrade.lucene;

import org.hamcrest.BaseMatcher;
import org.hamcrest.Description;
import org.hamcrest.Matcher;
import org.hamcrest.Matchers;
import org.hamcrest.TypeSafeDiagnosingMatcher;
import org.junit.Rule;
Expand All @@ -31,6 +29,7 @@
import java.net.URISyntaxException;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
import java.util.function.Supplier;
Expand Down Expand Up @@ -82,7 +81,7 @@ public void pointIncorrectIndexOnMigrationFailure() throws URISyntaxException, L
TrackingLuceneLegacyIndexUpgrader indexUpgrader = new TrackingLuceneLegacyIndexUpgrader( indexFolder, true );

expectedException.expect( LegacyIndexMigrationException.class );
expectedException.expect( new LegacyIndexMigrationExceptionBaseMatcher("index1") );
expectedException.expect( new LegacyIndexMigrationExceptionBaseMatcher("index1", "index2") );

indexUpgrader.upgradeIndexes();
}
Expand All @@ -95,24 +94,25 @@ private Path createPathForResource(String resourceName) throws URISyntaxExceptio
private class LegacyIndexMigrationExceptionBaseMatcher extends TypeSafeDiagnosingMatcher<LegacyIndexMigrationException>
{

private String failedIndexName;
private String[] failedIndexNames;

public LegacyIndexMigrationExceptionBaseMatcher(String failedIndexName)
public LegacyIndexMigrationExceptionBaseMatcher(String... failedIndexNames)
{
this.failedIndexName = failedIndexName;
this.failedIndexNames = failedIndexNames;
}

@Override
public void describeTo( Description description )
{
description.appendText( failedIndexName ).appendText( " should fail during migration. " );
description.appendText( "Failed index should be one of:" )
.appendText( Arrays.toString( failedIndexNames ) );
}

@Override
protected boolean matchesSafely( LegacyIndexMigrationException item, Description mismatchDescription )
{
String brokendIndexName = item.getFailedIndexName();
boolean matched = this.failedIndexName.equals( brokendIndexName );
boolean matched = Arrays.asList(failedIndexNames).contains( brokendIndexName );
if (!matched)
{
mismatchDescription.appendText( "Failed index is: " ).appendText( brokendIndexName );
Expand Down
1 change: 1 addition & 0 deletions tools/LICENSES.txt
Expand Up @@ -9,6 +9,7 @@ Apache Software License, Version 2.0
Guava: Google Core Libraries for Java
javax.inject
Lucene Core
Lucene Memory
Netty/All-in-One
opencsv
parboiled-core
Expand Down
1 change: 1 addition & 0 deletions tools/NOTICE.txt
Expand Up @@ -31,6 +31,7 @@ Apache Software License, Version 2.0
Guava: Google Core Libraries for Java
javax.inject
Lucene Core
Lucene Memory
Netty/All-in-One
opencsv
parboiled-core
Expand Down

0 comments on commit 94a2299

Please sign in to comment.