Skip to content

Commit

Permalink
FALCON-2193 Fix ExtensionStoreTest
Browse files Browse the repository at this point in the history
Fixes UTs failing after FALCON-2188

Author: Pallavi Rao <pallavi.rao@inmobi.com>

Reviewers: @sandeepSamudrala

Closes apache#305 from pallavi-rao/2193
  • Loading branch information
Pallavi Rao committed Nov 22, 2016
1 parent fd384a7 commit 1b7708f
Showing 1 changed file with 19 additions and 14 deletions.
Expand Up @@ -19,7 +19,16 @@
package org.apache.falcon.extensions.store;

import com.google.common.collect.ImmutableMap;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.net.URISyntaxException;
import java.util.Map;
import javax.persistence.EntityManager;
import javax.persistence.Query;
import org.apache.falcon.FalconException;
import org.apache.falcon.entity.parser.ValidationException;
import org.apache.falcon.entity.store.StoreAccessException;
import org.apache.falcon.extensions.jdbc.ExtensionMetaStore;
import org.apache.falcon.extensions.mirroring.hdfs.HdfsMirroringExtension;
Expand All @@ -33,16 +42,6 @@
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;

import javax.persistence.EntityManager;
import javax.persistence.Query;
import java.io.OutputStreamWriter;
import java.io.BufferedWriter;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.OutputStream;
import java.net.URISyntaxException;
import java.util.Map;

/**
* Tests for extension store.
*/
Expand Down Expand Up @@ -95,11 +94,17 @@ private static void initFileSystem() throws IOException {

@BeforeMethod
public void clean() {
clear();
clearDB();
// Clean up FS
try {
fs.delete(new Path(extensionStorePath + "/hdfs-mirroring"), true);
} catch (IOException e) {
// Ignore
}
}


@Test(enabled = false)
@Test
public void testRegisterExtensionMetadata() throws IOException, URISyntaxException, FalconException{
createlibs();
createReadmeAndJar();
Expand All @@ -110,7 +115,7 @@ public void testRegisterExtensionMetadata() throws IOException, URISyntaxExcepti
Assert.assertEquals(metaStore.getAllExtensions().size(), 1);
}

@Test(expectedExceptions=FileNotFoundException.class)
@Test(expectedExceptions=ValidationException.class)
public void testFailureCaseRegisterExtensionMetadata() throws IOException, URISyntaxException, FalconException{
store = ExtensionStore.get();
createlibs();
Expand Down Expand Up @@ -160,7 +165,7 @@ private void createReadmeAndJar() throws IOException{
br.close();
}

private void clear() {
private void clearDB() {
EntityManager em = FalconJPAService.get().getEntityManager();
em.getTransaction().begin();
try {
Expand Down

0 comments on commit 1b7708f

Please sign in to comment.