package org.datasyslab.geospark.formatMapper.shapefileParser.shapes;

import org.junit.After;
import org.junit.Before;

import java.io.Serializable;

import static org.junit.Assert.*;

/**
 * Created by zongsizhang on 6/13/17.
 */
public class ShapeRDDTest implements Serializable{
    @Before
    public void setUp() throws Exception {

    }

    @After
    public void tearDown() throws Exception {
    }

}
@@ -78,74 +78,631 @@
 org.
-junit.After;%0Aimport org.junit.Before;%0A%0Aimport java.io.Serializable
+apache.log4j.Level;%0Aimport org.apache.log4j.Logger;%0Aimport org.apache.spark.SparkConf;%0Aimport org.apache.spark.api.java.JavaSparkContext;%0Aimport org.geotools.data.DataStore;%0Aimport org.geotools.data.DataStoreFinder;%0Aimport org.geotools.data.FeatureSource;%0Aimport org.geotools.feature.FeatureCollection;%0Aimport org.junit.*;%0Aimport org.opengis.feature.simple.SimpleFeature;%0Aimport org.opengis.feature.simple.SimpleFeatureType;%0Aimport org.opengis.filter.Filter;%0A%0Aimport java.io.File;%0Aimport java.io.IOException;%0Aimport java.io.Serializable;%0Aimport java.net.MalformedURLException;%0Aimport java.util.HashMap;%0Aimport java.util.Map
 ;%0A%0Ai
@@ -832,16 +832,148 @@
 izable%7B%0A
+%0A    /** The sc. */%0A    public static JavaSparkContext sc;%0A%0A    /** The Input location. */%0A    public static String InputLocation;%0A%0A
     @Bef
@@ -975,16 +975,21 @@
  @Before
+Class
 %0A    pub
@@ -996,18 +996,597 @@
 lic 
-void setUp
+static void onceExecutedBeforeAll() %7B%0A        SparkConf conf = new SparkConf().setAppName(%22ShapeRDDTest%22).setMaster(%22local%5B2%5D%22).set(%22spark.executor.cores%22,%222%22);%0A        sc = new JavaSparkContext(conf);%0A        Logger.getLogger(%22org%22).setLevel(Level.WARN);%0A        Logger.getLogger(%22akka%22).setLevel(Level.WARN);%0A        //Hard code to a file in resource folder. But you can replace it later in the try-catch field in your hdfs system.%0A        InputLocation = ShapeRDDTest.class.getClassLoader().getResource(%22shapefiles/polygon%22).getPath();%0A    %7D%0A%0A    @Test%0A    public void testLoadShapeFile
 () t
@@ -1583,32 +1583,34 @@
 peFile() throws 
+IO
 Exception %7B%0A%0A   
@@ -1605,16 +1605,791 @@
 ption %7B%0A
+        // load shape with geotool.shapefile%0A        File file = new File(InputLocation);%0A        Map%3CString, Object%3E map = new HashMap%3CString, Object%3E();%0A        map.put(%22url%22, file.toURI().toURL());%0A        DataStore dataStore = DataStoreFinder.getDataStore(map);%0A        String typeName = dataStore.getTypeNames()%5B0%5D;%0A        FeatureSource%3CSimpleFeatureType, SimpleFeature%3E source = dataStore%0A                .getFeatureSource(typeName);%0A        Filter filter = Filter.INCLUDE;%0A        FeatureCollection%3CSimpleFeatureType, SimpleFeature%3E collection = source.getFeatures(filter);%0A        // load shapes with our tool%0A        ShapeRDD shapeRDD = new ShapeRDD(InputLocation,sc);%0A        Assert.assertEquals(shapeRDD.getShapeWritableRDD().collect().size(), collection.size());
 %0A    %7D%0A%0A

add ShapeRDDTest, add test function verify count of shapes loaded