Skip to main content
Главная страница » Football » Bisha (Saudi Arabia)

Bisha FC: Premier League Stars, Stats & Squad Highlights

Overview of Bisha Football Team

Bisha is a prominent football team hailing from Saudi Arabia, competing in the Saudi Professional League. Known for its dynamic play and strategic prowess, the team has garnered attention both locally and internationally. Founded in 1978, Bisha plays under the guidance of their current coach, aiming to solidify their position in the league.

Team History and Achievements

Bisha boasts a rich history filled with notable achievements. The team has clinched several titles over the years, including multiple league championships and domestic cup victories. Their most remarkable season was [Year], where they finished [Position] in the league standings, showcasing their competitive edge.

Current Squad and Key Players

The current squad features a blend of seasoned veterans and promising young talent. Key players include [Player Name], a star striker known for his goal-scoring ability, and [Player Name], a versatile midfielder whose tactical awareness is crucial to the team’s success.

Lists & Rankings of Players and Stats

  • Top Performers: ✅ [Player Name] – Goals: 15 | 🎰 Assists: 10
  • Key Positions: Defender – [Player Name]

Team Playing Style and Tactics

Bisha employs a 4-3-3 formation, emphasizing quick transitions and high pressing. Their strengths lie in their attacking prowess and defensive organization, while occasional lapses in midfield control can be seen as weaknesses.

Interesting Facts and Unique Traits

Bisha’s fanbase is known for its passionate support, often earning them the nickname “[Nickname].” The team has intense rivalries with teams like [Rival Team], adding an extra layer of excitement to their matches.

Comparisons with Other Teams

When compared to other teams in the division, Bisha stands out for its tactical discipline and ability to perform under pressure. Their head-to-head record against top contenders like [Team Name] demonstrates their competitive spirit.

Case Studies or Notable Matches

A memorable match for Bisha was their victory against [Opponent] in [Year], where they overturned a deficit with a stunning comeback. This game highlighted their resilience and tactical acumen.

Tables Summarizing Team Stats

Statistic Data
Last 5 Matches Form W-W-D-L-W
Head-to-Head Record vs. Top Rivals [Wins]-[Losses]-[Draws]

Tips & Recommendations for Betting Analysis

To analyze Bisha effectively for betting purposes, consider their recent form, key player performances, and upcoming fixtures. Pay attention to their head-to-head records against opponents to gauge potential outcomes.

Quotes or Expert Opinions about the Team

“Bisha’s tactical flexibility makes them one of the most exciting teams to watch this season,” says [Expert Name], a renowned sports analyst.

Pros & Cons of Current Form or Performance

  • Pros:
    • Solid defensive structure (✅)

    davidegriffo/ai/src/main/java/com/davidegriffo/ai/agent/solver/astar/AStarSolver.java
    package com.davidegriffo.ai.agent.solver.astar;

    import java.util.Comparator;
    import java.util.HashSet;
    import java.util.LinkedList;
    import java.util.PriorityQueue;

    import com.davidegriffo.ai.agent.search.SearchNode;
    import com.davidegriffo.ai.agent.search.SearchProblem;
    import com.davidegriffo.ai.agent.search.SearchSolver;

    public class AStarSolver implements SearchSolver {

    private static final String NAME = “A*”;

    @Override
    public String getName() {
    return NAME;
    }

    @Override
    public LinkedList<SearchNode> solve(SearchProblem problem) {
    PriorityQueue<SearchNode> open = new PriorityQueue(new Comparator<SearchNode>() {
    @Override
    public int compare(SearchNode o1, SearchNode o2) {
    return (int)(o1.getCost() + o1.getHeuristic() – (o2.getCost() + o2.getHeuristic()));
    }
    });

    open.add(problem.getRoot());

    while (!open.isEmpty()) {
    if (problem.isGoal(open.peek())) return getSolution(open.poll(), problem);

    open.remove();

    for (SearchNode child : problem.getChildren(open.peek())) {
    if (!child.isIn(open) && !child.isIn(new HashSet())) open.add(child);
    }

    if (problem.isGoal(open.peek())) return getSolution(open.poll(), problem);
    }

    return null;

    // while (!open.isEmpty()) {
    // if (problem.isGoal(open.peek())) return getSolution(open.poll(), problem);
    // open.remove();
    // for (SearchNode child : problem.getChildren(open.peek())) {
    // if (!child.isIn(open) && !child.isIn(new HashSet())) open.add(child);
    // }
    // }
    //
    // return null;

    // PriorityQueue<SearchNode> open = new PriorityQueue(new Comparator<SearchNode>() {
    // public int compare(SearchNode o1, SearchNode o2) {
    // return ((Integer)(o1.getCost() + o1.getHeuristic())).compareTo(o2.getCost() + o2.getHeuristic());
    // }
    // });
    //
    // open.add(problem.getRoot());
    //
    // while (!open.isEmpty()) {
    //
    //// System.out.println(“OPEN”);
    //// for (SearchNode node : open) System.out.println(node.getState());
    ////
    //// System.out.println(“CLOSED”);
    //// for (SearchNode node : closed) System.out.println(node.getState());
    //
    //
    // if (problem.isGoal(open.peek())) return getSolution(problem.getRoot(), open.poll());
    //
    // closed.add(open.remove());
    //
    //// System.out.println(“OPEN”);
    //// for (SearchNode node : open) System.out.println(node.getState());
    ////
    //// System.out.println(“CLOSED”);
    //// for (SearchNode node : closed) System.out.println(node.getState());
    //
    //
    //
    ////
    //// if (problem.isGoal(closed.peek()))
    //// return getSolution(problem.getRoot(), closed.poll()); // TODO check this
    ////
    ////
    ////
    ////
    //// if (!closed.contains(problem.getRoot()))
    //// closed.add(problem.getRoot()); // add root only once
    ////
    ////
    ////
    ////
    ////
    ////
    //// while (!open.isEmpty()) { // expand all nodes at this level
    ////
    ////
    ////
    ////
    //// if (!closed.contains(problem.getRoot()))
    //// closed.add(problem.getRoot()); // add root only once
    ////
    ////
    //////// if (!closed.contains(root)) closed.add(root); // add root only once
    ////////
    ////////
    //////// if (!closed.contains(root))
    //////// closed.add(root); // add root only once
    ////////
    ////////
    //////// while (!open.isEmpty()) { // expand all nodes at this level
    ////////
    //////// if (!closed.contains(root))
    //////// closed.add(root); // add root only once
    ////////
    ////////
    //////// SearchNode[] children = new SearchNode[open.size()];
    /////
    ///// int i=0;
    /////
    ///// while(!open.isEmpty())
    ///// children[i++] = open.remove();
    ///
    ///
    ///
    /// for(int i=0; i<children.length; i++) {
    ///
    /// if(closed.contains(children[i])) continue; // skip visited nodes
    ///
    /// children[i].setCost(children[i].getDepth()+children[i].getHeuristic());
    ///
    /// if(problem.isGoal(children[i]))
    /// return getSolution(problem.getRoot(), children[i]);
    ///
    /// open.addAll(problem.getChildren(children[i]));
    /// }
    ///
    ///
    ///
    ///
    ///
    /// }
    ///
    /////
    ///// }
    //
    //
    //
    //
    //
    //
    //}

    }

    private LinkedList<SearchNode> getSolution(SearchProblem problem,
    SearchNode goal) {

    LinkedList<SearchNode> solution = new LinkedList();

    solution.push(goal);

    SearchNode parent = goal.getParent();

    while(parent != null){
    solution.push(parent);
    parent = parent.getParent();
    }

    return solution;
    }

    }davidegriffo/ai> ## Artificial Intelligence

    This repository contains some code I wrote during my university studies.

    ## Overview

    The project consists of three modules:
    * `core` contains basic classes used by both `agents` module.
    * `agents` contains agents that implement different search algorithms.
    * `tsp` contains implementations of several algorithms that solve TSP.

    ## Usage

    To run any agent:

    mvn exec:java -Dexec.mainClass=”com.davidegriffo.ai.AgentRunner”
    -Dexec.args=”[path_to_agents_config_file]”

    ## Authors

    * Davide Griffò ([@davidegriffo](https://github.com/davidegriffo))
    * Daniele Scappini ([@daniloscappini](https://github.com/daniloscappini))

    ## License

    This project is licensed under MIT License – see LICENSE file.<|file_sep monitoredAgents=[{"name":"bfs","type":"breadthFirst"},
    {"name":"dfs","type":"depthFirst"},
    {"name":"astar","type":"aStar"}]davidegriffo/ai<|file_sep::: {.titlepage}

    # Introduction

    The main objective of this work is implementing an application that allows users to create agents capable of solving problems based on different search strategies.

    The application will be developed using Java programming language.

    The application will allow users to define environments containing different types of problems.

    Users will then be able to create agents that are able to solve these problems.

    These agents will use different search strategies which will be defined by users themselves.

    Finally users will be able to monitor these agents while they try solving problems.

    :::

    ::: {.part}

    # Part I: Description

    ## Chapter 1: Agents

    ### Section 1.1: Concepts

    #### Definition 1.1:

    An **agent** is an entity that perceives its environment through sensors,
    and acts upon that environment through actuators.
    An agent receives percepts from its sensors,
    and on each percept it chooses an action.
    An agent's behavior may depend on its percept history.

    #### Definition 1.2:

    An **environment** is everything external to an agent.
    It includes other agents as well as nature.

    #### Definition 1.3:

    An **agent function** maps each percept sequence into an action.

    #### Definition 1.4:

    A **simple reflex agent** selects actions based solely on the current percept,
    ignoring percepts received earlier.

    #### Definition 1.5:

    A **model-based reflex agent** maintains an internal state variable called model,
    which represents what it believes about aspects of the world not directly observable in the current percept.
    Such an agent uses both percept sequences AND models when choosing actions.

    #### Definition 1.6:

    A **goal-based agent** takes actions not just on the basis of its percept sequence but also on what it wants to achieve:
    its goals.

    #### Definition 1.7:

    A **utility-based agent** takes actions not just on the basis of what it wants but also on how much it wants each possible state:
    its utility function.

    ### Section 1.2: Agent Architecture

    ![Agent architecture](images/chapter01-image01.png)

    Figure @ref(fig:chapter01-figure01): Agent architecture

    ### Section 1.3: Agents' Life Cycle

    ![Agents' life cycle](images/chapter01-image02.png)

    Figure @ref(fig:chapter01-figure02): Agents' life cycle

    ### Section 1.4: Problem Solving Agents

    #### Definition 1.8:

    A **problem-solving agent** perceives changes in its environment,
    maintains some internal state representing what it knows about the world,
    and selects actions based on those perceptions and knowledge.
    Such agents are designed so that they act rationally:
    that is, they do whatever action they believe at each point will help them achieve their goals given what they know.

    #### Definition 1.9:

    A **search problem** consists of four components:

    ##### Component number one:

    ###### *Initial state*

    It specifies exactly which states are initial states,

    ##### Component number two:

    ###### *Actions*

    It specifies which actions are available from each state,

    ##### Component number three:

    ###### *Transition model*

    It specifies what each action does:
    that is, given a state s and an action a,
    it returns some new state s' resulting from performing action a in state s,

    ##### Component number four:

    ###### *Goal test*

    It specifies how one can tell whether some given state is a goal state.

    :::

    ## Chapter 2: Planning Agents

    ### Section 2.0: Concepts

    #### Definition 2.0:

    Planning involves determining sequences of actions leading from an initial situation to one or more goal situations.
    Planning involves searching among sequences rather than among individual states as we did with search problems.

    ### Section 2.0: Planning Problems

    #### Definition @ref(def:def-planning-problem):

    A planning problem consists of four components:

    ##### Component number one:

    ###### *Initial state*

    It specifies exactly which states are initial states,

    ##### Component number two:

    ###### *Actions*

    It specifies which actions are available from each state,

    ##### Component number three:

    ###### *Transition model*

    It specifies what each action does:
    that is, given a state s and an action a,
    it returns some new state s' resulting from performing action a in state s,

    ##### Component number four:

    ###### *Goals*

    Instead of specifying just one single goal test as we did with search problems,
    planning problems specify sets G(S)
    of possible goals;

    ### Section @ref(sec:definitions-planning-agents):

    A planning agent must maintain two models internally:

    ##### Model number one:

    ###### *World model*

    Its world model must contain enough information about how actions affect states so that it can determine which sequences lead from initial states towards goals,

    ##### Model number two:

    ###### *Agent model*

    Its own internal model must contain enough information about how percepts change over time so that it can tell when it has reached any particular goal.

    :::

    ## Chapter @ref(chap:introduction-search-problems):

    Introducing search problems

    ### Section @ref(sec:intro-search-problems):

    Introducing search problems

    :::

    # Part II: Implementation Details

    ## Chapter @ref(chap:detailed-implementation-details):

    Detailed implementation details

    :::davidegriffo/ai– MySQL dump 10.13 Distrib 5.7.17-MariaDB, for Linux (x86_64)

    — Host: localhost Database: ai_db_dev_test_env_db_000001_20171114T104726Z_00000000000000_database_000001_20171114T104726Z_00000000000000_database_001_db_schema_001_schema_versioning__schema_version__001_v001_schema_data__schema_data__001_v002_migration__migration__001_v002_migration__migration__002_v002_migration__migration__003_v003_migration__migration__004_v004_migration__migration__005_v005_migration__migration__006_v006_migration__
    — ——————————————————
    — Server version : MariaDB Server – mariadb.org binary distribution
    — Version : 10.x.x-MariaDB-log mariadb.org binary distribution
    — Revision : $Revision$
    — Distribution : MariaDB
    — URL : http://mariadb.org/

    /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
    /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
    /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
    /*!40101 SET NAMES utf8mb4 */;
    /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
    /*!40103 SET TIME_ZONE=’+00:00′ */;
    /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
    /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
    /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE=’NO_AUTO_VALUE_ON_ZERO’ */;
    /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;


    — Table structure for table `agents`

    DROP TABLE IF EXISTS `agents`;
    /*!40101 SET @saved_cs_client = @@character_set_client */;
    /*!40101 SET character_set_client = utf8mb4 */;
    CREATE TABLE `agents` (
    `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT ‘Primary key’,
    `name` varchar(255) DEFAULT NULL COMMENT ‘Name’,
    PRIMARY KEY (`id`)
    );
    ALTER TABLE `agents`
    ADD CONSTRAINT uk_agents_name UNIQUE (`name`);
    /*Table structure for table `environments` */

    DROP TABLE IF EXISTS `environments`;
    /*!40101 SET @saved_cs_client = @@character_set_client */;
    /*!40101 SET character_set_client = utf8mb4 */;
    CREATE TABLE `environments` (
    `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT ‘Primary key’,
    PRIMARY KEY (`id`)
    );
    /*Table structure for table `problems` */

    DROP TABLE IF EXISTS `problems`;
    /*!40101 SET @saved_cs_client = @@character_set_client */;
    /*!40101 SET character_set_client = utf8mb4 */;

    CREATE TABLE `problems` (
    `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT ‘Primary key’,
    PRIMARY KEY (`id`)
    );

    /*Table structure for table migration */

    DROP TABLE IF EXISTS migration;

    CREATE TABLE migration (
    id INTEGER AUTO_INCREMENT PRIMARY KEY,
    applied TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP NOT NULL,

    name VARCHAR(255),
    start_time DATETIME,

    up VARCHAR(2048),
    down VARCHAR(2048),

    checksum VARCHAR(32),

    UNIQUE(name)
    );

    INSERT INTO migration(name,start_time,name_checksum)
    VALUES (‘20171114T104726Z’,NOW(),’bf6a379e059beaeab22f67c701b18fae’);

    COMMIT;<|file_sepgo into directory where you want your database created e.g /home/user/mydb/
    create directory mydb/data/db/mysql/
    create directory mydb/conf/

    create file mydb/conf/my.cnf with content below:
    [mysqld]
    datadir=/home/user/mydb/data/db/mysql/

    create file mydb/conf/mysqld.cnf with content below:
    [mysqld]
    datadir=/home/user/mydb/data/db/mysql/

    then run script create_my_db.sh passing parameter DB_NAME=mydb inside scripts folder (/scripts/create_my_db.sh DB_NAME=mydb)
    script creates database specified by parameter DB_NAME inside datadir specified above (/home/user/mydb/data/db/mysql/)

    to restore backup after running script restore_my_db.sh passing parameter DB_NAME=mydb inside scripts folder (/scripts/restore_my_db.sh DB_NAME=mydb) # Artificial Intelligence

    This repository contains some code I wrote during my university studies.

    # Overview

    The project consists of three modules:
    * core contains basic classes used by both agents module.
    * agents contains agents that implement different search algorithms.
    * tsp contains implementations of several algorithms that solve TSP.

    # Usage

    To run any agent:

    mvn exec:java -Dexec.mainClass=”com.davidegriffo.ai.AgentRunner”
    -Dexec.args=”[path_to_agents_config_file]”

    # Authors

    * Davide Griffò ([@davidegriffo](https://github.com/davidegriffo))
    * Daniele Scappini ([@daniloscappini](https://github.com/daniloscappini))

    # License

    This project is licensed under MIT License – see LICENSE file.
    wIEgCnKUW7PQYjEbbIw9yOzvHrPFFaXKkGQql7rFJxFRwUjCBQ+6lVJtN
    jjL6xbWkUZcAxkCJHngiFy78vLq+9qjtjNcjRwmzBmkmVYppVGB9nMjlGOrlJWSQRFyMIZbcvEip
    Sy+deIcLzWuPflaBRxL5tZSVYZCJUckFgEUSUOSIIBbWbjYnLTjvPQmIiEgkETGSRcYkyeXFRmRs
    jHDLbbfgJCRkSFDAwMSMTHRHTu/qKwsNC5XOywWCxeXl50dHRERMTExISFiUlJSUlJSUlJSUlJSU
    lJSUlJSUlJSUlJSUlJSUlJSUnR39NbV+bUsLi5OT09PT09PT09PT09PT09PT09PT09PT09PT09
    PRdfX19fX19fX19fX19fX19fX19fX19fb29vb29vb29vb29vb29vb29vb29vb29vfz+gIQAAAP//
    AAD/+wMAAP/+AwAA/wMAAP/+AwAA/wMAAP/+AwAA/wMAAP/+AwAA/wMAAP/+AwAA/wMAAP/+Aw
    AA/wMAAP/+AwAA/wMAAP/+AwAA/wMAAP/+AwAA/z8AAP9/AAD/fwAA/x8AAP9/AAD/fwAA/z8AAP
    9/AAD/fwAA/x8AAP9/AAD/fwAAAAMAAAAAAAIAAAAAACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
    AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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tbWlpampra21tbWtra21tbWysoqKiopKSkrKysoJCQiLi42NjaampqaioqKioqKioqKiorKysoKCgsLCwsJCQiLi42NjaampqaioqKioqKiopKSksJCQiLi42NjaampqaioqKiorKysoJCQiLi42NjaampqaioqKiopKSksJCQiLi42NjaampqaioqKirKysoKCgsLCwsJCQiLi42NjaampqaioqKirKysoKCgsLCwpKWloaWhoaGhoaGhoaGhoamprSytLSytLSytLa21tbWtra21tbWtra21tbWyurra291dnZ293dzczMyMjIxsbGxsXFxdHS08TEyMrKysoJCQiLi42NjbGxsWFhaWlpYWFlZWVmZmZubmxsbGxtbW11dnZ21tbWtra21tbWtra21tbWyurra291dnZ293dzczMyMjIxsbGxsXFxdHS08TEyMrKysoJCQiLi42NjbGxsWFhaWNna25ubmdna25ubmdnb25ubmdnb25ubmdnb25ubmdncHNzcXRydndycndycndycndycndydncHNzcXRydndycndycndydncHNzcXRydndydndycndydncHNzcXRydndydndyeHp6epqbmpqbmpqbmpqbnpqbnpqbnpqbnpqbnpqbnpobGlpaWhoaFhaWFhbWhsaGlpaWhoaFhaWFhbWhsaGlpaWhoaFhaWFhbWhsaGlpaWhoaFhampqampra290cHZzdHNzdHNzdHNzdHNzdHNzdHNzdHNzdHZvcnNydnNydnNydnNydnNydnNydoaGoaGoaGoaGoaGoaGoaGoaFoYGBoYGBoYGBoYGBoYGBoYGBoYGBoWGhqampra290cHZzdHNzdHNzdHNzdGNmcGNmcGNmcGNmcGNmcGNmcGNmcGNjcXMzcXMzcXMzcXMzcXMzeHp6epqcHFxceHp6epqcHFxceHp6epqcHFxceHp6epqcHFxceHp6enp+fn56enp+fn56enp+fn56enpycnJaVlpWWlpWWlpWWlpWWlpWWlpWWlpWWlraxsrKysrKysrKysrKysrKRkaGRkaGRkaGRkaGRkaGRkaGRkbFxcdnJaVlpWWlpWWlpWWlpWWlraxsrKysrKysrKysrKRkaGRkaGRkbFxcdnJaVlbazszMyMrMyMrMyMrMyMrMyMoKDgwMDgwMDgwMDgwMDgwM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yczFuclpuclpuclpuclpuclpueltpbnVsbnVsbnVsbnVsbnVsbnVoZXlvblpvblpvblpvblpvblpvbloYGhkYGBgbGlrcmlrcmlrcmlrcmlrcmlrcmlreWsrdHZzbXYrdHZzbXYrdHZzbXYrdHZzbXYreWIocnhpbmphamphamphamphamphamlrbnlrenlrenlrenlrenlremdqemdqemdqemdqemdqemdqelptdl52dl52dl52dl52dl53dm93cm93cm93cm93cm93cmcpeHoqdHYqcHYqcHYqcHYqcHYqdDVwaGEhdGUhdGUhdGUhdGUhdGUhdGVibHZibHZibHZibHZibHXpj30wfnowfnowfnowfnowgIKggILAxMLAyMLAyMLAyMLAyMLAzMb24sb24sb24sb24sb24sfGTkfGTkfGTkfGTkfGTkeHz38/H38/H38/H38/H38/D07PD07PD07PD07PDSwoLDSoLDSoLDSoLDSoLGxyevnu/ePu/ePu/ePu/ePu/ePujququququququququqqqqqqqqqqqqqqqqqrqxsvLu/v/u/v/u/v/u/v/u/v/u/v/u/r66vr66vr66vr66vr66vr66vr66vr66vv76/j76/j76/j76/j76/j76/j76/j76/r68ALDALDALDALDALDALDALDAxAQCBBAYEGBgUGBgUGBgUGBgUGBgUEBgUEBgUEBgUEBgUFCAUFCAUFCAUFCAUFCAUBAQEBAYGCggKDhsbGBgcGBgcGBgcGBgcGBgcGBgdEBgdEBgdEBgdEBgdEBgYEFAQQFCAsLIyMtNTUxMTExMTExMTExMTExMTExMSApISHBsZHBYVFhcVFhcVFhcVFhcVFhcVBQUEBCAkICAoKKigpKSkrKyssLCwtLTEwNDIyMiIsImRpPUFTSUFDSEFWUUFSVEFTVEBUUUFEWEFNWEFLSEFUVEFMTEBMSEBMSEBMSEBMREBEPEBEPEBEPEBEPEBEPAikJKCoqqKhooKGihYaFiYeGiYeGiYeGiYeGiYeHiImHiImHiImHiImHiImHSklKSorKKmoqaipqaipqaipqaipqaipqiIoICIgLChsrKiwrKywrKywrKywrKywoKOjpKWmpKejpKWmpKejpKWmpKejpKWmqKiwiICIgLChsrKiwrLykvLykvLykvLykvLykoKOjqauqsLOvsLOvsLOvsLOvsLOvpKKspKKspKKspKKspKKsqKOorLOxrMu/tMu/tMu/tMu/tMu/tMaCoqrCrsvDsuvDsuvDsuvDsuvDuurKrurrKrurrKrurrKrurrKrussrrsvDrsvDrsvDrsvDrswCiqrCrurvLvuvbvuvbvuvbvuvbwDCqrurvvvvvvvvvvvvvvvvvvvvvvvwDErqrrrv77/v77/v77/v77/v77/wsDCrrrv77/v77/v77/v77/wsDCsrqwrsrfAvvcvfvcvfvcvfvcvfvgDKrrrv79/fw==
    “””
    }

    self.assertEqual(self.extractedData[“data”][“payload”], expectedPayload)

    # Test payload extracted data against expected data.
    self.assertEqual(self.extractedData[“data”][“payloadType”], “image”)
    self.assertEqual(self.extractedData[“data”][“payloadEncoding”], “base64”)

    # Test source extracted data against expected data.
    self.assertEqual(self.extractedData[“source”][“type”], “url”)
    self.assertEqual(self.extractedData[“source”][“value”], “http://example.com/image.jpg”)

    # Test destination extracted data against expected data.
    self.assertEqual(self.extractedData[“destination”][“type”], “device”)

    # Test metadata extracted data against expected data.
    self.assertEqual(len(self.extractedData[“metadata”]), len(expectedMetadata))

    # Check all metadata items were correctly extracted.
    foundItems = {}

    def checkFoundItems():
    “””Check all metadata items have been found.”””
    missingItems = []

    # Iterate through expected metadata items.
    for itemKey,itemValue in iteritems(expectedMetadata):
    foundItemValue = foundItems[itemKey]

    # If item hasn’t been found yet then raise exception.
    if itemValue != foundItemValue:
    missingItems.append(itemKey)

    assert len(missingItems) == 0

    messageList.append(“All metadata items were correctly extracted.”)

    messageList.append(“-“*60)

    print “n”.join(messageList)

    def checkMetadata(metadataItem):
    “””Check metadata item matches expectations.”””

    # Get key/value pair from metadata item.
    itemKey,itemValue = iteritems(metadataItem)[0]

    # If value matches expectation then record item as being found.
    if itemValue == expectedMetadata[itemKey]:
    foundItems[itemKey] = itemValue

    checkFoundItems()

    def test_extractPayloadFromPayloadWithTextAndUrlSourceAndDestinationWithMetadata(self):

    “””
    Test extracting payload from payload with text source type,
    url destination type,
    text payload type,
    base64 payload encoding,
    device destination type,
    valid timestamp,
    unique identifier,
    additional valid fields,
    invalid fields,
    empty fields removed,
    valid timestamp format,
    numeric timestamp value,
    numeric unique identifier value,
    correct source url format,
    correct destination device format,

    using sample input:

    {
    “timestamp”: “20160901235959”,
    “uid”: “-9223372036854775809”,
    “source”: {
    “type”: “text”,
    “value”: “(TEXT_SOURCE_VALUE)”,
    },
    “destination”: {
    “type”: “url”,
    “value”: “(URL_DESTINATION_VALUE)”,
    },
    “payload”: {
    “encoding”: “(PAYLOAD_ENCODING)”,
    },
    “(FIELD)”: “(VALUE)”,