public void loadCodeFile_FindBugs()
        {
            Assert.That(File.Exists(findBugsExample), "File Didn't exist");
            var loadEngine = new O2AssesmentLoad_FindBugs();

            Assert.That(loadEngine.canLoadFile(findBugsExample), "load engine could not load file");
            var o2Assessment = loadEngine.loadFile(findBugsExample);

            Assert.That(o2Assessment != null, "o2Assessment was null");
            Assert.That(o2Assessment.o2Findings.Count > 0, "There were no findings imported");
            var savedFile = o2Assessment.save(new O2AssessmentSave_OunceV6());

            Assert.That(File.Exists(savedFile), "savedFile didnt exist:" + savedFile);
            DI.log.info("Imported file saved to :{0}", savedFile);

            ascx_FindingsViewer.o2AssessmentLoadEngines.Add(new O2AssessmentLoad_OunceV6());
            var findingsViewerControlName = "FindingsViewer";

            O2AscxGUI.openAscxAsForm(typeof(ascx_FindingsViewer), findingsViewerControlName);
            var findingsViewerControl = (ascx_FindingsViewer)O2AscxGUI.getAscx(findingsViewerControlName);

            findingsViewerControl.loadO2Assessment(savedFile);
            //O2AscxGUI.waitForAscxGuiClose();
            O2AscxGUI.close();
        }
 public void openGUI()
 {
     O2AscxGUI.openAscxAsForm(typeof(ascx_ApplyRulesToFindings), applyRulesToFindingsControlName);
     ascx_FindingsViewer.o2AssessmentLoadEngines.Add(new O2AssessmentLoad_OunceV6());
     PublicDI.log.LogRedirectionTarget = null;  //so that the GUI messages go the debug
     loadTestData();
 }
        public void loadAscxGUI()
        {
            O2AscxGUI.openAscxAsForm(typeof(ascx_ScanWizard));
            var ascxScanWizard = O2AscxGUI.getAscx(typeof(ascx_ScanWizard).Name);

            Assert.That(ascxScanWizard != null, "ascxScanWizard was null");
            O2AscxGUI.waitForAscxGuiClose();
        }
 public void openGui()
 {
     O2AscxGUI.openAscxAsForm(typeof(ascx_FindingsSplitter), findingsSplitterControlName);
     findingsSplitter = (ascx_FindingsSplitter)O2AscxGUI.getAscx(findingsSplitterControlName);
     cirDataViewer    = findingsSplitter.getCirDataViewer_ToProcess();
     findingsViewer   = findingsSplitter.getFindingsViewer_toProcess();
     ascx_FindingsViewer.o2AssessmentLoadEngines.Add(new O2AssessmentLoad_OunceV6());
 }
Beispiel #5
0
        public void loadShowStrutsConfigFiles()
        {
            //var strutsConfig = Serialize.getDeSerializedObjectFromXmlFile(Struts_Sample_Validator, typeof(formvalidation));
            //Assert.That(strutsConfig != null, "validator.xml was null");
            O2AscxGUI.openAscxAsForm(typeof(ascx_ShowStrutsConfigFiles));
            var ascxControl = (ascx_ShowStrutsConfigFiles)O2AscxGUI.getAscx("ascx_ShowStrutsConfigFiles");

            //ascxControl.invokeOnThread(() => ascxControl.mapFile(Struts_Sample_Validator));
            O2AscxGUI.waitForAscxGuiClose();
        }
Beispiel #6
0
        public void loadGui()
        {
            O2AscxGUI.openAscxAsForm(typeof(ascx_ViewO2Config));
            var viewO2ConfigAscx = O2AscxGUI.getAscx("ascx_ViewO2Config");

            Assert.That(viewO2ConfigAscx != null, "viewO2ConfigAscx was NULl");

            O2AscxGUI.waitForAscxGuiClose();

            DI.log.info("all done");
        }
        public static void openOzasmtFile()
        {
            ascx_FindingsViewer.o2AssessmentLoadEngines.Add(new O2AssessmentLoad_OunceV6());
            // open the source Findings Viewer
            O2AscxGUI.openAscxAsForm(typeof(ascx_FindingsViewer), findingsViewerControlName_Source);
            // load assessment file into Source Findings Viewer
            // we have to use the direct call due to a bug in Mono
            //findingsViewerControlName_Source.invokeOnAscx("loadO2Assessment", new object[] { ozasmtFileToUse });
            O2AscxGUI_Ext.invokeOnAscx(findingsViewerControlName_Source, "loadO2Assessment", new object[] { ozasmtFileToUse });

            MessageBox.Show("Ozasmt File loaded in Findings Viewer Control: " + ozasmtFileToUse);
        }
Beispiel #8
0
        public void loadStrutsConfigXml()
        {
            var strutsConfig = Serialize.getDeSerializedObjectFromXmlFile(Spring_JPetStore_struts_config_xml, typeof(strutsconfig));

            Assert.That(strutsConfig != null, "strutsConfig was null");
            O2AscxGUI.openAscxAsForm(typeof(ascx_Struts_config_xml));
            var ascxControl = (ascx_Struts_config_xml)O2AscxGUI.getAscx("ascx_Struts_config_xml");

            ascxControl.invokeOnThread(
                () => ascxControl.mapFile(Spring_JPetStore_struts_config_xml));
            O2AscxGUI.waitForAscxGuiClose();
        }
Beispiel #9
0
        public void loadWebXmlInGui()
        {
            var webXml = Serialize.getDeSerializedObjectFromXmlFile(SpringMVC_PetClinic_web_xml, typeof(webappType));

            Assert.That(webXml != null, "webXml was null");
            O2AscxGUI.openAscxAsForm(typeof(ascx_J2EE_web_xml));
            var ascxControl = (ascx_J2EE_web_xml)O2AscxGUI.getAscx("ascx_J2EE_web_xml");

            ascxControl.invokeOnThread(
                () => ascxControl.mapFile(SpringMVC_PetClinic_web_xml));
            O2AscxGUI.waitForAscxGuiClose();
        }
Beispiel #10
0
        public void testLoadingInGUI_Dll()
        {
            O2AscxGUI.openAscxAsForm(typeof(ascx_XRules_UnitTests), "ascx_XRules_UnitTests");
            var ascxXRulesUnitTest = (ascx_XRules_UnitTests)O2AscxGUI.getAscx("ascx_XRules_UnitTests");

            Assert.That(ascxXRulesUnitTest != null, "ascxXRulesUnitTest was null");
            //var targetAssembly = Path.Combine(DI.config.hardCodedO2LocalBuildDir, "_O2_Scanner_DotNet.exe");
            var targetAssembly = Path.Combine(DI.config.hardCodedO2LocalBuildDir, "O2_Core_XRules.dll");

            DI.log.info("Setting targetAssembly to {0}", targetAssembly);
            ascxXRulesUnitTest.loadFile(targetAssembly);
            ascxXRulesUnitTest.XRulesTreeView_ExpandAll();
            O2AscxGUI.waitForAscxGuiClose();
        }
        public void test_openCirDataControlDirectly()
        {
            // get control
            var ascxControlName = "Cir Analysis";

            O2AscxGUI.openAscxAsForm(typeof(ascx_CirAnalysis), ascxControlName);
            var cirAnalysis = (ascx_CirAnalysis)O2AscxGUI.getAscx(ascxControlName);

            Assert.That(cirAnalysis != null, "cirAnalysis was null");
            //process O2Kernel (i.e convert it into CirData)
            Assert.That(cirAnalysis.getCirDataAnalysisObject().dCirClass.Count == 0, "At this stage there should be no classes loaded");
            cirAnalysis.loadO2CirDataFile(DI.config.ExecutingAssembly);
            Assert.That(cirAnalysis.getCirDataAnalysisObject().dCirClass.Count > 0, "There were no classes loaded in CirDataAnalysis object");
            if (cirAnalysis.ParentForm != null)
            {
                cirAnalysis.ParentForm.Close();
            }
        }
Beispiel #12
0
        public void testLoadingInGUI_CSharpFile()
        {
            var targetCSharpFile = Path.Combine(DI.config.hardCodedO2LocalBuildDir, @"_UnitTests\CSharp_Tests\_Sample_UnitTests.cs");

            Assert.That(File.Exists(targetCSharpFile), "Could not find targetCSharpFile");
            // open ascx
            O2AscxGUI.openAscxAsForm(typeof(ascx_XRules_UnitTests), "ascx_XRules_UnitTests");
            var ascxXRulesUnitTest = (ascx_XRules_UnitTests)O2AscxGUI.getAscx("ascx_XRules_UnitTests");

            Assert.That(ascxXRulesUnitTest != null, "ascxXRulesUnitTest was null");
            // load file
            DI.log.info("Setting targetCSharpFile to {0}", targetCSharpFile);
            ascxXRulesUnitTest.loadFile(targetCSharpFile);
            ascxXRulesUnitTest.XRulesTreeView_ExpandAll();

            // let user see what is going on
            O2AscxGUI.waitForAscxGuiClose();
        }
Beispiel #13
0
        [Test]  // the errors that will appear in the logs are because we are not loading the CIR data file, for example "getTreeNodeWithAutoWiredObject, loaded cirData did not contained signature :org.springframework.samples.petclinic.web.EditOwnerForm.setupForm(int;org.springframework.ui.Model):java.lang.String"
        public void viewSpringMvcControllersObjectOnGui()
        {
            if (false == File.Exists(expectedSpringMvcAttributeXmlFile))
            {
                AnnotationsHelper.executeJythonScript(testSpringMvcClassFile);
            }
            // create controllers
            var springMvcControllers = LoadSpringMvcData.createSpringMvcControllersFromXmlAttributeFile(expectedSpringMvcAttributeXmlFile);
            // create Gui
            var viewSpringMvcControllerName = "ascx_CreateSpringMvcMappings";

            O2AscxGUI.openAscxAsForm(typeof(ascx_SpringMvcMappings), viewSpringMvcControllerName);
            var springMvcMappings = (ascx_SpringMvcMappings)O2AscxGUI.getAscx(viewSpringMvcControllerName);

            // load controllers on gui
            springMvcMappings.showSpringMvcControllers(springMvcControllers);
            O2AscxGUI.close();
            //viewSpringMvcController
        }
        public void test_OzastFilesIntoO2Findings()
        {
            // set-up o2AssessmentLoad engines
            ascx_FindingsViewer.o2AssessmentLoadEngines.Add(new O2AssessmentLoad_OunceV6());
            ascx_FindingsViewer.o2AssessmentLoadEngines.Add(new O2AssessmentLoad_OunceV6_1());

            // open FindingsViewer controls
            O2AscxGUI.openAscxAsForm(typeof(ascx_FindingsViewer), findingsViewerControlOzasmt60);
            O2AscxGUI.openAscxAsForm(typeof(ascx_FindingsViewer), findingsViewerControlOzasmt61);

            // load ozasmt files in it
            findingsViewerControlOzasmt60.invokeOnAscx("loadO2Assessment", new object[] { ozasmt60 });
            findingsViewerControlOzasmt61.invokeOnAscx("loadO2Assessment", new object[] { ozasmt61 });

            // wait for FindingsViewer controls to close
            //O2AscxGUI.waitForAscxGuiClose();
            O2AscxGUI.closeAscxParent(findingsViewerControlOzasmt61);
            O2AscxGUI.closeAscxParent(findingsViewerControlOzasmt60);
            //O2AscxGUI.close();
            //O2AscxGUI.waitForAscxGuiClose();
        }
        public void openGui()
        {
            // use this to use the main O2 GUi

            /* O2AscxGUI.launch();
             * O2AscxGUI.openAscx(typeof (ascx_SourceCodeEditor), O2DockState.Document,sourceCodeEditorControl); */
            // use this to only open the ascx_SourceCodeEditor control
            O2AscxGUI.openAscxAsForm(typeof(ascx_SourceCodeEditor), sourceCodeEditorControl);
            Assert.That(O2AscxGUI.isAscxLoaded(sourceCodeEditorControl), "sourceCodeEditorControl was not loaded");

            //sourceCodeEditorControl.invokeOnAscx("loadSampleScripts", new object[] {typeof (OzasmtScriptSamples)});
            //    Assert.That(((List<string>)sourceCodeEditorControl.invokeOnAscx("getSampleScriptsNames")).Count > 0, "getSampleScriptsNames.Count == 0 ");



            O2AscxGUI.invokeOnAscxControl(sourceCodeEditorControl, "loadSourceCodeFile", new object[] { hardCodedPathToSampleScriptToEdit });

            //Processes.Sleep(1000);

            /*var sourceCodeFromAscxControl = (string) O2AscxGUI.invokeOnAscxControl(sourceCodeEditorControl, "getSourceCode");
             * Assert.That(sourceCodeFromAscxControl == OzasmtScriptSamples._1_OzamtManipulation,
             *          "Source code was not correctly loaded");*/
        }
Beispiel #16
0
        public void loadTestData()
        {
            O2AscxGUI.openAscxAsForm(typeof(ascx_JoinTracesOnInterfaces));
            var joinTracesControl = (ascx_JoinTracesOnInterfaces)O2AscxGUI.getAscx("ascx_JoinTracesOnInterfaces");

            Assert.That(joinTracesControl != null, "joinTracesControl object was null");
            var baseFindingsControl = joinTracesControl.getBaseFindingsControl();
            // var barCirDataViewerControl = joinTracesControl.getBaseCirDataViewerControl();
            // load base Findings
            var loadThread = joinTracesControl.loadBaseFindings(baseFindings);

            loadThread.Join();
            Assert.That(baseFindingsControl.currentO2Findings.Count > 0, "no findings Loaded");
            // load base Cir
            joinTracesControl.loadBaseCir(baseCir);

            // calculateSourcesMappedToInterfaces

            joinTracesControl.calculateSourcesMappedToInterfaces(true);

            O2AscxGUI.close();
            //O2AscxGUI.waitForAscxGuiClose();
        }
Beispiel #17
0
        private static void o2MessageQueue_onMessages(IO2Message o2Message)
        {
            try
            {
                if (o2Message is IM_GUIAction)
                {
                    var mGuiAction = (IM_GUIAction)o2Message;
                    DI.log.info("O2GuiWithDockPanel received IM_GUIAction of action: {0}", mGuiAction.GuiAction);
                    switch (mGuiAction.GuiAction)
                    {
                    case IM_GUIActions.isAscxGuiAvailable:
                        isAscxGuiAvailable();
                        break;

                    //   case (IM_GUIActions.openControlInGui): // don't handle these here
                    case IM_GUIActions.getGuiAscx:
                        if (mGuiAction.returnDataCallback != null)
                        {
                            mGuiAction.returnDataCallback(O2DockUtils.getAscx(mGuiAction.controlName));
                        }
                        break;

                    case IM_GUIActions.executeOnAscx:
                        if (mGuiAction.controlName == null || mGuiAction.targetMethod == null ||
                            mGuiAction.methodParameters == null)
                        {
                            DI.log.error(
                                "in O2Environment.O2MessagesHandler.o2MessageQueue_onMessages received a O2Message for IM_GUIActions.executeOnAscx, but either the targetMethod or methodParameters are null");
                        }
                        else
                        {
                            var ascxControlToExecute = O2AscxGUI.getAscx(mGuiAction.controlName);
                            if (ascxControlToExecute == null)
                            {
                                DI.log.error(
                                    "in O2MessagesHandler...IM_GUIActions.executeOnAscx, could not get control: {0}",
                                    mGuiAction.controlName);
                            }
                            else
                            {
                                o2Message.returnData = DI.reflection.invoke(ascxControlToExecute,
                                                                            mGuiAction.targetMethod,
                                                                            mGuiAction.methodParameters);
                            }
                        }
                        break;

                    case IM_GUIActions.closeAscxParent:
                        O2AscxGUI.closeAscxParent(mGuiAction.controlName);
                        break;

                    case IM_GUIActions.openControlInGui:                // this is a special case since we should only handle this if the main GUI is not loaded
                        if (false == O2AscxGUI.isGuiLoaded())           // this tends to happen on Unit tests where we only have one control loaded
                        {
                            // and if the Gui is not loaded open this control as a stand alone FORM
                            O2AscxGUI.openAscxAsForm(mGuiAction.controlType, mGuiAction.controlName);
                        }
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                DI.log.ex(ex, " in O2MessagesHandler.o2MessageQueue_onMessages");
            }
        }
Beispiel #18
0
 public void setupGui()
 {
     O2AscxGUI.openAscxAsForm(typeof(ascx_XRules_Editor));
     xRulesEditor = (ascx_XRules_Editor)O2AscxGUI.getAscx("ascx_XRules_Editor");
     Assert.That(xRulesEditor != null, "xRulesEditor was null");
 }
Beispiel #19
0
 public void compileRules_InGUI()
 {
     O2AscxGUI.openAscxAsForm(typeof(ascx_XRules_Execution));
     O2AscxGUI.waitForAscxGuiClose();
 }
Beispiel #20
0
 public void launchGUI()
 {
     ascx_FindingsViewer.o2AssessmentLoadEngines.Add(new O2AssessmentLoad_OunceV6());
     O2AscxGUI.openAscxAsForm(typeof(ascx_JoinSinksToSources), joinSinksToSourcesControl);
 }
Beispiel #21
0
 public void openGUI()
 {
     O2AscxGUI.openAscxAsForm(typeof(ascx_RulePackViewer), rulePackViewerControlName);
 }
Beispiel #22
0
 public void loadGUI()
 {
     O2AscxGUI.openAscxAsForm(typeof(ascx_XRules_UnitTests));
     O2AscxGUI.waitForAscxGuiClose();
 }