Example #1
0
class TestYearsCounter(unittest.TestCase):


	def setUp(self):
	   conf = SparkConf().setAppName("appTest").setMaster("local[*]")
	   self.sc = SparkContext(conf=conf)
	   self.counter = YearsCounter() 

	def tearDown(self):
	   self.sc.stop()

	def test_when_exist_three_movies_in_rdd(self):
		movieList = ["1993::Toy Story (1995)::Animation|Children's|Comedy",
		             "1993::Toy Story (1996)::Animation|Children's|Comedy",
		             "1993::Toy Story (1996)::Animation|Children's|Comedy"]
		movies = self.sc.parallelize(movieList)
		self.assertEqual(self.counter.getMaxValues(movies),('(1996)'))
Example #2
0
	def setUp(self):
	   conf = SparkConf().setAppName("appTest").setMaster("local[*]")
	   self.sc = SparkContext(conf=conf)
	   self.counter = YearsCounter() 
Example #3
0
 def read(self, filePlace, type):
     movies = self._sc.textFile(filePlace)
     counter = WordCounter()
     if type is 'Years':
         counter = YearsCounter()
     return counter.getMaxValues(movies)