예제 #1
0
    def StartDataOperations(self):
        '''
        Calls datastore methods.
        '''
        uploadFile = 'dataStoreTest.txt'
        localFile = 'dataStoreTest2.txt'

        #
        # GetUploadDescriptor
        #
        self.uploadUrl = self.dataStore.GetUploadDescriptor()
        print self.name, 'GetUploadDescriptor', self.uploadUrl, '\n'

        #
        # GetDataDescriptions
        #
        dList = self.dataStore.GetDataDescriptions()
        print self.name, 'GetDataDescriptions', dList, '\n'

        #
        # GSIHTTPUploadFiles
        #
        print self.name, 'GSIHTTPUploadFiles ', uploadFile, '\n'

        try:
            DataStore.GSIHTTPUploadFiles(self.uploadUrl, [uploadFile], None)
        except DataStore.UploadFailed, e:
            log.exception(self.name + " Upload failed")
예제 #2
0
    def __init__(self, url):
        VenueClient.__init__(self)
        print '--------------- SET PROFILE'
        profile = ClientProfile('userProfile')
        self.SetProfile(profile)
        self.profile.Dump()

        print '\n--------------- CREATE PROXY'
        try:
            venueUri = Client.Handle(url).get_proxy().GetDefaultVenue()
            print 'get url for default venue from server ', url

        except:
            venueUri = url

        print 'venue url: ', url
        print 'get proxy for venue', venueUri
        self.client = Client.Handle(venueUri).get_proxy()

        print '\n--------------- ENTER VENUE'
        self.EnterVenue(venueUri)

        print '\n--------------- ADD DATA'
        self.upload_url = self.client.GetUploadDescriptor()
        file_list = ['test_Apps.py']
        DataStore.GSIHTTPUploadFiles(self.upload_url, file_list, None)

        print '\n--------------- REMOVE DATA'
        data = DataDescription3('test_Apps.py')
        self.client.RemoveData(data)

        #         print '\n--------------- ADD SERVICE'
        #         service = ServiceDescription('serviceName', 'serviceDescription', 'serviceUri',\
        #                                      'serviceIcon', 'serviceStoragetype')
        #         self.client.AddService(service)

        #         print '\n--------------- REMOVE DATA'
        #        self.client.RemoveData(data)

        #         print '\n--------------- REMOVE SERVICE'
        #         self.client.RemoveService(service)

        nodeUrl = 'http://nodeserviceurl'
        print '\n--------------- SET NODE SERVICE URL', nodeUrl
        self.SetNodeServiceUri(nodeUrl)
        print '--------------- NODE SERVICE URL: ', self.nodeServiceUri

        print '\n--------------- CHANGE PROFILE'
        profile2 = ClientProfile('nodeProfile')
        self.SetProfile(profile2)
        self.profile.Dump()

        print '\n--------------- EXIT VENUE'
        self.ExitVenue()
hdlr = Log.StreamHandler()
hdlr.setLevel(Log.DEBUG)
Log.HandleLoggers(Log.StreamHandler(), Log.GetDefaultLoggers())

sys.path.append(r"c:\home\olson\ag\dev\AccessGrid")

from AccessGrid import DataStore

defaultURL = "https://localhost:9011/test"

if len(sys.argv) > 1:
    url = sys.argv[1]
else:
    url = defaultURL

files = [
    r"c:\temp\tarfile-0.6.5.zip",
    r"c:\boot.ini",
    r"c:\Program Files\Inno Setup 3\whatsnew.htm",
    #         r"file name with spaces.txt",
    #         r"c:\home\olson\ag\dev\AccessGrid\AccessGrid\put.py",
    #          r"c:\temp\put.py",
    r"c:\home\olson\docs\AG\ag-2-design\datastore-simplified.doc"
]

if re.search("^https:", url):
    x = DataStore.GSIHTTPUploadFiles(url, files, None)
elif re.search("^http:", url):
    x = DataStore.HTTPUploadFiles("ME", url, files, None)