|
From: <br...@us...> - 2008-10-22 11:58:37
|
Revision: 420
http://acmcontester.svn.sourceforge.net/acmcontester/?rev=420&view=rev
Author: brus07
Date: 2008-10-22 11:58:24 +0000 (Wed, 22 Oct 2008)
Log Message:
-----------
Added TestRunnerPlugin. In this plugin using Tester for test source.
But now using old version of testing module.
Modified Paths:
--------------
ACMServer/trunk/ACMServer/ACMMediator.sln
Added Paths:
-----------
ACMServer/trunk/ACMServer/Plugins/TesterPlugins/TestRunnerPlugin/
ACMServer/trunk/ACMServer/Plugins/TesterPlugins/TestRunnerPlugin/Properties/
ACMServer/trunk/ACMServer/Plugins/TesterPlugins/TestRunnerPlugin/Properties/AssemblyInfo.cs
ACMServer/trunk/ACMServer/Plugins/TesterPlugins/TestRunnerPlugin/TestRunnerPlugin.cs
ACMServer/trunk/ACMServer/Plugins/TesterPlugins/TestRunnerPlugin/TestRunnerPlugin.csproj
ACMServer/trunk/ACMServer/Plugins/TesterPlugins/TestRunnerPlugin/WorkRunner.cs
Modified: ACMServer/trunk/ACMServer/ACMMediator.sln
===================================================================
--- ACMServer/trunk/ACMServer/ACMMediator.sln 2008-10-21 07:44:02 UTC (rev 419)
+++ ACMServer/trunk/ACMServer/ACMMediator.sln 2008-10-22 11:58:24 UTC (rev 420)
@@ -23,6 +23,12 @@
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "testData", "Library\testData\testData.csproj", "{4EB54D66-105B-4CFD-8883-CBE7CA70AFA5}"
EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "TesterPlugins", "TesterPlugins", "{D67E1C70-DFE6-4C3E-BCA9-DD3DB9CB4B30}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestRunnerPlugin", "Plugins\TesterPlugins\TestRunnerPlugin\TestRunnerPlugin.csproj", "{8F305004-8FB7-4F85-8063-3A7041DB840F}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Runner", "Runner\Runner.csproj", "{052D9F77-17AF-42F3-BFBF-975A19383496}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -61,6 +67,14 @@
{4EB54D66-105B-4CFD-8883-CBE7CA70AFA5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4EB54D66-105B-4CFD-8883-CBE7CA70AFA5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4EB54D66-105B-4CFD-8883-CBE7CA70AFA5}.Release|Any CPU.Build.0 = Release|Any CPU
+ {8F305004-8FB7-4F85-8063-3A7041DB840F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {8F305004-8FB7-4F85-8063-3A7041DB840F}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {8F305004-8FB7-4F85-8063-3A7041DB840F}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {8F305004-8FB7-4F85-8063-3A7041DB840F}.Release|Any CPU.Build.0 = Release|Any CPU
+ {052D9F77-17AF-42F3-BFBF-975A19383496}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {052D9F77-17AF-42F3-BFBF-975A19383496}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {052D9F77-17AF-42F3-BFBF-975A19383496}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {052D9F77-17AF-42F3-BFBF-975A19383496}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -72,7 +86,9 @@
{4EB54D66-105B-4CFD-8883-CBE7CA70AFA5} = {9AC82C0B-F256-41DD-9B4A-A59EC7EB4890}
{E4F4B91E-CC25-410B-B53A-E2507EFA4FCB} = {D80861F5-3751-4D49-884B-1A10FE1BCB07}
{69FB4176-F298-4AF7-B714-B6758AA9A58E} = {D80861F5-3751-4D49-884B-1A10FE1BCB07}
+ {D67E1C70-DFE6-4C3E-BCA9-DD3DB9CB4B30} = {D80861F5-3751-4D49-884B-1A10FE1BCB07}
{20B192BC-FD4D-4ED5-90F5-B5994F995238} = {E4F4B91E-CC25-410B-B53A-E2507EFA4FCB}
{9462E3BD-67AD-4887-BF4C-8B6A25048941} = {E4F4B91E-CC25-410B-B53A-E2507EFA4FCB}
+ {8F305004-8FB7-4F85-8063-3A7041DB840F} = {D67E1C70-DFE6-4C3E-BCA9-DD3DB9CB4B30}
EndGlobalSection
EndGlobal
Property changes on: ACMServer/trunk/ACMServer/Plugins/TesterPlugins/TestRunnerPlugin
___________________________________________________________________
Added: svn:ignore
+ bin
obj
Added: tsvn:logminsize
+ 5
Property changes on: ACMServer/trunk/ACMServer/Plugins/TesterPlugins/TestRunnerPlugin/Properties
___________________________________________________________________
Added: tsvn:logminsize
+ 5
Added: ACMServer/trunk/ACMServer/Plugins/TesterPlugins/TestRunnerPlugin/Properties/AssemblyInfo.cs
===================================================================
--- ACMServer/trunk/ACMServer/Plugins/TesterPlugins/TestRunnerPlugin/Properties/AssemblyInfo.cs (rev 0)
+++ ACMServer/trunk/ACMServer/Plugins/TesterPlugins/TestRunnerPlugin/Properties/AssemblyInfo.cs 2008-10-22 11:58:24 UTC (rev 420)
@@ -0,0 +1,35 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("TestRunnerPlugin")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("Home")]
+[assembly: AssemblyProduct("TestRunnerPlugin")]
+[assembly: AssemblyCopyright("Copyright © Home 2008")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("7defcb4b-5ef7-4f12-97e0-03dcdaccbb09")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Revision and Build Numbers
+// by using the '*' as shown below:
+[assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
Added: ACMServer/trunk/ACMServer/Plugins/TesterPlugins/TestRunnerPlugin/TestRunnerPlugin.cs
===================================================================
--- ACMServer/trunk/ACMServer/Plugins/TesterPlugins/TestRunnerPlugin/TestRunnerPlugin.cs (rev 0)
+++ ACMServer/trunk/ACMServer/Plugins/TesterPlugins/TestRunnerPlugin/TestRunnerPlugin.cs 2008-10-22 11:58:24 UTC (rev 420)
@@ -0,0 +1,46 @@
+using System;
+using AcmContester.Plugins.PluginsFramework;
+using AcmContester.Library.LibraryExtention;
+using AcmContester.Library.LibraryExtention.Data;
+
+namespace AcmContester.Plugins.MediatorPlugins.TestRunnerPlugin
+{
+ public class TestRunnerPlugin: BaseMediatorPlugin
+ {
+ WorkRunner runner = new WorkRunner();
+ public TestRunnerPlugin()
+ {
+ runner.onDataArrived += new WorkRunner.DataArrivedDelegate(runner_onDataArrived);
+ }
+
+ private bool runner_onDataArrived(SystemMessage message)
+ {
+ base.DataArrived(message);
+ return true;
+ }
+
+ public override void Send(SystemMessage message)
+ {
+ if (message.IsType("ApplicationSystem") && message.Message == "stop")
+ {
+ runner.Stop();
+ return;
+ }
+
+ if (message.IsType("TestingSubmit") == true)
+ runner.AddWork(message.Message);
+ if (message.IsType("TestingSubmitList") == true)
+ {
+ SubmitList list = SubmitList.CreateFromXml(message.Message);
+ for (int i = 0; i < list.Items.Length; i++)
+ {
+ while (runner.IsBusy() == true)
+ System.Threading.Thread.Sleep(50);
+ runner.AddWork(list.Items[i].ToString());
+ }
+
+ }
+ }
+
+ }
+}
Added: ACMServer/trunk/ACMServer/Plugins/TesterPlugins/TestRunnerPlugin/TestRunnerPlugin.csproj
===================================================================
--- ACMServer/trunk/ACMServer/Plugins/TesterPlugins/TestRunnerPlugin/TestRunnerPlugin.csproj (rev 0)
+++ ACMServer/trunk/ACMServer/Plugins/TesterPlugins/TestRunnerPlugin/TestRunnerPlugin.csproj 2008-10-22 11:58:24 UTC (rev 420)
@@ -0,0 +1,66 @@
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProductVersion>8.0.50727</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{8F305004-8FB7-4F85-8063-3A7041DB840F}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>TestRunnerPlugin</RootNamespace>
+ <AssemblyName>TestRunnerPlugin</AssemblyName>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>bin\Debug\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>bin\Release\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="System" />
+ <Reference Include="System.Data" />
+ <Reference Include="System.Xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ <Compile Include="TestRunnerPlugin.cs" />
+ <Compile Include="WorkRunner.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\..\..\Library\Data\Data.csproj">
+ <Project>{30C0EFA3-36A8-4C6F-8FEC-28F771D4933F}</Project>
+ <Name>Data</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\..\..\Library\LibraryExtention\LibraryExtention.csproj">
+ <Project>{A8135069-F8BA-4E5D-835F-3FF3F350AA5D}</Project>
+ <Name>LibraryExtention</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\..\..\Runner\Runner.csproj">
+ <Project>{052D9F77-17AF-42F3-BFBF-975A19383496}</Project>
+ <Name>Runner</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\..\PluginsFramework\PluginsFramework.csproj">
+ <Project>{69FB4176-F298-4AF7-B714-B6758AA9A58E}</Project>
+ <Name>PluginsFramework</Name>
+ </ProjectReference>
+ </ItemGroup>
+ <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+ Other similar extension points exist, see Microsoft.Common.targets.
+ <Target Name="BeforeBuild">
+ </Target>
+ <Target Name="AfterBuild">
+ </Target>
+ -->
+</Project>
\ No newline at end of file
Copied: ACMServer/trunk/ACMServer/Plugins/TesterPlugins/TestRunnerPlugin/WorkRunner.cs (from rev 418, ACMServer/trunk/ACMServer/Tester/Library/WorkRunner.cs)
===================================================================
--- ACMServer/trunk/ACMServer/Plugins/TesterPlugins/TestRunnerPlugin/WorkRunner.cs (rev 0)
+++ ACMServer/trunk/ACMServer/Plugins/TesterPlugins/TestRunnerPlugin/WorkRunner.cs 2008-10-22 11:58:24 UTC (rev 420)
@@ -0,0 +1,105 @@
+using System;
+using System.Threading;
+using AcmContester.Library.LibraryExtention;
+
+namespace AcmContester.Plugins.MediatorPlugins.TestRunnerPlugin
+{
+ class WorkRunner
+ {
+
+ public delegate bool DataArrivedDelegate(SystemMessage message);
+ public event DataArrivedDelegate onDataArrived;
+
+ string source = "";
+ object working = 0;
+ Thread thread = new Thread(new ParameterizedThreadStart(Go));
+
+ internal bool IsBusy()
+ {
+ lock (working)
+ {
+ if ((int)working == 1 || (thread.ThreadState == ThreadState.Running))
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ internal bool AddWork(string message)
+ {
+ if (IsBusy() == true)
+ {
+ return false;
+ }
+
+ //TODO: tut potribno stavyty lock
+ // a znimaty vze u samomu Thread'i
+ // (dyv. na inshe TODO:)
+ lock (source)
+ source = message;
+
+ //TODO: potribno jakos obnulyty status thread,
+ // tak shob ne potribno bulo stvorjuvaty novyj
+ thread = new Thread(new ParameterizedThreadStart(Go));
+ thread.Start(this);
+ return true;
+ }
+
+ static void Go(object data)
+ {
+ if (data is WorkRunner == false)
+ throw new ArgumentException();
+
+ WorkRunner gate = (WorkRunner)data;
+
+ lock (gate.working)
+ gate.working = 1;
+
+ string copySource;
+ //TODO: tut potribno znimaty postavlenyj lock
+ // toj lock postavlenyj u potoci sho vyklykav cej
+ lock (gate.source)
+ copySource = gate.source;
+ gate.Run(copySource);
+
+ lock (gate.working)
+ gate.working = 0;
+ }
+
+ void Run(string message)
+ {
+ string result;
+ try
+ {
+ result = Checker.Checker.GetResult(message);
+ }
+ catch (Exception ex)
+ {
+ Log log = Log.GetLog();
+ log.Loging("Form1::DataArrived: Error: " + ex.Message, Log.Priority.ERR);
+ log.Loging("Form1::DataArrived: Error: " + ex.StackTrace, Log.Priority.ERR);
+ return;
+ }
+
+ //TODO: ne znaju chy tut potriben lock
+ lock (this)
+ {
+ this.Send(new SystemMessage(result, "TestingResult"));
+ }
+ }
+
+ private bool Send(SystemMessage systemMessage)
+ {
+ if (onDataArrived != null)
+ return this.onDataArrived(systemMessage);
+ return true;
+ }
+
+ internal void Stop()
+ {
+ if (thread != null)
+ thread.Abort();
+ }
+ }
+}
Property changes on: ACMServer/trunk/ACMServer/Plugins/TesterPlugins/TestRunnerPlugin/WorkRunner.cs
___________________________________________________________________
Added: svn:mergeinfo
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|