예제 #1
0
 def testGetHourFromTimeStamp(self):
     """ @TODO: move this into a seperate unit Test for the getTimestamp Class but for now it is perfect here
     """
     timestamp = 4000
     binId = getTimestamp.gettimeStampIn_Hours(timestamp)
     self.assertEqual(binId, 1, "the conversion from timestamp to hour is wrong")
예제 #2
0
        print "not able to create a database connection"
    
    cursor.execute("USE " + config_global.cassandra_default_keyspace)
    
    #config_global.dbname_dimensionList_rowKeys[0]
    #dL = DimensionListModel(config_global.dbname_dimensionList_rowKeys[0])
    dL = DimensionListModel('user_ids')

    timestamp = int( time.time() )
    for i in xrange(70):
        id = 2
        curr_timestamp = timestamp + i 
        dL.save( id, curr_timestamp )
    
    
    binId = getTimestamp.gettimeStampIn_Hours( timestamp )
    
    print timestamp
    print dL.getByTime(timestamp-60, timestamp+50)
    
    #dL.save_bin(1, 'hours', binId)
    
    print getTimestamp.getTimeStampFromHours( binId )
    
    #print dL.getAll()
    print "binify"
    x = ( dL.binify('hours', binId-1, binId) )
    print len( x )