text:
from django.db.models import Model
from django.db.models import ForeignKey
from django.db.models import BooleanField
from django.db.models import CharField
from django.db.models import TextField
from django.db.models import DateTimeField
from django.utils.translation import ugettext as _
from apps.account.models import Account

SIZE_CHOICES = [      # Body Hight
    ('SMALL', _('SMALL')),  # 0cm - 145cm
    ('MEDIUM', _('MEDIUM')), # 145cm - 175cm
    ('LARGE', _('LARGE'))   # 175cm +
]

class Bike(Model):

    # main data
    team = ForeignKey('team.Team', related_name='bikes')
    name = CharField(max_length=1024)
    gallery = ForeignKey('gallery.Gallery')
    description = TextField()
    active = BooleanField(default=True)
    reserve = BooleanField(default=False) # not requestable
    station = ForeignKey('station.Station', related_name="bikes")
    lockcode = CharField(max_length=1024)
    size = CharField(max_length=64, choices=SIZE_CHOICES, default='MEDIUM')
    lights = BooleanField(default=False) # to cycle when dark

    # metadata
    created_by  = ForeignKey(Account, related_name="bikes_created")
    created_on  = DateTimeField(auto_now_add=True)
    updated_by  = ForeignKey(Account, related_name="bikes_updated")
    updated_on  = DateTimeField(auto_now=True)

    def __unicode__(self):
        return self.name

    class Meta:

        ordering = ['name']


text:
import React, { Component, PropTypes } from 'react';
import { PTORecord } from '../../reducers/pto-reducer';

class PTOForm extends Component {

    constructor(props) {
        super(props);

        this._handleApplyPTO = ::this._handleApplyPTO;
    }

    _handleApplyPTO() {

        let startDate = this.refs.startDate;
        let toDate = this.refs.toDate;
        let memory = this.refs.memory;

        this.props.handleApplyPTO(new PTORecord({
            startDate: startDate.value,
            toDate: toDate.value,
            memory: memory.value
        }));
    }

    render() {

        return (

Apply A PTO

                                    <input className="mdl-textfield__input" type="text" ref="startDate" />
                                    Start Date

                                    <input className="mdl-textfield__input" type="text" ref="toDate" />
                                    To Date

                                    <textarea className="mdl-textfield__input" type="text" rows="3" ref="memory"></textarea>
                                    Memory

                                <button className="mdl-button mdl-js-button mdl-button--raised mdl-button--colored" onClick={this._handleApplyPTO}>
                                    Apply
                                </button>

        );
    }
}

PTOForm.propTypes = {
    newPTO: PropTypes.object.isRequired,
    handleApplyPTO: PropTypes.func.isRequired
};

export default PTOForm;

redpajama_set_name: RedPajamaGithub


text:
#reset {
  display: flex;
  flex-flow: column;
  font-size: 16px;
  min-height: 423px;
  padding: 40px 17px 80px;
  text-align: center;
  width: 722px;
}

#reset #reset-controls {
  bottom: 40px;
  justify-content: center;
  margin-top: auto;
}

#reset-controls button {
  margin: 0 10px;
}

#reset #reset-warning-icon {
  height: 112px;
}

#reset #reset-warning-msg,
#reset #powerwash-warning-msg,
#reset #powerwash-and-rollback-warning-msg {
  color: #606060;
  font-size: 22px;
  padding: 5px 45px 30px;
}

.reset-text {
  color: #606060;
}

#reset #reset-warning-details,
#reset #reset-revert-promise-msg {
  padding: 20px 40px 0;
}

#reset #reset-warning-restart {
  padding: 30px 40px 0;
}

#reset #rollback {
  padding: 30px 40px 10px;
}

#reset #reset-revert-spinner-message {
  display: inline-block;
  padding: 25px 0;
  vertical-align: middle;
}

#reset #reset-revert-spinner {
  margin-top: 0;
  vertical-align: middle;
}

.powerwash-proposal-specific,
.rollback-proposal-specific,
.revert-promise-specific,
.restart-required-specific {
  display: none;
}

.powerwash-proposal-view .powerwash-proposal-specific,
.rollback-proposal-view .rollback-proposal-specific,
.restart-required-view .restart-required-specific,
.revert-promise-view .revert-promise-specific {
  display: block;
}

#reset-restart-button,
#reset-button,
#reset-toconfirm-button,
#reset-cancel-button,
.revert-promise-view #reset-controls {
  display: none;
}

.restart-required-view #reset-restart-button,
.powerwash-proposal-view #reset-toconfirm-button,
.rollback-proposal-view #reset-toconfirm-button,
.restart-required-view #reset-cancel-button,
.powerwash-proposal-view #reset-cancel-button,
.rollback-proposal-view #reset-cancel-button {
  display: inline-block;
}


text:
from django.conf.urls.defaults import url
from rest_framework.settings import api_settings

def format_suffix_patterns(urlpatterns, suffix_required=False, allowed=None):
    """
    Supplement existing urlpatterns with corresponding patterns that also
    include a '.format' suffix.  Retains urlpattern ordering.

    urlpatterns:
        A list of URL patterns.

    suffix_required:
        If `True`, only suffixed URLs will be generated, and non-suffixed
        URLs will not be used.  Defaults to `False`.

    allowed:
        An optional tuple/list of allowed suffixes.  eg ['json', 'api']
        Defaults to `None`, which allows any suffix.
    """
    suffix_kwarg = api_settings.FORMAT_SUFFIX_KWARG
    if allowed:
        if len(allowed) == 1:
            allowed_pattern = allowed[0]
        else:
            allowed_pattern = '(%s)' % '|'.join(allowed)
        suffix_pattern = r'\.(?P<%s>%s)$' % (suffix_kwarg, allowed_pattern)
    else:
        suffix_pattern = r'\.(?P<%s>[a-z]+)$' % suffix_kwarg

    ret = []
    for urlpattern in urlpatterns:
        # Form our complementing '.format' urlpattern
        regex = urlpattern.regex.pattern.rstrip('$') + suffix_pattern
        view = urlpattern._callback or urlpattern._callback_str
        kwargs = urlpattern.default_args
        name = urlpattern.name
        # Add in both the existing and the new urlpattern
        if not suffix_required:
            ret.append(urlpattern)
        ret.append(url(regex, view, kwargs, name))
    return ret


text:
Sun Steel Color Palette for Wing IDE
==========================
Optional color palette for the Python Wing IDE

![ScreenShot](/screenshots/sun_steel_editor_screen.jpg)

About
==========================
Sun Steel is a custom color scheme designed for the Python Wing IDE. The scheme is the color approximation of a #FFFC6F Triad with high contrast.

Author: RazorX aka Daniel Hill

Sun Steel Installation
==========================
1. Copy the sun-steel.plt file into the `Wing IDE/resources/palettes` folder.
2. Copy the sun-steel folder (containing the python.stx) into the `Wing IDE/resources/syntax` folder.
3. If you already have the Wing IDE open, then you must restart it to initialize the new palette.
4. The Sun Steel color palette will show up under Edit -> Preferences -> User Interface -> Color Palette
5. Use the Match Palette option to colorize the entire interface.

Support and IDE
==========================
- Support: Send requests or comments to: public at razorx.com | Please allow 2-3 days for a reply. Note: The Wingware folks are not required to support these files, so please don't bother them about it.<br />
- IDE info: Visit http://wingware.com for more information about the Python Wing IDE, and the cool people behind it.


text:
package dao.interfaces;

import basico.Produto;
import dao.generico.IDAOGenerico;

public interface IDAOProduto extends IDAOGenerico<Produto> {

}


text:
package client

import (
	"github.com/operator-framework/operator-lifecycle-manager/pkg/api/client/clientset/versioned"
	"k8s.io/client-go/rest"
)

// NewClient creates a client that can interact with OLM resources in k8s api
func NewClient(kubeconfig string) (client versioned.Interface, err error) {
	var config *rest.Config
	config, err = getConfig(kubeconfig)
	if err != nil {
		return
	}
	return versioned.NewForConfig(config)
}


text:
define(['jquery', 'cfgs', 'API',
  'core/core-modules/framework.event',
  'core/core-modules/framework.ajax',
  'core/core-modules/framework.base64',
  'core/core-modules/framework.block',
  'core/core-modules/framework.dialog',
  'core/core-modules/framework.generator',
  'core/core-modules/framework.layout',
  'core/core-modules/framework.util',
  'core/core-modules/framework.form',
  'core/core-modules/framework.table',
  'core/core-modules/framework.dict',

  "core/core-modules/framework.cookie",
  'core/core-plugins/plugins-logging'],
  function ($, cfgs, api, event, ajax, base64, block, dialog, generator, layout, util, form, table, dict, cookie) {

    String.prototype.startWith = function (str) {
      var reg = new RegExp("^" + str);
      return reg.test(this);
    }

    String.prototype.endWith = function (str) {
      var reg = new RegExp(str + "$");
      return reg.test(this);
    }

    form.source = layout;

    var exportModule = {
      config: cfgs,
      api: api,
      // event: event,
      // ajax: ajax,
      base64: base64,
      block: block,
      generator: generator,
      layout: layout,
      util: util,
      form: form,
      table: table,
      dict: dict,
      cookie: cookie,

      // 对话框处理
      alert: dialog.alertText,
      confirm: dialog.confirm,
      // ajax处理
      get: ajax.get,
      post: ajax.post,
      // 事件处理
      on: event.on,
      off: event.off,
      raise: event.raise,

      Start: function (dependencies) {
        console.info("应用程序启动");
        require(dependencies, function () {
          layout.init();
        })();
      }
    };

    return exportModule
  });


text:
/*
 * native_window::xcb
 * Native Window implementation for XCB.
 */

#ifndef SKUI_GUI_NATIVE_WINDOW_XCB_H
#define SKUI_GUI_NATIVE_WINDOW_XCB_H

#include "gui/native_window.h++"

#include <core/utility.h++>

#include <memory>
#include <unordered_map>

#include <xcb/xcb.h>

namespace skui::gui::xcb
{
  enum class atom
  {
    wm_protocols,
    wm_delete_window,
    wm_change_state,
  };
  static const std::unordered_map<atom, std::string> atom_names
  {
    {atom::wm_protocols, "WM_PROTOCOLS"},
    {atom::wm_delete_window, "WM_DELETE_WINDOW"},
    {atom::wm_change_state, "WM_CHANGE_STATE"},
  };

  class data
  {
  protected:
    data();
    virtual ~data();
    data(xcb_connection_t* connection);

    int preferred_screen_index;
    xcb_connection_t* connection;
    xcb_screen_t* preferred_screen;

    std::unordered_map<atom, xcb_atom_t> atoms;

  private:
    void initialize_atoms();
    void initialize_atom(atom atom);
  };
}

namespace skui::gui::native_window
{
  class xcb : public gui::xcb::data
            , public base
  {
  public:
    xcb();
    ~xcb() override;

    void create(const graphics::pixel_position& position,
                const graphics::pixel_size& size) override;
    void show() final;
    void hide() final;
    void close() final;

    core::string get_title() const final;
    void set_title(const core::string& title) final;
    std::pair<graphics::pixel_position, graphics::pixel_size> get_current_geometry() const override;

    xcb_connection_t* get_connection() const;
    xcb_window_t get_window() const;
    const xcb_atom_t& get_atom(gui::xcb::atom atom) const;

  protected:
    xcb(std::unique_ptr<native_visual::base>&& native_visual,
        xcb_connection_t* connection);

    xcb_window_t window;
  };
}

#endif


text:
package org.openspaces.itest.core.space.mode.listeners;

import com.gigaspaces.cluster.activeelection.SpaceMode;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.openspaces.core.GigaSpace;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import static org.junit.Assert.*;

/**
 * @author shaiw
 */
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration("classpath:/org/openspaces/itest/core/space/mode/listeners/mode-listener.xml")
public class SpaceModeListenerTest   {

    private static final int TIMEOUT = 10000;

     @Autowired protected SpaceModeListenerBean modeListener;

     @Autowired protected GigaSpace gigaSpace1;

     @Autowired protected GigaSpace gigaSpace2;

    public SpaceModeListenerTest() {

    }

    protected String[] getConfigLocations() {
        return new String[]{"/org/openspaces/itest/core/space/mode/listeners/mode-listener.xml"};
    }

     @Test public void testModeListener() {
        assertNotNull(modeListener.state);
        assertNotNull(gigaSpace1);
        assertNotNull(gigaSpace2);
        assertEquals(2, modeListener.state.size());
        assertTrue(modeListener.state.containsKey(gigaSpace1.getSpace().getURL().toString()));
        assertTrue(modeListener.state.containsKey(gigaSpace2.getSpace().getURL().toString()));
        assertEquals(SpaceMode.PRIMARY, modeListener.state.get(gigaSpace1.getSpace().getURL().toString()));
        assertEquals(SpaceMode.BACKUP, modeListener.state.get(gigaSpace2.getSpace().getURL().toString()));

        // shut down space1 and wait for active election to do its stuff
        try {
            gigaSpace1.getSpace().getDirectProxy().shutdown();
            Thread.sleep(TIMEOUT);
        } catch (Exception e) {
            fail(e.getMessage());
        }

        // check the space2 is now the primary
        assertEquals(SpaceMode.PRIMARY, modeListener.state.get(gigaSpace2.getSpace().getURL().toString()));
    }
}


text:
FILE(REMOVE_RECURSE
  "CMakeFiles/gtest-typed-test_test.dir/test/gtest-typed-test_test.cc.o"
  "CMakeFiles/gtest-typed-test_test.dir/test/gtest-typed-test2_test.cc.o"
  "gtest-typed-test_test.pdb"
  "gtest-typed-test_test"
)

# Per-language clean rules from dependency scanning.
FOREACH(lang CXX)
  INCLUDE(CMakeFiles/gtest-typed-test_test.dir/cmake_clean_${lang}.cmake OPTIONAL)
ENDFOREACH(lang)


text:
package segmentedfilesystem;

public class FileRetriever {

	public FileRetriever(String server, int port) {
        // Save the server and port for use in `downloadFiles()`
        //...
	}

	public void downloadFiles() {
        // Do all the heavy lifting here.
        // This should
        //   * Connect to the server
        //   * Download packets in some sort of loop
        //   * Handle the packets as they come in by, e.g.,
        //     handing them to some PacketManager class
        // Your loop will need to be able to ask someone
        // if you've received all the packets, and can thus
        // terminate. You might have a method like
        // PacketManager.allPacketsReceived() that you could
        // call for that, but there are a bunch of possible
        // ways.
	}

}


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
                "http://www.w3.org/TR/REC-html40/loose.dtd">

  <title>Description of write_dtank</title>
  <meta name="keywords" content="write_dtank">
  <meta name="description" content="Dump mesh to datatank file">
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  <meta name="generator" content="m2html v1.5 © 2003-2005 Guillaume Flandin">
  <meta name="robots" content="index, follow">
  <link type="text/css" rel="stylesheet" href="../m2html.css">

Home >  fvcom_prepro > write_dtank.m

write_dtank

PURPOSE

Dump mesh to datatank file

SYNOPSIS

function write_dtank(fname,Mobj,geographic)

DESCRIPTION

 Dump mesh to datatank file

 function dump_dtascii(fname,Mobj)

 DESCRIPTION:
    Dump mesh, open boundary nodes, river nodes, and probe nodes to DTascii file

 INPUT
   fname = datatank file name
   Mobj  = mesh object

 OUTPUT:
    fname:  ascii datatank file

 Author(s):
    Geoff Cowles (University of Massachusetts Dartmouth)

 Revision history

CROSS-REFERENCE INFORMATION

This function calls:

This function is called by:

SOURCE CODE

0001 function write_dtank(fname,Mobj,geographic)
0002 % Dump mesh to datatank file
0003 %
0004 % function dump_dtascii(fname,Mobj)
0005 %
0006 % DESCRIPTION:
0007 %    Dump mesh, open boundary nodes, river nodes, and probe nodes to DTascii file
0008 %
0009 % INPUT
0010 %   fname = datatank file name
0011 %   Mobj  = mesh object
0012 %
0013 % OUTPUT:
0014 %    fname:  ascii datatank file
0015 %
0016 % Author(s):
0017 %    Geoff Cowles (University of Massachusetts Dartmouth)
0018 %
0019 % Revision history
0020
0021 % parse input args
0022 cartesian = true;
0023 if(exist('geographic'))
0024   cartesian = false;
0025 end;
0026
0027 if(~cartesian)
0028   % open datatank file
0029   fid = fopen(fname,'w');
0030   fprintf(fid,'DataTank Binary File\n');
0031   fprintf(fid,'Bathymetry_Geog\n');
0032   fprintf(fid,'TriangularMesh2D\n');
0033
0034   %Grid
0035   fprintf(fid,'Points\n');
0036   fprintf(fid,'%d %d \n',2,Mobj.nVerts);
0037   for i=1:Mobj.nVerts
0038     fprintf(fid,'%f %f \n',Mobj.lon(i),Mobj.lat(i));
0039   end;
0040
0041   % elements
0042   fprintf(fid,'Triangles\n');
0043   fprintf(fid,'%d %d\n',3,Mobj.nElems);
0044   for i=1:Mobj.nElems
0045     fprintf(fid,'%d %d %d \n',Mobj.tri(i,1)-1,Mobj.tri(i,2)-1,Mobj.tri(i,3)-1);
0046   end;
0047 else
0048   % open datatank file
0049   fid = fopen(fname,'w');
0050   fprintf(fid,'DataTank Binary File\n');
0051   fprintf(fid,'Bathymetry_Cart\n');
0052   fprintf(fid,'TriangularMesh2D\n');
0053
0054   %Grid
0055   fprintf(fid,'Points\n');
0056   fprintf(fid,'%d %d \n',2,Mobj.nVerts);
0057   for i=1:Mobj.nVerts
0058     fprintf(fid,'%f %f \n',Mobj.x(i),Mobj.y(i));
0059   end;
0060
0061   % elements
0062   fprintf(fid,'Triangles\n');
0063   fprintf(fid,'%d %d\n',3,Mobj.nElems);
0064   for i=1:Mobj.nElems
0065     fprintf(fid,'%d %d %d \n',Mobj.tri(i,1)-1,Mobj.tri(i,2)-1,Mobj.tri(i,3)-1);
0066   end;
0067 end;
0068
0069
0070
0071 % bathymetry
0072 fprintf(fid,'Values\n');
0073 fprintf(fid,'%d\n',Mobj.nVerts);
0074 for i=1:Mobj.nVerts
0075   fprintf(fid,'%d \n',Mobj.h(i));
0076 end;
0077
0078
0079 % time step
0080 fprintf(fid,'Time Step\n');
0081 fprintf(fid,'TriangularMesh2D\n');
0082 fprintf(fid,'Use Last Grid\n');
0083 fprintf(fid,'Values\n');
0084 fprintf(fid,'%d\n',Mobj.nVerts);
0085 for i=1:Mobj.nVerts
0086   fprintf(fid,'%d \n',Mobj.ts(i));
0087 end;
0088
0089 % open boundary nodes
0090 if(Mobj.nObs > 0)
0091 fprintf(fid,'ObcNodes\n');
0092 fprintf(fid,'NumberList\n');
0093 fprintf(fid,'%d\n',sum(Mobj.nObcNodes));
0094 for i=1:Mobj.nObcNodes(1)
0095   fprintf(fid,'%d\n',Mobj.obc_nodes(1,i));
0096 end;
0097 end;
0098
0099 % river nodes
0100 if(Mobj.nRivers > 0)
0101 fprintf(fid,'RivNodes\n');
0102 fprintf(fid,'NumberList\n');
0103 fprintf(fid,'%d\n',Mobj.nRivNodes(1));
0104 for i=1:Mobj.nRivNodes(1);
0105   fprintf(fid,'%d\n',Mobj.riv_nodes(1,i));
0106 end;
0107 end;
0108
0109 fclose(fid);
0110

<address>Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005</address>


text:
package vecbackup

import (
	"crypto/rand"
	"crypto/sha1"
	"errors"
	"fmt"
	"golang.org/x/crypto/nacl/secretbox"
	"golang.org/x/crypto/pbkdf2"
	"io"
)

type EncKey [32]byte

func (key EncKey) String() string {
	return fmt.Sprintf("Key-%x", []byte(key[:]))
}

func encryptBytes(key *EncKey, text []byte, out []byte) ([]byte, error) {
	var nonce [24]byte
	if _, err := io.ReadFull(rand.Reader, nonce[:]); err != nil {
		return nil, err
	}
	total := len(nonce) + len(text) + secretbox.Overhead
	if cap(out) < len(nonce)+len(text) {
		out = make([]byte, len(nonce), total)
	} else {
		out = out[:len(nonce)]
	}
	copy(out, nonce[:])
	encrypted := secretbox.Seal(out, text, &nonce, (*[32]byte)((key)))
	return encrypted, nil
}

func decryptBytes(key *EncKey, encrypted []byte, out []byte) ([]byte, error) {
	var nonce [24]byte
	copy(nonce[:], encrypted[:24])
	decrypted, ok := secretbox.Open(out[:0], encrypted[24:], &nonce, (*[32]byte)(key))
	if !ok {
		return nil, errors.New("Unable to decrypt")
	}
	return decrypted, nil
}

func genKey(pw []byte, rounds int) ([]byte, *EncKey, *EncKey, []byte, error) {
	salt := make([]byte, 32)
	if _, err := io.ReadFull(rand.Reader, salt); err != nil {
		return nil, nil, nil, nil, err
	}
	key := pbkdf2.Key(pw, salt, rounds, 32, sha1.New)
	var masterKey EncKey
	copy(masterKey[:], key)
	var storageKey EncKey
	if _, err := io.ReadFull(rand.Reader, storageKey[:]); err != nil {
		return nil, nil, nil, nil, err
	}
	fpSecret := make([]byte, 64)
	if _, err := io.ReadFull(rand.Reader, fpSecret); err != nil {
		return nil, nil, nil, nil, err
	}
	return salt, &masterKey, &storageKey, fpSecret, nil
}

func getMasterKey(pw, salt []byte, rounds int) *EncKey {
	key := pbkdf2.Key(pw, salt, rounds, 32, sha1.New)
	var masterKey EncKey
	copy(masterKey[:], key)
	return &masterKey
}


text:
Test = require('connecttest')
require('cardinalities')
local events = require('events')
local mobile_session = require('mobile_session')

--ToDo: Remove below line when heartbeat function work well on protocol 3.
config.defaultProtocolVersion = 2 -- to avoid error with heartbeat function

---------------------------------------------------------------------------------------------
-----------------------------Required Shared Libraries---------------------------------------
---------------------------------------------------------------------------------------------
local commonFunctions = require('user_modules/shared_testcases/commonFunctions')
local commonSteps = require('user_modules/shared_testcases/commonSteps')
local commonTestCases = require('user_modules/shared_testcases/commonTestCases')
local testCasesForPolicyTable = require('user_modules/shared_testcases/testCasesForPolicyTable')
require('user_modules/AppTypes')

APIName = "OnTouchEvent" -- set API name

Apps = {}
Apps[1] = {}
Apps[2] = {}

function DelayedExp(time)
  local event = events.Event()
  event.matches = function(self, e) return self == e end
  EXPECT_EVENT(event, "Delayed event")
  	:Timeout(time+1000)
  RUN_AFTER(function()
              RAISE_EVENT(event, event)
            end, time)
end

local function OnTouchEvent_Notification_IsIgnored(TestCaseName)
	Test[TestCaseName]  = function(self)

		DelayedExp(2000)
		local parameter = {
						type = "BEGIN",
						event = { {c = {{x = 1, y = 1}}, id = 0, ts = {900} } }
					}

		--hmi side: send OnTouchEvent
		self.hmiConnection:SendNotification("UI.OnTouchEvent",	parameter)

		--mobile side: expected OnTouchEvent notification
		--EXPECT_NOTIFICATION("OnTouchEvent", parameter)
		EXPECT_NOTIFICATION("OnTouchEvent", {})
		:Times(0)
	end
end

---------------------------------------------------------------------------------------------
-------------------------------------------Preconditions-------------------------------------
---------------------------------------------------------------------------------------------

	commonSteps:DeleteLogsFileAndPolicyTable()

	--Print new line to separate new test cases group
	commonFunctions:newTestCasesGroup("Preconditions")

	function Test:StopSDLToBackUpPreloadedPt( ... )
		-- body
		StopSDL()
		DelayedExp(1000)
	end

	function Test:BackUpPreloadedPt()
		-- body
		os.execute('cp ' .. config.pathToSDL .. 'sdl_preloaded_pt.json' .. ' ' .. config.pathToSDL .. 'backup_sdl_preloaded_pt.json')
		os.execute('rm ' .. config.pathToSDL .. 'policy.sqlite')
	end

	function Test:SetParameterInJson(pathToFile)
		-- body
		pathToFile = config.pathToSDL .. 'sdl_preloaded_pt.json'
		local file  = io.open(pathToFile, "r")
		local json_data = file:read("*all") -- may be abbreviated to "*a";
		file:close()

		local json = require("modules/json")

		local data = json.decode(json_data)
		for k,v in pairs(data.policy_table.functional_groupings) do
			if (data.policy_table.functional_groupings[k].rpcs == nil) then
			    --do
			    data.policy_table.functional_groupings[k] = nil
			else
			    --do
			    local count = 0
			    for _ in pairs(data.policy_table.functional_groupings[k].rpcs) do count = count + 1 end
			    if (count < 30) then
			        --do
					data.policy_table.functional_groupings[k] = nil
			    end
			end
		end

		data.policy_table.functional_groupings.OnTouchEventGroup = {}
		data.policy_table.functional_groupings.OnTouchEventGroup.rpcs = {}
		data.policy_table.functional_groupings.OnTouchEventGroup.rpcs.OnTouchEvent = {}
		data.policy_table.functional_groupings.OnTouchEventGroup.rpcs.OnTouchEvent.hmi_levels = {'FULL'}

		data.policy_table.app_policies.default.groups = {"Base-4", "OnTouchEventGroup"}

		data = json.encode(data)
		-- print(data)
		-- for i=1, #data.policy_table.app_policies.default.groups do
		-- 	print(data.policy_table.app_policies.default.groups[i])
		-- end
		file = io.open(pathToFile, "w")
		file:write(data)
		file:close()
	end

	local function StartSDLAfterChangePreloaded()
		-- body

		Test["Precondition_StartSDL"] = function(self)
			StartSDL(config.pathToSDL, config.ExitOnCrash)
			DelayedExp(1000)
		end

		Test["Precondition_InitHMI_1"] = function(self)
			self:initHMI()
		end

		Test["Precondition_InitHMI_onReady_1"] = function(self)
			self:initHMI_onReady()
		end

		Test["Precondition_ConnectMobile_1"] = function(self)
			self:connectMobile()
		end

		Test["Precondition_StartSession_1"] = function(self)
			self.mobileSession = mobile_session.MobileSession(self, self.mobileConnection)
		end

	end

	StartSDLAfterChangePreloaded()

	function Test:RestorePreloadedPt()
		-- body
		os.execute('cp ' .. config.pathToSDL .. 'backup_sdl_preloaded_pt.json' .. ' ' .. config.pathToSDL .. 'sdl_preloaded_pt.json')
		os.execute('rm ' .. config.pathToSDL .. 'backup_sdl_preloaded_pt.json')
	end
	--End Precondition.1

	--Begin Precondition.2
	--Description: Activation application
	local GlobalVarAppID = 0
	function RegisterApplication(self)
		-- body
		config.application1.registerAppInterfaceParams.appHMIType = {'NAVIGATION'}
		local corrID = self.mobileSession:SendRPC("RegisterAppInterface", config.application1.registerAppInterfaceParams)

		EXPECT_HMINOTIFICATION("BasicCommunication.OnAppRegistered")
		:Do(function (_, data)
			-- body
			GlobalVarAppID = data.params.application.appID
		end)

		EXPECT_RESPONSE(corrID, {success = true})

		-- delay - bug of ATF - it is not wait for UpdateAppList and later
		-- line appID = self.applications["Test Application"]} will not assign appID
		DelayedExp(1000)
	end

	function Test:RegisterApp()
		-- body
		self.mobileSession:StartService(7)
		:Do(function (_, data)
			-- body
			RegisterApplication(self)
		end)
	end
	--End Precondition.2

	--1. Activate application
		--Begin Precondition.1
		--Description: Activation application
			function Test:ActivationApp()
				--hmi side: sending SDL.ActivateApp request
				-- local RequestId = self.hmiConnection:SendRequest("SDL.ActivateApp", { appID = self.applications["Test Application"]})
				local RequestId = self.hmiConnection:SendRequest("SDL.ActivateApp", { appID = GlobalVarAppID})
				EXPECT_HMIRESPONSE(RequestId)

				--mobile side: expect notification
				EXPECT_NOTIFICATION("OnHMIStatus", {hmiLevel = "FULL", systemContext = "MAIN"})
			end
		--End Precondition.1

	--2. Create PT that allowed OnTouchEvent in Base-4 group and update PT
	local PermissionLines_OnTouchEvent =
[[					"OnTouchEvent": {
						"hmi_levels": [
						  "BACKGROUND",
						  "LIMITED",
						  "NONE",
						  "FULL"
						]
					  }]] .. ", \n"

	local PermissionLinesForBase4 = PermissionLines_OnTouchEvent
	local PermissionLinesForGroup1 = nil
	local PermissionLinesForApplication = nil
	--TODO: PT is blocked by ATF defect APPLINK-19188
	--local PTName = testCasesForPolicyTable:createPolicyTableFile(PermissionLinesForBase4, PermissionLinesForGroup1, PermissionLinesForApplication)
	--testCasesForPolicyTable:updatePolicy(PTName)
	-- PAY ATTENTION - now sdl_preloaded is used, may be this TODO is not required

-----------------------------------------------------------------------------------------------
-------------------------------------------TEST BLOCK I----------------------------------------
--------------------------------Check normal cases of Mobile request---------------------------
-----------------------------------------------------------------------------------------------

--Not Applicable

----------------------------------------------------------------------------------------------
-----------------------------------------TEST BLOCK II----------------------------------------
-----------------------------Check special cases of Mobile request----------------------------
----------------------------------------------------------------------------------------------

--Not Applicable

-----------------------------------------------------------------------------------------------
-------------------------------------------TEST BLOCK III--------------------------------------
----------------------------------Check normal cases of HMI notification---------------------------
-----------------------------------------------------------------------------------------------
--Requirement id in JAMA or JIRA:
	--SDLAQ-N_CRS-5: OnTouchEvent
		--SDLAQ-N_CRS-155: TouchType
		--SDLAQ-N_CRS-149: TouchEvent
			--SDLAQ-N_CRS-154: TouchCoord

--Verification criteria:
	--1. Notifies about touch events on the screen's prescribed area

--TODO: Update this script according to answer on APPLINK-17560
----------------------------------------------------------------------------------------------

	--List of parameters:
	--1. type: type=TouchType(BEGIN, MOVE, END), mandatory=true
	--2. event: type=TouchEvent, mandatory="true" minsize="1" maxsize="10" array="true"
		--TouchEvent:
			--id: Integer, minvalue=0, maxvalue=9, mandatory=true
			--ts: Integer, mandatory=true, array=true, minvalue=0, maxvalue=2147483647 minsize=1, maxsize=1000
			--c: TouchCoord, mandatory=true, array=true, minsize=1, maxsize=1000
				--TouchCoord:
					--x: Integer, minvalue=0, maxvalue=10000, mandatory=true
					--y: Integer, minvalue=0, maxvalue=10000, mandatory=true
----------------------------------------------------------------------------------------------

	local function TCs_verify_normal_cases()

		--Print new line to separate new test cases group
		commonFunctions:newTestCasesGroup("Test suite: Check normal cases of HMI notification")

	----------------------------------------------------------------------------------------------
	--Parameter #1: Checks type parameter: type=TouchType(BEGIN, MOVE, END), mandatory=true
	----------------------------------------------------------------------------------------------
		local function TCs_verify_type_parameter()

			--Print new line to separate new test cases group
			commonFunctions:newTestCasesGroup("Test suite: Check type parameter")

			--1. IsInBoundValues
			local types = {"BEGIN", "MOVE", "END", "CANCEL"}
			for i = 1, #types  do
				Test["OnTouchEvent_type_" .. types[i]] = function(self)

					local parameter = {
									type = types[i],
									event = { {c = {{x = 1, y = 1}}, id = 1, ts = {9908} } }
								}

					--hmi side: send OnTouchEvent
					self.hmiConnection:SendNotification("UI.OnTouchEvent",	parameter)

					--mobile side: expected OnTouchEvent notification
					EXPECT_NOTIFICATION("OnTouchEvent", parameter)

				end
			end

			--2. IsMissed
			--3. IsEmtpy
			--4. NonExist
			--5. WrongDataType
			local InvalidType = {	{value = nil, name = "IsMissed"},
									{value = "", name = "IsEmtpy"},
									{value = "ANY", name = "NonExist"},
									{value = 123, name = "WrongDataType"}}

			for i = 1, #InvalidType  do
				Test["OnTouchEvent_type_" .. InvalidType[i].name] = function(self)

					DelayedExp(2000)

					local parameter = {
									type = InvalidType[i].value,
									event = { {c = {{x = 1, y = 1}}, id = 1, ts = {9908} } }
								}

					--hmi side: send OnTouchEvent
					self.hmiConnection:SendNotification("UI.OnTouchEvent", parameter)

					--mobile side: expected OnTouchEvent notification
					EXPECT_NOTIFICATION("OnTouchEvent")
					:Times(0)
				end
			end

		end

		TCs_verify_type_parameter()

	----------------------------------------------------------------------------------------------
	--Parameter #2: Checks event.c.x parameter: type=Integer, minvalue=0, maxvalue=10000, mandatory=true
	----------------------------------------------------------------------------------------------
		local function TCs_verify_event_c_x_parameter()

			--Print new line to separate new test cases group
			commonFunctions:newTestCasesGroup("Test suite: Check event.c.x parameter")

			--1. IsLowerBound
			--2. IsMiddle
			--3. IsUpperBound
			local ValidValues = {	{value = 0, name = "IsLowerBound"},
						{value = 5000, name = "IsMiddle"},
						{value = 10000, name = "IsUpperBound"}}

			for i = 1, #ValidValues  do
				Test["OnTouchEvent_event_c_x_" .. ValidValues[i].name] = function(self)

					local parameter = {
										type = "BEGIN",
										event = { {c = {{x = ValidValues[i].value, y = 1}}, id = 1, ts = {9908} } }
									}

					--hmi side: send OnTouchEvent
					self.hmiConnection:SendNotification("UI.OnTouchEvent", parameter)

					--mobile side: expected OnTouchEvent notification
					EXPECT_NOTIFICATION("OnTouchEvent", parameter)

				end
			end

			--4. IsMissed
			--5. IsOutLowerBound
			--6. IsOutUpperBound
			--7. IsWrongType
			local InvalidValues = {	{value = nil, name = "IsMissed"},
									{value = -1, name = "IsOutLowerBound"},
									{value = 10001, name = "IsOutUpperBound"},
									{value = "2", name = "WrongDataType"}}

			for i = 1, #InvalidValues  do
				Test["OnTouchEvent_event_c_x_" .. InvalidValues[i].name] = function(self)
					DelayedExp(2000)
					local parameter = {
										type = "BEGIN",
										event = { {c = {{x = InvalidValues[i].value, y = 1}}, id = 1, ts = {9908} } }
									}

					--hmi side: send OnTouchEvent
					self.hmiConnection:SendNotification("UI.OnTouchEvent", parameter)

					--mobile side: expected OnTouchEvent notification
					EXPECT_NOTIFICATION("OnTouchEvent")
					:Times(0)
				end
			end

		end

		TCs_verify_event_c_x_parameter()

	----------------------------------------------------------------------------------------------
	--Parameter #3: Checks event.c.y parameter: type=Integer, minvalue=0, maxvalue=10000, mandatory=true
	----------------------------------------------------------------------------------------------
		local function TCs_verify_event_c_y_parameter()

			--Print new line to separate new test cases group
			commonFunctions:newTestCasesGroup("Test suite: Check event.c.y parameter")

			--1. IsLowerBound
			--2. IsMiddle
			--3. IsUpperBound
			local ValidValues = {	{value = 0, name = "IsLowerBound"},
						{value = 5000, name = "IsMiddle"},
						{value = 10000, name = "IsUpperBound"}}

			for i = 1, #ValidValues  do
				Test["OnTouchEvent_event_c_y_" .. ValidValues[i].name] = function(self)

					local parameter = {
										type = "BEGIN",
										event = { {c = {{x = 1, y = ValidValues[i].value}}, id = 1, ts = {9908} } }
									}

					--hmi side: send OnTouchEvent
					self.hmiConnection:SendNotification("UI.OnTouchEvent", parameter)

					--mobile side: expected OnTouchEvent notification
					EXPECT_NOTIFICATION("OnTouchEvent", parameter)

				end
			end

			--4. IsMissed
			--5. IsOutLowerBound
			--6. IsOutUpperBound
			--7. IsWrongType
			local InvalidValues = {	{value = nil, name = "IsMissed"},
									{value = -1, name = "IsOutLowerBound"},
									{value = 10001, name = "IsOutUpperBound"},
									{value = "2", name = "WrongDataType"}}

			for i = 1, #InvalidValues  do
				Test["OnTouchEvent_event_c_y_" .. InvalidValues[i].name] = function(self)
					DelayedExp(2000)
					local parameter = {
										type = "BEGIN",
										event = { {c = {{x = 1, y = InvalidValues[i].value}}, id = 1, ts = {9908} } }
									}

					--hmi side: send OnTouchEvent
					self.hmiConnection:SendNotification("UI.OnTouchEvent", parameter)

					--mobile side: expected OnTouchEvent notification
					EXPECT_NOTIFICATION("OnTouchEvent")
					:Times(0)
				end
			end

		end

		TCs_verify_event_c_y_parameter()

	----------------------------------------------------------------------------------------------
	--Parameter #4 Checks event.c parameter: type=TouchCoord, mandatory=true, array=true, minsize=1, maxsize=1000
	----------------------------------------------------------------------------------------------
		local function TCs_verify_event_c_parameter()

			--Print new line to separate new test cases group
			commonFunctions:newTestCasesGroup("Test suite: Check event.c parameter")

			--1. IsLowerBound
			--2. IsUpperBound

			--Create array 1000 items.
			local c_upperbound = {}
			for i = 1, 1000 do
				table.insert(c_upperbound, {x = i, y = 1})
			end

			local ValidValues = {
						{name = "IsLowerBound", value = {{x = 1, y = 1}}},
						{name = "IsUpperBound", value = c_upperbound}}

			for i = 1, #ValidValues  do
				Test["OnTouchEvent_event_c_" .. ValidValues[i].name] = function(self)

					local parameter = {
										type = "BEGIN",
										event = { {c = ValidValues[i].value, id = 1, ts = {9908} } }
									}

					--hmi side: send OnTouchEvent
					self.hmiConnection:SendNotification("UI.OnTouchEvent", parameter)

					--mobile side: expected OnTouchEvent notification
					EXPECT_NOTIFICATION("OnTouchEvent", parameter)

				end
			end

			--3. IsMissed
			--4. IsOutLowerBound
			--5. IsOutUpperBound
			--6. IsWrongType

			--Create array 1001 items
			local c_outupperbound = {}
			for i = 1, 1001 do
				table.insert(c_outupperbound, {x = i, y = 1})
			end

			local InvalidValues = {	{name = "IsMissed", value = nil},
									{name = "IsOutLowerBound", value = {}},
									{name = "IsOutUpperBound", value = c_outupperbound},
									{name = "WrongDataType", value = 123}}

			for i = 1, #InvalidValues  do
				Test["OnTouchEvent_event_c_" .. InvalidValues[i].name] = function(self)
					DelayedExp(2000)
					local parameter = {
										type = "BEGIN",
										event = { {c = InvalidValues[i].value, id = 1, ts = {9908} } }
									}

					--hmi side: send OnTouchEvent
					self.hmiConnection:SendNotification("UI.OnTouchEvent", parameter)

					--mobile side: expected OnTouchEvent notification
					EXPECT_NOTIFICATION("OnTouchEvent")
					:Times(0)
				end
			end

		end

		TCs_verify_event_c_parameter()

	----------------------------------------------------------------------------------------------
	--Parameter #5: Checks event.ts parameter: type=Integer, mandatory=true, array=true, minvalue=0, maxvalue=2147483647 minsize=1, maxsize=1000
	----------------------------------------------------------------------------------------------
		local function TCs_verify_event_ts_parameter()

			--Print new line to separate new test cases group
			commonFunctions:newTestCasesGroup("Test suite: Check event.ts element parameter")

			--1. IsLowerBound
			--2. IsMiddle
			--2. IsUpperBound

			local ValidValues = {
						{name = "IsLowerBound", value = 0},
						{name = "IsMiddle", value = 1147483647},
						{name = "IsUpperBound", value = 2147483647}}

			for i = 1, #ValidValues  do
				Test["OnTouchEvent_event_ts_" .. ValidValues[i].name] = function(self)

					local parameter = {
										type = "BEGIN",
										event = { {c = {{x = 1, y = 1}}, id = 1, ts = {ValidValues[i].value} } }
									}

					--hmi side: send OnTouchEvent
					self.hmiConnection:SendNotification("UI.OnTouchEvent", parameter)

					--mobile side: expected OnTouchEvent notification
					EXPECT_NOTIFICATION("OnTouchEvent", parameter)

				end
			end

			--4. IsMissed
			--5. IsOutLowerBound
			--6. IsOutUpperBound
			--7. IsWrongType

			local InvalidValues = {	{name = "IsMissed", value = nil},
									{name = "IsOutLowerBound", value = -1},
									{name = "IsOutUpperBound", value = 2147483648},
									{name = "WrongDataType", value = "123"}}

			for i = 1, #InvalidValues  do
				Test["OnTouchEvent_event_ts_" .. InvalidValues[i].name] = function(self)
					DelayedExp(2000)
					local parameter = {
										type = "BEGIN",
										event = { {c = {{x = 1, y = 1}}, id = 1, ts = {InvalidValues[i].value} } }
									}

					--hmi side: send OnTouchEvent
					self.hmiConnection:SendNotification("UI.OnTouchEvent", parameter)

					--mobile side: expected OnTouchEvent notification
					EXPECT_NOTIFICATION("OnTouchEvent")
					:Times(0)
				end
			end

			--Print new line to separate new test cases group
			commonFunctions:newTestCasesGroup("Test suite: Check event.ts array parameter")

			--1. IsLowerBound: covered by above TCs OnTouchEvent_event_ts_IsLowerBound/IsMiddle/IsUpperBound
			--2. IsUpperBound

			--Create array 1000 items.
			local ts_upperbound = {}
			for i = 1, 1000 do
				table.insert(ts_upperbound, i)
			end

			local ValidValues = {
						--{name = "IsLowerBound", value = {1}}, --1. IsLowerBound: covered by above TCs OnTouchEvent_event_ts_IsLowerBound/IsMiddle/IsUpperBound
						{name = "IsUpperBound", value = ts_upperbound}}

			for i = 1, #ValidValues  do
				Test["OnTouchEvent_event_ts_array_" .. ValidValues[i].name] = function(self)

					local parameter = {
										type = "BEGIN",
										event = { {c = {{x =1, y = 1}}, id = 1, ts = ValidValues[i].value } }
									}

					--hmi side: send OnTouchEvent
					self.hmiConnection:SendNotification("UI.OnTouchEvent", parameter)

					--mobile side: expected OnTouchEvent notification
					EXPECT_NOTIFICATION("OnTouchEvent", parameter)

				end
			end

			--3. IsMissed
			--4. IsOutLowerBound
			--5. IsOutUpperBound
			--6. IsWrongType

			--Create array 1001 items
			local ts_outupperbound = {}
			for i = 1, 1001 do
				table.insert(ts_outupperbound, i)
			end

			local InvalidValues = {	{name = "IsMissed", value = nil},
									{name = "IsOutLowerBound", value = {}},
									{name = "IsOutUpperBound", value = ts_outupperbound},
									{name = "WrongDataType", value = 123}}

			for i = 1, #InvalidValues  do
				Test["OnTouchEvent_event_ts_array_" .. InvalidValues[i].name] = function(self)
					DelayedExp(2000)
					local parameter = {
										type = "BEGIN",
										event = { {c = {{x =1, y = 1}}, id = 1, ts = InvalidValues[i].value } }
									}

					--hmi side: send OnTouchEvent
					self.hmiConnection:SendNotification("UI.OnTouchEvent", parameter)

					--mobile side: expected OnTouchEvent notification
					EXPECT_NOTIFICATION("OnTouchEvent")
					:Times(0)
				end
			end

		end

		TCs_verify_event_ts_parameter()

	----------------------------------------------------------------------------------------------
	--Parameter #5: Checks event.id parameter: type=Integer, minvalue=0, maxvalue=9, mandatory=true
	----------------------------------------------------------------------------------------------
		local function TCs_verify_event_id_parameter()

			--Print new line to separate new test cases group
			commonFunctions:newTestCasesGroup("Test suite: Check event.id parameter")

			--1. IsLowerBound
			--2. IsMiddle
			--2. IsUpperBound

			local ValidValues = {
						{name = "IsLowerBound", value = 0},
						{name = "IsMiddle", value = 5},
						{name = "IsUpperBound", value = 9}}

			for i = 1, #ValidValues  do
				Test["OnTouchEvent_event_id_" .. ValidValues[i].name] = function(self)

					local parameter = {
										type = "BEGIN",
										event = { {c = {{x = 1, y = 1}}, id = ValidValues[i].value, ts = {1} } }
									}

					--hmi side: send OnTouchEvent
					self.hmiConnection:SendNotification("UI.OnTouchEvent", parameter)

					--mobile side: expected OnTouchEvent notification
					EXPECT_NOTIFICATION("OnTouchEvent", parameter)

				end
			end

			--4. IsMissed
			--5. IsOutLowerBound
			--6. IsOutUpperBound
			--7. IsWrongType

			local InvalidValues = {	{name = "IsMissed", value = nil},
									{name = "IsOutLowerBound", value = -1},
									{name = "IsOutUpperBound", value = 10},
									{name = "WrongDataType", value = "2"}}

			for i = 1, #InvalidValues  do
				Test["OnTouchEvent_event_ts_" .. InvalidValues[i].name] = function(self)
					DelayedExp(2000)
					local parameter = {
										type = "BEGIN",
										event = { {c = {{x = 1, y = 1}}, id = InvalidValues[i].value, ts = {1} } }
									}

					--hmi side: send OnTouchEvent
					self.hmiConnection:SendNotification("UI.OnTouchEvent", parameter)

					--mobile side: expected OnTouchEvent notification
					EXPECT_NOTIFICATION("OnTouchEvent")
					:Times(0)
				end
			end

		end

		TCs_verify_event_id_parameter()

	----------------------------------------------------------------------------------------------
	--Parameter #6: Checks event parameter: type=TouchEvent, mandatory="true" minsize="1" maxsize="10" array="true"
	----------------------------------------------------------------------------------------------
		local function TCs_verify_event_parameter()

			--Print new line to separate new test cases group
			commonFunctions:newTestCasesGroup("Test suite: Check event array parameter")

			--1. IsLowerBound: covered by above TCs
			--2. IsUpperBound

			--Create array 10 items.
			local event_upperbound = {}
			for i = 0, 9 do
				table.insert(event_upperbound, {c = {{x = i + 1, y = 1}}, id = i, ts = {9908} })
			end

			local ValidValues = {
						{name = "IsUpperBound", value = event_upperbound}}

			for i = 1, #ValidValues  do
				Test["OnTouchEvent_event_array_" .. ValidValues[i].name] = function(self)

					local parameter = {
										type = "BEGIN",
										event = ValidValues[i].value
									}

					--hmi side: send OnTouchEvent
					self.hmiConnection:SendNotification("UI.OnTouchEvent", parameter)

					--mobile side: expected OnTouchEvent notification
					EXPECT_NOTIFICATION("OnTouchEvent", parameter)

				end
			end

			--3. IsMissed
			--4. IsOutLowerBound
			--5. IsOutUpperBound
			--6. IsWrongType

			--Create array 11 items
			local event_outupperbound = {}
			for i = 0, 9 do
				table.insert(event_outupperbound, {c = {{x = i+1, y = 1}}, id = i, ts = {9908}} )
			end
			table.insert(event_outupperbound, {c = {{x = 1, y = 1}}, id = 1, ts = {9908} })

			local InvalidValues = {	{name = "IsMissed", value = nil},
									{name = "IsOutLowerBound", value = {}},
									{name = "IsOutUpperBound", value = event_outupperbound},
									{name = "WrongDataType", value = 123}}

			for i = 1, #InvalidValues  do
				Test["OnTouchEvent_event_array_" .. InvalidValues[i].name] = function(self)
					DelayedExp(2000)
					local parameter = {
										type = "BEGIN",
										event = InvalidValues[i].value
									}

					--hmi side: send OnTouchEvent
					self.hmiConnection:SendNotification("UI.OnTouchEvent", parameter)

					--mobile side: expected OnTouchEvent notification
					EXPECT_NOTIFICATION("OnTouchEvent")
					:Times(0)
				end
			end

		end

		TCs_verify_event_parameter()

	end

	TCs_verify_normal_cases()

----------------------------------------------------------------------------------------------
-----------------------------------------TEST BLOCK IV----------------------------------------
----------------------------Check special cases of HMI notification---------------------------
----------------------------------------------------------------------------------------------
--Requirement id in JAMA or JIRA:
	--APPLINK-14765: SDL must cut off the fake parameters from requests, responses and notifications received from HMI

-----------------------------------------------------------------------------------------------

--List of test cases for special cases of HMI notification:
	--1. InvalidJsonSyntax
	--2. InvalidStructure
	--3. FakeParams
	--4. FakeParameterIsFromAnotherAPI
	--5. MissedmandatoryParameters
	--6. MissedAllPArameters
	--7. SeveralNotifications with the same values
	--8. SeveralNotifications with different values
----------------------------------------------------------------------------------------------

	local function SpecialResponseChecks()

		--Print new line to separate new test cases group
		commonFunctions:newTestCasesGroup("Test suite: Check special cases of HMI notification")

		--1. Verify OnTouchEvent with invalid Json syntax
		----------------------------------------------------------------------------------------------
		function Test:OnTouchEvent_InvalidJsonSyntax()
			DelayedExp(2000)
			--hmi side: send OnTouchEvent
			--":" is changed by ";" after "jsonrpc"
			self.hmiConnection:Send('{"jsonrpc";"2.0","method":"UI.OnTouchEvent","params":{"type":"BEGIN","event":[{"c":[{"x":251,"y":194}],"id":0,"ts":[9908]}]}}')

			EXPECT_NOTIFICATION("OnTouchEvent")
			:Times(0)

		end

		--2. Verify OnTouchEvent with invalid structure
		----------------------------------------------------------------------------------------------
		function Test:OnTouchEvent_InvalidStructure()
			DelayedExp(2000)
			--hmi side: send OnTouchEvent
			--method is moved into params parameter
			self.hmiConnection:Send('{"jsonrpc":"2.0","params":{"method":"UI.OnTouchEvent","type":"BEGIN","event":[{"c":[{"x":251,"y":194}],"id":0,"ts":[9908]}]}}')

			EXPECT_NOTIFICATION("OnTouchEvent")
			:Times(0)
		end

		--3. Verify OnTouchEvent with FakeParams
		----------------------------------------------------------------------------------------------
		function Test:OnTouchEvent_FakeParams()

			--hmi side: send OnTouchEvent
			self.hmiConnection:SendNotification("UI.OnTouchEvent",
						{
							type = "BEGIN",
							fake = 123,
							event = {{fake = 123, c = {{fake = 123, x = 1, y = 1}}, id = 1, ts = {9908} } }
						})

			--mobile side: expected OnTouchEvent notification
			EXPECT_NOTIFICATION("OnTouchEvent",
						{
							type = "BEGIN",
							event = {{c = {{x = 1, y = 1}}, id = 1, ts = {9908} } }
						})
			:ValidIf(function(_,data)

				if data.payload.fake or
					data.payload.event[1].fake or
					data.payload.event[1].c[1].fake then
						print(" SDL forwards fake parameter to mobile ")
						return false
				else
						return true
				end
			end)

		end

		--4. Verify OnTouchEvent with FakeParameterIsFromAnotherAPI
		function Test:OnTouchEvent_FakeParameterIsFromAnotherAPI()

			--hmi side: send OnTouchEvent
			self.hmiConnection:SendNotification("UI.OnTouchEvent",
						{
							type = "BEGIN",
							sliderPosition = 123,
							event = {{sliderPosition = 123, c = {{sliderPosition = 123, x = 1, y = 1}}, id = 1, ts = {9908} } }
						})

			--mobile side: expected OnTouchEvent notification
			EXPECT_NOTIFICATION("OnTouchEvent",
						{
							type = "BEGIN",
							event = {{c = {{x = 1, y = 1}}, id = 1, ts = {9908} } }
						})
			:ValidIf(function(_,data)

				if data.payload.sliderPosition or
					data.payload.event[1].sliderPosition or
					data.payload.event[1].c[1].sliderPosition then
						print(" SDL forwards fake parameter to mobile ")
						return false
				else
						return true
				end
			end)

		end

		--5. Verify OnTouchEvent misses mandatory parameter
		----------------------------------------------------------------------------------------------
		--It is covered when verifying each parameter

		--6. Verify OnTouchEvent MissedAllPArameters
		----------------------------------------------------------------------------------------------
		function Test:OnTouchEvent_AllParameters_AreMissed()
			DelayedExp(2000)
			--hmi side: send OnTouchEvent
			self.hmiConnection:SendNotification("UI.OnTouchEvent",{})

			--mobile side: expected OnTouchEvent notification
			EXPECT_NOTIFICATION("OnTouchEvent")
			:Times(0)

		end

		--7. Verify OnTouchEvent with SeveralNotifications_WithTheSameValues
		----------------------------------------------------------------------------------------------
		function Test:OnTouchEvent_SeveralNotifications_WithTheSameValues()

			--hmi side: send OnTouchEvent
			local parameter = {
									type = "BEGIN",
									event = { {c = {{x = 1, y = 1}}, id = 1, ts = {9908} } }
								}

			--hmi side: send OnTouchEvent
			self.hmiConnection:SendNotification("UI.OnTouchEvent",	parameter)
			self.hmiConnection:SendNotification("UI.OnTouchEvent",	parameter)
			self.hmiConnection:SendNotification("UI.OnTouchEvent",	parameter)

			--mobile side: expected OnTouchEvent notification
			EXPECT_NOTIFICATION("OnTouchEvent", parameter)
			:Times(3)

		end

		--8. Verify OnTouchEvent with SeveralNotifications_WithDifferentValues
		----------------------------------------------------------------------------------------------
		function Test:OnTouchEvent_SeveralNotifications_WithDifferentValues()

			--hmi side: send OnTouchEvent
			local parameter1 = 	{
									type = "BEGIN",
									event = { {c = {{x = 1, y = 1}}, id = 1, ts = {9908} } }
								}

			local parameter2 = 	{
									type = "BEGIN",
									event = { {c = {{x = 2, y = 1}}, id = 1, ts = {9908} } }
								}

			local parameter3 = 	{
									type = "BEGIN",
									event = { {c = {{x = 3, y = 1}}, id = 1, ts = {9908} } }
								}

			--hmi side: send OnTouchEvent
			self.hmiConnection:SendNotification("UI.OnTouchEvent",	parameter1)
			self.hmiConnection:SendNotification("UI.OnTouchEvent",	parameter2)
			self.hmiConnection:SendNotification("UI.OnTouchEvent",	parameter3)

			--mobile side: expected OnTouchEvent notification
			EXPECT_NOTIFICATION("OnTouchEvent", parameter1, parameter2, parameter3)
			:Times(3)

		end

	end

	SpecialResponseChecks()

-----------------------------------------------------------------------------------------------
-------------------------------------------TEST BLOCK V----------------------------------------
-------------------------------------Checks All Result Codes-----------------------------------
-----------------------------------------------------------------------------------------------

--Description: Check all resultCodes

--TODO: Update this script according to answer on APPLINK-17560

--Requirement id in JAMA:
	--N/A

--Verification criteria: Verify SDL behaviors in different states of policy table:
	--1. Notification is not exist in PT => DISALLOWED in policy table, SDL ignores the notification
	--2. Notification is exist in PT but it has not consented yet by user => DISALLOWED in policy table, SDL ignores the notification
	--3. Notification is exist in PT but user does not allow function group that contains this notification => USER_DISALLOWED in policy table, SDL ignores the notification
	--4. Notification is exist in PT and user allow function group that contains this notification
----------------------------------------------------------------------------------------------

	local function ResultCodeChecks()

		--Print new line to separate new test cases group
		commonFunctions:newTestCasesGroup("Test suite: Checks All Result Codes")

	--1. Notification is not exist in PT => DISALLOWED in policy table, SDL ignores the notification
	----------------------------------------------------------------------------------------------
		--Precondition: Build policy table file
		local PTFileName = testCasesForPolicyTable:createPolicyTableWithoutAPI("OnTouchEvent")

		--Precondition: Update policy table
		testCasesForPolicyTable:updatePolicy(PTFileName)

		OnTouchEvent_Notification_IsIgnored("OnTouchEvent_IsNotExistInPT_IsIgnored")
	----------------------------------------------------------------------------------------------

	--2. Notification is exist in PT but it has not consented yet by user => DISALLOWED in policy table, SDL ignores the notification
	----------------------------------------------------------------------------------------------
		--Precondition: Build policy table file
		local PermissionLinesForBase4 = nil
		local PermissionLinesForGroup1 =
[[					"OnTouchEvent": {
						"hmi_levels": [
						  "FULL"
						]
					  }]] .. "\n"

		local appID = config.application1.registerAppInterfaceParams.fullAppID
		local PermissionLinesForApplication =
		[[			"]]..appID ..[[" : {
						"keep_context" : false,
						"steal_focus" : false,
						"priority" : "NONE",
						"default_hmi" : "NONE",
						"groups" : ["Base-4", "group1"]
					},
		]]

		local PTName = testCasesForPolicyTable:createPolicyTableFile(PermissionLinesForBase4, PermissionLinesForGroup1, PermissionLinesForApplication)
		testCasesForPolicyTable:updatePolicy(PTName)

		--Send notification and check it is ignored
		OnTouchEvent_Notification_IsIgnored("OnTouchEvent_UserHasNotConsentedYet_IsIgnored")
	----------------------------------------------------------------------------------------------

	--3. Notification is exist in PT but user does not allow function group that contains this notification => USER_DISALLOWED in policy table, SDL ignores the notification
	----------------------------------------------------------------------------------------------
		--Precondition: User does not allow function group
		testCasesForPolicyTable:userConsent(false, "group1")

		--Send notification and check it is ignored
		OnTouchEvent_Notification_IsIgnored("OnTouchEvent_UserDisallowed_IsIgnored")
	----------------------------------------------------------------------------------------------

	--4. Notification is exist in PT and user allow function group that contains this notification
	----------------------------------------------------------------------------------------------
		--Precondition: User allows function group
		testCasesForPolicyTable:userConsent(true, "group1")

		function Test:OnTouchEvent_Notification_IsAllowed()
			local parameter = {
							type = "BEGIN",
							event = { {c = {{x = 1, y = 1}}, id = 0, ts = {900} } }
						}

			--hmi side: send OnTouchEvent
			self.hmiConnection:SendNotification("UI.OnTouchEvent",	parameter)

			--mobile side: expected OnTouchEvent notification
			EXPECT_NOTIFICATION("OnTouchEvent", parameter)
		end

	----------------------------------------------------------------------------------------------
	end
	--TODO: PT is blocked by ATF defect APPLINK-19188
	--ResultCodeChecks()

----------------------------------------------------------------------------------------------
-----------------------------------------TEST BLOCK VI----------------------------------------
-------------------------Sequence with emulating of user's action(s)--------------------------
----------------------------------------------------------------------------------------------

--Requirement id in JAMA or JIRA:
	--SDLAQ-TC-218: TC_OnTouchEvent_navi_01
	--APPLINK-18023: 04[P][MAN]_TC_OnTouchEvent

--Verification criteria:
	--1. Click on navigation area
	--2. Click on navigation area with 2 fingers at the same time
	--3. Move on navigation area with 1 finger
	--4. Move on navigation area with 2 fingers at the same time
----------------------------------------------------------------------------------------------
	local function SequenceCheck1()

		--Print new line to separate new test cases group
		commonFunctions:newTestCasesGroup("Test suite: Sequence with emulating of user's action(s)")

		--1. Click on navigation area
		function Test:OnTouchEvent_type_BEGIN()
			print()
			print("Step 1. Click on navigation area")

			local parameter = {
							type = "BEGIN",
							event = { {c = {{x = 1, y = 1}}, id = 0, ts = {900} } }
						}

			--hmi side: send OnTouchEvent
			self.hmiConnection:SendNotification("UI.OnTouchEvent",	parameter)

			--mobile side: expected OnTouchEvent notification
			EXPECT_NOTIFICATION("OnTouchEvent", parameter)

		end

		function Test:OnTouchEvent_type_END()

			local parameter = {
							type = "END",
							event = { {c = {{x = 1, y = 1}}, id = 0, ts = {1000} } }
						}

			--hmi side: send OnTouchEvent
			self.hmiConnection:SendNotification("UI.OnTouchEvent",	parameter)

			--mobile side: expected OnTouchEvent notification
			EXPECT_NOTIFICATION("OnTouchEvent", parameter)

		end

		--1.1. Click and cancel on navigation
		function Test:OnTouchEvent_type_BEGIN()
			print()
			print("Step 1.1. Click and cancel on navigation area")

			local parameter = {
							type = "BEGIN",
							event = { {c = {{x = 1, y = 1}}, id = 0, ts = {900} } }
						}

			--hmi side: send OnTouchEvent
			self.hmiConnection:SendNotification("UI.OnTouchEvent",	parameter)

			--mobile side: expected OnTouchEvent notification
			EXPECT_NOTIFICATION("OnTouchEvent", parameter)

		end

		function Test:OnTouchEvent_type_CANCEL()

			local parameter = {
							type = "CANCEL",
							event = { {c = {{x = 1, y = 1}}, id = 0, ts = {1000} } }
						}

			--hmi side: send OnTouchEvent
			self.hmiConnection:SendNotification("UI.OnTouchEvent",	parameter)

			--mobile side: expected OnTouchEvent notification
			EXPECT_NOTIFICATION("OnTouchEvent", parameter)

		end

		--2. Click on navigation area with 2 fingers at the same time
		function Test:OnTouchEvent_type_BEGIN_2Fingers()
			print()
			print("Step 2. Click on navigation area with 2 fingers at the same time")

			local parameter1 = {
							type = "BEGIN",
							event = { {c = {{x = 1, y = 1}}, id = 0, ts = {900} } }
						}

			local parameter2 = {
							type = "BEGIN",
							event = { {c = {{x = 2, y = 1}}, id = 1, ts = {900} } }
						}

			--hmi side: send OnTouchEvent
			self.hmiConnection:SendNotification("UI.OnTouchEvent",	parameter1)
			self.hmiConnection:SendNotification("UI.OnTouchEvent",	parameter2)

			--mobile side: expected OnTouchEvent notification
			EXPECT_NOTIFICATION("OnTouchEvent", parameter1, parameter2)
			:Times(2)

		end

		function Test:OnTouchEvent_type_END_2Fingers()

			local parameter1 = {
							type = "END",
							event = { {c = {{x = 1, y = 1}}, id = 0, ts = {900} } }
						}

			local parameter2 = {
							type = "END",
							event = { {c = {{x = 2, y = 1}}, id = 1, ts = {900} } }
						}

			--hmi side: send OnTouchEvent
			self.hmiConnection:SendNotification("UI.OnTouchEvent",	parameter1)
			self.hmiConnection:SendNotification("UI.OnTouchEvent",	parameter2)

			--mobile side: expected OnTouchEvent notification
			EXPECT_NOTIFICATION("OnTouchEvent", parameter1, parameter2)
			:Times(2)

		end

		--2.1. Click and cancel on navigation area with 2 fingers at the same time
		function Test:OnTouchEvent_type_BEGIN_2Fingers()
			print()
			print("Step 2.1. Click and cancel on navigation area with 2 fingers at the same time")

			local parameter1 = {
							type = "BEGIN",
							event = { {c = {{x = 1, y = 1}}, id = 0, ts = {900} } }
						}

			local parameter2 = {
							type = "BEGIN",
							event = { {c = {{x = 2, y = 1}}, id = 1, ts = {900} } }
						}

			--hmi side: send OnTouchEvent
			self.hmiConnection:SendNotification("UI.OnTouchEvent",	parameter1)
			self.hmiConnection:SendNotification("UI.OnTouchEvent",	parameter2)

			--mobile side: expected OnTouchEvent notification
			EXPECT_NOTIFICATION("OnTouchEvent", parameter1, parameter2)
			:Times(2)

		end

		function Test:OnTouchEvent_type_CANCEL_2Fingers()

			local parameter1 = {
							type = "CANCEL",
							event = { {c = {{x = 1, y = 1}}, id = 0, ts = {900} } }
						}

			local parameter2 = {
							type = "CANCEL",
							event = { {c = {{x = 2, y = 1}}, id = 1, ts = {900} } }
						}

			--hmi side: send OnTouchEvent
			self.hmiConnection:SendNotification("UI.OnTouchEvent",	parameter1)
			self.hmiConnection:SendNotification("UI.OnTouchEvent",	parameter2)

			--mobile side: expected OnTouchEvent notification
			EXPECT_NOTIFICATION("OnTouchEvent", parameter1, parameter2)
			:Times(2)

		end

		--3. Move on navigation area with 1 finger
		function Test:OnTouchEvent_type_BEGIN()
			print()
			print("Step 3. Move on navigation area with 1 finger")

			local parameter = {
							type = "BEGIN",
							event = { {c = {{x = 1, y = 1}}, id = 0, ts = {900} } }
						}

			--hmi side: send OnTouchEvent
			self.hmiConnection:SendNotification("UI.OnTouchEvent",	parameter)

			--mobile side: expected OnTouchEvent notification
			EXPECT_NOTIFICATION("OnTouchEvent", parameter)

		end

		for i = 2, 100 do
			Test["OnTouchEvent_type_MOVE_x_" .. i .. "_y_" .. i - 1 ] = function(self)

				local parameter = {
								type = "MOVE",
								event = { {c = {{x = i, y = i - 1}}, id = 0, ts = {900 + i} } }
							}

				--hmi side: send OnTouchEvent
				self.hmiConnection:SendNotification("UI.OnTouchEvent",	parameter)

				--mobile side: expected OnTouchEvent notification
				EXPECT_NOTIFICATION("OnTouchEvent", parameter)

			end
		end

		function Test:OnTouchEvent_type_END()

			local parameter = {
							type = "END",
							event = { {c = {{x = 2, y = 1}}, id = 0, ts = {1000} } }
						}

			--hmi side: send OnTouchEvent
			self.hmiConnection:SendNotification("UI.OnTouchEvent",	parameter)

			--mobile side: expected OnTouchEvent notification
			EXPECT_NOTIFICATION("OnTouchEvent", parameter)

		end

		--4. Move on navigation area with 2 fingers
		function Test:OnTouchEvent_type_BEGIN_2Fingers()
			print()
			print("Step 4. Move on navigation area with 2 fingers")
			local parameter1 = {
							type = "BEGIN",
							event = { {c = {{x = 1, y = 1}}, id = 0, ts = {900} } }
						}

			local parameter2 = {
							type = "BEGIN",
							event = { {c = {{x = 2, y = 1}}, id = 1, ts = {900} } }
						}

			--hmi side: send OnTouchEvent
			self.hmiConnection:SendNotification("UI.OnTouchEvent",	parameter1)
			self.hmiConnection:SendNotification("UI.OnTouchEvent",	parameter2)

			--mobile side: expected OnTouchEvent notification
			EXPECT_NOTIFICATION("OnTouchEvent", parameter1, parameter2)
			:Times(2)

		end

		for i = 1, 100 do
			Test["OnTouchEvent_type_MOVE_2Fingers_Time_" .. i ] = function(self)

				local parameter1 = {
								type = "MOVE",
								event = { {c = {{x = 1 + i, y = 1 + i }}, id = 0, ts = {900 + i} } }
							}

				local parameter2 = {
								type = "MOVE",
								event = { {c = {{x = 2 + i, y = 1 + i}}, id = 1, ts = {900 + i} } }
							}

				--hmi side: send OnTouchEvent
				self.hmiConnection:SendNotification("UI.OnTouchEvent",	parameter1)
				self.hmiConnection:SendNotification("UI.OnTouchEvent",	parameter2)

				--mobile side: expected OnTouchEvent notification
				EXPECT_NOTIFICATION("OnTouchEvent", parameter1, parameter2)
				:Times(2)

			end
		end

		function Test:OnTouchEvent_type_END_2Fingers()

			local parameter1 = {
							type = "END",
							event = { {c = {{x = 101, y = 101}}, id = 0, ts = {900 + 101} } }
						}

			local parameter2 = {
							type = "END",
							event = { {c = {{x = 102, y = 102}}, id = 1, ts = {900 + 101} } }
						}

			--hmi side: send OnTouchEvent
			self.hmiConnection:SendNotification("UI.OnTouchEvent",	parameter1)
			self.hmiConnection:SendNotification("UI.OnTouchEvent",	parameter2)

			--mobile side: expected OnTouchEvent notification
			EXPECT_NOTIFICATION("OnTouchEvent", parameter1, parameter2)
			:Times(2)

		end

	end

	SequenceCheck1()

----------------------------------------------------------------------------------------------
--Checks of absence notifications in case of not navi app and processing in case of navi app.
----------------------------------------------------------------------------------------------
	local function SequenceCheck2()

		function Test:Precondition_Add_New_Session()

		  -- Connected expectation
			Test.mobileSession2 = mobile_session.MobileSession(Test, Test.mobileConnection)

			Test.mobileSession2:StartService(7)
		end

		function Test:Register_Second_App_Non_Nav()

			config.application2.registerAppInterfaceParams.appHMIType = {"DEFAULT"}
			CorIdRegister = self.mobileSession2:SendRPC("RegisterAppInterface", config.application2.registerAppInterfaceParams)
			strAppName = config.application2.registerAppInterfaceParams.appName

			--hmi side: expect BasicCommunication.OnAppRegistered request
			EXPECT_HMINOTIFICATION("BasicCommunication.OnAppRegistered",
			{
				application =
				{
					appName = strAppName
				}
			})
			:Do(function(_,data)
				--self.appName = data.params.application.appName
				self.applications[strAppName] = data.params.application.appID
				Apps[2].appID = data.params.application.appID
			end)

			--mobile side: expect response
			self.mobileSession2:ExpectResponse(CorIdRegister,
			{
				resultCode = 'SUCCESS'
			})
			:Timeout(12000)

			--mobile side: expect notification
			self.mobileSession2:ExpectNotification("OnHMIStatus",
			{
				systemContext = "MAIN", hmiLevel = "NONE", audioStreamingState = "NOT_AUDIBLE"
			})
			:Timeout(12000)
		end

		function Test_Activation_App2()

			--hmi side: sending SDL.ActivateApp request
			local RequestId = self.hmiConnection:SendRequest("SDL.ActivateApp", { appID = Apps[2].appID})
			EXPECT_HMIRESPONSE(RequestId)
			:Do(function(_,data)
				if
					data.result.isSDLAllowed ~= true then
					local RequestId = self.hmiConnection:SendRequest("SDL.GetUserFriendlyMessage", {language = "EN-US", messageCodes = {"DataConsent"}})

					--hmi side: expect SDL.GetUserFriendlyMessage message response
					--TODO: update after resolving APPLINK-16094.
					--EXPECT_HMIRESPONSE(RequestId,{result = {code = 0, method = "SDL.GetUserFriendlyMessage"}})
					EXPECT_HMIRESPONSE(RequestId)
					:Do(function(_,data)
						--hmi side: send request SDL.OnAllowSDLFunctionality
						self.hmiConnection:SendNotification("SDL.OnAllowSDLFunctionality", {allowed = true, source = "GUI", device = {id = config.deviceMAC, name = "127.0.0.1"}})

						--hmi side: expect BasicCommunication.ActivateApp request
						EXPECT_HMICALL("BasicCommunication.ActivateApp")
						:Do(function(_,data)
							--hmi side: sending BasicCommunication.ActivateApp response
							self.hmiConnection:SendResponse(data.id,"BasicCommunication.ActivateApp", "SUCCESS", {})
						end)
						:Times(AnyNumber())
					end)

				end
			end)

			--mobile side: expect notification
			self.mobileSession2:ExpectNotification("OnHMIStatus", {hmiLevel = "FULL", systemContext = "MAIN"})
			EXPECT_NOTIFICATION("OnHMIStatus", {hmiLevel = "FULL", systemContext = "MAIN"})
		end

		function Test:OnTouchEvent_Non_Navi_BEGIN()
			print()
			DelayedExp(2000)
			local parameter = {
							type = "BEGIN",
							event = { {c = {{x = 1, y = 1}}, id = 0, ts = {900} } }
						}

			--hmi side: send OnTouchEvent
			self.hmiConnection:SendNotification("UI.OnTouchEvent",	parameter)

			--mobile side: expected OnTouchEvent notification
			EXPECT_NOTIFICATION("OnTouchEvent", parameter)

			--mobile side: app2 expects notification
			self.mobileSession2:ExpectNotification("OnTouchEvent", parameter)
			:Times(0)
		end

		function Test:OnTouchEvent_Non_Navi_MOVE()
			DelayedExp(2000)
			local parameter = {
							type = "MOVE",
							event = { {c = {{x = 2, y = 2}}, id = 0, ts = {901} } }
						}

			--hmi side: send OnTouchEvent
			self.hmiConnection:SendNotification("UI.OnTouchEvent",	parameter)

			--mobile side: expected OnTouchEvent notification
			EXPECT_NOTIFICATION("OnTouchEvent", parameter)

			--mobile side: app2 expects notification
			self.mobileSession2:ExpectNotification("OnTouchEvent", parameter)
			:Times(0)

		end

		function Test:OnTouchEvent_Non_Navi_END()
			DelayedExp(2000)
			local parameter = {
							type = "END",
							event = { {c = {{x = 2, y = 2}}, id = 0, ts = {902} } }
						}

			--hmi side: send OnTouchEvent
			self.hmiConnection:SendNotification("UI.OnTouchEvent",	parameter)

			--mobile side: expected OnTouchEvent notification
			EXPECT_NOTIFICATION("OnTouchEvent", parameter)

			--mobile side: app2 expects notification
			self.mobileSession2:ExpectNotification("OnTouchEvent", parameter)
			:Times(0)

		end

		function Test:OnTouchEvent_Non_Navi_CANCEL()
			DelayedExp(2000)
			local parameter = {
							type = "CANCEL",
							event = { {c = {{x = 2, y = 2}}, id = 0, ts = {903} } }
						}

			--hmi side: send OnTouchEvent
			self.hmiConnection:SendNotification("UI.OnTouchEvent",	parameter)

			--mobile side: expected OnTouchEvent notification
			EXPECT_NOTIFICATION("OnTouchEvent", parameter)

			--mobile side: app2 expects notification
			self.mobileSession2:ExpectNotification("OnTouchEvent", parameter)
			:Times(0)

		end

		--Postcondition:
		function Test:Unregister_App2()

			local cid = self.mobileSession2:SendRPC("UnregisterAppInterface",{})

			self.mobileSession2:ExpectResponse(cid, { success = true, resultCode = "SUCCESS"})
			:Timeout(2000)
		end

	end

	SequenceCheck2()

----------------------------------------------------------------------------------------------
-----------------------------------------TEST BLOCK VII---------------------------------------
--------------------------------------Different HMIStatus-------------------------------------
----------------------------------------------------------------------------------------------

--Description: Check different HMIStatus

--Requirement id in JAMA:
	--N/A

	--Verification criteria:
		--The applications in HMI FULL don't reject OnTouchEvent request.
		--None of the applications in HMI NONE receives OnTouchEvent request.
		--The applications in HMI LIMITED rejects OnTouchEvent request.
		--The applications in HMI BACKGROUND rejects OnTouchEvent request.

	local function DifferentHMIlevelChecks()

		--Print new line to separate new test cases group
		commonFunctions:newTestCasesGroup("Test suite: Different HMI Level Checks")
		----------------------------------------------------------------------------------------------

		--1. HMI level is NONE
		----------------------------------------------------------------------------------------------
			--Precondition: Deactivate app to NONE HMI level
			commonSteps:DeactivateAppToNoneHmiLevel()

			OnTouchEvent_Notification_IsIgnored("OnTouchEvent_Notification_InNoneHmiLevel")

			--Postcondition: Activate app
			commonSteps:ActivationApp()
		----------------------------------------------------------------------------------------------

		--2. HMI level is LIMITED
		----------------------------------------------------------------------------------------------
			if commonFunctions:isMediaApp() then
				-- Precondition: Change app to LIMITED
				commonSteps:ChangeHMIToLimited()

				OnTouchEvent_Notification_IsIgnored("OnTouchEvent_Notification_InLimitedHmiLevel")

				--Postcondition: Activate app
				commonSteps:ActivationApp()
			end
		----------------------------------------------------------------------------------------------

		--3. HMI level is BACKGROUND
		----------------------------------------------------------------------------------------------

			if config.application1.registerAppInterfaceParams.isMediaApplication == true then

				commonTestCases:ChangeAppToBackgroundHmiLevel()

				OnTouchEvent_Notification_IsIgnored("OnTouchEvent_Notification_InBackgroundHmiLevel")

			else
				--APPLINK-8531
				--2. SDL must allow only one level: either FULL or LIMITED at the given moment of time for two apps of one and the same AppHMIType for the following AppHMITypes: MEDIA media, NAVIGATION non-media, COMMUNICATION non-media (per APPLINK-9802).

				-- Precondition 1: Opening new session
				commonSteps:precondition_AddNewSession()

				-- Precondition 2: Register app2
				function Test:Register_The_Second_NAVIGATION_non_media()

					--mobile side: RegisterAppInterface request
					local CorIdRAI = self.mobileSession2:SendRPC("RegisterAppInterface",
																{
																	syncMsgVersion =
																	{
																		majorVersion = 3,
																		minorVersion = 1,
																	},
																	appName ="SPT2",
																	isMediaApplication = false,
																	appHMIType = { "NAVIGATION" },
																	languageDesired ="EN-US",
																	hmiDisplayLanguageDesired ="EN-US",
																	appID ="2",
																	ttsName =
																	{
																		{
																			text ="SyncProxyTester2",
																			type ="TEXT",
																		},
																	},
																	vrSynonyms =
																	{
																		"vrSPT2",
																	}
																})

					--hmi side: expect BasicCommunication.OnAppRegistered request
					EXPECT_HMINOTIFICATION("BasicCommunication.OnAppRegistered",
					{
						application =
						{
							appName = "SPT2"
						}
					})
					:Do(function(_,data)
						--appId2 = data.params.application.appID
						Apps[2].appID = data.params.application.appID
					end)

					--mobile side: RegisterAppInterface response
					self.mobileSession2:ExpectResponse(CorIdRAI, { success = true, resultCode = "SUCCESS"})
						:Timeout(2000)

					self.mobileSession2:ExpectNotification("OnHMIStatus",{hmiLevel = "NONE", audioStreamingState = "NOT_AUDIBLE", systemContext = "MAIN"})
				end

				-- Precondition 3: Activate an other media app to change app to BACKGROUND
				function Test:Activate_The_Second_Media_App()

					--HMI send ActivateApp request
					local RequestId = self.hmiConnection:SendRequest("SDL.ActivateApp", { appID = Apps[2].appID})
					EXPECT_HMIRESPONSE(RequestId)
					:Do(function(_,data)

						if data.result.isSDLAllowed ~= true then
							local RequestId = self.hmiConnection:SendRequest("SDL.GetUserFriendlyMessage", {language = "EN-US", messageCodes = {"DataConsent"}})
							EXPECT_HMIRESPONSE(RequestId,{result = {code = 0, method = "SDL.GetUserFriendlyMessage"}})
							:Do(function(_,data)
								--hmi side: send request SDL.OnAllowSDLFunctionality
								self.hmiConnection:SendNotification("SDL.OnAllowSDLFunctionality", {allowed = true, source = "GUI", device = {id = 1, name = "127.0.0.1"}})
							end)

							EXPECT_HMICALL("BasicCommunication.ActivateApp")
							:Do(function(_,data)
								self.hmiConnection:SendResponse(data.id,"BasicCommunication.ActivateApp", "SUCCESS", {})
							end)
							:Times(2)
						end
					end)

					self.mobileSession2:ExpectNotification("OnHMIStatus", {hmiLevel = "FULL", audioStreamingState = "AUDIBLE", systemContext = "MAIN"})
					:Timeout(12000)

					self.mobileSession:ExpectNotification("OnHMIStatus", {hmiLevel = "BACKGROUND", audioStreamingState = "NOT_AUDIBLE", systemContext = "MAIN"})
				end

				OnTouchEvent_Notification_IsIgnored("OnTouchEvent_Notification_InBackgroundHmiLevel")

			end
		----------------------------------------------------------------------------------------------
	end
	DifferentHMIlevelChecks()

return Test


text:
/**
 * @class
 * Initializes a new instance of the ErrorModel class.
 * @constructor
 * @member {number} [status]
 *
 * @member {string} [message]
 *
 */
export interface ErrorModel {
    status?: number;
    message?: string;
}

/**
 * @class
 * Initializes a new instance of the ParameterGroupingPostRequiredParameters class.
 * @constructor
 * Additional parameters for the postRequired operation.
 * @member {number} body
 *
 * @member {string} [customHeader]
 *
 * @member {number} [query] Query parameter with default
 *
 * @member {string} path Path parameter
 *
 */
export interface ParameterGroupingPostRequiredParameters {
    body: number;
    customHeader?: string;
    query?: number;
    path: string;
}

/**
 * @class
 * Initializes a new instance of the ParameterGroupingPostOptionalParameters class.
 * @constructor
 * Additional parameters for the postOptional operation.
 * @member {string} [customHeader]
 *
 * @member {number} [query] Query parameter with default
 *
 */
export interface ParameterGroupingPostOptionalParameters {
    customHeader?: string;
    query?: number;
}

/**
 * @class
 * Initializes a new instance of the FirstParameterGroup class.
 * @constructor
 * Additional parameters for the postMultipleParameterGroups operation.
 * @member {string} [headerOne]
 *
 * @member {number} [queryOne] Query parameter with default
 *
 */
export interface FirstParameterGroup {
    headerOne?: string;
    queryOne?: number;
}

/**
 * @class
 * Initializes a new instance of the ParameterGroupingPostMultipleParameterGroupsSecondParameterGroup class.
 * @constructor
 * Additional parameters for the postMultipleParameterGroups operation.
 * @member {string} [headerTwo]
 *
 * @member {number} [queryTwo] Query parameter with default
 *
 */
export interface ParameterGroupingPostMultipleParameterGroupsSecondParameterGroup {
    headerTwo?: string;
    queryTwo?: number;
}


text:
from django.db import models

class Data(models.Model):
	data = models.DateField(primary_key=True)
	liturgia = models.ForeignKey("DiaLiturgico")
	destaque = models.BooleanField()
	class Meta:
		app_label = "mpm"
	def __str__(self):
		return self.data.strftime('%d/%m/%Y')  + " - " + self.liturgia.titulo.encode('utf-8)')


text:
package com.intellij.psi;

import com.intellij.openapi.util.Computable;
import com.intellij.openapi.util.Key;
import com.intellij.openapi.util.KeyedExtensionCollector;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.util.List;

public final class WeighingService {
  private static final KeyedExtensionCollector<Weigher, Key> COLLECTOR = new KeyedExtensionCollector<>("com.intellij.weigher");

  private WeighingService() { }

  @NotNull
  public static <T, Loc> WeighingComparable<T, Loc> weigh(Key<? extends Weigher<T, Loc>> key, T element, @Nullable Loc location) {
    return weigh(key, new Computable.PredefinedValueComputable<>(element), location);
  }

  @NotNull
  public static <T, Loc> WeighingComparable<T, Loc> weigh(Key<? extends Weigher<T, Loc>> key,
                                                          Computable<? extends T> element,
                                                          @Nullable Loc location) {
    @SuppressWarnings("unchecked") Weigher<T, Loc>[] array = getWeighers(key).toArray(new Weigher[0]);
    return new WeighingComparable<>(element, location, array);
  }

  public static <T, Loc> List<Weigher> getWeighers(Key<? extends Weigher<T, Loc>> key) {
    return COLLECTOR.forKey(key);
  }
}


text:
var angular = require('angular');
require('angular-route');
require('angular-animate');
require('angular-local-storage');
require('angular1-ui-bootstrap4');
require('./styles/main');

angular
  .module('voteApp', [
    'ngRoute',
    'ngAnimate',
    'ui.bootstrap',
    'LocalStorageModule',
  ])
  .config(require('./appRoutes'));

require('./controllers');
require('./directives');
require('./services');


text:
"use strict";

import MessageUtils from "../modules/message-utils.js";

module.exports = function(server: any) {
    return new Fruit(server);
};

class Fruit {

    constructor(server: any) {
        server.get("/fruit/:id", Fruit.getFruit);
    }

    private static getFruit(req: any, res: any) {
        res.send(MessageUtils.successMsg("orange"));
    }

}


text:
Spree Heroku
============

This is an extension for Spree, allowing the e-commerce system to run on Heroku - http://heroku.com.

The major constraint on Heroku is that we can't write files to disk, so this extension disables all disk caching, fixes a few issues and changes Spree to store on Amazon S3.

Requirements
------------

A Heroku account and an Amazon S3 account with a bucket.

Installation and configuration
-------------------------------

Add this to your project Gemfile:

    gem 'spree_heroku', :git => 'git://github.com/joneslee85/spree-heroku.git'

Install the new gems with bundler:

    $ bundle install

Specify the S3 credentials by two ways:

Create Heroku config var for specific environment

    $ heroku config:add S3_KEY='your_access_key'
    $ heroku config:add S3_SECRET='secret_access_key'
    $ heroku config:add S3_BUCKET='your_app_bucket'

OR

Create under RAILS_ROOT/config/s3.yml

    development:
      bucket: your_app_dev
      access_key_id: your_access_key
      secret_access_key: secret_access_key
      url: domain_url_or_path

    test:
      bucket: your_app_test
      access_key_id: your_access_key
      secret_access_key: secret_access_key
      url: domain_url_or_path

    production:
      bucket: your_app_prod
      access_key_id: your_access_key
      secret_access_key: secret_access_key
      url: domain_url_or_path

Create a Heroku application and deploy it:

    $ git init
    $ git add .
    $ git commit -m 'Initial create'
    $ heroku create
    $ git push heroku master

Bootstrap the database locally (not possible in Heroku, because the rake task attempts to copy files), and transfer it to Heroku:

    $ bundle exec rake db:bootstrap
    $ heroku db:push

Please note that if you choose to load sample data, images will be missing for all products. Spree's bootstrap task copies the images locally, but it doesn't put them on S3, where this extension configures Spree to look for images.

That's it - you're done! :)

Explanation about url variable
------------------------------

See the url variable in http://rdoc.info:8080/github/thoughtbot/paperclip/master/Paperclip/Storage/S3.

_url_ in s3.yml can be ":s3_domain_url" or ":s3_path_url" (default). STRING.

Troubleshooting
---------------

This extension has been tested with Spree 1.0 and Rails 3.1.3. If you have problems using the extension with a newer version of Spree, it could be due to Spree's gem dependencies having changed.

Copyright (c) 2012 Trung Lê, released under the New BSD License


text:
class Agent
  include Mongoid::Document
  include Mongoid::Timestamps::Updated
  field :title
  field :number
  embeds_many :names, :as => :namable
  referenced_in :game
end


text:
var _           = require('lodash'),
    testUtils   = require('../utils'),
    should      = require('should'),
    rewire      = require('rewire'),
    uuid        = require('node-uuid'),

    // Stuff we are testing
    packageInfo      = require('../../../package'),
    updateCheck      = rewire('../../server/update-check'),
    NotificationsAPI = require('../../server/api/notifications');

describe('Update Check', function () {
    describe('Reporting to UpdateCheck', function () {
        var environmentsOrig;

        before(function () {
            environmentsOrig = updateCheck.__get__('allowedCheckEnvironments');
            updateCheck.__set__('allowedCheckEnvironments', ['development', 'production', 'testing']);
        });

        after(function () {
            updateCheck.__set__('allowedCheckEnvironments', environmentsOrig);
        });

        beforeEach(testUtils.setup('owner', 'posts', 'perms:setting', 'perms:user', 'perms:init'));

        afterEach(testUtils.teardown);

        it('should report the correct data', function (done) {
            var updateCheckData = updateCheck.__get__('updateCheckData');

            updateCheckData().then(function (data) {
                should.exist(data);
                data.ghost_version.should.equal(packageInfo.version);
                data.node_version.should.equal(process.versions.node);
                data.env.should.equal(process.env.NODE_ENV);
                data.database_type.should.match(/sqlite3|mysql/);
                data.blog_id.should.be.a.String();
                data.blog_id.should.not.be.empty();
                data.theme.should.be.equal('casper');
                data.apps.should.be.a.String();
                data.blog_created_at.should.be.a.Number();
                data.user_count.should.be.above(0);
                data.post_count.should.be.above(0);
                data.npm_version.should.be.a.String();
                data.npm_version.should.not.be.empty();

                done();
            }).catch(done);
        });
    });

    describe('Custom Notifications', function () {
        var currentVersionOrig;

        before(function () {
            currentVersionOrig = updateCheck.__get__('currentVersion');
            updateCheck.__set__('currentVersion', '0.9.0');
        });

        after(function () {
            updateCheck.__set__('currentVersion', currentVersionOrig);
        });

        beforeEach(testUtils.setup('owner', 'posts', 'settings', 'perms:setting', 'perms:notification', 'perms:user', 'perms:init'));

        afterEach(testUtils.teardown);

        it('should create a custom notification for target version', function (done) {
            var createCustomNotification = updateCheck.__get__('createCustomNotification'),
                message = {
                    id: uuid.v4(),
                    version: '0.9.x',
                    content: '
Hey there! This is for 0.9.0 version
'
                };

            createCustomNotification(message).then(function () {
                return NotificationsAPI.browse(testUtils.context.internal);
            }).then(function (results) {
                should.exist(results);
                should.exist(results.notifications);
                results.notifications.length.should.be.above(0);
                should.exist(_.find(results.notifications, {uuid: message.id}));
                done();
            }).catch(done);
        });

        it('should not create notifications meant for other versions', function (done) {
            var createCustomNotification = updateCheck.__get__('createCustomNotification'),
                message = {
                    id: uuid.v4(),
                    version: '0.5.x',
                    content: '
Hey there! This is for 0.5.0 version
'
                };

            createCustomNotification(message).then(function () {
                return NotificationsAPI.browse(testUtils.context.internal);
            }).then(function (results) {
                should.not.exist(_.find(results.notifications, {uuid: message.id}));
                done();
            }).catch(done);
        });
    });
});


text:
const BREADCRUMB_TYPE = 'request'

const includes = require('@bugsnag/core/lib/es-utils/includes')

/*
 * Leaves breadcrumbs when network requests occur
 */
module.exports = (_ignoredUrls = [], win = window) => {
  let restoreFunctions = []
  const plugin = {
    load: client => {
      if (!client._isBreadcrumbTypeEnabled('request')) return

      const ignoredUrls = [
        client._config.endpoints.notify,
        client._config.endpoints.sessions
      ].concat(_ignoredUrls)

      monkeyPatchXMLHttpRequest()
      monkeyPatchFetch()

      // XMLHttpRequest monkey patch
      function monkeyPatchXMLHttpRequest () {
        if (!('addEventListener' in win.XMLHttpRequest.prototype)) return
        const nativeOpen = win.XMLHttpRequest.prototype.open

        // override native open()
        win.XMLHttpRequest.prototype.open = function open (method, url) {
          let requestSetupKey = false

          const error = () => handleXHRError(method, url)
          const load = () => handleXHRLoad(method, url, this.status)

          // if we have already setup listeners, it means open() was called twice, we need to remove
          // the listeners and recreate them
          if (requestSetupKey) {
            this.removeEventListener('load', load)
            this.removeEventListener('error', error)
          }

          // attach load event listener
          this.addEventListener('load', load)
          // attach error event listener
          this.addEventListener('error', error)

          requestSetupKey = true

          nativeOpen.apply(this, arguments)
        }

        if (process.env.NODE_ENV !== 'production') {
          restoreFunctions.push(() => {
            win.XMLHttpRequest.prototype.open = nativeOpen
          })
        }
      }

      function handleXHRLoad (method, url, status) {
        if (url === undefined) {
          client._logger.warn('The request URL is no longer present on this XMLHttpRequest. A breadcrumb cannot be left for this request.')
          return
        }

        // an XMLHttpRequest's URL can be an object as long as its 'toString'
        // returns a URL, e.g. a HTMLAnchorElement
        if (typeof url === 'string' && includes(ignoredUrls, url.replace(/\?.*$/, ''))) {
          // don't leave a network breadcrumb from bugsnag notify calls
          return
        }
        const metadata = {
          status: status,
          request: `${method} ${url}`
        }
        if (status >= 400) {
          // contacted server but got an error response
          client.leaveBreadcrumb('XMLHttpRequest failed', metadata, BREADCRUMB_TYPE)
        } else {
          client.leaveBreadcrumb('XMLHttpRequest succeeded', metadata, BREADCRUMB_TYPE)
        }
      }

      function handleXHRError (method, url) {
        if (url === undefined) {
          client._logger.warn('The request URL is no longer present on this XMLHttpRequest. A breadcrumb cannot be left for this request.')
          return
        }

        if (typeof url === 'string' && includes(ignoredUrls, url.replace(/\?.*$/, ''))) {
          // don't leave a network breadcrumb from bugsnag notify calls
          return
        }

        // failed to contact server
        client.leaveBreadcrumb('XMLHttpRequest error', {
          request: `${method} ${url}`
        }, BREADCRUMB_TYPE)
      }

      // window.fetch monkey patch
      function monkeyPatchFetch () {
        // only patch it if it exists and if it is not a polyfill (patching a polyfilled
        // fetch() results in duplicate breadcrumbs for the same request because the
        // implementation uses XMLHttpRequest which is also patched)
        if (!('fetch' in win) || win.fetch.polyfill) return

        const oldFetch = win.fetch
        win.fetch = function fetch () {
          const urlOrRequest = arguments[0]
          const options = arguments[1]

          let method
          let url = null

          if (urlOrRequest && typeof urlOrRequest === 'object') {
            url = urlOrRequest.url
            if (options && 'method' in options) {
              method = options.method
            } else if (urlOrRequest && 'method' in urlOrRequest) {
              method = urlOrRequest.method
            }
          } else {
            url = urlOrRequest
            if (options && 'method' in options) {
              method = options.method
            }
          }

          if (method === undefined) {
            method = 'GET'
          }

          return new Promise((resolve, reject) => {
            // pass through to native fetch
            oldFetch(...arguments)
              .then(response => {
                handleFetchSuccess(response, method, url)
                resolve(response)
              })
              .catch(error => {
                handleFetchError(method, url)
                reject(error)
              })
          })
        }

        if (process.env.NODE_ENV !== 'production') {
          restoreFunctions.push(() => {
            win.fetch = oldFetch
          })
        }
      }

      const handleFetchSuccess = (response, method, url) => {
        const metadata = {
          status: response.status,
          request: `${method} ${url}`
        }
        if (response.status >= 400) {
          // when the request comes back with a 4xx or 5xx status it does not reject the fetch promise,
          client.leaveBreadcrumb('fetch() failed', metadata, BREADCRUMB_TYPE)
        } else {
          client.leaveBreadcrumb('fetch() succeeded', metadata, BREADCRUMB_TYPE)
        }
      }

      const handleFetchError = (method, url) => {
        client.leaveBreadcrumb('fetch() error', { request: `${method} ${url}` }, BREADCRUMB_TYPE)
      }
    }
  }

  if (process.env.NODE_ENV !== 'production') {
    plugin.destroy = () => {
      restoreFunctions.forEach(fn => fn())
      restoreFunctions = []
    }
  }

  return plugin
}


text:
<?php

declare(strict_types=1);

namespace Sylius\Bundle\CoreBundle\Form\Extension;

use Sylius\Bundle\CoreBundle\Form\EventSubscriber\AddUserFormSubscriber;
use Sylius\Bundle\CoreBundle\Form\Type\User\ShopUserType;
use Sylius\Bundle\CustomerBundle\Form\Type\CustomerType;
use Symfony\Component\Form\AbstractTypeExtension;
use Symfony\Component\Form\FormBuilderInterface;

/**
 * @author Michał Marcinkowski <michal.marcinkowski@lakion.com>
 */
final class CustomerTypeExtension extends AbstractTypeExtension
{
    /**
     * {@inheritdoc}
     */
    public function buildForm(FormBuilderInterface $builder, array $options): void
    {
        $builder->addEventSubscriber(new AddUserFormSubscriber(ShopUserType::class));
    }

    /**
     * {@inheritdoc}
     */
    public function getExtendedType(): string
    {
        return CustomerType::class;
    }
}


text:
<?xml version="1.0" encoding="Windows-1252"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

	<modelVersion>4.0.0</modelVersion>

	<parent>
		<groupId>org.seleniumhq.webdriver</groupId>
		<artifactId>webdriver-parent</artifactId>
		<version>1.0-SNAPSHOT</version>
	</parent>
	<artifactId>webdriver-remote-common</artifactId>
	<name>webdriver-remote-common</name>

	<dependencies>
		<dependency>
			<groupId>org.seleniumhq.webdriver</groupId>
			<artifactId>webdriver-common</artifactId>
			<version>${project.version}</version>
		</dependency>
		<dependency>
			<groupId>org.json</groupId>
			<artifactId>json</artifactId>
			<version>20080701</version>
		</dependency>
		<dependency>
			<groupId>commons-codec</groupId>
			<artifactId>commons-codec</artifactId>
			<version>1.3</version>
		</dependency>
	</dependencies>

	<build>
		<sourceDirectory>src/java</sourceDirectory>
		<testSourceDirectory>test/java</testSourceDirectory>
		<plugins>
			<!-- See http://maven.apache.org/plugins/maven-surefire-plugin -->
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-surefire-plugin</artifactId>
				<configuration>
					<includes>
						<include>**/*Test.java</include>
					</includes>
				</configuration>
			</plugin>
		</plugins>
	</build>

</project>


text:
#ifndef SkMath_DEFINED
#  define SkMath_DEFINED
#  include "include/core/SkTypes.h"
// 64bit -> 32bit utilities

// Handy util that can be passed two ints, and will automatically promote to
// 64bits before the multiply, so the caller doesn't have to remember to cast
// e.g. (int64_t)a * b;
static int64_t sk_64_mul(int64_t a, int64_t b)
{
  return a * b;
}
///////////////////////////////////////////////////////////////////////////////

/** Given an integer and a positive (max) integer, return the value
 *  pinned against 0 and max, inclusive.
 *  @param value    The value we want returned pinned between [0...max]
 *  @param max      The positive max value
 *  @return 0 if value < 0, max if value > max, else value
 */
static int SkClampMax(int value, int max)
{
    // ensure that max is positive
  SkASSERT(max >= 0);
  if (value < 0)
  {
    value = 0;
  }
  if (value > max)
  {
    value = max;
  }
  return value;
}
/**
 *  Returns true if value is a power of 2. Does not explicitly check for
 *  value <= 0.
 */
template <typename T>
inline constexpr bool SkIsPow2(T value)
{
  return (value & (value - 1)) == 0;
}
///////////////////////////////////////////////////////////////////////////////

/**
 *  Return a*b/((1 << shift) - 1), rounding any fractional bits.
 *  Only valid if a and b are unsigned and <= 32767 and shift is > 0 and <= 8
 */
static unsigned SkMul16ShiftRound(U16CPU a, U16CPU b, int shift)
{
  SkASSERT(a <= 32767);
  SkASSERT(b <= 32767);
  SkASSERT(shift > 0 && shift <= 8);
  unsigned prod = a * b + (1 << (shift - 1));
  return (prod + (prod >> shift)) >> shift;
}
/**
 *  Return a*b/255, rounding any fractional bits.
 *  Only valid if a and b are unsigned and <= 32767.
 */
static U8CPU SkMulDiv255Round(U16CPU a, U16CPU b)
{
  SkASSERT(a <= 32767);
  SkASSERT(b <= 32767);
  unsigned prod = a * b + 128;
  return (prod + (prod >> 8)) >> 8;
}
#endif