Esempio n. 1
0
    def OnInit(self):

        wx.InitAllImageHandlers()
        # Create the AG application
        app = WXGUIApplication()
        name = "SharedPaint"

        # Add command line options
        app.AddCmdLineOption(self.appurlOption)
        app.AddCmdLineOption(self.venueUrlOption)
        app.AddCmdLineOption(self.idOption)

        # Initialize the AG application
        app.Initialize(name)

        # Create the group panel
        appUrl = app.GetOption("appUrl")
        venueUrl = app.GetOption("venueUrl")
        connectionId = app.GetOption('id')

        frame = FrameExtended(None, -1, 'SharedPaint', appUrl, venueUrl,
                              connectionId)
        frame.SetIcon(icons.getAGIconIcon())
        frame.MakeMenu()
        frame.LoadConsole()
        frame.Show()
        frame.Centre()
        self.frame = frame
        return True
Esempio n. 2
0
    connectionIDOption = Option(
        "-i",
        "--connectionID",
        dest="connectionID",
        type="string",
        default=None,
        help="Please provide a connection ID in the command line")

    wx.InitAllImageHandlers()
    # Create the AG application
    app = WXGUIApplication()
    name = "SharedPaint 3.0"

    # Add command line options
    app.AddCmdLineOption(appURLOption)
    app.AddCmdLineOption(connectionIDOption)

    # Initialize the AG application
    app.Initialize(name)

    appURL = app.GetOption("appURL")
    connectionID = app.GetOption("connectionID")

    spApp = SharedPaintApp(appURL, connectionID)

    # Start the window application processing
    spApp.MainLoop()

    # Exit gracefully
    os._exit(0)
Esempio n. 3
0
                       help="Specify an application url on the command line")
    venueurlOption = Option("-v", "--venueURL", dest="venueUrl", default=None,
                       help="Specify a venue url on the command line")
    testOption = Option("-t", "--testMode", dest="test", action="store_true",
                        default=None, help="Automatically create application session in venue")
    connectionIdOption = Option("-i", "--connectionId", dest="connectionId", default=None,
                                help="Add connection id")
    app.AddCmdLineOption(connectionIdOption)
    app.AddCmdLineOption(appurlOption)
    app.AddCmdLineOption(venueurlOption)
    app.AddCmdLineOption(testOption)

    name = "SharedPDF"
    app.Initialize(name)

    appUrl = app.GetOption("appUrl")
    venueUrl = app.GetOption("venueUrl")
    test = app.GetOption("test")
    conId = app.GetOption("connectionId")
    if test:
        from AccessGrid.Venue import VenueIW
        # Create an application session in the venue
        # for testing. This should normally be done via
        # the Venue Client menu.
        venue = VenueIW("https://localhost:8000/Venues/default")
        appDesc = venue.CreateApplication("Shared PDF",
                                          "Shared PDF",
                                          "application/x-ag-shared-pdf")
        
        appUrl = appDesc.uri
class SystemTest:
    def __init__(self):

        # Init the toolkit with the standard environment.
        self.app = WXGUIApplication()
        
        # Try to initialize
        args = self.app.Initialize("VenueClient", sys.argv[:1])

        # Handle command line options
        self.__buildOptions()
              
        if not self.port:
            self.port = 8000

        if not self.url:
            self.url = 'https://localhost:8000/Venues/default'

        # Create venue client components
        self.vc = VenueClient(pnode=self.pnode, port=self.port)
        self.vcc = VenueClientController()
        self.vcc.gui = Gui()
        self.vcc.SetVenueClient(self.vc)
        self.observer = Observer()
        self.vc.AddObserver(self.observer)
                
        # Start tests
        self.__StartTests()
        
        # Exit
        self.vc.Shutdown()
        sys.exit(0)
        
    def __StartTests(self):
        # -------------------------------------
        # EnterVenue
        # -------------------------------------
        
        self.__testMethod(self.vc.EnterVenue, "EnterVenue", args = [self.url])
                
        # -------------------------------------
        # Services
        # -------------------------------------
        
        # AddService
        service = ServiceDescription("test", "test", "test", "test")
        service.SetId(5)
        self.__testMethod(self.vc.AddService, "AddService", args = [service])

        s = self.observer.lastService
        
        if not s.id == service.id:
            print 'Add Service FAILED; service does not exist'
        
        # UpdateService
        service.SetName("Updated Service")
        self.__testMethod(self.vc.UpdateService, "UpdateService", args = [service])
        
        # RemoveService
        self.__testMethod(self.vc.RemoveService, "RemoveService", args = [service])

        # -------------------------------------
        # Data
        # -------------------------------------

        # AddData
        file1 = os.path.join(os.getcwd(), 'unittest_all.py')
        file2 = os.path.join(os.getcwd(), 'unittest_ClientProfile.py')
        self.__testMethod(self.vcc.UploadVenueFiles, "UploadVenueFiles", args = [[file1,file2]])

        time.sleep(20)
        d = self.observer.lastData
        
        d.SetName("Updated Name")
        # ModifyData
        self.__testMethod(self.vc.ModifyData, "ModifyData", args = [d])

        # RemoveData

        
        # -------------------------------------
        # Applications
        # -------------------------------------
        
        # CreateApplication
        name = 'Test App'
        self.__testMethod(self.vc.CreateApplication, "CreateApplication", args = ['Test App', "my_desc", 'my_mime'])
        
        app = self.observer.lastApplication
        
        if not app.name == name:
            print 'Create Application Failed; app does not exist'
            
        # UpdateApplication
        app.SetName("Updated Application")
        self.__testMethod(self.vc.UpdateApplication, "UpdateApplication", args = [app])
        
        # DestroyApplication
        self.__testMethod(self.vc.DestroyApplication, "DestroyApplication", args = [app.id])

        # --------------------------------------
        # ExitVenue
        # --------------------------------------
        self.__testMethod(self.vc.ExitVenue, 'ExitVenue')

                  
    def __testMethod(self, method, text, args = None):

        print '******************************************'
        
        try:
            if args:
                return apply(method, args)
            else:
                return apply(method)
            print '%s SUCCEEDED'%text
        except:
            print '%s FAILED'%text
        
        print '******************************************'
        
                
    def __buildOptions(self):
        # build options for this application
        
        portOption = Option("-p", "--port", type="int", dest="port",
                                        default=0, metavar="PORT",
                                        help="Set the port the venueclient control interface\
                                        should listen on.")
        self.app.AddCmdLineOption(portOption)
        pnodeOption = Option("--personalNode", action="store_true", dest="pnode",
                             default=0,
                             help="Run NodeService and ServiceManager with the client.")
        self.app.AddCmdLineOption(pnodeOption)
        urlOption = Option("--url", type="string", dest="url",
                           default="", metavar="URL",
                           help="URL of venue to enter on startup.")
        self.app.AddCmdLineOption(urlOption)
                        
        self.log = self.app.GetLog()
        self.pnode = self.app.GetOption("pnode")
        self.url = self.app.GetOption("url")
        self.port = self.app.GetOption("port")