private void Judge(JudgeContext context) { JudgeTask task = context.Task; ITaskSubmitter submitter = AdapterFactory.CreateTaskSubmitter(); try { UpdateTestData(context); using (BaseJudger judger = JudgerFactory.Create(context)) { LogStartJudgeTask(task.SubmitId); judger.Judge(); } } catch (ExpectedJudgeStopException) { } catch (Exception ex) // 判题失败 { context.Result = CreateFailedJudgeResult(context, ex.ToString()); throw; } finally { LogJudgeResult(context.Result); submitter.Submit(context); } }
/// <summary> /// Submits the hand. /// </summary> /// <param name="hand">The hand.</param> /// <param name="teamId">The team identifier.</param> /// <param name="gameId">The game identifier.</param> /// <returns></returns> public OperationOutcome SumbitHand(Hand hand, Guid teamId, Guid gameId) { var gameAdapter = AdapterFactory.GetGameAdapter(); var game = gameAdapter.GetGameById(gameId); if (game == null) { throw new BadRequestException(); } var response = this.SubmitHandGeneric(hand, teamId, game); if (!game.IsSimulatedGame) { return(response); } gameAdapter = AdapterFactory.GetGameAdapter(); game = gameAdapter.GetGameById(gameId); if (!game.IsComplete) { this.SumbitSimulatedHand(game); } return(response); }
public void Create_WhenTokenIssuedSuccessEvent_WillReturnTokenIssuedSuccessEventAdapter() { // Arrange var authResponse = new AuthorizeResponse() { Request = new ValidatedAuthorizeRequest() { Client = new Client(), Subject = new ClaimsPrincipal(new ClaimsIdentity(new List <Claim>() { new Claim(JwtClaimTypes.Subject, string.Empty) })) } }; var evt = new TokenIssuedSuccessEvent(authResponse); var sut = new AdapterFactory(); // Act var adapter = sut.Create(evt); // Assert Assert.IsType <TokenIssuedSuccessEventAdapter>(adapter); }
public static void Main(string[] args) { var sourceFile = "DATANORM.001"; var resultFile = "result.xml"; var adapterType = InferAdapterFromFile(sourceFile); var factory = new AdapterFactory(@"T:\Gemeinsame Dateien\trinity6"); var adapter = factory.CreateAdapter(adapterType); AuthorizeAdapter(adapter); AttachEventHandlers(adapter); try { adapter.Run(sourceFile, resultFile); Console.WriteLine("Conversion completed."); } catch (AdapterFailureException ex) { Console.WriteLine("Conversion failed with error: " + ex.Message); } }
private LogBookDataModel GetLogBook(int logNum, string environment, bool fetchWithDetails = false) { using (var adapter = AdapterFactory.CreateAdapter(MyNameSpace, environment)) { return(GetLogBookWithDetails(logNum, adapter, fetchWithDetails)); } }
public IPoint TopRight() { double x = Origin.X + Width; double y = Origin.Y + Height; IPoint topRight = AdapterFactory.GetNewPoint(x, y); return(topRight); }
public SqlExpBase(SqlAdapterType adater, SqlTableDefine tableDefine, List <SqlColumnDefine> columnDefines) { _type = SqlType.Query; _adapter = adater; _builder = new Builder.Builder(_type, tableDefine, columnDefines, AdapterFactory.GetAdapterInstance(_adapter)); _resolver = new LambdaResolver(_builder); }
public SqlExpBase(SqlAdapterType adater, Type entityType) { _type = SqlType.Query; _adapter = adater; _entityType = entityType; _builder = new Builder.Builder(_type, entityType, AdapterFactory.GetAdapterInstance(_adapter)); _resolver = new LambdaResolver(_builder); }
public void TestAttributesAdapterType() { TestInit(); //todo:fix connection mock IAdapter <Document> adapter = AdapterFactory <Document> .GetAdapter(MapConfigEnum.ATTRIBUTESETTINGS, maps); Assert.IsTrue(typeof(AttributesAdapter <Document>).IsInstanceOfType(adapter)); }
/// <summary> /// Gets all games for dashboard games. /// </summary> /// <param name="numberOfGames">The number of games.</param> /// <returns>DashboardGames</returns> public IEnumerable <Game> GetAllGamesForDashboardGames(int?numberOfGames = null) { numberOfGames = numberOfGames ?? Properties.Settings.Default.DefaultMaxDashboardGames; var adapter = AdapterFactory.GetGameAdapter(); return(adapter.GetGamesForDashbaord(numberOfGames.Value)); }
public IPoint TopRight() { double x = _textBox.Origin.X + _textBox.Width; double y = _textBox.Origin.Y + _textBox.Height; IPoint topRight = AdapterFactory.GetNewPoint(x, y); return(topRight); }
protected override RegionAdapterMappings ConfigureRegionAdapterMappings() { RegionAdapterMappings mappings = base.ConfigureRegionAdapterMappings(); var factory = Container.GetExportedValue <IRegionBehaviorFactory>(); mappings.RegisterMapping(typeof(NavBarControl), AdapterFactory.Make <RegionAdapterBase <NavBarControl> >(factory)); return(mappings); }
public void GetAdapterTest() { IAdapterFactory factory = new AdapterFactory(); IAdapter actualAdapter = factory.GetAdapter(nameof(PingAdapter)); Assert.AreEqual(typeof(PingAdapter), actualAdapter.GetType()); }
public static void CreateTable(this IDbConnection db, SqlTableDefine tableDefine, List <SqlColumnDefine> columnList, IDbTransaction transaction = null) { var dbAdapter = AdapterFactory.GetAdapterInstance(db.GetAdapter()); var createTableSql = dbAdapter.CreateTableSql(tableDefine, columnList); db.Execute(createTableSql, transaction: transaction); }
public void GetAdapterTest_UnknownAdapter() { IAdapterFactory factory = new AdapterFactory(); Assert.ThrowsException <InvalidOperationException>(() => { IAdapter actualAdapter = factory.GetAdapter("UnknownAdapter"); }); }
public static void TruncateTable(this IDbConnection db, string tableName, string tableSchema, IDbTransaction transaction = null) { var dbAdapter = AdapterFactory.GetAdapterInstance(db.GetAdapter()); var sql = dbAdapter.TruncateTableSql(tableName, tableSchema); db.Execute(sql, transaction: transaction); }
public static bool TableExist(this IDbConnection db, string tableName, string tableSchema = null, IDbTransaction transaction = null) { var dbAdapter = AdapterFactory.GetAdapterInstance(db.GetAdapter()); var tableExistSql = dbAdapter.TableExistSql(tableName, tableSchema); return(db.ExecuteScalar <int>(tableExistSql, transaction: transaction) > 0); }
static void Main(string[] args) { var chunkSizeBytes = Int32.Parse(args[0]); var sourcePath = args[1]; var adapterFactory = new AdapterFactory(); var senderService = new SenderService(adapterFactory, chunkSizeBytes, sourcePath); senderService.Send(); }
/// <summary> /// Gets the simulated game. /// </summary> /// <param name="team">The team.</param> /// <returns>The simulated team</returns> protected Guid GetSimulatedGame(Team team) { var gameAdapter = AdapterFactory.GetGameAdapter(); var game = gameAdapter.RegisiterSimulatorGame(Properties.Settings.Default.SimulatorTeamName); gameAdapter.SaveChanges(); return(game.Id); }
public static Task CreateTableAsync(this IDbConnection db, SqlTableDefine tableDefine, List <SqlColumnDefine> columnList, IDbTransaction transaction = null) { var dbAdapter = AdapterFactory.GetAdapterInstance(db.GetAdapter()); var createTableSql = dbAdapter.CreateTableSql(tableDefine, columnList); return(db.ExecuteSqlAsync(transaction, createTableSql)); }
/// <summary> /// Sumbits the simulated hand. /// </summary> /// <param name="game">The game.</param> /// <returns>The opperation outcome</returns> public OperationOutcome SumbitSimulatedHand(Game game) { var teamAdapter = AdapterFactory.GetTeamAdapter(); var randomHand = this.GetRandomHand(); var team = teamAdapter.GetTeamByName(Properties.Settings.Default.SimulatorTeamName); return(this.SubmitHandGeneric(randomHand, team.Id, game)); }
public static Task <int> TruncateTableAsync(this IDbConnection db, string tableName, string tableSchema, IDbTransaction transaction = null) { var dbAdapter = AdapterFactory.GetAdapterInstance(db.GetAdapter()); var sql = dbAdapter.TruncateTableSql(tableName, tableSchema); return(db.ExecuteAsync(sql, transaction: transaction)); }
public List <ProductEx> Consolidate <TProductType>(IQueryable <TProductType> products) where TProductType : class { var adapter = AdapterFactory.GetAdapter <TProductType>(); products.ToList().ForEach( p => consolidatedProducts.Add(new ProductEx(adapter.Adapt(p), this))); return(consolidatedProducts); }
public static InterfaceT ToInterface <InterfaceT>(object target) where InterfaceT : class { var i = target as InterfaceT; if (i == null) { i = AdapterFactory <InterfaceT> .Create(target); } return(i); }
protected override void ConfigureRegionAdapterMappings(RegionAdapterMappings regionAdapterMappings) { base.ConfigureRegionAdapterMappings(regionAdapterMappings); var factory = base.Container.Resolve <IRegionBehaviorFactory>(); regionAdapterMappings.RegisterMapping(typeof(DocumentGroup), AdapterFactory.Make <RegionAdapterBase <DocumentGroup> >(factory)); regionAdapterMappings.RegisterMapping(typeof(LayoutPanel), AdapterFactory.Make <RegionAdapterBase <LayoutPanel> >(factory)); regionAdapterMappings.RegisterMapping(typeof(LayoutGroup), AdapterFactory.Make <RegionAdapterBase <LayoutGroup> >(factory)); regionAdapterMappings.RegisterMapping(typeof(TabbedGroup), AdapterFactory.Make <RegionAdapterBase <TabbedGroup> >(factory)); }
public AdapterController(ILoggerFactory loggerFactory, IHostingEnvironment env, IObjectStorageService objectStorageService, AdapterFactory adapterFactory) { _logger = loggerFactory.CreateLogger <AdapterController>(); _env = env; _objectStorageService = objectStorageService; _adapterFactory = adapterFactory; }
public SqlExpBase(SqlAdapterType adater, Type entityType, string specialSchema) { _type = SqlType.Query; _adapter = adater; _entityType = entityType; SqlAdapter = AdapterFactory.GetAdapterInstance(_adapter); _builder = new Builder.Builder(_type, entityType, SqlAdapter, specialSchema); //_builder = new Builder.Builder(_type, entityType, AdapterFactory.GetAdapterInstance(_adapter)); _resolver = new LambdaResolver(_builder); }
/// <summary> /// 根据实体类创建数据库表 /// </summary> /// <typeparam name="T">实体类类型</typeparam> /// <param name="db"></param> /// <param name="transaction"></param> public static void CreateTable <T>(this IDbConnection db, IDbTransaction transaction = null) { var dbAdapter = AdapterFactory.GetAdapterInstance(db.GetAdapter()); var entityDef = EntityHelper.GetEntityDefine <T>(); var createTableSql = dbAdapter.CreateTableSql(entityDef.Item1, entityDef.Item2); db.Execute(createTableSql, transaction: transaction); }
protected override RegionAdapterMappings ConfigureRegionAdapterMappings() { RegionAdapterMappings mappings = base.ConfigureRegionAdapterMappings(); var factory = Container.GetExportedValue <IRegionBehaviorFactory>(); mappings.RegisterMapping(typeof(LayoutPanel), AdapterFactory.Make <RegionAdapterBase <LayoutPanel> >(factory)); mappings.RegisterMapping(typeof(LayoutGroup), AdapterFactory.Make <RegionAdapterBase <LayoutGroup> >(factory)); mappings.RegisterMapping(typeof(TabbedGroup), AdapterFactory.Make <RegionAdapterBase <TabbedGroup> >(factory)); mappings.RegisterMapping(typeof(DocumentGroup), AdapterFactory.Make <RegionAdapterBase <DocumentGroup> >(factory)); return(mappings); }
public void GetPocoAdapterForGenericObjects() { // Arrange var factory = new AdapterFactory(); //Act: var adapter = factory.Create(new PocoModel(), typeof(PocoModel)); // Assert Assert.Equal(typeof(PocoAdapter), adapter.GetType()); }