code
stringlengths
3
1.01M
repo_name
stringlengths
5
116
path
stringlengths
3
311
language
stringclasses
30 values
license
stringclasses
15 values
size
int64
3
1.01M
using System.Xml.Serialization; namespace Geo.Gps.Serialization.Xml.Gpx.Gpx10 { [XmlType(AnonymousType=true, Namespace="http://www.topografix.com/GPX/1/0")] public class GpxTrackPoint : GpxPoint { public decimal course { get; set; } [XmlIgnore] public bool courseSpecified { get; set; } public decimal speed { get; set; } [XmlIgnore] public bool speedSpecified { get; set; } } }
asapostolov/Geo
Geo/Gps/Serialization/Xml/Gpx/Gpx10/GpxTrackPoint.cs
C#
lgpl-3.0
446
<?php /** * 信息中心默认语言包 zh_cn * * @package application.modules.officialdoc.language.zh_cn * @version $Id: default.php 481 2013-05-30 08:04:10Z gzwwb $ * @author gzwwb <gzwwb@ibos.com.cn> */ return array( //----------------golabs------------------- 'Information center' => '信息中心', 'Officialdoc' => '通知公告', 'Officialdoc list' => '通知列表', 'Add officialdoc' => '新建通知', 'Edit officialdoc' => '编辑通知', 'Show officialdoc' => '查看通知', 'Preview officialdoc' => '预览通知', //----------------ContentController------------------- 'No permission or officialdoc not exists' => '没有权限操作或者通知不存在', 'No_permission' => '没有权限操作', 'No_exists' => '文章不存在', //----------------list------------------- 'New doc' => '发布通知', 'All' => '全部', 'Published' => '已发布', 'No sign' => '未签收', 'Already sign' => '已签收', 'Sign' => '签收', 'Sign in' => '签收于', 'Sign for success' => '签收成功', 'No verify' => '待审核', 'More Operating' => '更多操作', 'Move' => '移动', 'Top' => '置顶', 'Highlight' => '高亮', 'Delete' => '删除', 'Verify' => '审核', 'Title' => '标题', 'Last update' => '最后修改', 'View' => '查看', 'Operating' => '操作', 'Edit' => '编辑', 'Keyword' => '关键字', 'Start time' => '开始时间', 'End time' => '结束时间', 'Directory' => '目录', 'Expired time' => '过期时间', 'Advanced search' => '高级搜索', 'Highlight succeed' => '高亮成功', 'Unhighlighting success' => '取消高亮成功', 'Set top' => '设置置顶', 'Top succeed' => '置顶成功', 'Unstuck success' => '取消置顶成功', 'You sure you want to delete it' => '确定要删除吗', 'Delete succeed' => '删除成功', 'Move by' => '移动至', 'Move succeed' => '移动成功', 'Move failed' => '移动失败', 'Sure Operating' => '确认操作', 'Sure delete' => '确认要删除吗', 'Did not select any document' => '未选择任何通知', 'You do not have the right to audit the documents' => '你没有审核该通知的权利', 'You do not have permission to verify the official' => '抱歉,您不是该审核步骤的审核人', 'New message title' => '{sender} 在通知公告-{category}发布了“{subject}”的通知!', 'New message content' => '{content}', 'New verify message title' => '{sender} 在通知公告-{category}发布了“{subject}”的通知,请您审核!', 'New verify message content' => '{content}', 'New back title' => ' 您发表的通知“{subject}”被退回 ', 'New back content' => ' {content}', 'Sign message title' => '{name} 提醒您签收通知 “{title}”', 'Sign message content' => '{content}', 'Do not need approval' => '无需审核,请编辑直接发布', //----------------show------------------- 'Close' => '关闭', 'Print' => '打印', 'Forward' => '转发', 'News' => '信息', 'Posted on' => '发布于', 'Approver' => '审核人', 'Update on' => '修改于', 'Version' => '版本', 'Category' => '分类', 'Scope' => '范围', 'Cc' => '抄送', 'This officialdoc requires you to sign' => '本通知需要您', 'Next reminder' => '下次提醒', 'You have to sign this document' => '您已签收', 'Comment' => '评论', 'Sign isread' => '查阅情况', 'Sign situation' => '签收情况', 'History version' => '历史版本', 'Department' => '部门', 'Reader and signtime' => '签收人员 / 签收时间', 'Update man' => '修改人', 'Publish time' => '发布时间', 'Temporarily no' => '暂无', 'Sign failed' => '签收失败', 'You do not have permission to read the officialdoc' => '你没有查看该通知的权限,谢谢', 'No user to remind' => '没有未签收人员可提醒', 'Remind title' => '提醒您签收通知', 'Remind succeed' => '提醒成功', 'Now sign' => '立即签收', 'Sign time' => '签收时间为:', 'Sign staff' => '签收人员', 'Unsign staff' => '未签收人员', 'Comment my doc' => '评论{realname}的通知<a href=\"{url}\">&nbsp;“{title}”</a>', //----------------sidebar------------------- 'None' => '无', 'New' => '新建', 'Contents under this classification only be deleted when no content' => '该分类下有内容,仅当无内容时才可删除', 'Leave at least a Category' => '请至少保留一个分类', //----------------add------------------- 'News title' => '信息标题', 'Appertaining category' => '所属分类', 'Publishing permissions' => '发布范围', 'Publish' => '发布', 'Draft' => '草稿', 'Comments module is not installed or enabled' => '未安装或未启用评论模块', 'Vote' => '评论', 'Return' => '返回', 'Preview' => '预览', 'Submit' => '提交', 'Wait verify' => '待审核', 'File size limit' => '&nbsp;&nbsp;&nbsp;&nbsp;文件大小限制', //----------------后台------------------- 'Officialdoc setting' => '通知设置', 'Officialdoc approver' => '通知审批人', 'Enable' => '启用', 'Disabled' => '禁用', 'NO.' => '序号', 'Template name' => '模板名称', 'Officialdoc template edit' => '通知模板编辑', 'See more docs' => '查看更多通知', 'Year' => '年', 'Month' => '月', 'Day' => '日', 'Post officialdoc' => '发表了一篇通知', 'Feed title' => '<a href="{url}" class="xwb anchor">{subject}</a>' );
SeekArt/IBOS
system/modules/officialdoc/language/zh_cn/default.php
PHP
lgpl-3.0
5,779
/** * 基于jquery.select2扩展的select插件,基本使用请参考select2相关文档 * 默认是多选模式,并提供了input模式下的初始化方法,对应的数据格式是{ id: 1, text: "Hello" } * 这里的参数只对扩展的部分作介绍 * filter、includes、excludes、query四个参数是互斥的,理论只能有其一个参数 * @method ibosSelect * @param option.filter * @param {Function} option.filter 用于过滤源数据的函数 * @param {Array} option.includes 用于过滤源数据的数据,有效数据的id组 * @param {Array} option.excludes 用于过滤源数据的数据,无效数据的id组 * @param {Boolean} option.pinyin 启用拼音搜索,需要pinyinEngine组件 * @return {jQuery} */ $.fn.ibosSelect = (function(){ var _process = function(datum, collection, filter){ var group, attr; datum = datum[0]; if (datum.children) { group = {}; for (attr in datum) { if (datum.hasOwnProperty(attr)) group[attr] = datum[attr]; } group.children = []; $(datum.children).each2(function(i, childDatum) { _process(childDatum, group.children, filter); }); if (group.children.length) { collection.push(group); } } else { if(filter && !filter(datum)) { return false; } collection.push(datum); } } // 使用带有filter过滤源数据的query函数,其实质就是在query函数执行之前,用filter函数先过滤一次数据 var _queryWithFilter = function(query, filter){ var t = query.term, filtered = { results: [] }, data = []; $(this.data).each2(function(i, datum) { _process(datum, data, filter); }); if (t === "") { query.callback({ results: data }); return; } $(data).each2(function(i, datum) { _process(datum, filtered.results, function(d){ return query.matcher(t, d.text + ""); }) }); query.callback(filtered); } // 根据ID从data数组中获取对应的文本, 主要用于val设置 var _getTextById = function(id, data){ // debugger; var ret; for(var i = 0; i < data.length; i++){ if(data[i].children){ ret = _getTextById(id, data[i].children); if(typeof ret !== "undefined"){ break; } } else { if(data[i].id + "" === id) { ret = data[i].text; break; } } } return ret; } var defaults = { multiple: true, pinyin: true, formatResultCssClass: function(data){ return data.cls; }, formatNoMatches: function(){ return U.lang("S2.NO_MATCHES"); }, formatSelectionTooBig: function (limit) { return U.lang("S2.SELECTION_TO_BIG", { count: limit}); }, formatSearching: function () { return U.lang("S2.SEARCHING"); }, formatInputTooShort: function (input, min) { return U.lang("S2.INPUT_TO_SHORT", { count: min - input.length}); }, formatLoadMore: function (pageNumber) { return U.lang("S2.LOADING_MORE"); }, initSelection: function(elem, callback){ var ins = elem.data("select2"), data = ins.opts.data, results; if(ins.opts.multiple) { results = []; $.each(elem.val().split(','), function(index, val){ results.push({id: val, text: _getTextById(val, data)}); }) } else { results = { id: elem.val(), text: _getTextById(elem.val(), data) } } callback(results); } } var select2 = function(option){ if(typeof option !== "string") { option = $.extend({}, defaults, option); // 注意: filter | query | includes | excludes 四个属性是互斥的 // filter基于query, 而includes、excludes基于filter // 优先度 includes > excludes > filter > query // includes是一个数组,指定源数据中有效数据的ID值,将过滤ID不在此数组中的数据 if(option.includes && $.isArray(option.includes)){ option.filter = function(datum){ return $.inArray(datum.id, option.includes) !== -1; } // includes是一个数组,指定源数据中无效数据的ID值,将过滤ID在此数组中的数据 } else if(option.excludes && $.isArray(option.excludes)) { option.filter = function(datum){ return $.inArray(datum.id, option.excludes) === -1; } } // 当有filter属性时,将使用自定义的query方法替代原来的query方法,filter用于从源数据层面上过滤不需要出现的数据 if(option.filter){ option.query = function(query) { _queryWithFilter(query, option.filter); } } // 使用pinyin搜索引擎 if(option.pinyin) { var _customMatcher = option.matcher; option.matcher = function(term){ if(term === ""){ return true; } return Ibos.matchSpell.apply(this, arguments) && (_customMatcher ? _customMatcher.apply(this, arguments) : true); } } // 使用 select 元素时,要去掉一部分默认项 if($(this).is("select")) { delete option.multiple; delete option.initSelection; } return $.fn.select2.call(this, option) } return $.fn.select2.apply(this, arguments) } return select2; })();
SeekArt/IBOS
static/js/src/base/ibos.select2.js
JavaScript
lgpl-3.0
5,038
/**************************************************************************** ** ** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ ** You may use this file under the terms of the BSD license as follows: ** ** "Redistribution and use in source and binary forms, with or without ** modification, are permitted provided that the following conditions are ** met: ** * Redistributions of source code must retain the above copyright ** notice, this list of conditions and the following disclaimer. ** * Redistributions in binary form must reproduce the above copyright ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. ** * Neither the name of The Qt Company Ltd nor the names of its ** contributors may be used to endorse or promote products derived ** from this software without specific prior written permission. ** ** ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." ** ** $QT_END_LICENSE$ ** ****************************************************************************/ #include "piechart.h" #include "pieslice.h" #include <qdeclarative.h> #include <QDeclarativeView> #include <QApplication> int main(int argc, char *argv[]) { QApplication app(argc, argv); qmlRegisterType<PieChart>("Charts", 1, 0, "PieChart"); qmlRegisterType<PieSlice>("Charts", 1, 0, "PieSlice"); QDeclarativeView view; view.setSource(QUrl::fromLocalFile("app.qml")); view.show(); return app.exec(); }
Distrotech/qtquick1
examples/declarative/tutorials/extending/chapter5-listproperties/main.cpp
C++
lgpl-3.0
2,394
#pragma once #include "Session.h" #pragma once #include "NetPacket.h" class ChatSession: public Session { public: void HandlePing(NetPacket * NetPacket); void HandleEnterRoom(NetPacket * recvPack); void HandleLevaeRoom(NetPacket * recvPack); void HandlePlayerMessage(NetPacket * recvPack); unsigned int RoomId() const { return m_roomId; } private: bool authenticated; unsigned int m_roomId; };
thomashuang/clover
cpp/clover/ChatSession.h
C
lgpl-3.0
433
#include <cstdio> #include <cstring> #define MAXX 50 #define MAXY 50 #define MAXLEN 100 #define Zero(v) memset((v), 0, sizeof(v)) int X, Y; char ins[MAXLEN + 1]; int x, y, d; bool scent[MAXX + 1][MAXY + 1]; const char dirs_str[] = "NESW"; const int dirs[4][2] = { { 0, 1 }, { 1, 0 }, { 0, -1 }, { -1, 0 } }; void simulate() { int n = strlen(ins); int x2, y2; bool lost = false; for (int i = 0; i < n; ++i) { if (ins[i] == 'L') { d = (d + 3) % 4; continue; } else if (ins[i] == 'R') { d = (d + 1) % 4; continue; } else if (ins[i] != 'F') continue; x2 = x + dirs[d][0]; y2 = y + dirs[d][1]; if (x2 >= 0 && x2 <= X && y2 >= 0 && y2 <= Y) { x = x2, y = y2; continue; } if (scent[x][y]) continue; scent[x][y] = true; lost = true; break; } printf("%d %d %c", x, y, dirs_str[d]); if (lost) puts(" LOST"); else putchar('\n'); } int main() { scanf("%d%d", &X, &Y); char o[4]; while (true) { if (scanf("%d%d%s%s", &x, &y, o, ins) != 4) break; d = strcspn(dirs_str, o); simulate(); } return 0; }
lbv/pc-code
solved/l-n/mutant-flatworld-explorers/explorers.cpp
C++
unlicense
1,276
/** ****************************************************************************** * @file DMA/DMA_FLASHToRAM/Src/stm32f1xx_it.c * @author MCD Application Team * @version V1.3.0 * @date 18-December-2015 * @brief Main Interrupt Service Routines. * This file provides template for all exceptions handler and * peripherals interrupt service routine. ****************************************************************************** * @attention * * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2> * * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * 3. Neither the name of STMicroelectronics nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * ****************************************************************************** */ /* Includes ------------------------------------------------------------------*/ #include "main.h" #include "stm32f1xx_it.h" /** @addtogroup STM32F1xx_HAL_Examples * @{ */ /** @addtogroup DMA_FLASHToRAM * @{ */ /* Private typedef -----------------------------------------------------------*/ /* Private define ------------------------------------------------------------*/ /* Private macro -------------------------------------------------------------*/ /* Private variables ---------------------------------------------------------*/ extern DMA_HandleTypeDef DmaHandle; /* Private function prototypes -----------------------------------------------*/ /* Private functions ---------------------------------------------------------*/ /******************************************************************************/ /* Cortex-M3 Processor Exceptions Handlers */ /******************************************************************************/ /** * @brief This function handles NMI exception. * @param None * @retval None */ void NMI_Handler(void) { } /** * @brief This function handles Hard Fault exception. * @param None * @retval None */ void HardFault_Handler(void) { /* Go to infinite loop when Hard Fault exception occurs */ while (1) { } } /** * @brief This function handles Memory Manage exception. * @param None * @retval None */ void MemManage_Handler(void) { /* Go to infinite loop when Memory Manage exception occurs */ while (1) { } } /** * @brief This function handles Bus Fault exception. * @param None * @retval None */ void BusFault_Handler(void) { /* Go to infinite loop when Bus Fault exception occurs */ while (1) { } } /** * @brief This function handles Usage Fault exception. * @param None * @retval None */ void UsageFault_Handler(void) { /* Go to infinite loop when Usage Fault exception occurs */ while (1) { } } /** * @brief This function handles SVCall exception. * @param None * @retval None */ void SVC_Handler(void) { } /** * @brief This function handles Debug Monitor exception. * @param None * @retval None */ void DebugMon_Handler(void) { } /** * @brief This function handles PendSVC exception. * @param None * @retval None */ void PendSV_Handler(void) { } /** * @brief This function handles SysTick Handler. * @param None * @retval None */ void SysTick_Handler(void) { HAL_IncTick(); } /******************************************************************************/ /* STM32F1xx Peripherals Interrupt Handlers */ /* Add here the Interrupt Handler for the used peripheral(s) (PPP), for the */ /* available peripheral interrupt handler's name please refer to the startup */ /* file (startup_stm32f1xx.s). */ /******************************************************************************/ /** * @brief This function handles DMA channel interrupt request. * @param None * @retval None */ void DMA_INSTANCE_IRQHANDLER(void) { /* Check the interrupt and clear flag */ HAL_DMA_IRQHandler(&DmaHandle); } /** * @} */ /** * @} */ /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
hyller/CodeLibrary
stm32cubef1/STM32Cube_FW_F1_V1.3.0/Projects/STM3210E_EVAL/Examples/DMA/DMA_FLASHToRAM/Src/stm32f1xx_it.c
C
unlicense
5,715
[SDS-2.2, Scalable Data Science](https://lamastex.github.io/scalable-data-science/sds/2/2/) =========================================================================================== This is an elaboration of the <http://spark.apache.org/docs/latest/sql-programming-guide.html> by Ivan Sadikov and Raazesh Sainudiin. Data Sources ============ Spark Sql Programming Guide --------------------------- - Data Sources - Generic Load/Save Functions - Manually Specifying Options - Run SQL on files directly - Save Modes - Saving to Persistent Tables - Parquet Files - Loading Data Programmatically - Partition Discovery - Schema Merging - Hive metastore Parquet table conversion - Hive/Parquet Schema Reconciliation - Metadata Refreshing - Configuration - JSON Datasets - Hive Tables - Interacting with Different Versions of Hive Metastore - JDBC To Other Databases - Troubleshooting Data Sources ============ Spark SQL supports operating on a variety of data sources through the `DataFrame` or `DataFrame` interfaces. A Dataset can be operated on as normal RDDs and can also be registered as a temporary table. Registering a Dataset as a table allows you to run SQL queries over its data. But from time to time you would need to either load or save Dataset. Spark SQL provides built-in data sources as well as Data Source API to define your own data source and use it read / write data into Spark. Overview -------- Spark provides some built-in datasources that you can use straight out of the box, such as [Parquet](https://parquet.apache.org/), [JSON](http://www.json.org/), [JDBC](https://en.wikipedia.org/wiki/Java_Database_Connectivity), [ORC](https://orc.apache.org/) (available with enabled Hive Support, but this is changing, and ORC will not require Hive support and will work with default Spark session starting from next release), and Text (since Spark 1.6) and CSV (since Spark 2.0, before that it is accessible as a package). Third-party datasource packages ------------------------------- Community also have built quite a few datasource packages to provide easy access to the data from other formats. You can find list of those packages on http://spark-packages.org/, e.g. [Avro](http://spark-packages.org/package/databricks/spark-avro), [CSV](http://spark-packages.org/package/databricks/spark-csv), [Amazon Redshit](http://spark-packages.org/package/databricks/spark-redshift) (for Spark &lt; 2.0), [XML](http://spark-packages.org/package/HyukjinKwon/spark-xml), [NetFlow](http://spark-packages.org/package/sadikovi/spark-netflow) and many others. Generic Load/Save functions --------------------------- In order to load or save DataFrame you have to call either `read` or `write`. This will return [DataFrameReader](https://spark.apache.org/docs/latest/api/scala/index.html#org.apache.spark.sql.DataFrameReader) or [DataFrameWriter](https://spark.apache.org/docs/latest/api/scala/index.html#org.apache.spark.sql.DataFrameWriter) depending on what you are trying to achieve. Essentially these classes are entry points to the reading / writing actions. They allow you to specify writing mode or provide additional options to read data source. ``` scala // This will return DataFrameReader to read data source println(spark.read) val df = spark.range(0, 10) // This will return DataFrameWriter to save DataFrame println(df.write) ``` > org.apache.spark.sql.DataFrameReader@7e7dee07 > org.apache.spark.sql.DataFrameWriter@1f45f4b > df: org.apache.spark.sql.Dataset[Long] = [id: bigint] ``` scala // Saving Parquet table in Scala val df_save = spark.table("social_media_usage").select("platform", "visits") df_save.write.mode("overwrite").parquet("/tmp/platforms.parquet") // Loading Parquet table in Scala val df = spark.read.parquet("/tmp/platforms.parquet") df.show(5) ``` > +----------+------+ > | platform|visits| > +----------+------+ > | SMS| 61652| > | SMS| 44547| > | Flickr| null| > |Newsletter| null| > | Twitter| 389| > +----------+------+ > only showing top 5 rows > > df_save: org.apache.spark.sql.DataFrame = [platform: string, visits: int] > df: org.apache.spark.sql.DataFrame = [platform: string, visits: int] ``` python # Loading Parquet table in Python dfPy = spark.read.parquet("/tmp/platforms.parquet") dfPy.show(5) ``` > +----------+------+ > | platform|visits| > +----------+------+ > | SMS| 61652| > | SMS| 44547| > | Flickr| null| > |Newsletter| null| > | Twitter| 389| > +----------+------+ > only showing top 5 rows ``` scala // Saving JSON dataset in Scala val df_save = spark.table("social_media_usage").select("platform", "visits") df_save.write.json("/tmp/platforms.json") // Loading JSON dataset in Scala val df = spark.read.json("/tmp/platforms.json") df.show(5) ``` > +----------+------+ > | platform|visits| > +----------+------+ > | SMS| 61652| > | SMS| 44547| > | Flickr| null| > |Newsletter| null| > | Twitter| 389| > +----------+------+ > only showing top 5 rows > > df_save: org.apache.spark.sql.DataFrame = [platform: string, visits: int] > df: org.apache.spark.sql.DataFrame = [platform: string, visits: bigint] ``` python # Loading JSON dataset in Python dfPy = spark.read.json("/tmp/platforms.json") dfPy.show(5) ``` > +----------+------+ > | platform|visits| > +----------+------+ > | SMS| 61652| > | SMS| 44547| > | Flickr| null| > |Newsletter| null| > | Twitter| 389| > +----------+------+ > only showing top 5 rows ### Manually Specifying Options You can also manually specify the data source that will be used along with any extra options that you would like to pass to the data source. Data sources are specified by their fully qualified name (i.e., `org.apache.spark.sql.parquet`), but for built-in sources you can also use their short names (`json`, `parquet`, `jdbc`). DataFrames of any type can be converted into other types using this syntax. ``` scala val json = sqlContext.read.format("json").load("/tmp/platforms.json") json.select("platform").show(10) val parquet = sqlContext.read.format("parquet").load("/tmp/platforms.parquet") parquet.select("platform").show(10) ``` > +----------+ > | platform| > +----------+ > | SMS| > | SMS| > | Flickr| > |Newsletter| > | Twitter| > | Twitter| > | Android| > | Android| > | Android| > |Broadcastr| > +----------+ > only showing top 10 rows > > +----------+ > | platform| > +----------+ > | SMS| > | SMS| > | Flickr| > |Newsletter| > | Twitter| > | Twitter| > | Android| > | Android| > | Android| > |Broadcastr| > +----------+ > only showing top 10 rows > > json: org.apache.spark.sql.DataFrame = [platform: string, visits: bigint] > parquet: org.apache.spark.sql.DataFrame = [platform: string, visits: int] ### Run SQL on files directly Instead of using read API to load a file into DataFrame and query it, you can also query that file directly with SQL. ``` scala val df = sqlContext.sql("SELECT * FROM parquet.`/tmp/platforms.parquet`") df.printSchema() ``` > root > |-- platform: string (nullable = true) > |-- visits: integer (nullable = true) > > df: org.apache.spark.sql.DataFrame = [platform: string, visits: int] ### Save Modes Save operations can optionally take a `SaveMode`, that specifies how to handle existing data if present. It is important to realize that these save modes do not utilize any locking and are not atomic. Additionally, when performing a `Overwrite`, the data will be deleted before writing out the new data. \| Scala/Java \| Any language \| Meaning \| \| --- \| --- \| --- \| \| `SaveMode.ErrorIfExists` (default) \| `"error"` (default) \| When saving a DataFrame to a data source, if data already exists, an exception is expected to be thrown. \| \| `SaveMode.Append` \| `"append"` \| When saving a DataFrame to a data source, if data/table already exists, contents of the DataFrame are expected to be appended to existing data. \| \| `SaveMode.Overwrite` \| `"overwrite"` \| Overwrite mode means that when saving a DataFrame to a data source, if data/table already exists, existing data is expected to be overwritten by the contents of the DataFrame. \| \| `SaveMode.Ignore` \| `"ignore"` \| Ignore mode means that when saving a DataFrame to a data source, if data already exists, the save operation is expected to not save the contents of the DataFrame and to not change the existing data. This is similar to a `CREATE TABLE IF NOT EXISTS` in SQL. \| ### Saving to Persistent Tables `DataFrame` and `Dataset` can also be saved as persistent tables using the `saveAsTable` command. Unlike the `createOrReplaceTempView` command, `saveAsTable` will materialize the contents of the dataframe and create a pointer to the data in the metastore. Persistent tables will still exist even after your Spark program has restarted, as long as you maintain your connection to the same metastore. A DataFrame for a persistent table can be created by calling the `table` method on a `SparkSession` with the name of the table. By default `saveAsTable` will create a “managed table”, meaning that the location of the data will be controlled by the metastore. Managed tables will also have their data deleted automatically when a table is dropped. ``` scala // First of all list tables to see that table we are about to create does not exist spark.catalog.listTables.show() ``` > +--------------------+--------+-----------+---------+-----------+ > | name|database|description|tableType|isTemporary| > +--------------------+--------+-----------+---------+-----------+ > | cities_csv| default| null| EXTERNAL| false| > | cleaned_taxes| default| null| MANAGED| false| > |commdettrumpclint...| default| null| MANAGED| false| > | donaldtrumptweets| default| null| EXTERNAL| false| > | linkage| default| null| EXTERNAL| false| > | nations| default| null| EXTERNAL| false| > | newmplist| default| null| EXTERNAL| false| > | ny_baby_names| default| null| MANAGED| false| > | nzmpsandparty| default| null| EXTERNAL| false| > | pos_neg_category| default| null| EXTERNAL| false| > | rna| default| null| MANAGED| false| > | samh| default| null| EXTERNAL| false| > | social_media_usage| default| null| EXTERNAL| false| > | table1| default| null| EXTERNAL| false| > | test_table| default| null| EXTERNAL| false| > | uscites| default| null| EXTERNAL| false| > +--------------------+--------+-----------+---------+-----------+ ``` sql drop table if exists simple_range ``` ``` scala val df = spark.range(0, 100) df.write.saveAsTable("simple_range") // Verify that table is saved and it is marked as persistent ("isTemporary" value should be "false") spark.catalog.listTables.show() ``` > +--------------------+--------+-----------+---------+-----------+ > | name|database|description|tableType|isTemporary| > +--------------------+--------+-----------+---------+-----------+ > | cities_csv| default| null| EXTERNAL| false| > | cleaned_taxes| default| null| MANAGED| false| > |commdettrumpclint...| default| null| MANAGED| false| > | donaldtrumptweets| default| null| EXTERNAL| false| > | linkage| default| null| EXTERNAL| false| > | nations| default| null| EXTERNAL| false| > | newmplist| default| null| EXTERNAL| false| > | ny_baby_names| default| null| MANAGED| false| > | nzmpsandparty| default| null| EXTERNAL| false| > | pos_neg_category| default| null| EXTERNAL| false| > | rna| default| null| MANAGED| false| > | samh| default| null| EXTERNAL| false| > | simple_range| default| null| MANAGED| false| > | social_media_usage| default| null| EXTERNAL| false| > | table1| default| null| EXTERNAL| false| > | test_table| default| null| EXTERNAL| false| > | uscites| default| null| EXTERNAL| false| > +--------------------+--------+-----------+---------+-----------+ > > df: org.apache.spark.sql.Dataset[Long] = [id: bigint] Parquet Files ------------- [Parquet](http://parquet.io) is a columnar format that is supported by many other data processing systems. Spark SQL provides support for both reading and writing Parquet files that automatically preserves the schema of the original data. When writing Parquet files, all columns are automatically converted to be nullable for compatibility reasons. ### More on Parquet [Apache Parquet](https://parquet.apache.org/) is a [columnar storage](http://en.wikipedia.org/wiki/Column-oriented_DBMS) format available to any project in the Hadoop ecosystem, regardless of the choice of data processing framework, data model or programming language. It is a more efficient way to store data frames. - To understand the ideas read [Dremel: Interactive Analysis of Web-Scale Datasets, Sergey Melnik, Andrey Gubarev, Jing Jing Long, Geoffrey Romer, Shiva Shivakumar, Matt Tolton and Theo Vassilakis,Proc. of the 36th Int'l Conf on Very Large Data Bases (2010), pp. 330-339](http://research.google.com/pubs/pub36632.html), whose Abstract is as follows: - Dremel is a scalable, interactive ad-hoc query system for analysis of read-only nested data. By combining multi-level execution trees and columnar data layouts it is **capable of running aggregation queries over trillion-row tables in seconds**. The system **scales to thousands of CPUs and petabytes of data, and has thousands of users at Google**. In this paper, we describe the architecture and implementation of Dremel, and explain how it complements MapReduce-based computing. We present a novel columnar storage representation for nested records and discuss experiments on few-thousand node instances of the system. <p class="htmlSandbox"><iframe src="https://parquet.apache.org/documentation/latest/" width="95%" height="500" sandbox> <p> <a href="http://spark.apache.org/docs/latest/ml-features.html"> Fallback link for browsers that, unlikely, don't support frames </a> </p> </iframe></p> ### Loading Data Programmatically ``` scala // Read in the parquet file created above. Parquet files are self-describing so the schema is preserved. // The result of loading a Parquet file is also a DataFrame. val parquetFile = sqlContext.read.parquet("/tmp/platforms.parquet") // Parquet files can also be registered as tables and then used in SQL statements. parquetFile.createOrReplaceTempView("parquetFile") val platforms = sqlContext.sql("SELECT platform FROM parquetFile WHERE visits > 0") platforms.distinct.map(t => "Name: " + t(0)).collect().foreach(println) ``` > Name: Flickr > Name: iPhone > Name: YouTube > Name: WordPress > Name: SMS > Name: iPhone App > Name: Youtube > Name: Instagram > Name: iPhone app > Name: Linked-In > Name: Twitter > Name: TOTAL > Name: Tumblr > Name: Newsletter > Name: Pinterest > Name: Android > Name: Foursquare > Name: Google+ > Name: Foursquare (Badge Unlock) > Name: Facebook > parquetFile: org.apache.spark.sql.DataFrame = [platform: string, visits: int] > platforms: org.apache.spark.sql.DataFrame = [platform: string] ### Partition Discovery Table partitioning is a common optimization approach used in systems like Hive. In a partitioned table, data are usually stored in different directories, with partitioning column values encoded in the path of each partition directory. The Parquet data source is now able to discover and infer partitioning information automatically. For example, we can store all our previously used population data (from the programming guide example!) into a partitioned table using the following directory structure, with two extra columns, `gender` and `country` as partitioning columns: path └── to └── table ├── gender=male │ ├── ... │ │ │ ├── country=US │ │ └── data.parquet │ ├── country=CN │ │ └── data.parquet │ └── ... └── gender=female ├── ... │ ├── country=US │ └── data.parquet ├── country=CN │ └── data.parquet └── ... By passing `path/to/table` to either `SparkSession.read.parquet` or `SparkSession.read.load`, Spark SQL will automatically extract the partitioning information from the paths. Now the schema of the returned DataFrame becomes: root |-- name: string (nullable = true) |-- age: long (nullable = true) |-- gender: string (nullable = true) |-- country: string (nullable = true) Notice that the data types of the partitioning columns are automatically inferred. Currently, numeric data types and string type are supported. Sometimes users may not want to automatically infer the data types of the partitioning columns. For these use cases, the automatic type inference can be configured by `spark.sql.sources.partitionColumnTypeInference.enabled`, which is default to `true`. When type inference is disabled, string type will be used for the partitioning columns. Starting from Spark 1.6.0, partition discovery only finds partitions under the given paths by default. For the above example, if users pass `path/to/table/gender=male` to either `SparkSession.read.parquet` or `SparkSession.read.load`, `gender` will not be considered as a partitioning column. If users need to specify the base path that partition discovery should start with, they can set `basePath` in the data source options. For example, when `path/to/table/gender=male` is the path of the data and users set `basePath` to `path/to/table/`, `gender` will be a partitioning column. ### Schema Merging Like ProtocolBuffer, Avro, and Thrift, Parquet also supports schema evolution. Users can start with a simple schema, and gradually add more columns to the schema as needed. In this way, users may end up with multiple Parquet files with different but mutually compatible schemas. The Parquet data source is now able to automatically detect this case and merge schemas of all these files. Since schema merging is a relatively expensive operation, and is not a necessity in most cases, we turned it off by default starting from 1.5.0. You may enable it by: 1. setting data source option `mergeSchema` to `true` when reading Parquet files (as shown in the examples below), or 2. setting the global SQL option `spark.sql.parquet.mergeSchema` to `true`. ``` scala // Create a simple DataFrame, stored into a partition directory val df1 = sc.parallelize(1 to 5).map(i => (i, i * 2)).toDF("single", "double") df1.write.mode("overwrite").parquet("/tmp/data/test_table/key=1") // Create another DataFrame in a new partition directory, adding a new column and dropping an existing column val df2 = sc.parallelize(6 to 10).map(i => (i, i * 3)).toDF("single", "triple") df2.write.mode("overwrite").parquet("/tmp/data/test_table/key=2") // Read the partitioned table val df3 = spark.read.option("mergeSchema", "true").parquet("/tmp/data/test_table") df3.printSchema() // The final schema consists of all 3 columns in the Parquet files together // with the partitioning column appeared in the partition directory paths. // root // |-- single: integer (nullable = true) // |-- double: integer (nullable = true) // |-- triple: integer (nullable = true) // |-- key: integer (nullable = true)) ``` > root > |-- single: integer (nullable = true) > |-- double: integer (nullable = true) > |-- triple: integer (nullable = true) > |-- key: integer (nullable = true) > > df1: org.apache.spark.sql.DataFrame = [single: int, double: int] > df2: org.apache.spark.sql.DataFrame = [single: int, triple: int] > df3: org.apache.spark.sql.DataFrame = [single: int, double: int ... 2 more fields] ### Hive metastore Parquet table conversion When reading from and writing to Hive metastore Parquet tables, Spark SQL will try to use its own Parquet support instead of Hive SerDe for better performance. This behavior is controlled by the `spark.sql.hive.convertMetastoreParquet` configuration, and is turned on by default. #### Hive/Parquet Schema Reconciliation There are two key differences between Hive and Parquet from the perspective of table schema processing. 1. Hive is case insensitive, while Parquet is not 2. Hive considers all columns nullable, while nullability in Parquet is significant Due to this reason, we must reconcile Hive metastore schema with Parquet schema when converting a Hive metastore Parquet table to a Spark SQL Parquet table. The reconciliation rules are: 1. Fields that have the same name in both schema must have the same data type regardless of nullability. The reconciled field should have the data type of the Parquet side, so that nullability is respected. 2. The reconciled schema contains exactly those fields defined in Hive metastore schema. - Any fields that only appear in the Parquet schema are dropped in the reconciled schema. - Any fileds that only appear in the Hive metastore schema are added as nullable field in the reconciled schema. #### Metadata Refreshing Spark SQL caches Parquet metadata for better performance. When Hive metastore Parquet table conversion is enabled, metadata of those converted tables are also cached. If these tables are updated by Hive or other external tools, you need to refresh them manually to ensure consistent metadata. ``` scala // should refresh table metadata spark.catalog.refreshTable("simple_range") ``` ``` sql -- Or you can use SQL to refresh table REFRESH TABLE simple_range; ``` ### Configuration Configuration of Parquet can be done using the `setConf` method on `SQLContext` or by running `SET key=value` commands using SQL. \| Property Name \| Default \| Meaning \| \| --- \| --- \| --- \| --- \| \| `spark.sql.parquet.binaryAsString` \| false \| Some other Parquet-producing systems, in particular Impala, Hive, and older versions of Spark SQL, do not differentiate between binary data and strings when writing out the Parquet schema. This flag tells Spark SQL to interpret binary data as a string to provide compatibility with these systems. \| \| `spark.sql.parquet.int96AsTimestamp` \| true \| Some Parquet-producing systems, in particular Impala and Hive, store Timestamp into INT96. This flag tells Spark SQL to interpret INT96 data as a timestamp to provide compatibility with these systems. \| \| `spark.sql.parquet.cacheMetadata` \| true \| Turns on caching of Parquet schema metadata. Can speed up querying of static data. \| \| `spark.sql.parquet.compression.codec` \| gzip \| Sets the compression codec use when writing Parquet files. Acceptable values include: uncompressed, snappy, gzip, lzo. \| \| `spark.sql.parquet.filterPushdown` \| true \| Enables Parquet filter push-down optimization when set to true. \| \| `spark.sql.hive.convertMetastoreParquet` \| true \| When set to false, Spark SQL will use the Hive SerDe for parquet tables instead of the built in support. \| \| `spark.sql.parquet.output.committer.class` \| `org.apache.parquet.hadoop.ParquetOutputCommitter` \| The output committer class used by Parquet. The specified class needs to be a subclass of `org.apache.hadoop.mapreduce.OutputCommitter`. Typically, it's also a subclass of `org.apache.parquet.hadoop.ParquetOutputCommitter`. Spark SQL comes with a builtin `org.apache.spark.sql.parquet.DirectParquetOutputCommitter`, which can be more efficient then the default Parquet output committer when writing data to S3. \| \| `spark.sql.parquet.mergeSchema` \| `false` \| When true, the Parquet data source merges schemas collected from all data files, otherwise the schema is picked from the summary file or a random data file if no summary file is available. \| JSON Datasets ------------- Spark SQL can automatically infer the schema of a JSON dataset and load it as a DataFrame. This conversion can be done using `SparkSession.read.json()` on either an RDD of String, or a JSON file. Note that the file that is offered as *a json file* is not a typical JSON file. Each line must contain a separate, self-contained valid JSON object. As a consequence, a regular multi-line JSON file will most often fail. ``` scala // A JSON dataset is pointed to by path. // The path can be either a single text file or a directory storing text files. val path = "/tmp/platforms.json" val platforms = spark.read.json(path) // The inferred schema can be visualized using the printSchema() method. platforms.printSchema() // root // |-- platform: string (nullable = true) // |-- visits: long (nullable = true) // Register this DataFrame as a table. platforms.createOrReplaceTempView("platforms") // SQL statements can be run by using the sql methods provided by sqlContext. val facebook = spark.sql("SELECT platform, visits FROM platforms WHERE platform like 'Face%k'") facebook.show() // Alternatively, a DataFrame can be created for a JSON dataset represented by // an RDD[String] storing one JSON object per string. val rdd = sc.parallelize("""{"name":"IWyn","address":{"city":"Columbus","state":"Ohio"}}""" :: Nil) val anotherPlatforms = spark.read.json(rdd) anotherPlatforms.show() ``` > root > |-- platform: string (nullable = true) > |-- visits: long (nullable = true) > > +--------+------+ > |platform|visits| > +--------+------+ > |Facebook| 3| > |Facebook| 36| > |Facebook| 47| > |Facebook| 90| > |Facebook| 105| > |Facebook| 123| > |Facebook| 119| > |Facebook| 148| > |Facebook| 197| > |Facebook| 179| > |Facebook| 200| > |Facebook| 200| > |Facebook| 183| > |Facebook| 190| > |Facebook| 227| > |Facebook| 194| > |Facebook| 243| > |Facebook| 237| > |Facebook| 234| > |Facebook| 238| > +--------+------+ > only showing top 20 rows > > +---------------+----+ > | address|name| > +---------------+----+ > |[Columbus,Ohio]|IWyn| > +---------------+----+ > > <console>:63: warning: method json in class DataFrameReader is deprecated: Use json(Dataset[String]) instead. > val anotherPlatforms = spark.read.json(rdd) > ^ > path: String = /tmp/platforms.json > platforms: org.apache.spark.sql.DataFrame = [platform: string, visits: bigint] > facebook: org.apache.spark.sql.DataFrame = [platform: string, visits: bigint] > rdd: org.apache.spark.rdd.RDD[String] = ParallelCollectionRDD[23304] at parallelize at <console>:62 > anotherPlatforms: org.apache.spark.sql.DataFrame = [address: struct<city: string, state: string>, name: string] Hive Tables ----------- Spark SQL also supports reading and writing data stored in [Apache Hive](http://hive.apache.org/). However, since Hive has a large number of dependencies, it is not included in the default Spark assembly. Hive support is enabled by adding the `-Phive` and `-Phive-thriftserver` flags to Spark’s build. This command builds a new assembly jar that includes Hive. Note that this Hive assembly jar must also be present on all of the worker nodes, as they will need access to the Hive serialization and deserialization libraries (SerDes) in order to access data stored in Hive. Configuration of Hive is done by placing your `hive-site.xml`, `core-site.xml` (for security configuration), `hdfs-site.xml` (for HDFS configuration) file in `conf/`. Please note when running the query on a YARN cluster (`cluster` mode), the `datanucleus` jars under the `lib_managed/jars` directory and `hive-site.xml` under `conf/` directory need to be available on the driver and all executors launched by the YARN cluster. The convenient way to do this is adding them through the `--jars` option and `--file` option of the `spark-submit` command. When working with Hive one must construct a `HiveContext`, which inherits from `SQLContext`, and adds support for finding tables in the MetaStore and writing queries using HiveQL. Users who do not have an existing Hive deployment can still create a `HiveContext`. When not configured by the hive-site.xml, the context automatically creates `metastore_db` in the current directory and creates `warehouse` directory indicated by HiveConf, which defaults to `/user/hive/warehouse`. Note that you may need to grant write privilege on `/user/hive/warehouse` to the user who starts the spark application. ``` scala val spark = SparkSession.builder.enableHiveSupport().getOrCreate() spark.sql("CREATE TABLE IF NOT EXISTS src (key INT, value STRING)") spark.sql("LOAD DATA LOCAL INPATH 'examples/src/main/resources/kv1.txt' INTO TABLE src") // Queries are expressed in HiveQL spark.sql("FROM src SELECT key, value").collect().foreach(println) ``` ### Interacting with Different Versions of Hive Metastore One of the most important pieces of Spark SQL’s Hive support is interaction with Hive metastore, which enables Spark SQL to access metadata of Hive tables. Starting from Spark 1.4.0, a single binary build of Spark SQL can be used to query different versions of Hive metastores, using the configuration described below. Note that independent of the version of Hive that is being used to talk to the metastore, internally Spark SQL will compile against Hive 1.2.1 and use those classes for internal execution (serdes, UDFs, UDAFs, etc). The following options can be used to configure the version of Hive that is used to retrieve metadata: \| Property Name \| Default \| Meaning \| \| --- \| --- \| --- \| \| `spark.sql.hive.metastore.version` \| `1.2.1` \| Version of the Hive metastore. Available options are `0.12.0` through `1.2.1`. \| \| `spark.sql.hive.metastore.jars` \| `builtin` \| Location of the jars that should be used to instantiate the HiveMetastoreClient. This property can be one of three options: `builtin`, `maven`, a classpath in the standard format for the JVM. This classpath must include all of Hive and its dependencies, including the correct version of Hadoop. These jars only need to be present on the driver, but if you are running in yarn cluster mode then you must ensure they are packaged with you application. \| \| `spark.sql.hive.metastore.sharedPrefixes` \| `com.mysql.jdbc,org.postgresql,com.microsoft.sqlserver,oracle.jdbc` \| A comma separated list of class prefixes that should be loaded using the classloader that is shared between Spark SQL and a specific version of Hive. An example of classes that should be shared is JDBC drivers that are needed to talk to the metastore. Other classes that need to be shared are those that interact with classes that are already shared. For example, custom appenders that are used by log4j. \| \| `spark.sql.hive.metastore.barrierPrefixes` \| `(empty)` \| A comma separated list of class prefixes that should explicitly be reloaded for each version of Hive that Spark SQL is communicating with. For example, Hive UDFs that are declared in a prefix that typically would be shared (i.e. `org.apache.spark.*`). \| JDBC To Other Databases ----------------------- Spark SQL also includes a data source that can read data from other databases using JDBC. This functionality should be preferred over using [JdbcRDD](http://spark.apache.org/docs/latest/api/scala/index.html#org.apache.spark.rdd.JdbcRDD). This is because the results are returned as a DataFrame and they can easily be processed in Spark SQL or joined with other data sources. The JDBC data source is also easier to use from Java or Python as it does not require the user to provide a ClassTag. (Note that this is different than the Spark SQL JDBC server, which allows other applications to run queries using Spark SQL). To get started you will need to include the JDBC driver for you particular database on the spark classpath. For example, to connect to postgres from the Spark Shell you would run the following command: SPARK_CLASSPATH=postgresql-9.3-1102-jdbc41.jar bin/spark-shell Tables from the remote database can be loaded as a DataFrame or Spark SQL Temporary table using the Data Sources API. The following options are supported: \| Property Name \| Meaning \| \| --- \| --- \| --- \| \| `url` \| The JDBC URL to connect to. \| \| `dbtable` \| The JDBC table that should be read. Note that anything that is valid in a `FROM` clause of a SQL query can be used. For example, instead of a full table you could also use a subquery in parentheses. \| \| `driver` \| The class name of the JDBC driver needed to connect to this URL. This class will be loaded on the master and workers before running an JDBC commands to allow the driver to register itself with the JDBC subsystem. \| \| `partitionColumn, lowerBound, upperBound, numPartitions` \| These options must all be specified if any of them is specified. They describe how to partition the table when reading in parallel from multiple workers. `partitionColumn` must be a numeric column from the table in question. Notice that `lowerBound` and `upperBound` are just used to decide the partition stride, not for filtering the rows in table. So all rows in the table will be partitioned and returned. \| \| `fetchSize` \| The JDBC fetch size, which determines how many rows to fetch per round trip. This can help performance on JDBC drivers which default to low fetch size (eg. Oracle with 10 rows). \| // Example of using JDBC datasource val jdbcDF = spark.read.format("jdbc").options(Map("url" -> "jdbc:postgresql:dbserver", "dbtable" -> "schema.tablename")).load() -- Or using JDBC datasource in SQL CREATE TEMPORARY TABLE jdbcTable USING org.apache.spark.sql.jdbc OPTIONS ( url "jdbc:postgresql:dbserver", dbtable "schema.tablename" ) ### Troubleshooting - The JDBC driver class must be visible to the primordial class loader on the client session and on all executors. This is because Java’s DriverManager class does a security check that results in it ignoring all drivers not visible to the primordial class loader when one goes to open a connection. One convenient way to do this is to modify compute\_classpath.sh on all worker nodes to include your driver JARs. - Some databases, such as H2, convert all names to upper case. You’ll need to use upper case to refer to those names in Spark SQL.
raazesh-sainudiin/scalable-data-science
gb/sds-2-2/007d_SparkSQLProgGuide_HW.md
Markdown
unlicense
35,754
import React from 'react'; import ReactDOM from 'react-dom'; import './index.css'; function Square(props) { return ( <button className="square" onClick={props.onClick}> {props.value} </button> ); } class Board extends React.Component { renderSquare(i) { return ( <Square value={this.props.squares[i]} onClick={() => this.props.onClick(i)} /> ); } render() { return ( <div> <div className="board-row"> {this.renderSquare(0)} {this.renderSquare(1)} {this.renderSquare(2)} </div> <div className="board-row"> {this.renderSquare(3)} {this.renderSquare(4)} {this.renderSquare(5)} </div> <div className="board-row"> {this.renderSquare(6)} {this.renderSquare(7)} {this.renderSquare(8)} </div> </div> ); } } class Game extends React.Component { constructor(props) { super(props); this.state = { history: [{ squares: Array(9).fill(null) }], xIsNext: true }; } handleClick(i) { const history = this.state.history; const current = history[history.length - 1]; const squares = current.squares.slice(); if (calculateWinner(squares) || squares[i]) { return; } squares[i] = this.state.xIsNext ? 'X' : 'O'; this.setState({ history: history.concat([{ squares: squares }]), xIsNext: !this.state.xIsNext, }); } render() { const history = this.state.history; const current = history[history.length - 1]; const winner = calculateWinner(current.squares); let status; if (winner) { status = 'Winner: ' + winner; } else { status = 'Next player: ' + (this.state.xIsNext ? 'X' : 'O'); } return ( <div className="game"> <div className="game-board"> <Board squares={current.squares} onClick={(i) => this.handleClick(i)} /> </div> <div className="game-info"> <div>{status}</div> <ol>{/* TODO */}</ol> </div> </div> ); } } // ======================================== ReactDOM.render( <Game />, document.getElementById('root') ); function calculateWinner(squares) { const lines = [ [0, 1, 2], [3, 4, 5], [6, 7, 8], [0, 3, 6], [1, 4, 7], [2, 5, 8], [0, 4, 8], [2, 4, 6], ]; for (let i = 0; i < lines.length; i++) { const [a, b, c] = lines[i]; if (squares[a] && squares[a] === squares[b] && squares[a] === squares[c]) { return squares[a]; } } return null; }
xiaoxiaoyao/MyApp
HTML/前端/my-react-app-spring-boot-yao/src/index.js
JavaScript
unlicense
2,690
/********************************************************************************** Copyright (C) 2012 Syed Reza Ali (www.syedrezaali.com) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. **********************************************************************************/ #ifndef CIUI_ROTARY_SLIDER #define CIUI_ROTARY_SLIDER #include "cinder/TriMesh.h" #include "cinder/Shape2d.h" #include "cinder/CinderMath.h" #include "ciUIWidgetWithLabel.h" class ciUIRotarySlider : public ciUIWidgetWithLabel { public: ciUIRotarySlider(float x, float y, float w, float _min, float _max, float _value, string _name) { useReference = false; rect = new ciUIRectangle(x,y,w,w); init(w, _min, _max, &_value, _name); } ciUIRotarySlider(float w, float _min, float _max, float _value, string _name) { useReference = false; rect = new ciUIRectangle(0,0,w,w); init(w, _min, _max, &_value, _name); } ciUIRotarySlider(float x, float y, float w, float _min, float _max, float *_value, string _name) { useReference = true; rect = new ciUIRectangle(x,y,w,w); init(w, _min, _max, _value, _name); } ciUIRotarySlider(float w, float _min, float _max, float *_value, string _name) { useReference = true; rect = new ciUIRectangle(0,0,w,w); init(w, _min, _max, _value, _name); } ~ciUIRotarySlider() { if(!useReference) { delete valueRef; } } void init(float w, float _min, float _max, float *_value, string _name) { name = _name; kind = CI_UI_WIDGET_ROTARYSLIDER; paddedRect = new ciUIRectangle(-padding, -padding, w+padding*2.0f, w+padding); paddedRect->setParent(rect); draw_fill = true; value = *_value; //the widget's value if(useReference) { valueRef = _value; } else { valueRef = new float(); *valueRef = value; } max = _max; min = _min; if(value > max) { value = max; } if(value < min) { value = min; } outerRadius = rect->getWidth()*.5f; innerRadius = rect->getWidth()*.25f; value = ci::lmap<float>(value, min, max, 0.0, 1.0); label = new ciUILabel(0,w+padding,(name+" LABEL"), (name + ": " + numToString(getScaledValue(),2)), CI_UI_FONT_SMALL); label->setParent(label); label->setRectParent(rect); label->setEmbedded(true); increment = 0.1f; } virtual void update() { if(useReference) value = cinder::lmap<float>(*valueRef, min, max, 0.0, 1.0); } virtual void setDrawPadding(bool _draw_padded_rect) { draw_padded_rect = _draw_padded_rect; label->setDrawPadding(false); } virtual void setDrawPaddingOutline(bool _draw_padded_rect_outline) { draw_padded_rect_outline = _draw_padded_rect_outline; label->setDrawPaddingOutline(false); } virtual void drawBack() { if(draw_back) { ci::gl::color(color_back); drawArcStrip(1.0); } } virtual void drawFill() { if(draw_fill) { ci::gl::color(color_fill); drawArcStrip(value); } } virtual void drawFillHighlight() { if(draw_fill_highlight) { ci::gl::color(color_fill_highlight); drawArcStrip(value); } } virtual void drawOutline() { if(draw_outline) { ci::gl::color(color_outline); ci::gl::drawStrokedCircle(Vec2f(rect->getX()+rect->getHalfWidth(), rect->getY()+rect->getHalfHeight()), innerRadius); ci::gl::drawStrokedCircle(Vec2f(rect->getX()+rect->getHalfWidth(), rect->getY()+rect->getHalfHeight()), outerRadius); } } virtual void drawOutlineHighlight() { if(draw_outline_highlight) { ci::gl::color(color_outline_highlight); ci::gl::drawStrokedCircle(Vec2f(rect->getX()+rect->getHalfWidth(), rect->getY()+rect->getHalfHeight()), innerRadius); ci::gl::drawStrokedCircle(Vec2f(rect->getX()+rect->getHalfWidth(), rect->getY()+rect->getHalfHeight()), outerRadius); } } void mouseMove(int x, int y ) { if(rect->inside((float) x, (float) y)) { state = CI_UI_STATE_OVER; } else { state = CI_UI_STATE_NORMAL; } stateChange(); } void mouseDrag(int x, int y, int button) { if(hit) { state = CI_UI_STATE_DOWN; input((float) x, (float) y); triggerEvent(this); } else { state = CI_UI_STATE_NORMAL; } stateChange(); } void mouseDown(int x, int y, int button) { if(rect->inside((float) x, (float) y)) { hit = true; state = CI_UI_STATE_DOWN; input((float) x, (float) y); triggerEvent(this); } else { state = CI_UI_STATE_NORMAL; } stateChange(); } void mouseUp(int x, int y, int button) { if(hit) { #if defined( CINDER_COCOA_TOUCH ) state = CI_UI_STATE_NORMAL; #else state = CI_UI_STATE_OVER; #endif input((float) x, (float) y); triggerEvent(this); } else { state = CI_UI_STATE_NORMAL; } stateChange(); hit = false; } void keyDown( KeyEvent &event ) { if(state == CI_UI_STATE_OVER) { switch (event.getCode()) { case ci::app::KeyEvent::KEY_RIGHT: setValue(getScaledValue()+increment); triggerEvent(this); break; case ci::app::KeyEvent::KEY_UP: setValue(getScaledValue()+increment); triggerEvent(this); break; case ci::app::KeyEvent::KEY_LEFT: setValue(getScaledValue()-increment); triggerEvent(this); break; case ci::app::KeyEvent::KEY_DOWN: setValue(getScaledValue()-increment); triggerEvent(this); break; default: break; } } } void drawArcStrip(float percent) { float theta = ci::lmap<float>(percent, 0.0f , 1.0f , 0.0f , 360.0f); ci::gl::pushMatrices(); ci::gl::translate(rect->getX(),rect->getY()); TriMesh2d mesh; { float x = sin(-ci::toRadians(0.0f)); float y = cos(-ci::toRadians(0.0f)); mesh.appendVertex(Vec2f(center.x+outerRadius*x,center.y+outerRadius*y)); } for(int i = 0; i < theta; i+=8) { float x = sin(-ci::toRadians((float)i)); float y = cos(-ci::toRadians((float)i)); mesh.appendVertex(Vec2f(center.x+outerRadius*x,center.y+outerRadius*y)); } { float x = sin(-ci::toRadians(theta)); float y = cos(-ci::toRadians(theta)); mesh.appendVertex(Vec2f(center.x+outerRadius*x,center.y+outerRadius*y)); // mesh.appendVertex(Vec2f(center.x+innerRadius*x,center.y+innerRadius*y)); } { float x = sin(-ci::toRadians(0.0f)); float y = cos(-ci::toRadians(0.0f)); mesh.appendVertex(Vec2f(center.x+innerRadius*x,center.y+innerRadius*y)); } for(int i = 0; i < theta; i+=8) { float x = sin(-ci::toRadians((float)i)); float y = cos(-ci::toRadians((float)i)); mesh.appendVertex(Vec2f(center.x+innerRadius*x,center.y+innerRadius*y)); } { float x = sin(-ci::toRadians(theta)); float y = cos(-ci::toRadians(theta)); mesh.appendVertex(Vec2f(center.x+innerRadius*x,center.y+innerRadius*y)); } int numVerts = (mesh.getNumVertices())/2; for(int i = 0; i < numVerts-1; i++) { int topIndex = i+numVerts; mesh.appendTriangle(i, i+1, topIndex); mesh.appendTriangle(i+1, topIndex + 1, topIndex); } ci::gl::draw(mesh); ci::gl::popMatrices(); } void setIncrement(float _increment) { increment = _increment; } void input(float x, float y) { hitPoint = Vec2f(x,y); Vec2f mappedHitPoint = hitPoint; mappedHitPoint -= Vec2f(rect->getX()+center.x, rect->getY()+center.y); mappedHitPoint.normalized(); Vec2f cVector = center-homePoint; cVector.normalized(); value = ci::lmap<float>(atan2(cVector.x*mappedHitPoint.y-cVector.y*mappedHitPoint.x, cVector.x*mappedHitPoint.x + cVector.y*mappedHitPoint.y ), -M_PI, M_PI, 0.0f, 1.0f); if(value > 1.0) { value = 1.0; } else if(value < 0.0) { value = 0.0; } updateValueRef(); updateLabel(); } void updateValueRef() { (*valueRef) = getScaledValue(); } void updateLabel() { label->setLabel(name + ": " + numToString(getScaledValue(),2)); } void stateChange() { if(value > 0) { draw_fill = true; } else { draw_fill = false; } switch (state) { case CI_UI_STATE_NORMAL: { draw_fill_highlight = false; draw_outline_highlight = false; label->unfocus(); } break; case CI_UI_STATE_OVER: { draw_fill_highlight = false; draw_outline_highlight = true; label->unfocus(); } break; case CI_UI_STATE_DOWN: { draw_fill_highlight = true; draw_outline_highlight = true; label->focus(); } break; case CI_UI_STATE_SUSTAINED: { draw_fill_highlight = false; draw_outline_highlight = false; label->unfocus(); } break; default: break; } } void setVisible(bool _visible) { visible = _visible; label->setVisible(visible); } void setValue(float _value) { value = ci::lmap<float>(_value, min, max, 0.0, 1.0); updateValueRef(); updateLabel(); } float getValue() { return value; } float getScaledValue() { return ci::lmap<float>(value, 0.0, 1.0, min, max); } ciUILabel *getLabel() { return label; } void setParent(ciUIWidget *_parent) { parent = _parent; paddedRect->setHeight( paddedRect->getHeight() + label->getPaddingRect()->getHeight()); if(label->getPaddingRect()->getWidth()+padding*2.0f > paddedRect->getWidth()) { paddedRect->setWidth(label->getPaddingRect()->getWidth()); } center = Vec2f(rect->getWidth()*.5f, rect->getHeight()*.5f); homePoint = Vec2f(rect->getWidth()*.5f, rect->getHeight()); } bool isDraggable() { return true; } protected: //inherited: ciUIRectangle *rect; ciUIWidget *parent; float value, increment; float *valueRef; bool useReference; float max, min; Vec2f center; Vec2f hitPoint; Vec2f homePoint; float outerRadius, innerRadius; }; #endif
Grulfen/air_guitar
ciUI/src/ciUIRotarySlider.h
C
unlicense
13,486
require('babel-core/register')({plugins: ['babel-plugin-rewire']}) import packageJson from '../package.json' import conformToMask from '../src/conformToMask' import {placeholderChar} from '../src/constants' const createTextMaskInputElement = (isVerify()) ? require(`../${packageJson.main}`).createTextMaskInputElement : require('../src/createTextMaskInputElement.js').default describe('createTextMaskInputElement', () => { let inputElement beforeEach(() => { inputElement = document.createElement('input') }) it('takes an inputElement and other Text Mask parameters and returns an object which ' + 'allows updating and controlling the masking of the input element', () => { const maskedInputElementControl = createTextMaskInputElement({ inputElement, mask: ['(', /\d/, /\d/, /\d/, ')', ' ', /\d/, /\d/, /\d/, '-', /\d/, /\d/, /\d/, /\d/] }) expect(maskedInputElementControl.update).to.be.a('function') }) it('works with mask functions', () => { const mask = () => [/\d/, /\d/, /\d/, /\d/] expect(() => createTextMaskInputElement({inputElement, mask})).to.not.throw() }) it('displays mask when showMask is true', () => { const textMaskControl = createTextMaskInputElement({ showMask: true, inputElement, mask: ['(', /\d/, /\d/, /\d/, ')', ' ', /\d/, /\d/, /\d/, '-', /\d/, /\d/, /\d/, /\d/] }) textMaskControl.update() expect(inputElement.value).to.equal('(___) ___-____') }) it('does not display mask when showMask is false', () => { const textMaskControl = createTextMaskInputElement({ showMask: false, inputElement, mask: ['(', /\d/, /\d/, /\d/, ')', ' ', /\d/, /\d/, /\d/, '-', /\d/, /\d/, /\d/, /\d/] }) textMaskControl.update() expect(inputElement.value).to.equal('') }) describe('`update` method', () => { it('conforms whatever value is in the input element to a mask', () => { const mask = ['(', /\d/, /\d/, /\d/, ')', ' ', /\d/, /\d/, /\d/, '-', /\d/, /\d/, /\d/, /\d/] const textMaskControl = createTextMaskInputElement({inputElement, mask}) inputElement.value = '2' textMaskControl.update() expect(inputElement.value).to.equal('(2__) ___-____') }) it('works after multiple calls', () => { const mask = ['+', '1', ' ', '(', /\d/, /\d/, /\d/, ')', ' ', /\d/, /\d/, /\d/, '-', /\d/, /\d/, /\d/, /\d/] const textMaskControl = createTextMaskInputElement({inputElement, mask}) inputElement.value = '2' textMaskControl.update() expect(inputElement.value).to.equal('+1 (2__) ___-____') inputElement.value = '+1 (23__) ___-____' inputElement.selectionStart = 6 textMaskControl.update() expect(inputElement.value).to.equal('+1 (23_) ___-____') inputElement.value = '+1 (2_) ___-____' inputElement.selectionStart = 5 textMaskControl.update() expect(inputElement.value).to.equal('+1 (2__) ___-____') inputElement.value = '+1 (__) ___-____' inputElement.selectionStart = 4 textMaskControl.update() expect(inputElement.value).to.equal('') }) it('accepts a string to conform and overrides whatever value is in the input element', () => { const mask = ['(', /\d/, /\d/, /\d/, ')', ' ', /\d/, /\d/, /\d/, '-', /\d/, /\d/, /\d/, /\d/] const textMaskControl = createTextMaskInputElement({inputElement, mask}) inputElement.value = '2' textMaskControl.update('123') expect(inputElement.value).to.equal('(123) ___-____') }) it('accepts an empty string and overrides whatever value is in the input element', () => { const mask = ['(', /\d/, /\d/, /\d/, ')', ' ', /\d/, /\d/, /\d/, '-', /\d/, /\d/, /\d/, /\d/] const textMaskControl = createTextMaskInputElement({inputElement, mask}) textMaskControl.update(123) expect(inputElement.value).to.equal('(123) ___-____') textMaskControl.update('') expect(inputElement.value).to.equal('') }) it('accepts an empty string after reinitializing text mask', () => { const mask = ['(', /\d/, /\d/, /\d/, ')', ' ', /\d/, /\d/, /\d/, '-', /\d/, /\d/, /\d/, /\d/] let textMaskControl = createTextMaskInputElement({inputElement, mask}) textMaskControl.update(123) expect(inputElement.value).to.equal('(123) ___-____') //reset text mask textMaskControl = createTextMaskInputElement({inputElement, mask}) // now clear the value textMaskControl.update('') expect(inputElement.value).to.equal('') }) if (!isVerify()) { it('does not conform given parameter if it is the same as the previousConformedValue', () => { const conformToMaskSpy = sinon.spy(conformToMask) const mask = ['(', /\d/, /\d/, /\d/, ')', ' ', /\d/, /\d/, /\d/, '-', /\d/, /\d/, /\d/, /\d/] const textMaskControl = createTextMaskInputElement({inputElement, mask}) createTextMaskInputElement.__Rewire__('conformToMask', conformToMaskSpy) inputElement.value = '2' textMaskControl.update() expect(inputElement.value).to.equal('(2__) ___-____') expect(conformToMaskSpy.callCount).to.equal(1) textMaskControl.update('(2__) ___-____') expect(conformToMaskSpy.callCount).to.equal(1) createTextMaskInputElement.__ResetDependency__('conformToMask') }) } it('works with a string', () => { const mask = ['(', /\d/, /\d/, /\d/, ')', ' ', /\d/, /\d/, /\d/, '-', /\d/, /\d/, /\d/, /\d/] const textMaskControl = createTextMaskInputElement({inputElement, mask}) textMaskControl.update('2') expect(inputElement.value).to.equal('(2__) ___-____') }) it('works with a number by coercing it into a string', () => { const mask = ['(', /\d/, /\d/, /\d/, ')', ' ', /\d/, /\d/, /\d/, '-', /\d/, /\d/, /\d/, /\d/] const textMaskControl = createTextMaskInputElement({inputElement, mask}) textMaskControl.update(2) expect(inputElement.value).to.equal('(2__) ___-____') }) it('works with `undefined` and `null` by treating them as empty strings', () => { const mask = ['(', /\d/, /\d/, /\d/, ')', ' ', /\d/, /\d/, /\d/, '-', /\d/, /\d/, /\d/, /\d/] const textMaskControl = createTextMaskInputElement({inputElement, mask}) textMaskControl.update(undefined) expect(inputElement.value).to.equal('') textMaskControl.update(null) expect(inputElement.value).to.equal('') }) it('throws if given a value that it cannot work with', () => { const mask = ['(', /\d/, /\d/, /\d/, ')', ' ', /\d/, /\d/, /\d/, '-', /\d/, /\d/, /\d/, /\d/] const textMaskControl = createTextMaskInputElement({inputElement, mask}) expect(() => textMaskControl.update({})).to.throw() expect(() => textMaskControl.update(() => 'howdy')).to.throw() expect(() => textMaskControl.update([])).to.throw() }) it('adjusts the caret position', () => { const mask = ['(', /\d/, /\d/, /\d/, ')', ' ', /\d/, /\d/, /\d/, '-', /\d/, /\d/, /\d/, /\d/] const textMaskControl = createTextMaskInputElement({inputElement, mask, placeholderChar}) inputElement.focus() inputElement.value = '2' inputElement.selectionStart = 1 textMaskControl.update() expect(inputElement.selectionStart).to.equal(2) }) it('does not adjust the caret position if the input element is not focused', () => { const mask = ['(', /\d/, /\d/, /\d/, ')', ' ', /\d/, /\d/, /\d/, '-', /\d/, /\d/, /\d/, /\d/] const textMaskControl = createTextMaskInputElement({inputElement, mask}) inputElement.value = '2' inputElement.selectionStart = 1 textMaskControl.update() expect(inputElement.selectionStart).to.equal(0) }) it('calls the mask function before every update', () => { const maskSpy = sinon.spy(() => [/\d/, /\d/, /\d/, /\d/]) const textMaskControl = createTextMaskInputElement({inputElement, mask: maskSpy}) inputElement.value = '2' textMaskControl.update() expect(inputElement.value).to.equal('2___') inputElement.value = '24' textMaskControl.update() expect(inputElement.value).to.equal('24__') expect(maskSpy.callCount).to.equal(2) }) it('can be disabled with `false` mask', () => { const mask = false const textMaskControl = createTextMaskInputElement({inputElement, mask}) inputElement.value = 'a' textMaskControl.update() expect(inputElement.value).to.equal('a') }) it('can be disabled by returning `false` from mask function', () => { const mask = () => false const textMaskControl = createTextMaskInputElement({inputElement, mask}) inputElement.value = 'a' textMaskControl.update() expect(inputElement.value).to.equal('a') }) it('can pass in a config object to the update method', () => { const mask = ['(', /\d/, /\d/, /\d/, ')', ' ', /\d/, /\d/, /\d/, '-', /\d/, /\d/, /\d/, /\d/] const textMaskControl = createTextMaskInputElement() let inputElement = {value: '2'} textMaskControl.update(inputElement.value, {inputElement, mask}) expect(inputElement.value).to.equal('(2__) ___-____') }) it('can change the mask passed to the update method', () => { const textMaskControl = createTextMaskInputElement() let inputElement = {value: '2'} textMaskControl.update(inputElement.value, { inputElement, mask: ['(', /\d/, /\d/, /\d/, ')', ' ', /\d/, /\d/, /\d/, '-', /\d/, /\d/, /\d/, /\d/] }) expect(inputElement.value).to.equal('(2__) ___-____') textMaskControl.update('2', { inputElement, mask: ['+', '1', ' ', '(', /\d/, /\d/, /\d/, ')', ' ', /\d/, /\d/, /\d/, '-', /\d/, /\d/, /\d/, /\d/] }) expect(inputElement.value).to.equal('+1 (2__) ___-____') }) it('can change the guide passed to the update method', () => { const mask = ['(', /\d/, /\d/, /\d/, ')', ' ', /\d/, /\d/, /\d/, '-', /\d/, /\d/, /\d/, /\d/] const textMaskControl = createTextMaskInputElement() let inputElement = {value: '2'} textMaskControl.update(inputElement.value, {inputElement, mask, guide: true}) expect(inputElement.value).to.equal('(2__) ___-____') textMaskControl.update('2', {inputElement, mask, guide: false}) expect(inputElement.value).to.equal('(2') }) it('can change the placeholderChar passed to the update method', () => { const mask = ['(', /\d/, /\d/, /\d/, ')', ' ', /\d/, /\d/, /\d/, '-', /\d/, /\d/, /\d/, /\d/] const textMaskControl = createTextMaskInputElement() let inputElement = {value: '2'} textMaskControl.update(inputElement.value, {inputElement, mask, placeholderChar: '_'}) expect(inputElement.value).to.equal('(2__) ___-____') textMaskControl.update('2', {inputElement, mask, placeholderChar: '*'}) expect(inputElement.value).to.equal('(2**) ***-****') }) it('can change the inputElement passed to the update method', () => { const mask = ['(', /\d/, /\d/, /\d/, ')', ' ', /\d/, /\d/, /\d/, '-', /\d/, /\d/, /\d/, /\d/] const textMaskControl = createTextMaskInputElement() let firstInputElement = {value: '1'} let secondInputElement = {value: '2'} textMaskControl.update('1', {inputElement: firstInputElement, mask}) expect(firstInputElement.value).to.equal('(1__) ___-____') textMaskControl.update('2', {inputElement: secondInputElement, mask}) expect(secondInputElement.value).to.equal('(2__) ___-____') }) it('can change the config passed to createTextMaskInputElement', () => { const config = { inputElement, mask: ['(', /\d/, /\d/, /\d/, ')', ' ', /\d/, /\d/, /\d/, '-', /\d/, /\d/, /\d/, /\d/], guide: true, placeholderChar: '_' } const textMaskControl = createTextMaskInputElement(config) inputElement.value = '2' textMaskControl.update() expect(inputElement.value).to.equal('(2__) ___-____') // change the mask config.mask = ['+', '1', ' ', '(', /\d/, /\d/, /\d/, ')', ' ', /\d/, /\d/, /\d/, '-', /\d/, /\d/, /\d/, /\d/] inputElement.value = '23' // <- you have to change the value textMaskControl.update() expect(inputElement.value).to.equal('+1 (23_) ___-____') // change the placeholderChar config.placeholderChar = '*' inputElement.value = '4' // <- you have to change the value textMaskControl.update() expect(inputElement.value).to.equal('+1 (4**) ***-****') // change the guide config.guide = false inputElement.value = '45' // <- you have to change the value textMaskControl.update() expect(inputElement.value).to.equal('+1 (45') }) it('can override the config passed to createTextMaskInputElement', () => { const textMaskControl = createTextMaskInputElement({ inputElement, mask: ['(', /\d/, /\d/, /\d/, ')', ' ', /\d/, /\d/, /\d/, '-', /\d/, /\d/, /\d/, /\d/], guide: true }) inputElement.value = '2' textMaskControl.update() expect(inputElement.value).to.equal('(2__) ___-____') // pass in a config to the update method textMaskControl.update('23', { inputElement, mask: ['+', '1', ' ', '(', /\d/, /\d/, /\d/, ')', ' ', /\d/, /\d/, /\d/, '-', /\d/, /\d/, /\d/, /\d/], guide: false }) expect(inputElement.value).to.equal('+1 (23') // use original config again inputElement.value = '234' // <- you have to change the value textMaskControl.update() expect(inputElement.value).to.equal('(234) ___-____') }) }) })
CrisDan1905/text-mask
core/test/createTextMaskInputElement.spec.js
JavaScript
unlicense
13,794
Take a distributed lock in a shared SQL Server database. In F#: Example ------- Take a distributed lock in a shared SQL Server database. In F#: #r "Sproc.Lock.dll" open System open Sproc.Lock.Fun let connString = "sql server connection string" let lock1 = GetGlobalLock connString (TimeSpan.FromMinutes 5.) "MyAppLock" match lock1 with | Locked l -> sprintf "I got a lock called %s!" l.LockId // (will be "MyAppLock" on this occassion) | Unavailable -> sprintf "Someone else had the lock already!" | Error i -> sprintf "Something went wrong - error code: %d" i lock1.Dispose() And C#: using System; using Sproc.Lock.OO; namespace MyApp { class Thing { static void DoLockRequiringWork() { var provider = new LockProvider("sql connection string"); try { using (var lock2 = provider.GlobalLock("MyAppLock", TimeSpan.FromMinutes(5.0)) { // If I get here, I've got a lock! // Doing stuff! } // Lock released when Disposed } catch (LockUnavailableException) { // Couldn't get the lock throw; } catch (LockRequestErrorException) { // Getting the lock threw an error throw; } } } } Documentation ------------- Sproc.Lock is a combination of a managed .net library and a set of SQL Server scripts that combine to turn SQL Server into a distributed locking server. This library is only really recommended if you are already using SQL Server, and do not have a more suitable distibuted locking server already up and running. In that case, Sproc.Lock can save you the overhead of adding an additional piece of infrastructure to your environment Find out more at [15below.github.io/Sproc.Lock/](http://15below.github.io/Sproc.Lock/)
octoberclub/Sproc.Lock
README.md
Markdown
unlicense
2,172
GoogleElectionMap.shapeReady({name:"28_05",type:"state",state:"28_05",bounds:[],centroid:[],shapes:[ {points:[ {x:32.8810559124534,y: 24.5253494052583} , {x:32.8804366855404,y: 24.5250018993236} , {x:32.8804349320052,y: 24.5250021192127} , {x:32.8800699675051,y: 24.52504787811} , {x:32.880107603168,y: 24.5253602242076} , {x:32.8802839839792,y: 24.52603126374} , {x:32.8806752087983,y: 24.5268181464166} , {x:32.8813572439035,y: 24.5276168223645} , {x:32.8819505502392,y: 24.5286583392856} , {x:32.8825307177406,y: 24.5302435034032} , {x:32.882934635026,y: 24.5310072542635} , {x:32.8834485851789,y: 24.5330479929378} , {x:32.8837280117142,y: 24.5339626803751} , {x:32.884343892289,y: 24.534985099402} , {x:32.8849707220765,y: 24.5357073551443} , {x:32.8857139839758,y: 24.5365877815531} , {x:32.8867322124162,y: 24.5378013619691} , {x:32.8876882846372,y: 24.5390216560881} , {x:32.8891919119942,y: 24.540785084219} , {x:32.8898616158364,y: 24.5413523715326} , {x:32.890834703648,y: 24.5420471161423} , {x:32.892022806308,y: 24.5427073069361} , {x:32.8929960248504,y: 24.543274797266} , {x:32.8936151079581,y: 24.5439230021262} , {x:32.8939563239076,y: 24.5441777223781} , {x:32.8941969226219,y: 24.5443351788832} , {x:32.8942217362609,y: 24.5443514180803} , {x:32.8943103917561,y: 24.5441895397177} , {x:32.8939318918876,y: 24.5431597894563} , {x:32.8935156289255,y: 24.5419333682628} , {x:32.8928971968486,y: 24.5405332931207} , {x:32.8917605486434,y: 24.5388783635996} , {x:32.8902124631775,y: 24.5361164927854} , {x:32.888306467008,y: 24.5329536141396} , {x:32.8876782300639,y: 24.5314852017043} , {x:32.8871284082075,y: 24.5298608543163} , {x:32.8865281254967,y: 24.5282916909969} , {x:32.8855427814326,y: 24.5272845980552} , {x:32.8843422710402,y: 24.5265318135685} , {x:32.8843325732352,y: 24.5265286685573} , {x:32.8830908791957,y: 24.5261259978265} , {x:32.881890005934,y: 24.525789614878} , {x:32.8818650371091,y: 24.5257764371665} , {x:32.8810559124534,y: 24.5253494052583} ]} , {points:[ {x:32.9019960722517,y: 24.546197781935} , {x:32.9010302932533,y: 24.5450044439886} , {x:32.9010174381379,y: 24.545007502719} , {x:32.9007640795607,y: 24.5450677818085} , {x:32.9005131225026,y: 24.5451274885421} , {x:32.9003777640669,y: 24.5457237535524} , {x:32.9002865578843,y: 24.5473482461574} , {x:32.9004882152,y: 24.5482120654834} , {x:32.9003525941626,y: 24.5491373531242} , {x:32.900832773743,y: 24.55037862879} , {x:32.9018562389718,y: 24.5516524640258} , {x:32.9023628597906,y: 24.552782200296} , {x:32.9021249492644,y: 24.5534958706051} , {x:32.9022027836992,y: 24.5546847079245} , {x:32.9023690012363,y: 24.5560566043976} , {x:32.9028188794294,y: 24.5584934715349} , {x:32.9029844838607,y: 24.5607298870529} , {x:32.9032690872615,y: 24.5622439360486} , {x:32.9035020034828,y: 24.5643563747934} , {x:32.9037861391809,y: 24.5666009905706} , {x:32.9050066369447,y: 24.5719657076965} , {x:32.9052751701374,y: 24.5736726816184} , {x:32.9057684355406,y: 24.5755648725823} , {x:32.9061501491834,y: 24.5763054129537} , {x:32.9068912719161,y: 24.5775602749211} , {x:32.9071826506696,y: 24.5788354173812} , {x:32.9074633948669,y: 24.5793008493204} , {x:32.9078171918728,y: 24.5798100253351} , {x:32.9084907789616,y: 24.5812139252027} , {x:32.9090556117857,y: 24.5819898205123} , {x:32.9090636373088,y: 24.5820008439576} , {x:32.9092325012938,y: 24.5820241121723} , {x:32.9094009189669,y: 24.5820473185113} , {x:32.9096709844482,y: 24.5817544472809} , {x:32.909941684888,y: 24.5805824705258} , {x:32.9102296567228,y: 24.5788398566416} , {x:32.9103986387366,y: 24.5783849828288} , {x:32.9104974920394,y: 24.5767592356871} , {x:32.9105124195482,y: 24.5765137378363} , {x:32.9108056159214,y: 24.5753006450003} , {x:32.9102678229386,y: 24.5726887078502} , {x:32.9104706554834,y: 24.5720513487502} , {x:32.9103591291708,y: 24.5707968848439} , {x:32.9091798931689,y: 24.5670953383371} , {x:32.9087759661133,y: 24.5655306319631} , {x:32.9086508606572,y: 24.5642050621524} , {x:32.9078914454148,y: 24.5627695300111} , {x:32.9076658286507,y: 24.5618722099146} , {x:32.9077735243321,y: 24.5588879375975} , {x:32.907774932616,y: 24.5588497040426} , {x:32.9073701959783,y: 24.5556912390294} , {x:32.9072276733165,y: 24.5544241590121} , {x:32.906409261338,y: 24.5532986913824} , {x:32.9056973049112,y: 24.5517939294792} , {x:32.9049817259066,y: 24.5509504330437} , {x:32.9049658377677,y: 24.5509316956826} , {x:32.90381474316,y: 24.5492835424285} , {x:32.9037636822701,y: 24.5492027419115} , {x:32.9030737275812,y: 24.5481109239315} , {x:32.9019960722517,y: 24.546197781935} ]} , {points:[ {x:32.9068658186117,y: 24.5915723876647} , {x:32.9066878311066,y: 24.5915748676675} , {x:32.9067076277387,y: 24.5919749787228} , {x:32.9070246099623,y: 24.592443930182} , {x:32.9076231833487,y: 24.5928835333985} , {x:32.9088028737963,y: 24.5933109251489} , {x:32.9090074056725,y: 24.5934322206895} , {x:32.9090270978349,y: 24.5934438824877} , {x:32.9092976821383,y: 24.5934462932366} , {x:32.909286973302,y: 24.5931893578706} , {x:32.9091097934543,y: 24.5929591806176} , {x:32.9086061068361,y: 24.5926094511158} , {x:32.9074405092677,y: 24.5920562524253} , {x:32.9068790119857,y: 24.5915721962758} , {x:32.9068658186117,y: 24.5915723876647} ]} , {points:[ {x:32.9306380028288,y: 24.6439357499388} , {x:32.9304193835619,y: 24.6415543043021} , {x:32.9308201553539,y: 24.6410593727391} , {x:32.9305410201023,y: 24.6400288328263} , {x:32.9302961762274,y: 24.6395098034689} , {x:32.9300974490365,y: 24.6387671899185} , {x:32.9300874336471,y: 24.6384384253086} , {x:32.9298430339207,y: 24.6372989142743} , {x:32.9296187700537,y: 24.6366815740391} , {x:32.929292660736,y: 24.6357273153721} , {x:32.9289463936502,y: 24.6345297135787} , {x:32.9283143679605,y: 24.6333846414923} , {x:32.9276090835126,y: 24.6321245908133} , {x:32.9259368471765,y: 24.6299243777634} , {x:32.9249381092441,y: 24.628550513942} , {x:32.9243679699102,y: 24.6275159314012} , {x:32.9239819137914,y: 24.6264069339599} , {x:32.9237194492429,y: 24.6248475503466} , {x:32.9232304161745,y: 24.6244313972004} , {x:32.9226807488606,y: 24.6237706813579} , {x:32.9219094664714,y: 24.6220371266924} , {x:32.9209583026776,y: 24.6194354801501} , {x:32.9202098225335,y: 24.6176989185076} , {x:32.9196484077822,y: 24.6155277855946} , {x:32.9186196956626,y: 24.613296574409} , {x:32.9177874586635,y: 24.6120536075743} , {x:32.9169938204959,y: 24.6094799128237} , {x:32.9161977168247,y: 24.6075728003033} , {x:32.9158716227109,y: 24.6060585022178} , {x:32.9155042947087,y: 24.605048882695} , {x:32.9152185857547,y: 24.6042823155805} , {x:32.9149134545365,y: 24.602057702674} , {x:32.9145055301289,y: 24.6006555094605} , {x:32.9138931797687,y: 24.5992345016333} , {x:32.912469444399,y: 24.5990566945658} , {x:32.9121294329819,y: 24.5972399297232} , {x:32.9118492363033,y: 24.5956865239906} , {x:32.9114585710327,y: 24.5953194691625} , {x:32.9105310622483,y: 24.5941426406149} , {x:32.9094407460489,y: 24.5939341256383} , {x:32.9079374522802,y: 24.5932473626289} , {x:32.9066457405462,y: 24.5928325034861} , {x:32.9060107956899,y: 24.5916107817261} , {x:32.9048985872142,y: 24.5910952990972} , {x:32.9046749020783,y: 24.589543656946} , {x:32.9047226388473,y: 24.5894667537846} , {x:32.9046136175776,y: 24.5894867602747} , {x:32.9045531817626,y: 24.5883230970128} , {x:32.904354674077,y: 24.5872715018379} , {x:32.9039262262108,y: 24.5861776988867} , {x:32.9034211182531,y: 24.5850978637064} , {x:32.9028247295084,y: 24.583120715002} , {x:32.9025193327864,y: 24.5815503220875} , {x:32.9021368365261,y: 24.5805546797424} , {x:32.9018160783231,y: 24.579040352879} , {x:32.9016023333368,y: 24.5779186450114} , {x:32.9014042324767,y: 24.576404397734} , {x:32.901160779702,y: 24.574091002157} , {x:32.9003959129671,y: 24.5716522686668} , {x:32.9000808960838,y: 24.5709728465639} , {x:32.8997346638503,y: 24.5690107188021} , {x:32.8996510630001,y: 24.5674002554552} , {x:32.8995356436118,y: 24.56571795718} , {x:32.8992341125435,y: 24.5625019090756} , {x:32.8991040170725,y: 24.5599708549208} , {x:32.8989477034196,y: 24.5590748844666} , {x:32.8980879321001,y: 24.5575373917488} , {x:32.8979337637813,y: 24.5561042766295} , {x:32.8975376570664,y: 24.554970632733} , {x:32.896736102018,y: 24.5525857967486} , {x:32.8958712057812,y: 24.5510907338809} , {x:32.894948379246,y: 24.5496231562703} , {x:32.8943796417896,y: 24.547913414668} , {x:32.8941659601485,y: 24.5468477713103} , {x:32.8939212363672,y: 24.5462447535708} , {x:32.8933393728601,y: 24.5455854179938} , {x:32.8920374332369,y: 24.544603111427} , {x:32.8898776653757,y: 24.5431154603853} , {x:32.887671719285,y: 24.5419081362463} , {x:32.8852323439757,y: 24.5389890291771} , {x:32.8834157379391,y: 24.5365649375411} , {x:32.8827275622485,y: 24.5354673965301} , {x:32.882159612944,y: 24.5344169078237} , {x:32.8813308567563,y: 24.5323449731674} , {x:32.8809043076298,y: 24.5314279071763} , {x:32.8805244747611,y: 24.5297327853161} , {x:32.8800349412484,y: 24.5288102153174} , {x:32.8789196989165,y: 24.5269400357722} , {x:32.8784032313241,y: 24.525718351981} , {x:32.8779144990341,y: 24.523998211083} , {x:32.8772079782751,y: 24.5221283481906} , {x:32.8761208595581,y: 24.5194606056338} , {x:32.8755236038326,y: 24.5173415838965} , {x:32.8753881295868,y: 24.5165937557813} , {x:32.874844274727,y: 24.51559635064} , {x:32.8748371177966,y: 24.5155034947354} , {x:32.8743083111815,y: 24.5140476528538} , {x:32.8742450595108,y: 24.5137386722838} , {x:32.8731774306802,y: 24.5138787634109} , {x:32.8645361363841,y: 24.5159432258465} , {x:32.8652039569641,y: 24.5189366440886} , {x:32.8652520261104,y: 24.5190904950891} , {x:32.86244624526,y: 24.5168613373775} , {x:32.8550215473134,y: 24.5082612011912} , {x:32.8473672482674,y: 24.4977405036822} , {x:32.839149268727,y: 24.4926116118191} , {x:32.8195473431857,y: 24.51359608293} , {x:32.819206702427,y: 24.5139593793166} , {x:32.7247874545531,y: 24.4984739899919} , {x:32.7247343429083,y: 24.4967570827833} , {x:32.3053274242314,y: 24.5150151524095} , {x:32.3505190734948,y: 24.6001500683935} , {x:32.3751072001533,y: 24.6461496615975} , {x:32.7461789449408,y: 24.6231108842054} , {x:32.7467358579721,y: 24.6194649771254} , {x:32.7477559210231,y: 24.6199341877182} , {x:32.803738660182,y: 24.6230308346119} , {x:32.8701734869393,y: 24.627487662961} , {x:32.8967684734596,y: 24.636735017169} , {x:32.9086564138478,y: 24.6444041966976} , {x:32.9085952015556,y: 24.6446983519101} , {x:32.9088839652403,y: 24.6443743822834} , {x:32.9137395360047,y: 24.649022571411} , {x:32.9145728631378,y: 24.6528254798246} , {x:32.9171523484769,y: 24.6557762121668} , {x:32.9203176535248,y: 24.6567084526774} , {x:32.9225677645859,y: 24.6573297898235} , {x:32.9261012000676,y: 24.6570952672514} , {x:32.9281613976806,y: 24.6563682843939} , {x:32.9283076390063,y: 24.6563166930561} , {x:32.9300460768901,y: 24.6557632153275} , {x:32.930078176546,y: 24.6543167402235} , {x:32.9301291123022,y: 24.6515128973271} , {x:32.9302158149965,y: 24.6495805473188} , {x:32.9303714586333,y: 24.6486101642897} , {x:32.9306624148647,y: 24.647151462599} , {x:32.9305883773967,y: 24.6456266408222} , {x:32.9306380028288,y: 24.6439357499388} ]} , {points:[ {x:32.9301278080931,y: 24.6938136329239} , {x:32.9300377541867,y: 24.692156899672} , {x:32.9298164212757,y: 24.6882072762278} , {x:32.9297121107921,y: 24.6879556459738} , {x:32.9294180587474,y: 24.6874089693958} , {x:32.9293234043731,y: 24.6868710594824} , {x:32.9291527308794,y: 24.6864372171446} , {x:32.9291336578181,y: 24.6864421087535} , {x:32.9288488400492,y: 24.6865151526406} , {x:32.9282123364019,y: 24.6870874210293} , {x:32.9278797114991,y: 24.6875991050041} , {x:32.9277883747344,y: 24.6905152719209} , {x:32.9278152013799,y: 24.6920194262524} , {x:32.927028589153,y: 24.6952566372695} , {x:32.9266666440096,y: 24.6968847884626} , {x:32.9265143277109,y: 24.6975527094942} , {x:32.926504784016,y: 24.6978942538227} , {x:32.9265046315795,y: 24.697899715071} , {x:32.926704004053,y: 24.6979605380045} , {x:32.9271507021965,y: 24.6972580566782} , {x:32.9278343315725,y: 24.694109085076} , {x:32.9284985018112,y: 24.6926815228648} , {x:32.9287653309034,y: 24.6924156915316} , {x:32.9287763780245,y: 24.6924047858588} , {x:32.9289308088402,y: 24.6926317915826} , {x:32.9289919637841,y: 24.6935700662466} , {x:32.9288974586057,y: 24.6953916422866} , {x:32.9286251096799,y: 24.6966266061184} , {x:32.9286250464307,y: 24.6966371178005} , {x:32.9289288894453,y: 24.6966719617104} , {x:32.929251874777,y: 24.6964378806269} , {x:32.92999717928,y: 24.695299763335} , {x:32.9301308722827,y: 24.694883187372} , {x:32.9301278080931,y: 24.6938136329239} ]} , {points:[ {x:32.9359532780591,y: 24.7004843037647} , {x:32.935801474316,y: 24.7002239811879} , {x:32.9357886591425,y: 24.7002336140543} , {x:32.9356399790571,y: 24.7003453649678} , {x:32.9354024519121,y: 24.7005881698196} , {x:32.9353357010653,y: 24.7011260063233} , {x:32.9347741497566,y: 24.7033063971709} , {x:32.9343155119516,y: 24.7055440351821} , {x:32.9345803620299,y: 24.7059679178579} , {x:32.9345811868437,y: 24.7059692368051} , {x:32.9347699295824,y: 24.7060596578682} , {x:32.9347805585575,y: 24.7060647498539} , {x:32.9349171023363,y: 24.7061382043761} , {x:32.9349419503285,y: 24.7061515716449} , {x:32.9352458131697,y: 24.7061864032094} , {x:32.935492822874,y: 24.7059783028744} , {x:32.9354742240969,y: 24.705206198225} , {x:32.9357831757501,y: 24.7034102505833} , {x:32.9358305344492,y: 24.7022586155847} , {x:32.9359532780591,y: 24.7004843037647} ]} , {points:[ {x:32.9283541767998,y: 24.7026626723457} , {x:32.928378384393,y: 24.7026489501266} , {x:32.9284062204289,y: 24.7027035878679} , {x:32.9282958223407,y: 24.7038531559937} , {x:32.9283080270123,y: 24.7049034785964} , {x:32.9284880185721,y: 24.7058492791804} , {x:32.9286242865129,y: 24.7064207296643} , {x:32.9289967611297,y: 24.7078603728546} , {x:32.9289378378514,y: 24.7090098156704} , {x:32.9292171642024,y: 24.7113352688402} , {x:32.9292892833277,y: 24.712652920268} , {x:32.9292901978439,y: 24.7126704480073} , {x:32.929565634163,y: 24.712627201525} , {x:32.9299932407263,y: 24.7121936400491} , {x:32.9306416779878,y: 24.7112995371153} , {x:32.931383176554,y: 24.7104633465581} , {x:32.9321539830153,y: 24.7099874462971} , {x:32.9325321839224,y: 24.7094872003276} , {x:32.9329234934731,y: 24.7089734689073} , {x:32.9331881499505,y: 24.7083402172446} , {x:32.9331757433794,y: 24.7075512943161} , {x:32.9334072504045,y: 24.7064519636027} , {x:32.9336400743663,y: 24.7044122997087} , {x:32.9336643046898,y: 24.7034673341325} , {x:32.9336035780811,y: 24.7022569339499} , {x:32.9332700520966,y: 24.7014539007155} , {x:32.9331261203406,y: 24.699366404057} , {x:32.9331740413896,y: 24.6981072087208} , {x:32.9330425298376,y: 24.6962038033159} , {x:32.9328816564863,y: 24.6951713762225} , {x:32.9324829967971,y: 24.6948762385797} , {x:32.9324790448901,y: 24.6948792650447} , {x:32.9312403744706,y: 24.6960125789165} , {x:32.9299341488992,y: 24.6972734383093} , {x:32.9291093763119,y: 24.6979619312135} , {x:32.9286008374806,y: 24.699453654554} , {x:32.9280629416164,y: 24.7003050834408} , {x:32.9270956955957,y: 24.701677422276} , {x:32.9265874117721,y: 24.7022552109768} , {x:32.9264644956437,y: 24.702357145296} , {x:32.9265047402766,y: 24.7036026711182} , {x:32.9264001458461,y: 24.7048232863745} , {x:32.9265088642728,y: 24.7053790555104} , {x:32.9267074269958,y: 24.7065028195954} , {x:32.9270006293858,y: 24.7077916825406} , {x:32.9272439366982,y: 24.7087696218084} , {x:32.9276519341097,y: 24.7094668484348} , {x:32.9277083692421,y: 24.7104036495674} , {x:32.9277932630238,y: 24.7115708190394} , {x:32.9279545812083,y: 24.7125815875923} , {x:32.9280991306352,y: 24.7137466496527} , {x:32.9282158175012,y: 24.7139847615695} , {x:32.9282224468774,y: 24.7139982902214} , {x:32.9284218853936,y: 24.7139983856148} , {x:32.9284981695762,y: 24.7134605576316} , {x:32.9284479032918,y: 24.7123777969722} , {x:32.9285239731286,y: 24.7117848949232} , {x:32.9283726871458,y: 24.7108541728527} , {x:32.9285537833565,y: 24.709780619859} , {x:32.9287818872305,y: 24.7094508051419} , {x:32.9287442094019,y: 24.7089843854777} , {x:32.9285356418066,y: 24.7084489855661} , {x:32.9282801103432,y: 24.7075290353529} , {x:32.9282376228917,y: 24.7072527274795} , {x:32.9280927914129,y: 24.706795613638} , {x:32.9277183025548,y: 24.7062421190385} , {x:32.9274540212697,y: 24.7054606274182} , {x:32.9273503854301,y: 24.7042788102001} , {x:32.9274641130945,y: 24.7033961577717} , {x:32.9276172633697,y: 24.7029847241512} , {x:32.9280420539172,y: 24.7027989864893} , {x:32.9283541767998,y: 24.7026626723457} ]} , {points:[ {x:32.9208162904096,y: 24.7770510958558} , {x:32.9211007337113,y: 24.776762878129} , {x:32.9211325033097,y: 24.7764745237737} , {x:32.9214090305648,y: 24.7762151374302} , {x:32.9218436284335,y: 24.7757179295297} , {x:32.9218674454671,y: 24.7755160821795} , {x:32.921820257919,y: 24.7752204768541} , {x:32.9217019007775,y: 24.7750906467883} , {x:32.9213704148419,y: 24.7748669826574} , {x:32.9212442093343,y: 24.7746650551688} , {x:32.9213313367462,y: 24.7742397542994} , {x:32.9214577034765,y: 24.7741893572256} , {x:32.92149725726,y: 24.7740740297348} , {x:32.9216422933842,y: 24.7740741070174} , {x:32.9216551740979,y: 24.7740741138741} , {x:32.921734082428,y: 24.7741534575602} , {x:32.9219235151274,y: 24.7742616979279} , {x:32.92201818807,y: 24.774384305546} , {x:32.9220178169056,y: 24.7749682571044} , {x:32.9221498100616,y: 24.7750571658027} , {x:32.9221677753913,y: 24.775069266495} , {x:32.9224019272746,y: 24.7751094803726} , {x:32.9224204185784,y: 24.7751126556152} , {x:32.9224914224834,y: 24.7752064132983} , {x:32.9225814539933,y: 24.7753847876753} , {x:32.9225860557514,y: 24.7753939045483} , {x:32.9227992193589,y: 24.7754372722542} , {x:32.923019404471,y: 24.7755022490613} , {x:32.9230439499346,y: 24.7755094924108} , {x:32.9230912218574,y: 24.7756753311517} , {x:32.9232251463708,y: 24.7761656316033} , {x:32.923232784689,y: 24.776576564383} , {x:32.9233273705262,y: 24.7768433567888} , {x:32.9234225032297,y: 24.7769241024584} , {x:32.9234378569525,y: 24.7769371345763} , {x:32.9235957739165,y: 24.7769444264127} , {x:32.9237616492274,y: 24.7768507922234} , {x:32.923832848666,y: 24.7766345505647} , {x:32.9239832486008,y: 24.7760290493154} , {x:32.9242047915688,y: 24.7752938173891} , {x:32.9244817271986,y: 24.774356753472} , {x:32.9247346829685,y: 24.7738882799036} , {x:32.9253702091745,y: 24.7720204393668} , {x:32.9256821486737,y: 24.771578073405} , {x:32.9256098051734,y: 24.7712457393048} , {x:32.9257282454079,y: 24.7703896022804} , {x:32.9259241064736,y: 24.7698263034784} , {x:32.9263130772184,y: 24.7690316482456} , {x:32.9264592112858,y: 24.7687555662208} , {x:32.9266496500376,y: 24.7681170488986} , {x:32.9267888897632,y: 24.7669590631455} , {x:32.9268849341731,y: 24.7665356932772} , {x:32.9268709337876,y: 24.7660546717921} , {x:32.926724402225,y: 24.7652881894561} , {x:32.9266930012489,y: 24.762678173805} , {x:32.9266648601911,y: 24.761683714863} , {x:32.9265732876792,y: 24.7609765843913} , {x:32.9264634955015,y: 24.7611008245826} , {x:32.92645625828,y: 24.7600050096003} , {x:32.9265435953009,y: 24.7591904040133} , {x:32.9264488878304,y: 24.7591326821956} , {x:32.9264016034968,y: 24.758988472522} , {x:32.9262755544517,y: 24.7585342238894} , {x:32.9261178214468,y: 24.7582529823664} , {x:32.9260956663604,y: 24.758246901223} , {x:32.9258810081714,y: 24.758187979745} , {x:32.9256361715433,y: 24.7583320410094} , {x:32.9253991694607,y: 24.7585770369395} , {x:32.9252568456882,y: 24.7589230108933} , {x:32.9251066617201,y: 24.7592113053964} , {x:32.9249327290853,y: 24.759600518671} , {x:32.9246934707416,y: 24.7595097332306} , {x:32.9242055687899,y: 24.7598143448404} , {x:32.9237668779038,y: 24.7601598226289} , {x:32.9236155871289,y: 24.7604076879388} , {x:32.9235598404595,y: 24.7607146888924} , {x:32.9236232751192,y: 24.7609424807659} , {x:32.9236149166569,y: 24.7615616772765} , {x:32.923503767919,y: 24.7617511736746} , {x:32.9230790711086,y: 24.7632133217508} , {x:32.9226935299506,y: 24.7642110825424} , {x:32.9224545584024,y: 24.7646291166184} , {x:32.9222831927447,y: 24.764972960526} , {x:32.9219351934721,y: 24.7661768023774} , {x:32.9217505487976,y: 24.766780370422} , {x:32.921609528302,y: 24.7671408129537} , {x:32.921316758495,y: 24.7675349452007} , {x:32.920938898736,y: 24.7683924405507} , {x:32.92083137408,y: 24.7686768984577} , {x:32.9206746268033,y: 24.7689764679615} , {x:32.9205160433852,y: 24.7699160822216} , {x:32.9200688038563,y: 24.7730658036102} , {x:32.9198469408266,y: 24.7735897941973} , {x:32.9200464679148,y: 24.773260560654} , {x:32.9200458813367,y: 24.7741610876857} , {x:32.920078831211,y: 24.7746164290312} , {x:32.919923076022,y: 24.7755472260004} , {x:32.9198538359187,y: 24.7757240684698} , {x:32.9197273632645,y: 24.7759330683902} , {x:32.9196402858313,y: 24.7762718568285} , {x:32.9196717142529,y: 24.7765097808206} , {x:32.9197820835578,y: 24.7767765840627} , {x:32.9199247029633,y: 24.7769591141622} , {x:32.9199398731204,y: 24.7769785290011} , {x:32.920145241427,y: 24.7768705017251} , {x:32.9203347564177,y: 24.776856185831} , {x:32.9204676826221,y: 24.7768818110377} , {x:32.9204847625125,y: 24.7768851040672} , {x:32.9206224517679,y: 24.7770374660924} , {x:32.9206346800874,y: 24.7770509980522} , {x:32.9208162904096,y: 24.7770510958558} ]} , {points:[ {x:32.9265952911567,y: 24.7755382600645} , {x:32.9264970013818,y: 24.7755278555926} , {x:32.926376944919,y: 24.7757548873527} , {x:32.9262923208249,y: 24.7761482014633} , {x:32.9261100128348,y: 24.7764887476701} , {x:32.9259321486701,y: 24.7768252416978} , {x:32.9257454253232,y: 24.777121178403} , {x:32.9256874664148,y: 24.7774820631026} , {x:32.9257114324813,y: 24.7775991198495} , {x:32.9257140371901,y: 24.7776118436441} , {x:32.9258339567799,y: 24.7776159592647} , {x:32.9260383567022,y: 24.7774700747909} , {x:32.9261850208485,y: 24.7773160499914} , {x:32.92632727493,y: 24.777109304969} , {x:32.9264740550811,y: 24.7767606305983} , {x:32.9265941560645,y: 24.7764606037288} , {x:32.9266341755091,y: 24.7763835753447} , {x:32.9267275635725,y: 24.7761889707636} , {x:32.9267322886059,y: 24.7757145131543} , {x:32.926679044876,y: 24.7756252711848} , {x:32.9266124728043,y: 24.775540078528} , {x:32.9265952911567,y: 24.7755382600645} ]} , {points:[ {x:33.4744317904032,y: 25.1187186066261} , {x:33.4762399603633,y: 24.7927394096184} , {x:33.1346860097658,y: 24.7238083860264} , {x:33.1337075660594,y: 24.7249478196243} , {x:33.1322961369637,y: 24.7266068136277} , {x:33.1161169438074,y: 24.7157146510795} , {x:33.109563562643,y: 24.7131034854894} , {x:33.1087693479163,y: 24.7023487564745} , {x:33.106693981545,y: 24.6941627135772} , {x:33.0968800749698,y: 24.6898925300026} , {x:33.0941770161559,y: 24.6840148716203} , {x:33.0904638781902,y: 24.6776673172273} , {x:33.0844741475306,y: 24.6783058498821} , {x:33.0821740392933,y: 24.6768404050772} , {x:33.075702739352,y: 24.6730690387762} , {x:33.0678502289971,y: 24.6702305644103} , {x:33.0678778235264,y: 24.6701018939693} , {x:33.0676729430859,y: 24.6702405099429} , {x:33.0586613121379,y: 24.6727883232178} , {x:33.053357682183,y: 24.6784566526708} , {x:33.0372443455072,y: 24.6843925993545} , {x:33.0358600835625,y: 24.684605729329} , {x:33.0125033881747,y: 24.6882384084197} , {x:33.0111204496743,y: 24.6869711322682} , {x:33.0120572050733,y: 24.686113428667} , {x:33.0178364853864,y: 24.6808097446782} , {x:33.0201606719374,y: 24.6744716960843} , {x:33.0231962991369,y: 24.6629720677839} , {x:32.9605614512104,y: 24.6603400305634} , {x:32.9604623109301,y: 24.6602745037656} , {x:32.9605543123669,y: 24.6599903042435} , {x:32.9606681731848,y: 24.6596385982667} , {x:32.9560560149134,y: 24.6596371781282} , {x:32.9417800888342,y: 24.6593874709673} , {x:32.9412779989811,y: 24.6573080127737} , {x:32.9384711597578,y: 24.6532535726058} , {x:32.9378392944048,y: 24.6522297487431} , {x:32.9388347595213,y: 24.6404924282935} , {x:32.9384869091901,y: 24.635777661254} , {x:32.9383017721416,y: 24.6332681674865} , {x:32.9380514065238,y: 24.6298743464617} , {x:32.9380051982889,y: 24.6286759403527} , {x:32.9379470308886,y: 24.6271673497766} , {x:32.9379076205847,y: 24.6261451893898} , {x:32.9411145045592,y: 24.622950161812} , {x:32.9431545196642,y: 24.6222850693659} , {x:32.9435619447106,y: 24.6220701657095} , {x:32.9436827836863,y: 24.6220064267634} , {x:32.9436863542461,y: 24.6143651023874} , {x:32.9441469037162,y: 24.6093986547591} , {x:32.944118149104,y: 24.6062819534253} , {x:32.9441197110332,y: 24.60619719906} , {x:32.9438976762607,y: 24.606201626789} , {x:32.9393736708041,y: 24.6063005711304} , {x:32.9328718706822,y: 24.6063002152629} , {x:32.9331050412975,y: 24.6048806206539} , {x:32.9354501652893,y: 24.6020230420472} , {x:32.9367406454081,y: 24.6002145715308} , {x:32.937397574752,y: 24.5974429948885} , {x:32.9345156041636,y: 24.5969499875398} , {x:32.93326407273,y: 24.5950589825101} , {x:32.9332559184796,y: 24.5950449301483} , {x:32.9292936413789,y: 24.5969322552563} , {x:32.9275278452337,y: 24.59830230506} , {x:32.925976163456,y: 24.5986046797086} , {x:32.9246647992723,y: 24.5992033259051} , {x:32.9233531860633,y: 24.6001765357055} , {x:32.9224523939545,y: 24.5993519910048} , {x:32.9244276345132,y: 24.5951939677992} , {x:32.9234162282738,y: 24.5906299886102} , {x:32.9241358552543,y: 24.5894738974141} , {x:32.9265408752368,y: 24.5855946214583} , {x:32.9319380959904,y: 24.5809444424616} , {x:32.9401314246661,y: 24.5760437300169} , {x:32.9424906006642,y: 24.573074325624} , {x:32.9424986784935,y: 24.5730641582669} , {x:32.9393489452679,y: 24.5694227771806} , {x:32.9385081078451,y: 24.5616611034652} , {x:32.940557236675,y: 24.5613499661831} , {x:32.9407957223015,y: 24.5607513089639} , {x:32.940697743204,y: 24.5597066463742} , {x:32.9391147753021,y: 24.5587456227167} , {x:32.9405068811319,y: 24.5579150952606} , {x:32.9422270858334,y: 24.5569339683061} , {x:32.9432271499957,y: 24.5576757041022} , {x:32.9458091367332,y: 24.5596788033102} , {x:32.9476017477938,y: 24.5581776173748} , {x:32.9492747525844,y: 24.5566735767016} , {x:32.9492511913614,y: 24.556096177144} , {x:32.9503405427627,y: 24.5556869162587} , {x:32.9530970184699,y: 24.5536961619533} , {x:32.9556286742089,y: 24.5569247945524} , {x:32.9558979203394,y: 24.5576432642052} , {x:32.9502287933394,y: 24.5606069318754} , {x:32.9504202988012,y: 24.5647309886811} , {x:32.9506233484707,y: 24.5659827472189} , {x:32.9505193712573,y: 24.566142681723} , {x:32.9511128190813,y: 24.5739328678197} , {x:32.9514699099922,y: 24.5834933494642} , {x:32.9514910578509,y: 24.5851231999027} , {x:32.9513813954569,y: 24.5885079842458} , {x:32.9512894249695,y: 24.5916466779756} , {x:32.9512884748212,y: 24.5916793122524} , {x:32.9555587008472,y: 24.5917584344959} , {x:32.9604359214414,y: 24.591764310316} , {x:32.9648725585428,y: 24.5923703382067} , {x:32.9696677047299,y: 24.5965211110189} , {x:32.9709015035753,y: 24.597491603433} , {x:32.9761630476761,y: 24.597507636907} , {x:32.9781000508768,y: 24.5984774002783} , {x:32.9790676339984,y: 24.5984768881389} , {x:32.9809999810352,y: 24.5969387418474} , {x:32.9829352836362,y: 24.597260124789} , {x:32.9870511970739,y: 24.5955041473729} , {x:32.9942398415528,y: 24.5925050631465} , {x:32.9955129978101,y: 24.5925020149665} , {x:32.9961840970488,y: 24.5925002862124} , {x:33.0032537726569,y: 24.5973931476321} , {x:33.0067005260133,y: 24.5990804827708} , {x:33.0089985932032,y: 24.6000438497836} , {x:33.0132524135669,y: 24.5953333613966} , {x:33.0166160583005,y: 24.5931476784054} , {x:33.0201566050147,y: 24.5908000174323} , {x:33.0196247650771,y: 24.5858627378405} , {x:33.0216961584709,y: 24.5833749272382} , {x:33.0241751774872,y: 24.5798105646358} , {x:33.0255275117658,y: 24.5776112097045} , {x:33.025802652298,y: 24.5771637267724} , {x:33.0253632439647,y: 24.5717040936168} , {x:33.0312405804262,y: 24.5677967902442} , {x:33.0315001109069,y: 24.5676850337327} , {x:33.0307374905092,y: 24.5657208148313} , {x:33.03110249906,y: 24.5650528230852} , {x:33.0313453926875,y: 24.5627150509625} , {x:33.0314664309926,y: 24.5598207000319} , {x:33.0301699980832,y: 24.5548855435074} , {x:33.0283628763424,y: 24.5496405339186} , {x:33.0283557802747,y: 24.5496447672136} , {x:33.0282051630951,y: 24.5492510829651} , {x:33.0217712838712,y: 24.5319425026369} , {x:33.0167113080963,y: 24.5150152866386} , {x:33.0146217249347,y: 24.510410519088} , {x:33.0188603622799,y: 24.5074104296653} , {x:33.0216629123631,y: 24.5055374422646} , {x:33.0217041640538,y: 24.5055098440247} , {x:33.0198673658199,y: 24.5028410441463} , {x:33.0195662463001,y: 24.5024047921136} , {x:33.0213938958727,y: 24.4987199830509} , {x:33.0253231235738,y: 24.4901599144432} , {x:33.0236314825865,y: 24.4900235752351} , {x:33.0211165363255,y: 24.490045622705} , {x:33.0197692817867,y: 24.4812562503028} , {x:33.0146991493817,y: 24.4813984473001} , {x:33.0146990647463,y: 24.4805635363906} , {x:33.0144853630028,y: 24.4805290414796} , {x:33.0144383124028,y: 24.4805362220035} , {x:33.0144506972708,y: 24.4803432330293} , {x:33.0143593202645,y: 24.4788404005011} , {x:33.0143709280354,y: 24.4650504147615} , {x:33.0139739466547,y: 24.4536992446627} , {x:33.0160307088039,y: 24.4459360173353} , {x:33.0182688220556,y: 24.4410295922151} , {x:33.0178957590495,y: 24.4404320879088} , {x:33.0195165001217,y: 24.4361274497718} , {x:33.017570438027,y: 24.4321200708915} , {x:33.0109024703084,y: 24.4248746697808} , {x:33.0082854270177,y: 24.4235191317602} , {x:33.0096737819095,y: 24.4223825476477} , {x:33.0044540899797,y: 24.4190363739803} , {x:32.9996374836326,y: 24.4155770252913} , {x:32.9915051457668,y: 24.4118534008961} , {x:32.9912400415724,y: 24.4108011377252} , {x:32.9932745755944,y: 24.4036086641156} , {x:32.9838945031547,y: 24.3990848839944} , {x:32.9780047384995,y: 24.3978223683787} , {x:32.9748664177674,y: 24.3975241633683} , {x:32.9675682211924,y: 24.3926711871733} , {x:32.9609818386934,y: 24.3937069668391} , {x:32.9608209511089,y: 24.3937305937064} , {x:32.9619806302833,y: 24.3984337624069} , {x:32.9626768345569,y: 24.3989872970705} , {x:32.9655672041403,y: 24.3979003519156} , {x:32.9674856803134,y: 24.398542634729} , {x:32.969041600144,y: 24.3993447203347} , {x:32.976368405672,y: 24.4004383282386} , {x:32.9754489293497,y: 24.4024385222602} , {x:32.9735058473554,y: 24.4098672789131} , {x:32.9721671016111,y: 24.4137310674117} , {x:32.9710266254581,y: 24.4153527544686} , {x:32.969352779879,y: 24.4174475178025} , {x:32.9669048925164,y: 24.4260155797427} , {x:32.9649578473013,y: 24.4353956880699} , {x:32.9629501075643,y: 24.4358901373565} , {x:32.9595826155141,y: 24.4382166069919} , {x:32.9571063666994,y: 24.4401584991403} , {x:32.9579018458352,y: 24.4408872059921} , {x:32.9606423957697,y: 24.4418592729383} , {x:32.9621718799804,y: 24.4435547558251} , {x:32.9636086009514,y: 24.4450867154261} , {x:32.9658179696213,y: 24.4489724433853} , {x:32.9657831848384,y: 24.4490967844592} , {x:32.9656872812147,y: 24.4488569960374} , {x:32.9584391895548,y: 24.453530144618} , {x:32.9582365660991,y: 24.4535968506956} , {x:32.9540542949719,y: 24.4536955182482} , {x:32.945722201565,y: 24.453785747949} , {x:32.9453265724529,y: 24.4486255787353} , {x:32.9424744003388,y: 24.4499600328403} , {x:32.9396220501061,y: 24.4515372567633} , {x:32.9374997929997,y: 24.4517792015638} , {x:32.9324240771026,y: 24.4501123486301} , {x:32.9321176631925,y: 24.4499634471808} , {x:32.9292920218524,y: 24.449729173774} , {x:32.9281284518618,y: 24.4512554572477} , {x:32.9275140872686,y: 24.4514954044511} , {x:32.9274944069544,y: 24.4515598743304} , {x:32.9274484430174,y: 24.451710440422} , {x:32.9274806553847,y: 24.4523854765016} , {x:32.9271393490264,y: 24.4533803732282} , {x:32.926678424472,y: 24.4541702679722} , {x:32.9259995670418,y: 24.4552878712202} , {x:32.9254368781261,y: 24.4564950986046} , {x:32.9256645667922,y: 24.4567663474892} , {x:32.9257308689091,y: 24.4571520902171} , {x:32.9257326850214,y: 24.45716265465} , {x:32.925718178649,y: 24.4571709439482} , {x:32.9251856532206,y: 24.4574752277054} , {x:32.9244332220766,y: 24.4583299636256} , {x:32.921765749381,y: 24.4608522187756} , {x:32.9215496695509,y: 24.4613088713053} , {x:32.9214006893959,y: 24.4616237165181} , {x:32.9205574361376,y: 24.4618944025} , {x:32.9207394578765,y: 24.4623116294567} , {x:32.9202838834556,y: 24.4620819643362} , {x:32.9201021334365,y: 24.4621175104617} , {x:32.9199648391812,y: 24.4621443619852} , {x:32.9179820137698,y: 24.4628106891301} , {x:32.9181225892719,y: 24.4632233063734} , {x:32.9183231497629,y: 24.463811988507} , {x:32.9183094198579,y: 24.4638320693402} , {x:32.9182091087511,y: 24.4639787780145} , {x:32.9178218227726,y: 24.4638534252626} , {x:32.9173712101452,y: 24.4633460744509} , {x:32.9170248979402,y: 24.4629561532969} , {x:32.9166147328349,y: 24.4629767808286} , {x:32.9158626196242,y: 24.4632266346336} , {x:32.9143130983837,y: 24.4633091761699} , {x:32.9134473506369,y: 24.463120966735} , {x:32.9129229477082,y: 24.4635795034448} , {x:32.911874778088,y: 24.4635788864262} , {x:32.9095686210679,y: 24.4638878913566} , {x:32.9095503487271,y: 24.4638903395972} , {x:32.9095214665313,y: 24.4638878627079} , {x:32.9085705964573,y: 24.4638063151168} , {x:32.9079098083929,y: 24.4637850518816} , {x:32.9077666148357,y: 24.4638120765222} , {x:32.9072489120412,y: 24.4639097799952} , {x:32.9068160333262,y: 24.4638260837151} , {x:32.9066362783388,y: 24.4635725796416} , {x:32.9065201233391,y: 24.4634087687462} , {x:32.9057683499884,y: 24.4631788737925} , {x:32.9029696824947,y: 24.4631353878309} , {x:32.9024678873666,y: 24.4631681754734} , {x:32.90105567952,y: 24.4632593092612} , {x:32.9000685936142,y: 24.4633220059821} , {x:32.8965041315348,y: 24.4633691975997} , {x:32.8942318468812,y: 24.4634010606622} , {x:32.8918522322889,y: 24.4637881159969} , {x:32.8900848037968,y: 24.4639673635775} , {x:32.8886716556412,y: 24.4644043034163} , {x:32.8866430703704,y: 24.4650493298351} , {x:32.8847059379289,y: 24.4653398401743} , {x:32.8836580603796,y: 24.4650053246929} , {x:32.8828835691607,y: 24.4647335871008} , {x:32.8822913140538,y: 24.464524557201} , {x:32.8808786484259,y: 24.4644191570506} , {x:32.8799215940977,y: 24.4644392481401} , {x:32.8786908403848,y: 24.4647302465895} , {x:32.8773001249196,y: 24.4654799452116} , {x:32.8772885508404,y: 24.4654611641922} , {x:32.8767373747814,y: 24.465782836649} , {x:32.8758171125834,y: 24.4670158179687} , {x:32.8748661268747,y: 24.4683188656159} , {x:32.873760857034,y: 24.4707013008467} , {x:32.8733147815418,y: 24.4725375147676} , {x:32.8728999402219,y: 24.4737709030003} , {x:32.8726689131862,y: 24.4750044472548} , {x:32.8722846806285,y: 24.4762518793058} , {x:32.8720989836596,y: 24.4780883101216} , {x:32.8719434469522,y: 24.480387418647} , {x:32.8716401710236,y: 24.4830125163849} , {x:32.8718358145877,y: 24.4831783979583} , {x:32.8722566687157,y: 24.4829036070144} , {x:32.8741180554374,y: 24.4810902511849} , {x:32.8745933152822,y: 24.4807261370689} , {x:32.8751908592654,y: 24.480628498218} , {x:32.8757426678876,y: 24.4803065031203} , {x:32.8766016835663,y: 24.4791435738083} , {x:32.8777058936218,y: 24.4778686815717} , {x:32.8788099322518,y: 24.476747998169} , {x:32.8792853378875,y: 24.4762016119267} , {x:32.8796685454564,y: 24.4759495647739} , {x:32.879867485422,y: 24.476160020805} , {x:32.8795300577604,y: 24.4765943625075} , {x:32.8788857665445,y: 24.4775331669997} , {x:32.8783949409088,y: 24.4781776778593} , {x:32.8771225277622,y: 24.4791440024978} , {x:32.8766159121313,y: 24.4802511461753} , {x:32.8760638008967,y: 24.4808815795938} , {x:32.8757725280882,y: 24.4810916339979} , {x:32.8755273099408,y: 24.481203588579} , {x:32.8754040450301,y: 24.481918494214} , {x:32.874974573653,y: 24.4824508861916} , {x:32.8737336729305,y: 24.4827272483921} , {x:32.8726036470046,y: 24.4838002498897} , {x:32.8721078596292,y: 24.484006085037} , {x:32.871954860593,y: 24.4840535509626} , {x:32.8717987455823,y: 24.4841019788974} , {x:32.8720682640643,y: 24.4870693951665} , {x:32.8721546542476,y: 24.4882465631805} , {x:32.872178860249,y: 24.4901325797125} , {x:32.8722678680517,y: 24.4912484258821} , {x:32.87238480514,y: 24.492344887601} , {x:32.8728243006747,y: 24.4945356686698} , {x:32.8731677306684,y: 24.4960276579172} , {x:32.8741879271708,y: 24.498377829612} , {x:32.8742746668915,y: 24.4985776000471} , {x:32.8744281657922,y: 24.4993424773663} , {x:32.8752638259839,y: 24.4997051677703} , {x:32.8756901250646,y: 24.5008463234882} , {x:32.8764854578696,y: 24.5023614218212} , {x:32.8770666152565,y: 24.5049247337276} , {x:32.8775493807895,y: 24.5059329012229} , {x:32.8787721094985,y: 24.5091303800434} , {x:32.8799040102717,y: 24.5112202189285} , {x:32.8811276650825,y: 24.5135484557585} , {x:32.8810960793104,y: 24.5135559353477} , {x:32.8811032939934,y: 24.5135584174999} , {x:32.8814089982616,y: 24.5143718006826} , {x:32.8823416397708,y: 24.5166156802865} , {x:32.8828612814673,y: 24.518088151059} , {x:32.8833813096697,y: 24.5191540500902} , {x:32.8839779292891,y: 24.5202620645861} , {x:32.8852787743661,y: 24.5221416943707} , {x:32.8861661723396,y: 24.5237125701648} , {x:32.8871915525482,y: 24.5252414830452} , {x:32.8887553540111,y: 24.527934632234} , {x:32.8905392859665,y: 24.5308603068156} , {x:32.8917045590535,y: 24.5325875190765} , {x:32.8934078376931,y: 24.5352892875048} , {x:32.895097926975,y: 24.5376504487648} , {x:32.8963847110216,y: 24.538442006447} , {x:32.8974324928709,y: 24.5391076485675} , {x:32.8980098051744,y: 24.5399341909838} , {x:32.8986113827301,y: 24.5412901898302} , {x:32.899437126513,y: 24.5424022204512} , {x:32.9011370992524,y: 24.544043641156} , {x:32.9024079160939,y: 24.5457408444754} , {x:32.9041688775486,y: 24.5479150158313} , {x:32.9054063325601,y: 24.5493344124896} , {x:32.9058687556634,y: 24.5498648141388} , {x:32.9072547710423,y: 24.5514522267472} , {x:32.9075063628739,y: 24.5521634773074} , {x:32.9077935016863,y: 24.5537100018099} , {x:32.9086331778805,y: 24.5575601644752} , {x:32.9089496928646,y: 24.5592875540288} , {x:32.9095507044518,y: 24.5606125463051} , {x:32.9099512021349,y: 24.5619215796379} , {x:32.9102935199248,y: 24.5633471868207} , {x:32.9104963843763,y: 24.5652972457503} , {x:32.9109371556711,y: 24.5668581496024} , {x:32.9110594174495,y: 24.5674733402064} , {x:32.9119250152785,y: 24.5706769741401} , {x:32.9121996561682,y: 24.5725137050113} , {x:32.9123978502729,y: 24.5740699984887} , {x:32.9122740824428,y: 24.5756681602607} , {x:32.9120890873644,y: 24.5771260888368} , {x:32.911720168454,y: 24.5785138109539} , {x:32.9108295269673,y: 24.5805461210864} , {x:32.910506699072,y: 24.5817656311906} , {x:32.9104597668357,y: 24.5830694250971} , {x:32.9102293222049,y: 24.5837282066431} , {x:32.9103814340772,y: 24.5853966286901} , {x:32.9107328534187,y: 24.5870791896776} , {x:32.9110846138012,y: 24.5882991032074} , {x:32.9110611675795,y: 24.5883034071914} , {x:32.9114109967479,y: 24.5892791109466} , {x:32.9123322538596,y: 24.5894890100766} , {x:32.9122132418383,y: 24.5900516929498} , {x:32.912677995947,y: 24.5908386617185} , {x:32.9132300219054,y: 24.5920520891353} , {x:32.9142375581257,y: 24.5936896983338} , {x:32.9153732081227,y: 24.5959669555765} , {x:32.9161954169062,y: 24.5960650877911} , {x:32.9165468622342,y: 24.5978457733524} , {x:32.9170977613339,y: 24.5994723565043} , {x:32.9179249784995,y: 24.600664486359} , {x:32.9190122263665,y: 24.602852145071} , {x:32.9195328359296,y: 24.6039880176211} , {x:32.92005263289,y: 24.6063716267045} , {x:32.9206803887137,y: 24.6078440216776} , {x:32.9218237549914,y: 24.6107660904485} , {x:32.9226728580168,y: 24.6129058136324} , {x:32.9233809233381,y: 24.6145842920042} , {x:32.9248527794672,y: 24.6169028530244} , {x:32.9262842086941,y: 24.6185261883942} , {x:32.927548950356,y: 24.6202604061722} , {x:32.9283108079115,y: 24.6217770603822} , {x:32.9297889590711,y: 24.6234943412971} , {x:32.9310862534797,y: 24.6252856575358} , {x:32.9317647470376,y: 24.6272935388356} , {x:32.9323469123533,y: 24.6284434102354} , {x:32.9324076356243,y: 24.6295649989427} , {x:32.932928320603,y: 24.6309812097507} , {x:32.9332034910109,y: 24.6326216173078} , {x:32.9334786916322,y: 24.6342199660057} , {x:32.9335850415993,y: 24.6360705874553} , {x:32.9338908625373,y: 24.6377951245266} , {x:32.9343961835524,y: 24.6393515163125} , {x:32.934742534322,y: 24.640977060185} , {x:32.9338846304493,y: 24.6426065493079} , {x:32.9333061170819,y: 24.6456694579079} , {x:32.9335428021607,y: 24.6475337861533} , {x:32.9334651912716,y: 24.6490223965714} , {x:32.9337406046447,y: 24.6504207418661} , {x:32.9341564018662,y: 24.6517757058689} , {x:32.9344186866408,y: 24.6525367013744} , {x:32.9345355444842,y: 24.6532627124578} , {x:32.9345599547491,y: 24.654002763353} , {x:32.9345733202194,y: 24.654600340024} , {x:32.9347841147191,y: 24.6558235003299} , {x:32.9349739757199,y: 24.6578134037326} , {x:32.9350818117384,y: 24.6592514609693} , {x:32.9351281255652,y: 24.6595279660513} , {x:32.935117134979,y: 24.659528817565} , {x:32.9350250891935,y: 24.6599054018994} , {x:32.9348707807736,y: 24.6607464812061} , {x:32.9349369987621,y: 24.6616221702179} , {x:32.9351993907479,y: 24.6625185978563} , {x:32.9354920103629,y: 24.6637202062262} , {x:32.9355012005733,y: 24.6646259936154} , {x:32.9355706460088,y: 24.6668459991914} , {x:32.9351894702441,y: 24.6690860303879} , {x:32.9351981885386,y: 24.6706892152292} , {x:32.9351170912726,y: 24.6720600356651} , {x:32.9351028589512,y: 24.672300003534} , {x:32.93497359024,y: 24.6734409909807} , {x:32.9346003179076,y: 24.6751371222348} , {x:32.934401395434,y: 24.6761274176997} , {x:32.9340289433417,y: 24.6770723485504} , {x:32.9337845488045,y: 24.6778424418576} , {x:32.9334547973161,y: 24.6790216011264} , {x:32.9331679008032,y: 24.6797275154423} , {x:32.9331535813395,y: 24.6804381855217} , {x:32.9333454389482,y: 24.6816346079095} , {x:32.9333042627723,y: 24.6830187346502} , {x:32.9335760588394,y: 24.6840504768157} , {x:32.9338794908192,y: 24.6852690176107} , {x:32.93407970237,y: 24.6868490800257} , {x:32.9343327975666,y: 24.6893640885765} , {x:32.9347685104386,y: 24.6906172983743} , {x:32.9351472953324,y: 24.6917055719386} , {x:32.9355633237969,y: 24.6926090096808} , {x:32.9356491300707,y: 24.6936197229112} , {x:32.9361423510662,y: 24.6963039116542} , {x:32.9371754512515,y: 24.6985972727033} , {x:32.9374552244995,y: 24.700501739863} , {x:32.9376308234516,y: 24.7024180611081} , {x:32.9375818562894,y: 24.70460511625} , {x:32.9372224611889,y: 24.7077656176362} , {x:32.9373841218653,y: 24.7075558649985} , {x:32.9366130274144,y: 24.7085763874999} , {x:32.9358954265757,y: 24.7092769224491} , {x:32.9348014207392,y: 24.7102131419909} , {x:32.9334237623154,y: 24.7116655632802} , {x:32.932088735961,y: 24.7127152782576} , {x:32.9313515468689,y: 24.7139204374873} , {x:32.9310291194109,y: 24.714615872806} , {x:32.9307751088903,y: 24.7166945426785} , {x:32.9305329132943,y: 24.7176219879823} , {x:32.9302097107003,y: 24.7192413851803} , {x:32.9300250932086,y: 24.7200191250692} , {x:32.9294255098064,y: 24.7217741377303} , {x:32.9289372050318,y: 24.7231195863497} , {x:32.928929734816,y: 24.7231401667347} , {x:32.9285492658332,y: 24.7241594344958} , {x:32.928513223313,y: 24.7249903103628} , {x:32.9283316256367,y: 24.72604261337} , {x:32.9283520632578,y: 24.726502395455} , {x:32.929291899499,y: 24.7274586132744} , {x:32.9294105395205,y: 24.7291726580119} , {x:32.929546635861,y: 24.7304124738804} , {x:32.9294498041599,y: 24.7319933637737} , {x:32.9291182603579,y: 24.732832454587} , {x:32.9292590938429,y: 24.7351377663496} , {x:32.929441434218,y: 24.7362063035906} , {x:32.9294593270074,y: 24.7369320418494} , {x:32.9295347023828,y: 24.7386906173833} , {x:32.9299173660719,y: 24.7409113121792} , {x:32.9299735558953,y: 24.7420185100343} , {x:32.9301778367877,y: 24.7436263996471} , {x:32.930198461766,y: 24.7447514064787} , {x:32.9298241206925,y: 24.7461493772315} , {x:32.9297372773706,y: 24.7476251402954} , {x:32.9289554969062,y: 24.752485772653} , {x:32.928747101161,y: 24.75375012468} , {x:32.9282521646155,y: 24.7557256546676} , {x:32.9279060574901,y: 24.7575746593587} , {x:32.9278135680367,y: 24.758215996165} , {x:32.9278593657313,y: 24.7586576253337} , {x:32.9282083451854,y: 24.7577208563067} , {x:32.9283909902611,y: 24.7578899813649} , {x:32.9286304425892,y: 24.7576290079785} , {x:32.928679272722,y: 24.7588885088206} , {x:32.9285869894456,y: 24.7592827550664} , {x:32.9286367267761,y: 24.7594422017018} , {x:32.9287298598988,y: 24.7595986335381} , {x:32.9288854653395,y: 24.7583385466581} , {x:32.9288889211632,y: 24.7583418321436} , {x:32.9289007436031,y: 24.7584995817718} , {x:32.9289231990461,y: 24.7587992276581} , {x:32.9288701448866,y: 24.7609283765588} , {x:32.9289910513447,y: 24.7609284351479} , {x:32.9287882143323,y: 24.7638993136603} , {x:32.9286796689393,y: 24.7653946215427} , {x:32.9287372812183,y: 24.7663090749012} , {x:32.9285288575449,y: 24.7669271454134} , {x:32.92831957007,y: 24.7674468650747} , {x:32.928145470014,y: 24.7681852679211} , {x:32.928040541619,y: 24.7694553668343} , {x:32.9277418944874,y: 24.7706823810053} , {x:32.927654239722,y: 24.7717200021784} , {x:32.9276089045484,y: 24.7724146904566} , {x:32.9275722946154,y: 24.7729770016992} , {x:32.9273281479343,y: 24.774807839751} , {x:32.9270351108341,y: 24.7768209316773} , {x:32.927337990197,y: 24.7763147817332} , {x:32.927013191311,y: 24.776531522535} , {x:32.9269837320037,y: 24.7765511809216} , {x:32.9267072055474,y: 24.7767876171354} , {x:32.9264391488429,y: 24.7773000618078} , {x:32.9260498337469,y: 24.7783723379014} , {x:32.9256001845332,y: 24.7792237791152} , {x:32.9254963846851,y: 24.779476072662} , {x:32.9251594653799,y: 24.7795863026974} , {x:32.9251247953737,y: 24.7797834305751} , {x:32.9247948516476,y: 24.7809935325255} , {x:32.9249646617194,y: 24.7810178383656} , {x:32.9251490493303,y: 24.7811522799507} , {x:32.9253391212652,y: 24.7814290799837} , {x:32.9254271650525,y: 24.781076071347} , {x:32.9254283484981,y: 24.781095544762} , {x:32.9253283607598,y: 24.781463524772} , {x:32.9250436535207,y: 24.7821005951104} , {x:32.9250264367755,y: 24.7821246890646} , {x:32.9244719640944,y: 24.7828875027354} , {x:32.9242690285557,y: 24.7832680940621} , {x:32.9240135614021,y: 24.7838514334696} , {x:32.9238299787036,y: 24.7841944482014} , {x:32.923838045906,y: 24.7846374081639} , {x:32.9238402209682,y: 24.7847138103397} , {x:32.9238560270538,y: 24.7852437317724} , {x:32.9236138936205,y: 24.7853694017258} , {x:32.9234623558351,y: 24.7854887948313} , {x:32.9231139462105,y: 24.7857556907311} , {x:32.9228073729393,y: 24.7862850426506} , {x:32.9226831502023,y: 24.7839974212002} , {x:32.9225532891422,y: 24.7844626155809} , {x:32.9223110401389,y: 24.7850775807088} , {x:32.9220945469937,y: 24.7859370194497} , {x:32.9217485000418,y: 24.7867648453347} , {x:32.9216999273838,y: 24.7870035206945} , {x:32.9215751956725,y: 24.7876164198515} , {x:32.921333046683,y: 24.7880578964998} , {x:32.9211054650413,y: 24.7885569941573} , {x:32.9210562363517,y: 24.7886649546755} , {x:32.9210546305681,y: 24.7886898351628} , {x:32.9209951601943,y: 24.7896112186885} , {x:32.920700676734,y: 24.7908254733627} , {x:32.9205188032516,y: 24.7915508692535} , {x:32.920216244767,y: 24.7918819095026} , {x:32.9198444587763,y: 24.7923942842644} , {x:32.9195873968631,y: 24.7935613587314} , {x:32.9194015170349,y: 24.794060059372} , {x:32.9193911154275,y: 24.7942563174771} , {x:32.9190771477351,y: 24.794567704191} , {x:32.9186393142288,y: 24.7951667408711} , {x:32.9185873388827,y: 24.7952591573295} , {x:32.9184546303872,y: 24.7954951710966} , {x:32.9181886766305,y: 24.7961845941351} , {x:32.918295551838,y: 24.7969800572191} , {x:32.9180815228979,y: 24.7977815099514} , {x:32.9178741092421,y: 24.7981605396523} , {x:32.9174313623337,y: 24.7985157485639} , {x:32.9173580334909,y: 24.798966216766} , {x:32.9172287165194,y: 24.7998826036419} , {x:32.9170397942108,y: 24.8006930264288} , {x:32.9166268632323,y: 24.801782811508} , {x:32.9163930799149,y: 24.8025633717648} , {x:32.9161418277955,y: 24.8036199252583} , {x:32.9158820393859,y: 24.8045187575214} , {x:32.9157428420785,y: 24.8059381194581} , {x:32.9156475392721,y: 24.806332353656} , {x:32.9151456053277,y: 24.8075701350416} , {x:32.9147303611289,y: 24.8083663592545} , {x:32.9142977559523,y: 24.8092729745952} , {x:32.9141992708051,y: 24.8101489005137} , {x:32.9134056363416,y: 24.8114203104863} , {x:32.9130101742781,y: 24.8124102465207} , {x:32.9127256057329,y: 24.8130466512639} , {x:32.9123016529284,y: 24.8139714448995} , {x:32.9118181950568,y: 24.8147644311867} , {x:32.9118132104355,y: 24.8158352528831} , {x:32.9110260245684,y: 24.8171359274064} , {x:32.9101698409462,y: 24.8182472968217} , {x:32.9096219043769,y: 24.819184411743} , {x:32.9096347267476,y: 24.8192003165851} , {x:32.9091504537458,y: 24.8197677915638} , {x:32.9078958498886,y: 24.8202057509515} , {x:32.9074984960777,y: 24.8204742676116} , {x:32.9067291425041,y: 24.821766160798} , {x:32.9057285551196,y: 24.8236309651356} , {x:32.9050887733982,y: 24.8245207429577} , {x:32.9037883092423,y: 24.8254541522264} , {x:32.9034537795725,y: 24.8260006829962} , {x:32.9030499007502,y: 24.826831054998} , {x:32.9029832042663,y: 24.826936019474} , {x:32.902669239321,y: 24.8274301251187} , {x:32.9020120842132,y: 24.8280079846996} , {x:32.9008358002951,y: 24.829426645114} , {x:32.900039770538,y: 24.8307509209604} , {x:32.8994300687631,y: 24.8316195340226} , {x:32.8994053647743,y: 24.8316547285781} , {x:32.8991622238374,y: 24.8321757467438} , {x:32.8990129533781,y: 24.8324956108809} , {x:32.8985974080316,y: 24.8334416194777} , {x:32.8982510631521,y: 24.8342930450317} , {x:32.8978589290621,y: 24.8347764370512} , {x:32.8974667476094,y: 24.835312399973} , {x:32.8969575963321,y: 24.8357558622709} , {x:32.8966826996026,y: 24.8359952913069} , {x:32.8963941983728,y: 24.8365418362841} , {x:32.8962122626649,y: 24.8371790393771} , {x:32.8961630843052,y: 24.8373512795893} , {x:32.8958627916944,y: 24.8382132453124} , {x:32.895654883583,y: 24.8388229310271} , {x:32.8951934590856,y: 24.8394639822948} , {x:32.8950635775822,y: 24.8396266853132} , {x:32.8950089092518,y: 24.8396951681062} , {x:32.8944435803428,y: 24.8405692104401} , {x:32.8945565195875,y: 24.841439778796} , {x:32.8943022117675,y: 24.8415219900716} , {x:32.894190109228,y: 24.8417715181375} , {x:32.894231726778,y: 24.8425387586869} , {x:32.8942345745765,y: 24.8425912748885} , {x:32.8943287761773,y: 24.8438666011175} , {x:32.8937575298907,y: 24.8446213029933} , {x:32.8932230605749,y: 24.8450745775207} , {x:32.8927884940776,y: 24.8456811451068} , {x:32.8926705164069,y: 24.8460549186866} , {x:32.8917663570225,y: 24.8478832664045} , {x:32.8909002523665,y: 24.8496646990135} , {x:32.8902980025054,y: 24.8508617898645} , {x:32.8908352376935,y: 24.8511172969076} , {x:32.8908996809991,y: 24.851147957379} , {x:32.8937835994337,y: 24.8527496645362} , {x:32.8955438496299,y: 24.8542349217164} , {x:32.8959270412336,y: 24.8550325789258} , {x:32.8994257469539,y: 24.8548905618399} , {x:32.9037891854298,y: 24.8544837412578} , {x:32.9056634375724,y: 24.8538119328173} , {x:32.9119228017722,y: 24.8520202167553} , {x:32.9160200430428,y: 24.8514450060516} , {x:32.9161853412503,y: 24.8515450747674} , {x:32.9162424546993,y: 24.8515115098829} , {x:32.9182630447518,y: 24.8513128168791} , {x:32.9209575126526,y: 24.8510129422786} , {x:32.924669086344,y: 24.8517583193709} , {x:32.9278117318929,y: 24.852982544901} , {x:32.9292709573927,y: 24.8523712468954} , {x:32.9318169850952,y: 24.8525796833606} , {x:32.9336391911536,y: 24.851708248895} , {x:32.9453425008659,y: 24.8539070144252} , {x:32.9568279474866,y: 24.8464814433184} , {x:32.9804849669071,y: 24.8356543168099} , {x:32.9900398454007,y: 24.8455389070718} , {x:32.989530781126,y: 24.8474122543946} , {x:32.9905621041816,y: 24.8469565863812} , {x:32.9906068520364,y: 24.8476974034454} , {x:32.9911044041365,y: 24.8559351053064} , {x:32.9957819032223,y: 24.8601918770721} , {x:32.9978253141553,y: 24.8701327440178} , {x:32.9976225070353,y: 24.8703126451725} , {x:32.9976623093172,y: 24.8703089318966} , {x:33.0247670562779,y: 25.0128841647688} , {x:33.0376796684278,y: 25.012829139629} , {x:33.050415493061,y: 25.01344003155} , {x:33.0630398992527,y: 25.0136712057918} , {x:33.062359169166,y: 25.0149764969917} , {x:33.0630409293024,y: 25.0147320144853} , {x:33.0700241456856,y: 25.0144035256714} , {x:33.0778221599905,y: 25.0223180106365} , {x:33.0823848640069,y: 25.0181484598058} , {x:33.0901704325144,y: 25.0132568485274} , {x:33.0902247083489,y: 25.0136802367035} , {x:33.090439095594,y: 25.0132769937907} , {x:33.0974240752101,y: 25.0134496433665} , {x:33.098860782988,y: 25.0163195449055} , {x:33.1067067331546,y: 25.0127411941409} , {x:33.1162597448036,y: 25.0133676427572} , {x:33.1185801664153,y: 25.0189383641595} , {x:33.1211298446881,y: 25.0180448589445} , {x:33.1505809986843,y: 25.0288776008302} , {x:33.1517199488609,y: 25.0282859228616} , {x:33.4744317904032,y: 25.1187186066261} ]} ]})
amounir86/amounir86-2011-elections
voter-info/shapes/old_json/28_05.js
JavaScript
unlicense
52,858
<?php /** * An exception when an fActiveRecord is not found in the database * * @copyright Copyright (c) 2007-2008 Will Bond * @author Will Bond [wb] <will@flourishlib.com> * @license http://flourishlib.com/license * * @package Flourish * @link http://flourishlib.com/fNotFoundException * * @version 1.0.0b * @changes 1.0.0b The initial implementation [wb, 2007-06-14] */ class fNotFoundException extends fExpectedException { } /** * Copyright (c) 2007-2008 Will Bond <will@flourishlib.com> * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */
ksa46/work
library/Flourish/lib/fNotFoundException.php
PHP
unlicense
1,655
/** ****************************************************************************** * @file main.h * @author MCD Application Team * @version V1.3.0 * @date 18-December-2015 * @brief Header for main.c module ****************************************************************************** * @attention * * <h2><center>&copy; Copyright © 2015 STMicroelectronics International N.V. * All rights reserved.</center></h2> * * Redistribution and use in source and binary forms, with or without * modification, are permitted, provided that the following conditions are met: * * 1. Redistribution of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * 3. Neither the name of STMicroelectronics nor the names of other * contributors to this software may be used to endorse or promote products * derived from this software without specific written permission. * 4. This software, including modifications and/or derivative works of this * software, must execute solely and exclusively on microcontroller or * microprocessor devices manufactured by or for STMicroelectronics. * 5. Redistribution and use of this software other than as permitted under * this license is void and will automatically terminate your rights under * this license. * * THIS SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A * PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY * RIGHTS ARE DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT * SHALL STMICROELECTRONICS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * ****************************************************************************** */ /* Define to prevent recursive inclusion -------------------------------------*/ #ifndef __MAIN_H #define __MAIN_H /* Includes ------------------------------------------------------------------*/ #include "stm32f1xx_hal.h" #include "GUI.h" /* EVAL includes component */ #include "stm3210e_eval.h" /* Exported types ------------------------------------------------------------*/ /* Exported constants --------------------------------------------------------*/ #endif /* __MAIN_H */ /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
hyller/CodeLibrary
stm32cubef1/STM32Cube_FW_F1_V1.3.0/Projects/STM3210E_EVAL/Applications/STemWin/STemWin_HelloWorld/Inc/main.h
C
unlicense
3,241
*DECK PRWPGE SUBROUTINE PRWPGE (KEY, IPAGE, LPG, SX, IX) C***BEGIN PROLOGUE PRWPGE C***SUBSIDIARY C***PURPOSE Subsidiary to SPLP C***LIBRARY SLATEC C***TYPE SINGLE PRECISION (PRWPGE-S, DPRWPG-D) C***AUTHOR Hanson, R. J., (SNLA) C Wisniewski, J. A., (SNLA) C***DESCRIPTION C C PRWPGE LIMITS THE TYPE OF STORAGE TO A SEQUENTIAL SCHEME. C VIRTUAL MEMORY PAGE READ/WRITE SUBROUTINE. C C DEPENDING ON THE VALUE OF KEY, SUBROUTINE PRWPGE() PERFORMS A PAGE C READ OR WRITE OF PAGE IPAGE. THE PAGE HAS LENGTH LPG. C C KEY IS A FLAG INDICATING WHETHER A PAGE READ OR WRITE IS C TO BE PERFORMED. C IF KEY = 1 DATA IS READ. C IF KEY = 2 DATA IS WRITTEN. C IPAGE IS THE PAGE NUMBER OF THE MATRIX TO BE ACCESSED. C LPG IS THE LENGTH OF THE PAGE OF THE MATRIX TO BE ACCESSED. C SX(*),IX(*) IS THE MATRIX TO BE ACCESSED. C C THIS SUBROUTINE IS A MODIFICATION OF THE SUBROUTINE LRWPGE, C SANDIA LABS. REPT. SAND78-0785. C MODIFICATIONS BY K.L. HIEBERT AND R.J. HANSON C REVISED 811130-1000 C REVISED YYMMDD-HHMM C C***SEE ALSO SPLP C***ROUTINES CALLED PRWVIR, XERMSG C***REVISION HISTORY (YYMMDD) C 811215 DATE WRITTEN C 891214 Prologue converted to Version 4.0 format. (BAB) C 900315 CALLs to XERROR changed to CALLs to XERMSG. (THJ) C 900328 Added TYPE section. (WRB) C 900510 Fixed error messages and replaced GOTOs with C IF-THEN-ELSE. (RWC) C 910403 Updated AUTHOR and DESCRIPTION sections. (WRB) C***END PROLOGUE PRWPGE REAL SX(*) DIMENSION IX(*) C***FIRST EXECUTABLE STATEMENT PRWPGE C C CHECK IF IPAGE IS IN RANGE. C IF (IPAGE.LT.1) THEN CALL XERMSG ('SLATEC', 'PRWPGE', + 'THE VALUE OF IPAGE (PAGE NUMBER) WAS NOT IN THE RANGE' // + '1.LE.IPAGE.LE.MAXPGE.', 55, 1) ENDIF C C CHECK IF LPG IS POSITIVE. C IF (LPG.LE.0) THEN CALL XERMSG ('SLATEC', 'PRWPGE', + 'THE VALUE OF LPG (PAGE LENGTH) WAS NONPOSITIVE.', 55, 1) ENDIF C C DECIDE IF WE ARE READING OR WRITING. C IF (KEY.EQ.1) THEN C C CODE TO DO A PAGE READ. C CALL PRWVIR(KEY,IPAGE,LPG,SX,IX) ELSE IF (KEY.EQ.2) THEN C C CODE TO DO A PAGE WRITE. C CALL PRWVIR(KEY,IPAGE,LPG,SX,IX) ELSE CALL XERMSG ('SLATEC', 'PRWPGE', + 'THE VALUE OF KEY (READ-WRITE FLAG) WAS NOT 1 OR 2.', 55, 1) ENDIF RETURN END
andremirt/v_cond
slatec/src/prwpge.f
FORTRAN
unlicense
2,500
#include "buffer_manager.hh" #include "assert.hh" #include "buffer.hh" #include "client_manager.hh" #include "exception.hh" #include "file.hh" #include "ranges.hh" #include "string.hh" namespace Kakoune { BufferManager::~BufferManager() { // Move buffers to avoid running BufClose with buffers remaining in that list BufferList buffers = std::move(m_buffers); for (auto& buffer : buffers) buffer->on_unregistered(); // Make sure not clients exists if (ClientManager::has_instance()) ClientManager::instance().clear(); } Buffer* BufferManager::create_buffer(String name, Buffer::Flags flags, StringView data, timespec fs_timestamp) { auto path = real_path(parse_filename(name)); for (auto& buf : m_buffers) { if (buf->name() == name or (buf->flags() & Buffer::Flags::File and buf->name() == path)) throw runtime_error{"buffer name is already in use"}; } m_buffers.push_back(std::make_unique<Buffer>(std::move(name), flags, data, fs_timestamp)); auto* buffer = m_buffers.back().get(); buffer->on_registered(); if (contains(m_buffer_trash, buffer)) throw runtime_error{"buffer got removed during its creation"}; return buffer; } void BufferManager::delete_buffer(Buffer& buffer) { auto it = find_if(m_buffers, [&](auto& p) { return p.get() == &buffer; }); kak_assert(it != m_buffers.end()); m_buffer_trash.emplace_back(std::move(*it)); m_buffers.erase(it); if (ClientManager::has_instance()) ClientManager::instance().ensure_no_client_uses_buffer(buffer); buffer.on_unregistered(); } Buffer* BufferManager::get_buffer_ifp(StringView name) { auto path = real_path(parse_filename(name)); for (auto& buf : m_buffers) { if (buf->name() == name or (buf->flags() & Buffer::Flags::File and buf->name() == path)) return buf.get(); } return nullptr; } Buffer& BufferManager::get_buffer(StringView name) { Buffer* res = get_buffer_ifp(name); if (not res) throw runtime_error{format("no such buffer '{}'", name)}; return *res; } Buffer& BufferManager::get_first_buffer() { if (all_of(m_buffers, [](auto& b) { return (b->flags() & Buffer::Flags::Debug); })) create_buffer("*scratch*", Buffer::Flags::None); return *m_buffers.back(); } void BufferManager::backup_modified_buffers() { for (auto& buf : m_buffers) { if ((buf->flags() & Buffer::Flags::File) and buf->is_modified() and not (buf->flags() & Buffer::Flags::ReadOnly)) write_buffer_to_backup_file(*buf); } } void BufferManager::clear_buffer_trash() { for (auto& buffer : m_buffer_trash) { // Do that again, to be tolerant in some corner cases, where a buffer is // deleted during its creation if (ClientManager::has_instance()) { ClientManager::instance().ensure_no_client_uses_buffer(*buffer); ClientManager::instance().clear_window_trash(); } buffer.reset(); } m_buffer_trash.clear(); } }
casimir/kakoune
src/buffer_manager.cc
C++
unlicense
3,157
# Talking points ## Start of Class 0. Remind students that we do not have class on MLK day 1. Remind students of the assignment that will be due 2. Alert students that there is a guest speaker tonight -- a web developer 3. Mention to students that class will keep ramping up 4. Be sure to tell students to regularly check in with your teaching fellow -- even outside of class ## Before we "break out"
machinelearningdeveloper/lc101-kc
January 12, 2017/talking-points.md
Markdown
unlicense
405
// // Mixer.h // Tonic // // Created by Nick Donaldson on 2/9/13. // // See LICENSE.txt for license and usage information. // //! A mixer is like an adder but acts as a source and allows dynamic removal #ifndef __Tonic__Mixer__ #define __Tonic__Mixer__ #include "Synth.h" #include "CompressorLimiter.h" using std::vector; namespace Tonic { namespace Tonic_ { class Mixer_ : public BufferFiller_ { private: TonicFrames workSpace_; vector<BufferFiller> inputs_; void computeSynthesisBlock(const SynthesisContext_ &context); public: Mixer_(); void addInput(BufferFiller input); void removeInput(BufferFiller input); }; inline void Mixer_::computeSynthesisBlock(const SynthesisContext_ &context) { // Clear buffer outputFrames_.clear(); // Tick and add inputs for (unsigned int i=0; i<inputs_.size(); i++){ // Tick each bufferFiller every time, with our context (for now). inputs_[i].tick(workSpace_, context); outputFrames_ += workSpace_; } } } class Mixer : public TemplatedBufferFiller<Tonic_::Mixer_>{ public: void addInput(BufferFiller input){ gen()->lockMutex(); gen()->addInput(input); gen()->unlockMutex(); } void removeInput(BufferFiller input){ gen()->lockMutex(); gen()->removeInput(input); gen()->unlockMutex(); } }; } #endif /* defined(__Tonic__Mixer__) */
TonicAudio/ofxTonic
src/Tonic/Mixer.h
C
unlicense
1,553
// Implements http://rosettacode.org/wiki/N-queens_problem #![feature(test)] extern crate test; use std::vec::Vec; use std::thread::spawn; use std::sync::mpsc::channel; #[cfg(test)] use test::Bencher; #[cfg(not(test))] fn main() { for num in 0i32..16 { println!("Sequential: {}: {}", num, n_queens(num)); } for num in 0i32..16 { println!("Parallel: {}: {}", num, semi_parallel_n_queens(num)); } } /* _ ___ ___ | |_ _____ _ __ / __|/ _ \| \ \ / / _ \ '__/ \__ \ (_) | |\ V / __/ | |___/\___/|_| \_/ \___|_| */ // Solves n-queens using a depth-first, backtracking solution. // Returns the number of solutions for a given n. fn n_queens(n: i32) -> usize { // Pass off to our helper function. return n_queens_helper((1 << n as usize) -1, 0, 0, 0); } // The meat of the algorithm is in here, a recursive helper function // that actually computes the answer using a depth-first, backtracking // algorithm. // // The 30,000 foot overview is as follows: // // This function takes only 3 important parameters: three integers // which represent the spots on the current row that are blocked // by previous queens. // // The "secret sauce" here is that we can avoid passing around the board // or even the locations of the previous queens and instead we use this // information to infer the conflicts for the next row. // // Once we know the conflicts in our current row we can simply recurse // over all of the open spots and profit. // // This implementation is optimized for speed and memory by using // integers and bit shifting instead of arrays for storing the conflicts. fn n_queens_helper(all_ones: i32, left_diags: i32, columns: i32, right_diags: i32) -> usize { // all_ones is a special value that simply has all 1s in the first n positions // and 0s elsewhere. We can use it to clear out areas that we don't care about. // Our solution count. // This will be updated by the recursive calls to our helper. let mut solutions = 0; // We get validSpots with some bit trickery. Effectively, each of the parameters // can be ORed together to create an integer with all the conflicts together, // which we then invert and limit by ANDing with all_ones, our special value //from earlier. let mut valid_spots = !(left_diags | columns | right_diags) & all_ones; // Since valid_spots contains 1s in all of the locations that // are conflict-free, we know we have gone through all of // those locations when valid_spots is all 0s, i.e. when it is 0. while valid_spots != 0 { // This is just bit trickery. For reasons involving the weird // behavior of two's complement integers, this creates an integer // which is all 0s except for a single 1 in the position of the // LSB of valid_spots. let spot = -valid_spots & valid_spots; // We then XOR that integer with the validSpots to flip it to 0 // in valid_spots. valid_spots = valid_spots ^ spot; // Make a recursive call. This is where we infer the conflicts // for the next row. solutions += n_queens_helper( all_ones, // We add a conflict in the current spot and then shift left, // which has the desired effect of moving all of the conflicts // that are created by left diagonals to the left one square. (left_diags | spot) << 1, // For columns we simply mark this column as filled by ORing // in the currentSpot. (columns | spot), // This is the same as the left_diag shift, except we shift // right because these conflicts are caused by right diagonals. (right_diags | spot) >> 1); } // If columns is all blocked (i.e. if it is all ones) then we // have arrived at a solution because we have placed n queens. solutions + ((columns == all_ones) as usize) } // This is the same as the regular nQueens except it creates // n threads in which to to do the work. // // This is much slower for smaller numbers (under 16~17) but outperforms // the sequential algorithm after that. fn semi_parallel_n_queens(n: i32) -> usize { let all_ones = (1 << n as usize) - 1; let (columns, left_diags, right_diags) = (0, 0, 0); let mut receivers = Vec::new(); let mut valid_spots = !(left_diags | columns | right_diags) & all_ones; while valid_spots != 0 { let (tx, rx) = channel(); let spot = -valid_spots & valid_spots; valid_spots = valid_spots ^ spot; receivers.push(rx); spawn( move || -> () { tx.send(n_queens_helper(all_ones, (left_diags | spot) << 1, (columns | spot), (right_diags | spot) >> 1)).unwrap(); }); } receivers.iter().map(|r| r.recv().unwrap()).fold(0, |a, b| a + b) + ((columns == all_ones) as usize) } // Tests #[test] fn test_n_queens() { let real = vec!(1, 1, 0, 0, 2, 10, 4, 40, 92); for num in (0..9i32) { assert_eq!(n_queens(num), real[num as usize]); } } #[test] fn test_parallel_n_queens() { let real = vec!(1, 1, 0, 0, 2, 10, 4, 40, 92); for num in (0..9i32) { assert_eq!(semi_parallel_n_queens(num), real[num as usize]); } } #[bench] fn bench_n_queens(b: &mut Bencher) { b.iter(|| { test::black_box(n_queens(16)); }); } #[bench] fn bench_semi_parallel_n_queens(b: &mut Bencher) { b.iter(|| { test::black_box(semi_parallel_n_queens(16)); }); }
ghotiphud/rust-rosetta
src/n_queens.rs
Rust
unlicense
5,630
# -*- encoding: utf-8 -*- # # Copyright © 2013 IBM Corp # # Author: Tong Li <litong01@us.ibm.com> # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import logging.handlers import os import tempfile from ceilometer.dispatcher import file from ceilometer.openstack.common.fixture import config from ceilometer.openstack.common import test from ceilometer.publisher import utils class TestDispatcherFile(test.BaseTestCase): def setUp(self): super(TestDispatcherFile, self).setUp() self.CONF = self.useFixture(config.Config()).conf def test_file_dispatcher_with_all_config(self): # Create a temporaryFile to get a file name tf = tempfile.NamedTemporaryFile('r') filename = tf.name tf.close() self.CONF.dispatcher_file.file_path = filename self.CONF.dispatcher_file.max_bytes = 50 self.CONF.dispatcher_file.backup_count = 5 dispatcher = file.FileDispatcher(self.CONF) # The number of the handlers should be 1 self.assertEqual(1, len(dispatcher.log.handlers)) # The handler should be RotatingFileHandler handler = dispatcher.log.handlers[0] self.assertIsInstance(handler, logging.handlers.RotatingFileHandler) msg = {'counter_name': 'test', 'resource_id': self.id(), 'counter_volume': 1, } msg['message_signature'] = utils.compute_signature( msg, self.CONF.publisher.metering_secret, ) # The record_metering_data method should exist and not produce errors. dispatcher.record_metering_data(msg) # After the method call above, the file should have been created. self.assertTrue(os.path.exists(handler.baseFilename)) def test_file_dispatcher_with_path_only(self): # Create a temporaryFile to get a file name tf = tempfile.NamedTemporaryFile('r') filename = tf.name tf.close() self.CONF.dispatcher_file.file_path = filename self.CONF.dispatcher_file.max_bytes = None self.CONF.dispatcher_file.backup_count = None dispatcher = file.FileDispatcher(self.CONF) # The number of the handlers should be 1 self.assertEqual(1, len(dispatcher.log.handlers)) # The handler should be RotatingFileHandler handler = dispatcher.log.handlers[0] self.assertIsInstance(handler, logging.FileHandler) msg = {'counter_name': 'test', 'resource_id': self.id(), 'counter_volume': 1, } msg['message_signature'] = utils.compute_signature( msg, self.CONF.publisher.metering_secret, ) # The record_metering_data method should exist and not produce errors. dispatcher.record_metering_data(msg) # After the method call above, the file should have been created. self.assertTrue(os.path.exists(handler.baseFilename)) def test_file_dispatcher_with_no_path(self): self.CONF.dispatcher_file.file_path = None dispatcher = file.FileDispatcher(self.CONF) # The log should be None self.assertIsNone(dispatcher.log)
tanglei528/ceilometer
ceilometer/tests/dispatcher/test_file.py
Python
apache-2.0
3,762
/* * Copyright 2014 MongoDB, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef MONGOC_IOVEC_H #define MONGOC_IOVEC_H #include <bson.h> #ifndef _WIN32 # include <sys/uio.h> #endif BSON_BEGIN_DECLS #ifdef _WIN32 typedef struct { size_t iov_len; char *iov_base; } mongoc_iovec_t; #else typedef struct iovec mongoc_iovec_t; #endif BSON_END_DECLS #endif /* MONGOC_IOVEC_H */
jsbattig/mongo-c-driver
src/mongoc/mongoc-iovec.h
C
apache-2.0
916
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.isis.core.metamodel.facets.object.callbacks.remove; import java.lang.reflect.Method; import java.util.ArrayList; import java.util.Collections; import java.util.List; import org.apache.isis.core.metamodel.adapter.ObjectAdapter; import org.apache.isis.core.metamodel.facetapi.FacetHolder; import org.apache.isis.core.metamodel.facets.ImperativeFacet; public class RemovingCallbackFacetViaMethod extends RemovingCallbackFacetAbstract implements ImperativeFacet { private final List<Method> methods = new ArrayList<Method>(); public RemovingCallbackFacetViaMethod(final Method method, final FacetHolder holder) { super(holder); addMethod(method); } @Override public void addMethod(final Method method) { methods.add(method); } @Override public boolean impliesResolve() { return false; } @Override public Intent getIntent(final Method method) { return Intent.LIFECYCLE; } @Override public boolean impliesObjectChanged() { return false; } @Override public List<Method> getMethods() { return Collections.unmodifiableList(methods); } @Override public void invoke(final ObjectAdapter adapter) { ObjectAdapter.InvokeUtils.invokeAll(methods, adapter); } @Override protected String toStringValues() { return "methods=" + methods; } }
kidaa/isis
core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/callbacks/remove/RemovingCallbackFacetViaMethod.java
Java
apache-2.0
2,249
<!DOCTYPE html> <html itemscope lang="en-us"> <head><meta http-equiv="X-UA-Compatible" content="IE=edge" /> <meta charset="utf-8"> <meta name="HandheldFriendly" content="True"> <meta name="MobileOptimized" content="320"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"><meta name="generator" content="Hugo 0.57.2" /> <meta property="og:title" content="Registration" /> <meta name="twitter:title" content="registration"/> <meta itemprop="name" content="registration"><meta property="og:description" content="Embed registration iframe/link/etc. " /> <meta name="twitter:description" content="Embed registration iframe/link/etc. " /> <meta itemprop="description" content="Embed registration iframe/link/etc. "><meta name="twitter:site" content="@devopsdays"> <meta property="og:type" content="event" /> <meta property="og:url" content="/events/2017-vancouver/registration/" /><meta name="twitter:creator" content="@devopsdaysyvr" /><meta name="twitter:label1" value="Event" /> <meta name="twitter:data1" value="devopsdays Vancouver 2017" /><meta name="twitter:label2" value="Dates" /> <meta name="twitter:data2" value="March 31 - 1, 2017" /><meta property="og:image" content="https://www.devopsdays.org/img/sharing.jpg" /> <meta name="twitter:card" content="summary_large_image" /> <meta name="twitter:image" content="https://www.devopsdays.org/img/sharing.jpg" /> <meta itemprop="image" content="https://www.devopsdays.org/img/sharing.jpg" /> <meta property="fb:app_id" content="1904065206497317" /><meta itemprop="wordCount" content="3"> <title>devopsdays Vancouver 2017 - register </title> <script> window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date; ga('create', 'UA-9713393-1', 'auto'); ga('send', 'pageview'); </script> <script async src='https://www.google-analytics.com/analytics.js'></script> <link href="/css/site.css" rel="stylesheet"> <link href="https://fonts.googleapis.com/css?family=Roboto+Condensed:300,400,700" rel="stylesheet"><link rel="apple-touch-icon" sizes="57x57" href="/apple-icon-57x57.png"> <link rel="apple-touch-icon" sizes="60x60" href="/apple-icon-60x60.png"> <link rel="apple-touch-icon" sizes="72x72" href="/apple-icon-72x72.png"> <link rel="apple-touch-icon" sizes="76x76" href="/apple-icon-76x76.png"> <link rel="apple-touch-icon" sizes="114x114" href="/apple-icon-114x114.png"> <link rel="apple-touch-icon" sizes="120x120" href="/apple-icon-120x120.png"> <link rel="apple-touch-icon" sizes="144x144" href="/apple-icon-144x144.png"> <link rel="apple-touch-icon" sizes="152x152" href="/apple-icon-152x152.png"> <link rel="apple-touch-icon" sizes="180x180" href="/apple-icon-180x180.png"> <link rel="icon" type="image/png" sizes="192x192" href="/android-icon-192x192.png"> <link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png"> <link rel="icon" type="image/png" sizes="96x96" href="/favicon-96x96.png"> <link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png"> <link rel="manifest" href="/manifest.json"> <meta name="msapplication-TileColor" content="#ffffff"> <meta name="msapplication-TileImage" content="/ms-icon-144x144.png"> <meta name="theme-color" content="#ffffff"> <link href="/events/index.xml" rel="alternate" type="application/rss+xml" title="DevOpsDays" /> <link href="/events/index.xml" rel="feed" type="application/rss+xml" title="DevOpsDays" /> <script src=/js/devopsdays-min.js></script></head> <body lang=""> <nav class="navbar navbar-expand-md navbar-light"> <a class="navbar-brand" href="/"> <img src="/img/devopsdays-brain.png" height="30" class="d-inline-block align-top" alt="devopsdays Logo"> DevOpsDays </a> <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation"> <span class="navbar-toggler-icon"></span> </button> <div class="collapse navbar-collapse" id="navbarSupportedContent"> <ul class="navbar-nav mr-auto"><li class="nav-item global-navigation"><a class = "nav-link" href="/events">events</a></li><li class="nav-item global-navigation"><a class = "nav-link" href="/blog">blog</a></li><li class="nav-item global-navigation"><a class = "nav-link" href="/sponsor">sponsor</a></li><li class="nav-item global-navigation"><a class = "nav-link" href="/speaking">speaking</a></li><li class="nav-item global-navigation"><a class = "nav-link" href="/organizing">organizing</a></li><li class="nav-item global-navigation"><a class = "nav-link" href="/about">about</a></li></ul> </div> </nav> <nav class="navbar event-navigation navbar-expand-md navbar-light"> <a href="/events/2017-vancouver" class="nav-link">Vancouver</a> <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbar2"> <span class="navbar-toggler-icon"></span> </button> <div class="navbar-collapse collapse" id="navbar2"> <ul class="navbar-nav"><li class="nav-item active"> <a class="nav-link" href="/events/2017-vancouver/program">program</a> </li><li class="nav-item active"> <a class="nav-link" href="/events/2017-vancouver/location">location</a> </li><li class="nav-item active"> <a class="nav-link" href="/events/2017-vancouver/livestream">livestream</a> </li><li class="nav-item active"> <a class="nav-link" href="https://www.eventbrite.ca/e/devops-days-vancouver-2017-mar-31st-apr-1st-tickets-29634403298">registration</a> </li><li class="nav-item active"> <a class="nav-link" href="/events/2017-vancouver/contact">contact</a> </li><li class="nav-item active"> <a class="nav-link" href="/events/2017-vancouver/conduct">conduct</a> </li><li class="nav-item active"> <a class="nav-link" href="/events/2017-vancouver/policies">policies</a> </li></ul> </div> </nav> <div class="container-fluid"> <div class="row"> <div class="col-md-12"><div class="row"> <div class="col-md-12 content-text"><h1>devopsdays Vancouver - registration</h1> <div style="width:100%; text-align:left;"> Embed registration iframe/link/etc. </div></div> </div> <br /><div class="row cta-row"> <div class="col-md-12"><h4 class="sponsor-cta">Gold Sponsors</h4></div> </div><div class="row sponsor-row"><div class = "col-lg-1 col-md-2 col-4"> <a href = "https://automic.com/"><img src = "/img/sponsors/automic-before-20170605.png" alt = "Automic" title = "Automic" class="img-fluid"></a> </div><div class = "col-lg-1 col-md-2 col-4"> <a href = "http://www.boeingvancouver.com/"><img src = "/img/sponsors/boeing-vancouver.png" alt = "Boeing Vancouver" title = "Boeing Vancouver" class="img-fluid"></a> </div><div class = "col-lg-1 col-md-2 col-4"> <a href = "http://deis.io/"><img src = "/img/sponsors/deis.png" alt = "Deis" title = "Deis" class="img-fluid"></a> </div><div class = "col-lg-1 col-md-2 col-4"> <a href = "https://www.demonware.net/"><img src = "/img/sponsors/demonware.png" alt = "Demonware" title = "Demonware" class="img-fluid"></a> </div><div class = "col-lg-1 col-md-2 col-4"> <a href = "http://www.pivotal.io"><img src = "/img/sponsors/pivotal-before-20190307.png" alt = "Pivotal" title = "Pivotal" class="img-fluid"></a> </div><div class = "col-lg-1 col-md-2 col-4"> <a href = "https://www.salesforce.com/"><img src = "/img/sponsors/salesforce.png" alt = "Salesforce" title = "Salesforce" class="img-fluid"></a> </div><div class = "col-lg-1 col-md-2 col-4"> <a href = "https://saucelabs.com"><img src = "/img/sponsors/saucelabs.png" alt = "saucelabs" title = "saucelabs" class="img-fluid"></a> </div><div class = "col-lg-1 col-md-2 col-4"> <a href = "https://www.sumologic.com/"><img src = "/img/sponsors/sumologic-before-20181203.png" alt = "SumoLogic" title = "SumoLogic" class="img-fluid"></a> </div><div class = "col-lg-1 col-md-2 col-4"> <a href = "http://www.trinimbus.com"><img src = "/img/sponsors/trinimbus-before-20180524.png" alt = "TriNimbus" title = "TriNimbus" class="img-fluid"></a> </div><div class = "col-lg-1 col-md-2 col-4"> <a href = "http://www.victorops.com"><img src = "/img/sponsors/victorops-before-20180823.png" alt = "VictorOps" title = "VictorOps" class="img-fluid"></a> </div></div><div class="row cta-row"> <div class="col-md-12"><h4 class="sponsor-cta">Silver Sponsors</h4></div> </div><div class="row sponsor-row"><div class = "col-lg-1 col-md-2 col-4"> <a href = "http://chef.io"><img src = "/img/sponsors/chef.png" alt = "Chef Software, Inc" title = "Chef Software, Inc" class="img-fluid"></a> </div><div class = "col-lg-1 col-md-2 col-4"> <a href = "http://www.netapp.com/us/"><img src = "/img/sponsors/netapp.png" alt = "NetApp" title = "NetApp" class="img-fluid"></a> </div><div class = "col-lg-1 col-md-2 col-4"> <a href = "https://www.scalar.ca/"><img src = "/img/sponsors/scalar.png" alt = "Scalar" title = "Scalar" class="img-fluid"></a> </div><div class = "col-lg-1 col-md-2 col-4"> <a href = "http://careers.unbounce.com/"><img src = "/img/sponsors/unbounce.png" alt = "Unbounce" title = "Unbounce" class="img-fluid"></a> </div></div><div class="row cta-row"> <div class="col-md-12"><h4 class="sponsor-cta">Bronze Sponsors</h4></div> </div><div class="row sponsor-row"><div class = "col-lg-1 col-md-2 col-4"> <a href = "https://www.itglue.com/"><img src = "/img/sponsors/itglue.png" alt = "IT Glue" title = "IT Glue" class="img-fluid"></a> </div><div class = "col-lg-1 col-md-2 col-4"> <a href = "http://www.opsgenie.com"><img src = "/img/sponsors/opsgenie.png" alt = "OpsGenie" title = "OpsGenie" class="img-fluid"></a> </div><div class = "col-lg-1 col-md-2 col-4"> <a href = "http://www.samsung.com/"><img src = "/img/sponsors/samsung-rd.png" alt = "Samsung" title = "Samsung" class="img-fluid"></a> </div><div class = "col-lg-1 col-md-2 col-4"> <a href = "https://getstat.com/"><img src = "/img/sponsors/statsearchanalytics.png" alt = "STAT Search Analytics" title = "STAT Search Analytics" class="img-fluid"></a> </div></div><div class="row cta-row"> <div class="col-md-12"><h4 class="sponsor-cta">Coffee Sponsors</h4></div> </div><div class="row sponsor-row"><div class = "col-lg-1 col-md-2 col-4"> <a href = "http://www.ea.com/"><img src = "/img/sponsors/ea.png" alt = "EA" title = "EA" class="img-fluid"></a> </div></div><div class="row cta-row"> <div class="col-md-12"><h4 class="sponsor-cta">Happy Hour Sponsors</h4></div> </div><div class="row sponsor-row"></div><div class="row cta-row"> <div class="col-md-12"><h4 class="sponsor-cta">Friends Sponsors</h4></div> </div><div class="row sponsor-row"><div class = "col-lg-1 col-md-2 col-4"> <a href = "http://www.aytech.ca/"><img src = "/img/sponsors/ay-tech.png" alt = "A.Y Technologies Inc." title = "A.Y Technologies Inc." class="img-fluid"></a> </div><div class = "col-lg-1 col-md-2 col-4"> <a href = "http://www.pearlfishergroup.com/"><img src = "/img/sponsors/pearlfisher-adaptech.png" alt = "The Pearl Fisher Group" title = "The Pearl Fisher Group" class="img-fluid"></a> </div></div><br /> </div> </div> </div></div> </div> <nav class="navbar bottom navbar-light footer-nav-row" style="background-color: #bfbfc1;"> <div class = "row"> <div class = "col-md-12 footer-nav-background"> <div class = "row"> <div class = "col-md-6 col-lg-3 footer-nav-col"> <h3 class="footer-nav">@DEVOPSDAYS</h3> <div> <a class="twitter-timeline" data-dnt="true" href="https://twitter.com/devopsdays/lists/devopsdays" data-chrome="noheader" height="440"></a> <script> ! function(d, s, id) { var js, fjs = d.getElementsByTagName(s)[0], p = /^http:/.test(d.location) ? 'http' : 'https'; if (!d.getElementById(id)) { js = d.createElement(s); js.id = id; js.src = p + "://platform.twitter.com/widgets.js"; fjs.parentNode.insertBefore(js, fjs); } }(document, "script", "twitter-wjs"); </script> </div> </div> <div class="col-md-6 col-lg-3 footer-nav-col footer-content"> <h3 class="footer-nav">BLOG</h3><a href = "https://www.devopsdays.org/blog/2019/05/10/10-years-of-devopsdays/"><h1 class = "footer-heading">10 years of devopsdays</h1></a><h2 class="footer-heading">by Kris Buytaert - 10 May, 2019</h2><p class="footer-content">It&rsquo;s hard to believe but it is almost 10 years ago since #devopsdays happened for the first time in Gent. Back then there were almost 70 of us talking about topics that were of interest to both Operations and Development, we were exchanging our ideas and experiences `on how we were improving the quality of software delivery. Our ideas got started on the crossroads of Open Source, Agile and early Cloud Adoption.</p><a href = "https://www.devopsdays.org/blog/"><h1 class = "footer-heading">Blogs</h1></a><h2 class="footer-heading">10 May, 2019</h2><p class="footer-content"></p><a href="https://www.devopsdays.org/blog/index.xml">Feed</a> </div> <div class="col-md-6 col-lg-3 footer-nav-col"> <h3 class="footer-nav">CFP OPEN</h3><a href = "/events/2019-campinas" class = "footer-content">Campinas</a><br /><a href = "/events/2019-macapa" class = "footer-content">Macapá</a><br /><a href = "/events/2019-shanghai" class = "footer-content">Shanghai</a><br /><a href = "/events/2019-recife" class = "footer-content">Recife</a><br /><a href = "/events/2020-charlotte" class = "footer-content">Charlotte</a><br /><a href = "/events/2020-prague" class = "footer-content">Prague</a><br /><a href = "/events/2020-tokyo" class = "footer-content">Tokyo</a><br /><a href = "/events/2020-salt-lake-city" class = "footer-content">Salt Lake City</a><br /> <br />Propose a talk at an event near you!<br /> </div> <div class="col-md-6 col-lg-3 footer-nav-col"> <h3 class="footer-nav">About</h3> devopsdays is a worldwide community conference series for anyone interested in IT improvement.<br /><br /> <a href="/about/" class = "footer-content">About devopsdays</a><br /> <a href="/privacy/" class = "footer-content">Privacy Policy</a><br /> <a href="/conduct/" class = "footer-content">Code of Conduct</a> <br /> <br /> <a href="https://www.netlify.com"> <img src="/img/netlify-light.png" alt="Deploys by Netlify"> </a> </div> </div> </div> </div> </nav> <script> $(document).ready(function () { $("#share").jsSocials({ shares: ["email", {share: "twitter", via: 'devopsdaysyvr'}, "facebook", "linkedin"], text: 'devopsdays Vancouver - 2017', showLabel: false, showCount: false }); }); </script> </body> </html>
gomex/devopsdays-web
static/events/2017-vancouver/registration/index.html
HTML
apache-2.0
15,807
/* Copyright 2020 Google Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ #include <fuzzer/FuzzedDataProvider.h> #include <vector> #include <aconf.h> #include <stdio.h> #include <stdint.h> #include <stdlib.h> #include <stddef.h> #include <string.h> #include <png.h> #include "gmem.h" #include "gmempp.h" #include "parseargs.h" #include "GString.h" #include "gfile.h" #include "GlobalParams.h" #include "Object.h" #include "PDFDoc.h" #include "SplashBitmap.h" #include "Splash.h" #include "SplashOutputDev.h" #include "Stream.h" #include "config.h" extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { FuzzedDataProvider fdp (data, size); double hdpi = fdp.ConsumeFloatingPoint<double>(); double vdpi = fdp.ConsumeFloatingPoint<double>(); int rotate = fdp.ConsumeIntegral<int>(); bool useMediaBox = fdp.ConsumeBool(); bool crop = fdp.ConsumeBool(); bool printing = fdp.ConsumeBool(); std::vector<char> payload = fdp.ConsumeRemainingBytes<char>(); Object xpdf_obj; xpdf_obj.initNull(); BaseStream *stream = new MemStream(payload.data(), 0, payload.size(), &xpdf_obj); Object info, xfa; Object *acroForm; globalParams = new GlobalParams(NULL); globalParams->setErrQuiet(1); globalParams->setupBaseFonts(NULL); char yes[] = "yes"; globalParams->setEnableFreeType(yes); // Yes, it's a string and not a bool. globalParams->setErrQuiet(1); PDFDoc *doc = NULL; try { PDFDoc doc(stream); if (doc.isOk() == gTrue) { doc.getNumPages(); doc.getOutline(); doc.getStructTreeRoot(); doc.getXRef(); doc.okToPrint(gTrue); doc.okToCopy(gTrue); doc.okToChange(gTrue); doc.okToAddNotes(gTrue); doc.isLinearized(); doc.getPDFVersion(); GString *metadata; if ((metadata = doc.readMetadata())) { (void)metadata->getCString(); } delete metadata; Object info; doc.getDocInfo(&info); if (info.isDict()) { info.getDict(); } info.free(); if ((acroForm = doc.getCatalog()->getAcroForm())->isDict()) { acroForm->dictLookup("XFA", &xfa); xfa.free(); } for (size_t i = 0; i < doc.getNumPages(); i++) { doc.getLinks(i); auto page = doc.getCatalog()->getPage(i); if (!page->isOk()) { continue; } page->getResourceDict(); page->getMetadata(); page->getResourceDict(); } SplashColor paperColor = {0xff, 0xff, 0xff}; SplashOutputDev *splashOut = new SplashOutputDev(splashModeRGB8, 1, gFalse, paperColor); splashOut->setNoComposite(gTrue); splashOut->startDoc(doc.getXRef()); for (size_t i = 0; i <= doc.getNumPages(); ++i) { doc.displayPage(splashOut, i, hdpi, vdpi, rotate, useMediaBox, crop, printing); } (void)splashOut->getBitmap(); delete splashOut; } } catch (...) { } delete globalParams; return 0; }
skia-dev/oss-fuzz
projects/xpdf/fuzz_pdfload.cc
C++
apache-2.0
3,787
using System; using System.IO; using EnvDTE; namespace NuGet.VisualStudio { public class NativeProjectSystem : VsProjectSystem { public NativeProjectSystem(Project project, IFileSystemProvider fileSystemProvider) : base(project, fileSystemProvider) { } public override bool IsBindingRedirectSupported { get { return false; } } protected override void AddGacReference(string name) { // Native project doesn't know about GAC } public override bool ReferenceExists(string name) { // We disable assembly reference for native projects return true; } public override void AddReference(string referencePath, Stream stream) { // We disable assembly reference for native projects } public override void RemoveReference(string name) { // We disable assembly reference for native projects } public override void AddImport(string targetPath, ProjectImportLocation location) { if (VsVersionHelper.IsVisualStudio2010) { base.AddImport(targetPath, location); } else { // For VS 2012 or above, the operation has to be done inside the Writer lock if (String.IsNullOrEmpty(targetPath)) { throw new ArgumentNullException(CommonResources.Argument_Cannot_Be_Null_Or_Empty, "targetPath"); } string relativeTargetPath = PathUtility.GetRelativePath(PathUtility.EnsureTrailingSlash(Root), targetPath); Project.DoWorkInWriterLock(buildProject => buildProject.AddImportStatement(relativeTargetPath, location)); Project.Save(); } } public override void RemoveImport(string targetPath) { if (VsVersionHelper.IsVisualStudio2010) { base.RemoveImport(targetPath); } else { // For VS 2012 or above, the operation has to be done inside the Writer lock if (String.IsNullOrEmpty(targetPath)) { throw new ArgumentNullException(CommonResources.Argument_Cannot_Be_Null_Or_Empty, "targetPath"); } string relativeTargetPath = PathUtility.GetRelativePath(PathUtility.EnsureTrailingSlash(Root), targetPath); Project.DoWorkInWriterLock(buildProject => buildProject.RemoveImportStatement(relativeTargetPath)); Project.Save(); } } protected override void AddFileToContainer(string fullPath, ProjectItems container) { container.AddFromFile(Path.GetFileName(fullPath)); } } }
chester89/nugetApi
src/VisualStudio/ProjectSystems/NativeProjectSystem.cs
C#
apache-2.0
2,947
/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.alibaba.jstorm.message.netty; import backtype.storm.Config; import backtype.storm.messaging.IConnection; import backtype.storm.messaging.IContext; import backtype.storm.utils.DisruptorQueue; import backtype.storm.utils.Utils; import com.alibaba.jstorm.callback.AsyncLoopThread; import com.alibaba.jstorm.metric.MetricDef; import com.alibaba.jstorm.utils.JStormUtils; import java.util.HashSet; import java.util.Map; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.Executors; import java.util.concurrent.ThreadFactory; import org.jboss.netty.channel.socket.nio.NioClientSocketChannelFactory; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class NettyContext implements IContext { private final static Logger LOG = LoggerFactory.getLogger(NettyContext.class); @SuppressWarnings("rawtypes") private Map stormConf; private NioClientSocketChannelFactory clientChannelFactory; private ReconnectRunnable reconnector; @SuppressWarnings("unused") public NettyContext() { } /** * initialization per Storm configuration */ @SuppressWarnings("rawtypes") public void prepare(Map stormConf) { this.stormConf = stormConf; int maxWorkers = Utils.getInt(stormConf.get(Config.STORM_MESSAGING_NETTY_CLIENT_WORKER_THREADS)); ThreadFactory bossFactory = new NettyRenameThreadFactory(MetricDef.NETTY_CLI + "boss"); ThreadFactory workerFactory = new NettyRenameThreadFactory(MetricDef.NETTY_CLI + "worker"); if (maxWorkers > 0) { clientChannelFactory = new NioClientSocketChannelFactory(Executors.newCachedThreadPool(bossFactory), Executors.newCachedThreadPool(workerFactory), maxWorkers); } else { clientChannelFactory = new NioClientSocketChannelFactory(Executors.newCachedThreadPool(bossFactory), Executors.newCachedThreadPool(workerFactory)); } reconnector = new ReconnectRunnable(); new AsyncLoopThread(reconnector, true, Thread.MIN_PRIORITY, true); } @Override public IConnection bind(String topologyId, int port, ConcurrentHashMap<Integer, DisruptorQueue> deserializedQueue, DisruptorQueue recvControlQueue, boolean bstartRec, Set<Integer> workerTasks) { IConnection retConnection = null; try { retConnection = new NettyServer(stormConf, port, deserializedQueue, recvControlQueue, bstartRec, workerTasks); } catch (Throwable e) { LOG.error("Failed to create NettyServer", e); JStormUtils.halt_process(-1, "Failed to bind " + port); } return retConnection; } @Override public IConnection connect(String topologyId, String host, int port) { return new NettyClientAsync(stormConf, clientChannelFactory, host, port, reconnector, new HashSet<Integer>(), new HashSet<Integer>()); } @Override public IConnection connect(String topologyId, String host, int port, Set<Integer> sourceTasks, Set<Integer> targetTasks) { return new NettyClientAsync(stormConf, clientChannelFactory, host, port, reconnector, sourceTasks, targetTasks); } /** * terminate this context */ public void term() { /* clientScheduleService.shutdown(); try { clientScheduleService.awaitTermination(10, TimeUnit.SECONDS); } catch (InterruptedException e) { LOG.error("Error when shutting down client scheduler", e); }*/ clientChannelFactory.releaseExternalResources(); reconnector.shutdown(); } }
alibaba/jstorm
jstorm-core/src/main/java/com/alibaba/jstorm/message/netty/NettyContext.java
Java
apache-2.0
4,482
#!/bin/bash ## # Copyright (c) 2008-2012 Marius Zwicker # All rights reserved. # # @LICENSE_HEADER_START:Apache@ # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # # http://www.mlba-team.de # # @LICENSE_HEADER_END:Apache@ ## ####################################################################### # # Configure Codeblocks/QtCreator project files # (c) 2012 Marius Zwicker # # Pass 'Release' as argument to build without debug flags # ####################################################################### BUILD_DIR="QtCreator_ProjectFiles" RELEASE_DIR="Release_$BUILD_DIR" GENERATOR="CodeBlocks - Unix Makefiles" TARGET="Qt Creator" DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" source $DIR/util.sh $@
JackieXie168/libdispatch
doc/xdispatch/build/genQtCreator_ProjectFiles.sh
Shell
apache-2.0
1,222
/*! * ${copyright} */ // Provides class sap.ui.rta.plugin.Combine. sap.ui.define([ 'sap/ui/rta/plugin/Plugin', 'sap/ui/dt/Selection', 'sap/ui/dt/OverlayRegistry', 'sap/ui/rta/Utils' ], function( Plugin, Selection, OverlayRegistry, Utils ) { "use strict"; /** * Constructor for a new Combine Plugin. * * @class * @extends sap.ui.rta.plugin.Plugin * @author SAP SE * @version ${version} * @constructor * @private * @since 1.46 * @alias sap.ui.rta.plugin.Combine * @experimental Since 1.46. This class is experimental and provides only limited functionality. Also the API might be changed in future. */ var Combine = Plugin.extend("sap.ui.rta.plugin.Combine", /** @lends sap.ui.rta.plugin.Combine.prototype */ { metadata: { // ---- object ---- // ---- control specific ---- library: "sap.ui.rta", properties: {}, associations: {}, events: {} } }); /** * check if the given overlay is editable * @param {sap.ui.dt.ElementOverlay} oOverlay - overlay to be checked for editable * @returns {boolean} whether it is editable or not * @private */ Combine.prototype._isEditable = function(oOverlay) { var oCombineAction = this.getAction(oOverlay); if (oCombineAction && oCombineAction.changeType && oCombineAction.changeOnRelevantContainer) { return this.hasChangeHandler(oCombineAction.changeType, oOverlay.getRelevantContainer()) && this.hasStableId(oOverlay); } else { return false; } }; Combine.prototype._checkForSameRelevantContainer = function(aSelectedOverlays) { var aRelevantContainer = []; for (var i = 0, n = aSelectedOverlays.length; i < n; i++) { aRelevantContainer[i] = aSelectedOverlays[i].getRelevantContainer(); var oCombineAction = this.getAction(aSelectedOverlays[i]); if (!oCombineAction || !oCombineAction.changeType){ return false; } if (i > 0) { if ((aRelevantContainer[0] !== aRelevantContainer[i]) || (this.getAction(aSelectedOverlays[0]).changeType !== oCombineAction.changeType)) { return false; } } } return true; }; /** * Checks if Combine is available for oOverlay * * @param {sap.ui.dt.Overlay} oOverlay overlay object * @return {boolean} true if available * @public */ Combine.prototype.isAvailable = function(oOverlay) { var aSelectedOverlays = this.getDesignTime().getSelection(); if (aSelectedOverlays.length <= 1) { return false; } return (this._isEditableByPlugin(oOverlay) && this._checkForSameRelevantContainer(aSelectedOverlays)); }; /** * Checks if Combine is enabled for oOverlay * * @param {sap.ui.dt.Overlay} oOverlay overlay object * @return {boolean} true if enabled * @public */ Combine.prototype.isEnabled = function(oOverlay) { var aSelectedOverlays = this.getDesignTime().getSelection(); // check that at least 2 fields can be combined if (!this.isAvailable(oOverlay) || aSelectedOverlays.length <= 1) { return false; } var aSelectedControls = aSelectedOverlays.map(function (oSelectedOverlay) { return oSelectedOverlay.getElementInstance(); }); // check that each selected element has an enabled action var bActionCheck = aSelectedOverlays.every(function(oSelectedOverlay) { var oAction = this.getAction(oSelectedOverlay); if (!oAction) { return false; } // when isEnabled is not defined the default is true if (typeof oAction.isEnabled !== "undefined") { if (typeof oAction.isEnabled === "function") { return oAction.isEnabled(aSelectedControls); } else { return oAction.isEnabled; } } return true; }, this); return bActionCheck; }; /** * @param {any} oCombineElement selected element */ Combine.prototype.handleCombine = function(oCombineElement) { var oElementOverlay = OverlayRegistry.getOverlay(oCombineElement); var oDesignTimeMetadata = oElementOverlay.getDesignTimeMetadata(); var aToCombineElements = []; var aSelectedOverlays = this.getDesignTime().getSelection(); for (var i = 0; i < aSelectedOverlays.length; i++) { var oSelectedElement = aSelectedOverlays[i].getElementInstance(); aToCombineElements.push(oSelectedElement); } var oCombineAction = this.getAction(oElementOverlay); var sVariantManagementReference = this.getVariantManagementReference(oElementOverlay, oCombineAction); var oCombineCommand = this.getCommandFactory().getCommandFor(oCombineElement, "combine", { source : oCombineElement, combineFields : aToCombineElements }, oDesignTimeMetadata, sVariantManagementReference); this.fireElementModified({ "command" : oCombineCommand }); }; /** * Retrieve the context menu item for the action. * @param {sap.ui.dt.ElementOverlay} oOverlay Overlay for which the context menu was opened * @return {object[]} Returns array containing the items with required data */ Combine.prototype.getMenuItems = function(oOverlay){ return this._getMenuItems(oOverlay, {pluginId : "CTX_GROUP_FIELDS", rank : 90}); }; /** * Get the name of the action related to this plugin. * @return {string} Returns the action name */ Combine.prototype.getActionName = function(){ return "combine"; }; /** * Trigger the plugin execution. * @param {sap.ui.dt.ElementOverlay[]} aOverlays Selected overlays; targets of the action * @param {any} oEventItem ContextMenu item which triggers the event * @param {any} oContextElement Element where the action is triggered */ Combine.prototype.handler = function(aOverlays, mPropertyBag){ //TODO: Handle "Stop Cut & Paste" depending on alignment with Dietrich! this.handleCombine(mPropertyBag.contextElement); }; return Combine; }, /* bExport= */true);
SQCLabs/openui5
src/sap.ui.rta/src/sap/ui/rta/plugin/Combine.js
JavaScript
apache-2.0
5,703
package helpers import ( "fmt" "github.com/SpectraLogic/ds3_go_sdk/ds3" ds3Models "github.com/SpectraLogic/ds3_go_sdk/ds3/models" helperModels "github.com/SpectraLogic/ds3_go_sdk/helpers/models" "github.com/SpectraLogic/ds3_go_sdk/sdk_log" "sync" "time" ) type putProducer struct { JobMasterObjectList *ds3Models.MasterObjectList //MOL from put bulk job creation WriteObjects *[]helperModels.PutObject queue *chan TransferOperation strategy *WriteTransferStrategy client *ds3.Client waitGroup *sync.WaitGroup writeObjectMap map[string]helperModels.PutObject processedBlobTracker blobTracker deferredBlobQueue BlobDescriptionQueue // queue of blobs whose channels are not yet ready for transfer sdk_log.Logger // Conditional value that gets triggered when a blob has finished being transferred doneNotifier NotifyBlobDone } func newPutProducer( jobMasterObjectList *ds3Models.MasterObjectList, putObjects *[]helperModels.PutObject, queue *chan TransferOperation, strategy *WriteTransferStrategy, client *ds3.Client, waitGroup *sync.WaitGroup, doneNotifier NotifyBlobDone) *putProducer { return &putProducer{ JobMasterObjectList: jobMasterObjectList, WriteObjects: putObjects, queue: queue, strategy: strategy, client: client, waitGroup: waitGroup, writeObjectMap: toWriteObjectMap(putObjects), deferredBlobQueue: NewBlobDescriptionQueue(), processedBlobTracker: newProcessedBlobTracker(), Logger: client.Logger, // use the same logger as the client doneNotifier: doneNotifier, } } // Creates a map of object name to PutObject struct func toWriteObjectMap(putObjects *[]helperModels.PutObject) map[string]helperModels.PutObject { objectMap := make(map[string]helperModels.PutObject) if putObjects == nil { return objectMap } for _, obj := range *putObjects { objectMap[obj.PutObject.Name] = obj } return objectMap } // Information required to perform a put operation of a blob using the source channelBuilder to BP destination type putObjectInfo struct { blob helperModels.BlobDescription channelBuilder helperModels.ReadChannelBuilder bucketName string jobId string } // Creates the transfer operation that will perform the data upload of the specified blob to BP func (producer *putProducer) transferOperationBuilder(info putObjectInfo) TransferOperation { return func() { // has this file fatally errored while transferring a different blob? if info.channelBuilder.HasFatalError() { // skip performing this blob transfer producer.Warningf("fatal error occurred previously on this file, skipping sending blob name='%s' offset=%d length=%d", info.blob.Name(), info.blob.Offset(), info.blob.Length()) return } reader, err := info.channelBuilder.GetChannel(info.blob.Offset()) if err != nil { producer.strategy.Listeners.Errored(info.blob.Name(), err) info.channelBuilder.SetFatalError(err) producer.Errorf("could not get reader for object with name='%s' offset=%d length=%d: %v", info.blob.Name(), info.blob.Offset(), info.blob.Length(), err) return } defer info.channelBuilder.OnDone(reader) sizedReader := NewIoReaderWithSizeDecorator(reader, info.blob.Length()) putObjRequest := ds3Models.NewPutObjectRequest(info.bucketName, info.blob.Name(), sizedReader). WithJob(info.jobId). WithOffset(info.blob.Offset()) producer.maybeAddMetadata(info, putObjRequest) _, err = producer.client.PutObject(putObjRequest) if err != nil { producer.strategy.Listeners.Errored(info.blob.Name(), err) info.channelBuilder.SetFatalError(err) producer.Errorf("problem during transfer of %s: %s", info.blob.Name(), err.Error()) } } } func (producer *putProducer) maybeAddMetadata(info putObjectInfo, putObjRequest *ds3Models.PutObjectRequest) { metadataMap := producer.metadataFrom(info) if len(metadataMap) == 0 { return } for key, value := range metadataMap { putObjRequest.WithMetaData(key, value) } } func (producer *putProducer) metadataFrom(info putObjectInfo) map[string]string { result := map[string]string{} for _, objectToPut := range *producer.WriteObjects { if objectToPut.PutObject.Name == info.blob.Name() { result = objectToPut.Metadata break } } return result } // Processes all the blobs in a chunk and attempts to add them to the transfer queue. // If a blob is not ready for transfer, then it is added to the waiting to be transferred queue. // Returns the number of blobs added to queue. func (producer *putProducer) processChunk(curChunk *ds3Models.Objects, bucketName string, jobId string) (int, error) { processedCount := 0 producer.Debugf("begin chunk processing %s", curChunk.ChunkId) // transfer blobs that are ready, and queue those that are waiting for channel for _, curObj := range curChunk.Objects { producer.Debugf("queuing object in waiting to be processed %s offset=%d length=%d", *curObj.Name, curObj.Offset, curObj.Length) blob := helperModels.NewBlobDescription(*curObj.Name, curObj.Offset, curObj.Length) blobQueued, err := producer.queueBlobForTransfer(&blob, bucketName, jobId) if err != nil { return 0, err } if blobQueued { processedCount++ } } return processedCount, nil } // Iterates through blobs that are waiting to be transferred and attempts to transfer. // If successful, blob is removed from queue. Else, it is re-queued. // Returns the number of blobs added to queue. func (producer *putProducer) processWaitingBlobs(bucketName string, jobId string) (int, error) { processedCount := 0 // attempt to process all blobs in waiting to be transferred waitingBlobs := producer.deferredBlobQueue.Size() for i := 0; i < waitingBlobs; i++ { //attempt transfer curBlob, err := producer.deferredBlobQueue.Pop() if err != nil { //should not be possible to get here producer.Errorf("problem when getting next blob to be transferred: %s", err.Error()) break } producer.Debugf("attempting to process %s offset=%d length=%d", curBlob.Name(), curBlob.Offset(), curBlob.Length()) blobQueued, err := producer.queueBlobForTransfer(curBlob, bucketName, jobId) if err != nil { return 0, err } if blobQueued { processedCount++ } } return processedCount, nil } // Attempts to transfer a single blob. If the blob is not ready for transfer, // it is added to the waiting to transfer queue. // Returns whether or not the blob was queued for transfer. func (producer *putProducer) queueBlobForTransfer(blob *helperModels.BlobDescription, bucketName string, jobId string) (bool, error) { if producer.processedBlobTracker.IsProcessed(*blob) { return false, nil // this was already processed } curWriteObj, ok := producer.writeObjectMap[blob.Name()] if !ok { err := fmt.Errorf("failed to find object associated with blob in object map: %s offset=%d length=%d", blob.Name(), blob.Offset(), blob.Length()) producer.Errorf("unrecoverable error: %v", err) producer.processedBlobTracker.MarkProcessed(*blob) return false, err // fatal error occurred } if curWriteObj.ChannelBuilder == nil { err := fmt.Errorf("failed to transfer object, it does not have a channel builder: %s", curWriteObj.PutObject.Name) producer.Errorf("unrecoverable error: %v", err) producer.processedBlobTracker.MarkProcessed(*blob) return false, err // fatal error occurred } if curWriteObj.ChannelBuilder.HasFatalError() { // a fatal error happened on a previous blob for this file, skip processing producer.Warningf("fatal error occurred while transferring previous blob on this file, skipping blob %s offset=%d length=%d", blob.Name(), blob.Offset(), blob.Length()) producer.processedBlobTracker.MarkProcessed(*blob) return false, nil // not actually transferring this blob } if !curWriteObj.ChannelBuilder.IsChannelAvailable(blob.Offset()) { producer.Debugf("channel is not currently available for blob %s offset=%d length=%d", blob.Name(), blob.Offset(), blob.Length()) // Not ready to be transferred producer.deferredBlobQueue.Push(blob) return false, nil // not ready to be sent } producer.Debugf("channel is available for blob %s offset=%d length=%d", curWriteObj.PutObject.Name, blob.Offset(), blob.Length()) // Blob ready to be transferred // Create transfer operation objInfo := putObjectInfo{ blob: *blob, channelBuilder: curWriteObj.ChannelBuilder, bucketName: bucketName, jobId: jobId, } transfer := producer.transferOperationBuilder(objInfo) // Increment wait group, and enqueue transfer operation producer.waitGroup.Add(1) *producer.queue <- transfer // Mark blob as processed producer.processedBlobTracker.MarkProcessed(*blob) return true, nil } // This initiates the production of the transfer operations which will be consumed by a consumer running in a separate go routine. // Each transfer operation will put one blob of content to the BP. // Once all blobs have been queued to be transferred, the producer will finish, even if all operations have not been consumed yet. func (producer *putProducer) run() error { defer close(*producer.queue) // determine number of blobs to be processed totalBlobCount := producer.totalBlobCount() producer.Debugf("job status totalBlobs=%d processedBlobs=%d", totalBlobCount, producer.processedBlobTracker.NumberOfProcessedBlobs()) // process all chunks and make sure all blobs are queued for transfer for producer.hasMoreToProcess(totalBlobCount) { processedCount, err := producer.queueBlobsReadyForTransfer(totalBlobCount) if err != nil { return err } // If the last operation processed blobs, then wait for something to finish if processedCount > 0 { // wait for a done signal to be received producer.doneNotifier.Wait() } else if producer.hasMoreToProcess(totalBlobCount) { // nothing could be processed, cache is probably full, wait a bit before trying again time.Sleep(producer.strategy.BlobStrategy.delay()) } } return nil } func (producer *putProducer) hasMoreToProcess(totalBlobCount int64) bool { return producer.processedBlobTracker.NumberOfProcessedBlobs() < totalBlobCount || producer.deferredBlobQueue.Size() > 0 } // Returns the number of items queued for work. func (producer *putProducer) queueBlobsReadyForTransfer(totalBlobCount int64) (int, error) { // Attempt to transfer waiting blobs processedCount, err := producer.processWaitingBlobs(*producer.JobMasterObjectList.BucketName, producer.JobMasterObjectList.JobId) if err != nil { return 0, err } // Check if we need to query the BP for allocated blobs, or if we already know everything is allocated. if int64(producer.deferredBlobQueue.Size()) + producer.processedBlobTracker.NumberOfProcessedBlobs() >= totalBlobCount { // Everything is already allocated, no need to query BP for allocated chunks return processedCount, nil } // Get the list of available chunks that the server can receive. The server may // not be able to receive everything, so not all chunks will necessarily be // returned chunksReady := ds3Models.NewGetJobChunksReadyForClientProcessingSpectraS3Request(producer.JobMasterObjectList.JobId) chunksReadyResponse, err := producer.client.GetJobChunksReadyForClientProcessingSpectraS3(chunksReady) if err != nil { producer.Errorf("unrecoverable error: %v", err) return processedCount, err } // Check to see if any chunks can be processed numberOfChunks := len(chunksReadyResponse.MasterObjectList.Objects) if numberOfChunks > 0 { // Loop through all the chunks that are available for processing, and send // the files that are contained within them. for _, curChunk := range chunksReadyResponse.MasterObjectList.Objects { justProcessedCount, err := producer.processChunk(&curChunk, *chunksReadyResponse.MasterObjectList.BucketName, chunksReadyResponse.MasterObjectList.JobId) if err != nil { return 0, err } processedCount += justProcessedCount } } return processedCount, nil } // Determines the number of blobs to be transferred. func (producer *putProducer) totalBlobCount() int64 { if producer.JobMasterObjectList.Objects == nil || len(producer.JobMasterObjectList.Objects) == 0 { return 0 } var count int64 = 0 for _, chunk := range producer.JobMasterObjectList.Objects { for range chunk.Objects { count++ } } return count }
SpectraLogic/ds3_go_sdk
helpers/putProducer.go
GO
apache-2.0
13,579
package org.jboss.resteasy.test.providers.multipart.resource; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; @XmlRootElement(name = "customer") @XmlAccessorType(XmlAccessType.FIELD) public class ContextProvidersCustomer { @XmlElement private String name; public ContextProvidersCustomer() { } public ContextProvidersCustomer(final String name) { this.name = name; } public String getName() { return name; } }
awhitford/Resteasy
testsuite/integration-tests/src/test/java/org/jboss/resteasy/test/providers/multipart/resource/ContextProvidersCustomer.java
Java
apache-2.0
607
//// [typeGuardFunctionOfFormThis.ts] class RoyalGuard { isLeader(): this is LeadGuard { return this instanceof LeadGuard; } isFollower(): this is FollowerGuard { return this instanceof FollowerGuard; } } class LeadGuard extends RoyalGuard { lead(): void {}; } class FollowerGuard extends RoyalGuard { follow(): void {}; } let a: RoyalGuard = new FollowerGuard(); if (a.isLeader()) { a.lead(); } else if (a.isFollower()) { a.follow(); } interface GuardInterface extends RoyalGuard {} let b: GuardInterface; if (b.isLeader()) { b.lead(); } else if (b.isFollower()) { b.follow(); } // if (((a.isLeader)())) { // a.lead(); // } // else if (((a).isFollower())) { // a.follow(); // } // if (((a["isLeader"])())) { // a.lead(); // } // else if (((a)["isFollower"]())) { // a.follow(); // } var holder2 = {a}; if (holder2.a.isLeader()) { holder2.a; } else { holder2.a; } class ArrowGuard { isElite = (): this is ArrowElite => { return this instanceof ArrowElite; } isMedic = (): this is ArrowMedic => { return this instanceof ArrowMedic; } } class ArrowElite extends ArrowGuard { defend(): void {} } class ArrowMedic extends ArrowGuard { heal(): void {} } let guard = new ArrowGuard(); if (guard.isElite()) { guard.defend(); } else if (guard.isMedic()) { guard.heal(); } interface Supplies { spoiled: boolean; } interface Sundries { broken: boolean; } interface Crate<T> { contents: T; volume: number; isSupplies(): this is Crate<Supplies>; isSundries(): this is Crate<Sundries>; } let crate: Crate<{}>; if (crate.isSundries()) { crate.contents.broken = true; } else if (crate.isSupplies()) { crate.contents.spoiled = true; } // Matching guards should be assignable a.isFollower = b.isFollower; a.isLeader = b.isLeader; class MimicGuard { isLeader(): this is MimicLeader { return this instanceof MimicLeader; }; isFollower(): this is MimicFollower { return this instanceof MimicFollower; }; } class MimicLeader extends MimicGuard { lead(): void {} } class MimicFollower extends MimicGuard { follow(): void {} } let mimic = new MimicGuard(); a.isLeader = mimic.isLeader; a.isFollower = mimic.isFollower; if (mimic.isFollower()) { mimic.follow(); mimic.isFollower = a.isFollower; } interface MimicGuardInterface { isLeader(): this is LeadGuard; isFollower(): this is FollowerGuard; } //// [typeGuardFunctionOfFormThis.js] var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var RoyalGuard = /** @class */ (function () { function RoyalGuard() { } RoyalGuard.prototype.isLeader = function () { return this instanceof LeadGuard; }; RoyalGuard.prototype.isFollower = function () { return this instanceof FollowerGuard; }; return RoyalGuard; }()); var LeadGuard = /** @class */ (function (_super) { __extends(LeadGuard, _super); function LeadGuard() { return _super !== null && _super.apply(this, arguments) || this; } LeadGuard.prototype.lead = function () { }; ; return LeadGuard; }(RoyalGuard)); var FollowerGuard = /** @class */ (function (_super) { __extends(FollowerGuard, _super); function FollowerGuard() { return _super !== null && _super.apply(this, arguments) || this; } FollowerGuard.prototype.follow = function () { }; ; return FollowerGuard; }(RoyalGuard)); var a = new FollowerGuard(); if (a.isLeader()) { a.lead(); } else if (a.isFollower()) { a.follow(); } var b; if (b.isLeader()) { b.lead(); } else if (b.isFollower()) { b.follow(); } // if (((a.isLeader)())) { // a.lead(); // } // else if (((a).isFollower())) { // a.follow(); // } // if (((a["isLeader"])())) { // a.lead(); // } // else if (((a)["isFollower"]())) { // a.follow(); // } var holder2 = { a: a }; if (holder2.a.isLeader()) { holder2.a; } else { holder2.a; } var ArrowGuard = /** @class */ (function () { function ArrowGuard() { var _this = this; this.isElite = function () { return _this instanceof ArrowElite; }; this.isMedic = function () { return _this instanceof ArrowMedic; }; } return ArrowGuard; }()); var ArrowElite = /** @class */ (function (_super) { __extends(ArrowElite, _super); function ArrowElite() { return _super !== null && _super.apply(this, arguments) || this; } ArrowElite.prototype.defend = function () { }; return ArrowElite; }(ArrowGuard)); var ArrowMedic = /** @class */ (function (_super) { __extends(ArrowMedic, _super); function ArrowMedic() { return _super !== null && _super.apply(this, arguments) || this; } ArrowMedic.prototype.heal = function () { }; return ArrowMedic; }(ArrowGuard)); var guard = new ArrowGuard(); if (guard.isElite()) { guard.defend(); } else if (guard.isMedic()) { guard.heal(); } var crate; if (crate.isSundries()) { crate.contents.broken = true; } else if (crate.isSupplies()) { crate.contents.spoiled = true; } // Matching guards should be assignable a.isFollower = b.isFollower; a.isLeader = b.isLeader; var MimicGuard = /** @class */ (function () { function MimicGuard() { } MimicGuard.prototype.isLeader = function () { return this instanceof MimicLeader; }; ; MimicGuard.prototype.isFollower = function () { return this instanceof MimicFollower; }; ; return MimicGuard; }()); var MimicLeader = /** @class */ (function (_super) { __extends(MimicLeader, _super); function MimicLeader() { return _super !== null && _super.apply(this, arguments) || this; } MimicLeader.prototype.lead = function () { }; return MimicLeader; }(MimicGuard)); var MimicFollower = /** @class */ (function (_super) { __extends(MimicFollower, _super); function MimicFollower() { return _super !== null && _super.apply(this, arguments) || this; } MimicFollower.prototype.follow = function () { }; return MimicFollower; }(MimicGuard)); var mimic = new MimicGuard(); a.isLeader = mimic.isLeader; a.isFollower = mimic.isFollower; if (mimic.isFollower()) { mimic.follow(); mimic.isFollower = a.isFollower; } //// [typeGuardFunctionOfFormThis.d.ts] declare class RoyalGuard { isLeader(): this is LeadGuard; isFollower(): this is FollowerGuard; } declare class LeadGuard extends RoyalGuard { lead(): void; } declare class FollowerGuard extends RoyalGuard { follow(): void; } declare let a: RoyalGuard; interface GuardInterface extends RoyalGuard { } declare let b: GuardInterface; declare var holder2: { a: RoyalGuard; }; declare class ArrowGuard { isElite: () => this is ArrowElite; isMedic: () => this is ArrowMedic; } declare class ArrowElite extends ArrowGuard { defend(): void; } declare class ArrowMedic extends ArrowGuard { heal(): void; } declare let guard: ArrowGuard; interface Supplies { spoiled: boolean; } interface Sundries { broken: boolean; } interface Crate<T> { contents: T; volume: number; isSupplies(): this is Crate<Supplies>; isSundries(): this is Crate<Sundries>; } declare let crate: Crate<{}>; declare class MimicGuard { isLeader(): this is MimicLeader; isFollower(): this is MimicFollower; } declare class MimicLeader extends MimicGuard { lead(): void; } declare class MimicFollower extends MimicGuard { follow(): void; } declare let mimic: MimicGuard; interface MimicGuardInterface { isLeader(): this is LeadGuard; isFollower(): this is FollowerGuard; }
synaptek/TypeScript
tests/baselines/reference/typeGuardFunctionOfFormThis.js
JavaScript
apache-2.0
8,326
/* * Copyright 2015 The Kythe Authors. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef KYTHE_CXX_COMMON_INDEXING_KYTHE_VFS_H_ #define KYTHE_CXX_COMMON_INDEXING_KYTHE_VFS_H_ #include "absl/types/optional.h" #include "clang/Basic/FileManager.h" #include "kythe/proto/analysis.pb.h" #include "llvm/Support/Path.h" #include "llvm/Support/VirtualFileSystem.h" namespace kythe { /// \brief A filesystem that allows access only to mapped files. /// /// IndexVFS normalizes all paths (using the working directory for /// relative paths). This means that foo/bar/../baz is assumed to be the /// same as foo/baz. class IndexVFS : public llvm::vfs::FileSystem { public: /// \param working_directory The absolute path to the working directory. /// \param virtual_files Files to map. /// \param virtual_dirs Directories to map. /// \param style Style used to parse incoming paths. Paths are normalized /// to POSIX-style. IndexVFS(const std::string& working_directory, const std::vector<proto::FileData>& virtual_files, const std::vector<llvm::StringRef>& virtual_dirs, llvm::sys::path::Style style); /// \return nullopt if `awd` is not absolute or its style could not be /// detected; otherwise, the style of `awd`. static absl::optional<llvm::sys::path::Style> DetectStyleFromAbsoluteWorkingDirectory(const std::string& awd); ~IndexVFS(); /// \brief Implements llvm::vfs::FileSystem::status. llvm::ErrorOr<llvm::vfs::Status> status(const llvm::Twine& path) override; /// \brief Implements llvm::vfs::FileSystem::openFileForRead. llvm::ErrorOr<std::unique_ptr<llvm::vfs::File>> openFileForRead( const llvm::Twine& path) override; /// \brief Unimplemented and unused. llvm::vfs::directory_iterator dir_begin(const llvm::Twine& dir, std::error_code& error_code) override; /// \brief Associates a vname with a path. void SetVName(const std::string& path, const proto::VName& vname); /// \brief Returns the vname associated with some `FileEntry`. /// \param entry The `FileEntry` to look up. /// \param merge_with The `VName` to copy the vname onto. /// \return true if a match was found; false otherwise. bool get_vname(const clang::FileEntry* entry, proto::VName* merge_with); /// \brief Returns the vname associated with some `path`. /// \param path The path to look up. /// \param merge_with The `VName` to copy the vname onto. /// \return true if a match was found; false otherwise. bool get_vname(const llvm::StringRef& path, proto::VName* merge_with); /// \brief Returns a string representation of `uid` for error messages. std::string get_debug_uid_string(const llvm::sys::fs::UniqueID& uid); const std::string& working_directory() const { return working_directory_; } llvm::ErrorOr<std::string> getCurrentWorkingDirectory() const override { return working_directory_; } std::error_code setCurrentWorkingDirectory(const llvm::Twine& Path) override { working_directory_ = Path.str(); return std::error_code(); } private: /// \brief Information kept on a file being tracked. struct FileRecord { /// Clang's VFS status record. llvm::vfs::Status status; /// Whether `vname` is valid. bool has_vname; /// This file's name, independent of path. std::string label; /// This file's VName, if set. proto::VName vname; /// This directory's children. std::vector<FileRecord*> children; /// This file's content. llvm::StringRef data; }; /// \brief A llvm::vfs::File that wraps a `FileRecord`. class File : public llvm::vfs::File { public: explicit File(FileRecord* record) : record_(record) {} llvm::ErrorOr<llvm::vfs::Status> status() override { return record_->status; } std::error_code close() override { return std::error_code(); } llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>> getBuffer( const llvm::Twine& Name, int64_t FileSize, bool RequiresNullTerminator, bool IsVolatile) override { name_ = Name.str(); return llvm::MemoryBuffer::getMemBuffer(record_->data, name_, RequiresNullTerminator); } private: FileRecord* record_; std::string name_; }; /// \brief Controls what happens when a missing path node is encountered. enum class BehaviorOnMissing { kCreateFile, ///< Create intermediate directories and a final file. kCreateDirectory, ///< Create intermediate and final directories. kReturnError ///< Abort. }; /// \brief Returns a FileRecord for the root components of `path`. /// \param path The path to investigate. /// \param create_if_missing If the root is missing, create it. /// \return A `FileRecord` or nullptr on abort. FileRecord* FileRecordForPathRoot(const llvm::Twine& path, bool create_if_missing); /// \param path The path to investigate. /// \param behavior What to do if `path` does not exist. /// \param size The size of the file to use if kCreateFile is relevant. /// \return A `FileRecord` or nullptr on abort. FileRecord* FileRecordForPath(llvm::StringRef path, BehaviorOnMissing behavior, size_t size); /// \brief Creates a new or returns an existing `FileRecord`. /// \param parent The parent `FileRecord`. /// \param create_if_missing Create a FileRecord if it's missing. /// \param label The label to look for under `parent`. /// \param type The type the record should have. /// \param size The size that should be used if this is a file record. FileRecord* AllocOrReturnFileRecord(FileRecord* parent, bool create_if_missing, llvm::StringRef label, llvm::sys::fs::file_type type, size_t size); /// The virtual files that were included in the index. const std::vector<proto::FileData>& virtual_files_; /// The working directory. Must be absolute. std::string working_directory_; /// Maps root names to root nodes. For indexes captured from Unix /// environments, there will be only one root name (the empty string). std::map<std::string, FileRecord*> root_name_to_root_map_; /// Maps unique IDs to file records. std::map<std::pair<uint64_t, uint64_t>, FileRecord*> uid_to_record_map_; }; } // namespace kythe #endif // KYTHE_CXX_COMMON_INDEXING_KYTHE_VFS_H_
kythe/kythe
kythe/cxx/indexer/cxx/KytheVFS.h
C
apache-2.0
7,086
/* * Copyright 2017 PayPal * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.squbs.actormonitor.testcube import akka.actor.Actor class TestActor extends Actor { def receive = { case x => sender() ! x } } class TestActorWithRoute extends Actor { def receive = { case x => sender() ! x } } class TestActor1 extends Actor { def receive = { case x =>context.stop(self) } }
akara/squbs
squbs-actormonitor/src/test/scala/org/squbs/actormonitor/TestCube/TestCube.scala
Scala
apache-2.0
930
/* * Copyright (C) 2013 nohana, Inc. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.amalgam.database; import android.annotation.TargetApi; import android.database.Cursor; import android.os.Build; /** * Utility for the {@link android.database.Cursor} */ @SuppressWarnings("unused") // public APIs public final class CursorUtils { private static final int TRUE = 1; private CursorUtils() { throw new AssertionError(); } /** * Close with null checks. * @param cursor to close. */ public static void close(Cursor cursor) { if (cursor == null) { return; } cursor.close(); } /** * Read the boolean data for the column. * @see android.database.Cursor#getColumnIndex(String). * @param cursor the cursor. * @param columnName the column name. * @return the boolean value. */ public static boolean getBoolean(Cursor cursor, String columnName) { return cursor != null && cursor.getInt(cursor.getColumnIndex(columnName)) == TRUE; } /** * Read the int data for the column. * @see android.database.Cursor#getInt(int). * @see android.database.Cursor#getColumnIndex(String). * @param cursor the cursor. * @param columnName the column name. * @return the int value. */ public static int getInt(Cursor cursor, String columnName) { if (cursor == null) { return -1; } return cursor.getInt(cursor.getColumnIndex(columnName)); } /** * Read the String data for the column. * @see android.database.Cursor#getString(int). * @see android.database.Cursor#getColumnIndex(String). * @param cursor the cursor. * @param columnName the column name. * @return the String value. */ public static String getString(Cursor cursor, String columnName) { if (cursor == null) { return null; } return cursor.getString(cursor.getColumnIndex(columnName)); } /** * Read the short data for the column. * @see android.database.Cursor#getShort(int). * @see android.database.Cursor#getColumnIndex(String). * @param cursor the cursor. * @param columnName the column name. * @return the short value. */ public static short getShort(Cursor cursor, String columnName) { if (cursor == null) { return -1; } return cursor.getShort(cursor.getColumnIndex(columnName)); } /** * Read the long data for the column. * @see android.database.Cursor#getLong(int). * @see android.database.Cursor#getColumnIndex(String). * @param cursor the cursor. * @param columnName the column name. * @return the long value. */ public static long getLong(Cursor cursor, String columnName) { if (cursor == null) { return -1; } return cursor.getLong(cursor.getColumnIndex(columnName)); } /** * Read the double data for the column. * @see android.database.Cursor#getDouble(int). * @see android.database.Cursor#getColumnIndex(String). * @param cursor the cursor. * @param columnName the column name. * @return the double value. */ public static double getDouble(Cursor cursor, String columnName) { if (cursor == null) { return -1; } return cursor.getDouble(cursor.getColumnIndex(columnName)); } /** * Read the float data for the column. * @see android.database.Cursor#getFloat(int). * @see android.database.Cursor#getColumnIndex(String). * @param cursor the cursor. * @param columnName the column name. * @return the float value. */ public static float getFloat(Cursor cursor, String columnName) { if (cursor == null) { return -1; } return cursor.getFloat(cursor.getColumnIndex(columnName)); } /** * Read the blob data for the column. * @see android.database.Cursor#getBlob(int). * @see android.database.Cursor#getColumnIndex(String). * @param cursor the cursor. * @param columnName the column name. * @return the blob value. */ public static byte[] getBlob(Cursor cursor, String columnName) { if (cursor == null) { return null; } return cursor.getBlob(cursor.getColumnIndex(columnName)); } /** * Checks the type of the column. * @see android.database.Cursor#getType(int). * @see android.database.Cursor#getColumnIndex(String). * @param cursor the cursor. * @param columnName the column name. * @return the type of the column. */ @TargetApi(Build.VERSION_CODES.HONEYCOMB) public static int getType(Cursor cursor, String columnName) { if (cursor == null) { return Cursor.FIELD_TYPE_NULL; } return cursor.getType(cursor.getColumnIndex(columnName)); } /** * Checks if the column value is null or not. * @see android.database.Cursor#isNull(int). * @see android.database.Cursor#getColumnIndex(String). * @param cursor the cursor. * @param columnName the column name. * @return true if the column value is null. */ public static boolean isNull(Cursor cursor, String columnName) { return cursor != null && cursor.isNull(cursor.getColumnIndex(columnName)); } }
KeithYokoma/Amalgam
amalgam/src/main/java/com/amalgam/database/CursorUtils.java
Java
apache-2.0
5,998
# -*- coding: utf-8 -*- # # Copyright 2013 - Mirantis, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. from pecan import rest from pecan import expose from pecan import request from mistral.openstack.common import log as logging from mistral.db import api as db_api from mistral.services import scheduler LOG = logging.getLogger(__name__) class WorkbookDefinitionController(rest.RestController): @expose() def get(self, workbook_name): LOG.debug("Fetch workbook definition [workbook_name=%s]" % workbook_name) return db_api.workbook_definition_get(workbook_name) @expose(content_type="text/plain") def put(self, workbook_name): text = request.text LOG.debug("Update workbook definition [workbook_name=%s, text=%s]" % (workbook_name, text)) wb = db_api.workbook_definition_put(workbook_name, text) scheduler.create_associated_triggers(wb) return wb['definition']
TimurNurlygayanov/mistral
mistral/api/controllers/v1/workbook_definition.py
Python
apache-2.0
1,511
require 'spec_helper' require 'pureftpd_helper' describe 'PureFTPd' do include_examples 'PureFTPd', 'postgresql' end
Aigeruth/pure-ftpd
test/integration/backend-postgresql/serverspec/default_spec.rb
Ruby
apache-2.0
120
// Copyright(C) David W. Jeske, 2013 // Released to the public domain. Use, modify and relicense at will. using System; using System.Threading; using System.Globalization; using System.Drawing; using OpenTK; using OpenTK.Graphics; using OpenTK.Graphics.OpenGL; using OpenTK.Audio; using OpenTK.Audio.OpenAL; using OpenTK.Input; using SimpleScene; using SimpleScene.Demos; namespace TestBench1 { partial class TestBench1 : TestBenchBootstrap { protected SSPolarJoint renderMesh5NeckJoint = null; protected SSAnimationStateMachineSkeletalController renderMesh4AttackSm = null; protected SSAnimationStateMachineSkeletalController renderMesh5AttackSm = null; protected SSSimpleObjectTrackingJoint tracker0; protected SSSimpleObjectTrackingJoint tracker4; /// <summary> /// The main entry point for the application. /// </summary> static void Main() { // The 'using' idiom guarantees proper resource cleanup. // We request 30 UpdateFrame events per second, and unlimited // RenderFrame events (as fast as the computer can handle). using (TestBench1 game = new TestBench1()) { game.Run(30.0); } } /// <summary>Creates a 800x600 window with the specified title.</summary> public TestBench1() : base("TestBench1") { } /// <summary> /// Called when it is time to setup the next frame. Add you game logic here. /// </summary> /// <param name="e">Contains timing information for framerate independent logic.</param> protected override void OnUpdateFrame(FrameEventArgs e) { base.OnUpdateFrame(e); if (renderMesh5NeckJoint != null) { renderMesh5NeckJoint.theta.value += (float)Math.PI / 2f * (float)e.Time; } } } }
RealRui/SimpleScene
Demos/TestBench1/TestBench1.cs
C#
apache-2.0
1,698
from trex_astf_lib.api import * # IPV6 tunable example # # ipv6.src_msb # ipv6.dst_msb # ipv6.enable # class Prof1(): def __init__(self): pass def get_profile(self, **kwargs): # ip generator ip_gen_c = ASTFIPGenDist(ip_range=["16.0.0.0", "16.0.0.255"], distribution="seq") ip_gen_s = ASTFIPGenDist(ip_range=["48.0.0.0", "48.0.255.255"], distribution="seq") ip_gen = ASTFIPGen(glob=ASTFIPGenGlobal(ip_offset="1.0.0.0"), dist_client=ip_gen_c, dist_server=ip_gen_s) c_glob_info = ASTFGlobalInfo() c_glob_info.tcp.rxbufsize = 8*1024 c_glob_info.tcp.txbufsize = 8*1024 s_glob_info = ASTFGlobalInfo() s_glob_info.tcp.rxbufsize = 8*1024 s_glob_info.tcp.txbufsize = 8*1024 return ASTFProfile(default_ip_gen=ip_gen, # Defaults affects all files default_c_glob_info=c_glob_info, default_s_glob_info=s_glob_info, cap_list=[ ASTFCapInfo(file="../avl/delay_10_http_browsing_0.pcap", cps=1) ] ) def register(): return Prof1()
kisel/trex-core
scripts/astf/param_tcp_rxbufsize_8k.py
Python
apache-2.0
1,298
declare module ioc { /** * A base class for applications using an IOC Container */ abstract class ApplicationContext implements IApplicationContext { /** * A base class for applications using an IOC Container * @param appName The name of your application */ constructor(appName: string); /** * A handle to access the ApplicationContext from anywhere in the application */ static applicationContext: IApplicationContext; /** * A method to override where you register your intances into the IOC Container * @param container The IOC container created for this ApplicationContext * @returns {} */ register(container: Container): void; } } declare module ioc { /** * The IOC Container */ class Container { private static container; private registeredInstances; private registeredScripts; private appName; /** * The IOC Container * @param appName The name of your application * @param baseNamespace */ constructor(appName: string); /** * Get the currently assigned IOC Container */ static getCurrent(): Container; /** * Get the name of the ApplicationContext this IOC container is made from */ getAppName(): string; /** * Register an instance type * @param type The full namespace of the type you want to instantiate */ register<T>(type: Function): InstanceRegistry<T>; /** * Resolve the registered Instance * @param type The full namespace of the type you want to resolve */ resolve<T>(type: Function): T; } } declare module ioc { /** * A helper class for aquiring animation methods */ class AnimationHelper { /** * Get the animationframe * @param callback Function to call on AnimationFrame */ static getAnimationFrame(callback: FrameRequestCallback): number; /** * Cancel an animationFrameEvent * @param requestId The handle of the event you want to cancel */ static cancelAnimationFrame(requestId: number): void; } } declare module ioc { interface IApplicationContext { /** * A method to override where you register your intances into the IOC Container * @param container The IOC container created for this ApplicationContext * @returns {} */ register(container: Container): void; } } declare module ioc { /** * A base class for libraries using an IOC Container * This is used to provide an easy way to register all the libraries components */ abstract class LibraryContext { /** * A method to override where you register your intances into the IOC Container * @param container The IOC container created for the ApplicationContext of the using app * @returns {} */ static register(container: Container): void; } } declare module ioc { interface IRegistryBase<T> { /** * Set the type of this Registry * @param type The full type of the Instance you want to register * @returns {} */ setType(type: Function): IRegistryBase<T>; /** * Return the Instance * @returns {} */ getInstance(): T; /** * Get the type of this Registry * @returns {} */ getType(): Function; /** * Set a function fo modify Instance that will be called directly after instantiating * @param resolve The function to call when resolving * @returns {} */ setResolveFunc(resolve: (instance: T) => T): IRegistryBase<T>; /** * Set a function to resolve the object in a different way than a parameterless constructor * @param instantiate The function used to Instantiate the object * @returns {} */ setInstantiateFunc(instantiate: () => T): IRegistryBase<T>; /** * Apply a lifetimescope to this Registry * @param lifetime The lifetimescope to apply to */ setLifetimeScope(lifetime: LifetimeScope): IRegistryBase<T>; } } declare module ioc { /** * Registry for standard Instances */ class InstanceRegistry<T> extends RegistryBase<T> { protected lifeTimeScope: LifetimeScope; protected callers: { [key: string]: any; }; /** * Return the Instance * @returns {} */ getInstance(): T; /** * Instantiate the object */ protected instantiate(): void; /** * Apply a lifetimescope to this Registry * @param lifetime The lifetimescope to apply to */ setLifetimeScope(lifetime: LifetimeScope): IRegistryBase<T>; } } declare module ioc { /** * The available lifetime scopes */ enum LifetimeScope { /** * Resolve everytime the Resolve is called */ PerResolveCall = 0, /** * Allow only one Instance of this type */ SingleInstance = 1, /** * Return only one Instance for every dependency */ PerDependency = 2, } } declare module ioc { /** * A base class to provide basic functionality for al Registries */ class RegistryBase<T> implements IRegistryBase<T> { protected type: Function; protected object: any; protected initiated: boolean; protected loaded: boolean; protected resolveFunc: (instance: T) => any; protected instantiateFunc: () => T; /** * Return the Instance * @returns {} */ getInstance(): T; /** * Get the type of this Registry * @returns {} */ getType(): Function; /** * Set the type of this Registry * @param type The full type of the Instance you want to register * @returns {} */ setType(type: Function | T): IRegistryBase<T>; /** * Method to override that Instantiates the object */ protected instantiate(): void; /** * Set a function fo modify Instance that will be called directly after instantiating * @param resolve The function to call when resolving * @returns {} */ setResolveFunc(resolve: (instance: T) => T): IRegistryBase<T>; /** * Set a function to resolve the object in a different way than a parameterless constructor * @param instantiate The function used to Instantiate the object * @returns {} */ setInstantiateFunc(instantiate: () => T): IRegistryBase<T>; /** * Apply a lifetimescope to this Registry * @param lifetime The lifetimescope to apply to */ setLifetimeScope(lifetime: LifetimeScope): IRegistryBase<T>; } } //# sourceMappingURL=SIOCC-TS.d.ts.map
Marvin-Brouwer/QR-Redirect
Source/QR-Reader/Scripts/typings/SIOCC-TS.d.ts
TypeScript
apache-2.0
7,284
/* * Copyright 2005-2014 The Kuali Foundation * * Licensed under the Educational Community License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.opensource.org/licenses/ecl1.php * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.kuali.kra.irb; import org.kuali.kra.irb.actions.submit.ProtocolSubmission; import org.kuali.kra.irb.personnel.ProtocolPerson; import org.kuali.kra.irb.personnel.ProtocolUnit; import org.kuali.kra.irb.protocol.funding.ProtocolFundingSource; import org.kuali.kra.irb.protocol.location.ProtocolLocation; import org.kuali.kra.irb.protocol.research.ProtocolResearchArea; import org.kuali.kra.protocol.CriteriaFieldHelper; import org.kuali.kra.protocol.ProtocolBase; import org.kuali.kra.protocol.ProtocolDaoOjbBase; import org.kuali.kra.protocol.ProtocolLookupConstants; import org.kuali.kra.protocol.actions.ProtocolActionBase; import org.kuali.kra.protocol.actions.submit.ProtocolSubmissionBase; import org.kuali.kra.protocol.personnel.ProtocolPersonBase; import org.kuali.kra.protocol.personnel.ProtocolUnitBase; import org.kuali.rice.krad.service.util.OjbCollectionAware; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.List; /** * * This class is the implementation for ProtocolDao interface. */ class ProtocolDaoOjb extends ProtocolDaoOjbBase<Protocol> implements OjbCollectionAware, ProtocolDao { /** * The APPROVED_SUBMISSION_STATUS_CODE contains the status code of approved protocol submissions (i.e. 203). */ private static final Collection<String> APPROVED_SUBMISSION_STATUS_CODES = Arrays.asList(new String[] {"203"}); /** * The ACTIVE_PROTOCOL_STATUS_CODES contains the various active status codes for a protocol. * <li> 200 - Active, open to enrollment * <li> 201 - Active, closed to enrollment * <li> 202 - Active, data analysis only */ private static final Collection<String> ACTIVE_PROTOCOL_STATUS_CODES = Arrays.asList(new String[] {"200", "201", "202"}); /** * The REVISION_REQUESTED_PROTOCOL_ACTION_TYPE_CODES contains the protocol action codes for the protocol revision requests. * <li> 202 - Specific Minor Revision * <li> 203 - Substantive Revision Requested */ private static final Collection<String> REVISION_REQUESTED_PROTOCOL_ACTION_TYPE_CODES = Arrays.asList(new String[] {"202", "203"}); /** * The REVISION_REQUESTED_PROTOCOL_STATUS_CODES contains the various status codes for protocol revision requests. * <li> 102 - Specific Minor Revision * <li> 104 - Substantive Revision Requested */ private static final Collection<String> REVISION_REQUESTED_PROTOCOL_STATUS_CODES = Arrays.asList(new String[] {"102", "104"}); private static final Collection<String> PENDING_AMENDMENT_RENEWALS_STATUS_CODES = Arrays.asList(new String[]{"100", "101", "102", "103", "104", "105", "106"}); @Override protected Collection<String> getApprovedSubmissionStatusCodesHook() { return APPROVED_SUBMISSION_STATUS_CODES; } @Override protected Collection<String> getActiveProtocolStatusCodesHook() { return ACTIVE_PROTOCOL_STATUS_CODES; } @Override protected Collection<String> getRevisionRequestedProtocolActionTypeCodesHook() { return REVISION_REQUESTED_PROTOCOL_ACTION_TYPE_CODES; } @Override protected Collection<String> getRevisionRequestedProtocolStatusCodesHook() { return REVISION_REQUESTED_PROTOCOL_STATUS_CODES; } @Override protected Class<? extends ProtocolActionBase> getProtocolActionBOClassHoook() { return org.kuali.kra.irb.actions.ProtocolAction.class; } @Override protected void initRoleListsHook(List<String> investigatorRoles, List<String> personRoles) { investigatorRoles.add("PI"); investigatorRoles.add("COI"); personRoles.add("SP"); personRoles.add("CA"); personRoles.add("CRC"); } @Override protected Collection<String> getPendingAmendmentRenewalsProtocolStatusCodesHook() { return PENDING_AMENDMENT_RENEWALS_STATUS_CODES; } @Override protected Class<? extends ProtocolBase> getProtocolBOClassHook() { return Protocol.class; } @Override protected Class<? extends ProtocolPersonBase> getProtocolPersonBOClassHook() { return ProtocolPerson.class; } @Override protected Class<? extends ProtocolUnitBase> getProtocolUnitBOClassHook() { return ProtocolUnit.class; } @Override protected Class<? extends ProtocolSubmissionBase> getProtocolSubmissionBOClassHook() { return ProtocolSubmission.class; } @Override protected List<CriteriaFieldHelper> getCriteriaFields() { List<CriteriaFieldHelper> criteriaFields = new ArrayList<CriteriaFieldHelper>(); criteriaFields.add(new CriteriaFieldHelper(ProtocolLookupConstants.Property.KEY_PERSON, ProtocolLookupConstants.Property.PERSON_NAME, ProtocolPerson.class)); criteriaFields.add(new CriteriaFieldHelper(ProtocolLookupConstants.Property.INVESTIGATOR, ProtocolLookupConstants.Property.PERSON_NAME, ProtocolPerson.class)); criteriaFields.add(new CriteriaFieldHelper(ProtocolLookupConstants.Property.FUNDING_SOURCE, ProtocolLookupConstants.Property.FUNDING_SOURCE_NUMBER, ProtocolFundingSource.class)); criteriaFields.add(new CriteriaFieldHelper(ProtocolLookupConstants.Property.PERFORMING_ORGANIZATION_ID, ProtocolLookupConstants.Property.ORGANIZATION_ID, ProtocolLocation.class)); criteriaFields.add(new CriteriaFieldHelper(ProtocolLookupConstants.Property.RESEARCH_AREA_CODE, ProtocolLookupConstants.Property.RESEARCH_AREA_CODE, ProtocolResearchArea.class)); return criteriaFields; } }
vivantech/kc_fixes
src/main/java/org/kuali/kra/irb/ProtocolDaoOjb.java
Java
apache-2.0
6,383
/** * Copyright (c) 2005-20010 springside.org.cn * * Licensed under the Apache License, Version 2.0 (the "License"); * * $Id: PropertyFilter.java 1205 2010-09-09 15:12:17Z calvinxiu $ */ package com.snakerflow.framework.orm; import java.util.ArrayList; import java.util.Date; import java.util.List; import java.util.Map; import javax.servlet.http.HttpServletRequest; import org.apache.commons.lang.StringUtils; import com.snakerflow.framework.utils.ConvertUtils; import com.snakerflow.framework.utils.ServletUtils; import org.springframework.util.Assert; /** * 与具体ORM实现无关的属性过滤条件封装类, 主要记录页面中简单的搜索过滤条件. * * @author calvin */ public class PropertyFilter { /** 多个属性间OR关系的分隔符. */ public static final String OR_SEPARATOR = "_OR_"; /** 属性比较类型. */ public enum MatchType { EQ, LIKE, LT, GT, LE, GE; } /** 属性数据类型. */ public enum PropertyType { S(String.class), I(Integer.class), L(Long.class), N(Double.class), D(Date.class), B(Boolean.class); private Class<?> clazz; private PropertyType(Class<?> clazz) { this.clazz = clazz; } public Class<?> getValue() { return clazz; } } private MatchType matchType = null; private Object matchValue = null; private Class<?> propertyClass = null; private String[] propertyNames = null; public PropertyFilter() { } /** * @param filterName 比较属性字符串,含待比较的比较类型、属性值类型及属性列表. * eg. LIKES_NAME_OR_LOGIN_NAME * @param value 待比较的值. */ public PropertyFilter(final String filterName, final String value) { String firstPart = StringUtils.substringBefore(filterName, "_"); String matchTypeCode = StringUtils.substring(firstPart, 0, firstPart.length() - 1); String propertyTypeCode = StringUtils.substring(firstPart, firstPart.length() - 1, firstPart.length()); try { matchType = Enum.valueOf(MatchType.class, matchTypeCode); } catch (RuntimeException e) { throw new IllegalArgumentException("filter名称" + filterName + "没有按规则编写,无法得到属性比较类型.", e); } try { propertyClass = Enum.valueOf(PropertyType.class, propertyTypeCode).getValue(); } catch (RuntimeException e) { throw new IllegalArgumentException("filter名称" + filterName + "没有按规则编写,无法得到属性值类型.", e); } String propertyNameStr = StringUtils.substringAfter(filterName, "_"); Assert.isTrue(StringUtils.isNotBlank(propertyNameStr), "filter名称" + filterName + "没有按规则编写,无法得到属性名称."); propertyNames = StringUtils.splitByWholeSeparator(propertyNameStr, PropertyFilter.OR_SEPARATOR); this.matchValue = ConvertUtils.convertStringToObject(value, propertyClass); } /** * 从HttpRequest中创建PropertyFilter列表, 默认Filter属性名前缀为filter. * * @see #buildFromHttpRequest(HttpServletRequest, String) */ public static List<PropertyFilter> buildFromHttpRequest(final HttpServletRequest request) { return buildFromHttpRequest(request, "filter"); } /** * 从HttpRequest中创建PropertyFilter列表 * PropertyFilter命名规则为Filter属性前缀_比较类型属性类型_属性名. * * eg. * filter_EQS_name * filter_LIKES_name_OR_email */ public static List<PropertyFilter> buildFromHttpRequest(final HttpServletRequest request, final String filterPrefix) { List<PropertyFilter> filterList = new ArrayList<PropertyFilter>(); //从request中获取含属性前缀名的参数,构造去除前缀名后的参数Map. Map<String, Object> filterParamMap = ServletUtils.getParametersStartingWith(request, filterPrefix + "_"); //分析参数Map,构造PropertyFilter列表 for (Map.Entry<String, Object> entry : filterParamMap.entrySet()) { String filterName = entry.getKey(); String value = (String) entry.getValue(); //如果value值为空,则忽略此filter. if (StringUtils.isNotBlank(value)) { PropertyFilter filter = new PropertyFilter(filterName, value); filterList.add(filter); } } return filterList; } /** * 获取比较值的类型. */ public Class<?> getPropertyClass() { return propertyClass; } /** * 获取比较方式. */ public MatchType getMatchType() { return matchType; } /** * 获取比较值. */ public Object getMatchValue() { return matchValue; } /** * 获取比较属性名称列表. */ public String[] getPropertyNames() { return propertyNames; } /** * 获取唯一的比较属性名称. */ public String getPropertyName() { Assert.isTrue(propertyNames.length == 1, "There are not only one property in this filter."); return propertyNames[0]; } /** * 是否比较多个属性. */ public boolean hasMultiProperties() { return (propertyNames.length > 1); } }
snakerflow/snaker-web
src/main/java/com/snakerflow/framework/orm/PropertyFilter.java
Java
apache-2.0
4,884
/* * Copyright 2019 MovingBlocks * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.terasology.gestalt.module.exceptions; /** * Exception for when metadata cannot be resolved for a module */ public class MissingModuleMetadataException extends RuntimeException { public MissingModuleMetadataException() { } public MissingModuleMetadataException(String s) { super(s); } public MissingModuleMetadataException(String s, Throwable throwable) { super(s, throwable); } }
immortius/gestalt
gestalt-module/src/main/java/org/terasology/gestalt/module/exceptions/MissingModuleMetadataException.java
Java
apache-2.0
1,036
#pragma once #ifndef UTIL_LOGGER_HPP #define UTIL_LOGGER_HPP #include <gsl/span> #include <string> #include <iterator> #include <vector> #include <cstdlib> /** * @brief A utility which logs a limited amount of entries * @details Logs strings inside a ringbuffer. * * If the buffer is full, the oldest entry will be overwritten. * */ class Logger { public: using Log = gsl::span<char>; public: Logger(Log& log, Log::index_type = 0); /** * @brief Log a string * @details * Write the string to the buffer a zero at the end to indicate end of string. * * If the string overlaps another string, it will clear the remaining string with zeros. * * @param str Message to be logged */ void log(const std::string& str); /** * @brief Retreive all entries from the log * @details Iterates forward over the whole buffer, building strings on the way * * Order old => new * * @return a vector with all the log entries */ std::vector<std::string> entries() const; /** * @brief Retreive entries N from the log * @details * Retrieves N (or less) latest entries from the log, * starting with the oldest. * * * @param n maximum number of entries * @return a vector with entries */ std::vector<std::string> entries(size_t n) const; /** * @brief Clear the log * @details Sets every byte to 0 and set position to start at the beginning. */ void flush(); /** * @brief Size of the log in bytes. * @details Assumes every byte is filled with either data or 0 * @return size in bytes */ auto size() const { return log_.size(); } private: /** The underlaying log */ Log& log_; /** * @brief A "circular" iterator, operating on a Logger::Log * @details Wraps around everytime it reaches the end */ class iterator : public Log::iterator { public: using base = Log::iterator; // inherit constructors using base::base; constexpr iterator& operator++() noexcept { //Expects(span_ && index_ >= 0); index_ = (index_ < span_->size()-1) ? index_+1 : 0; return *this; } constexpr iterator& operator--() noexcept { //Expects(span_ && index_ < span_->size()); index_ = (index_ > 0) ? index_-1 : span_->size()-1; return *this; } constexpr iterator& operator+=(difference_type n) noexcept { //Expects(span_); index_ = (index_ + n < span_->size()) ? index_ + n : std::abs((n - ((span_->size()) - index_)) % span_->size()); return *this; } constexpr span_iterator& operator-=(difference_type n) noexcept { // No use case for this (yet) return *this += -n; } }; // < class Logger::iterator /** Current position in the log */ iterator pos_; }; // << class Logger #endif
hioa-cs/IncludeOS
api/util/logger.hpp
C++
apache-2.0
2,818
/*! * Start Bootstrap - Freelancer Bootstrap Theme (http://startbootstrap.com) * Code licensed under the Apache License v2.0. * For details, see http://www.apache.org/licenses/LICENSE-2.0. */ body { overflow-x: hidden; } p { font-size: 20px; } p.small { font-size: 16px; } a, a:hover, a:focus, a:active, a.active { outline: 0; color: #18bc9c; } h1, h2, h3, h4, h5, h6 { text-transform: uppercase; font-family: Montserrat, "Helvetica Neue", Helvetica, Arial, sans-serif; font-weight: 700; } hr.star-light, hr.star-primary, hr.star-dark { margin: 25px auto 30px; padding: 0; max-width: 250px; border: 0; border-top: solid 5px; text-align: center; } hr.star-light:after, hr.star-primary:after, hr.star-dark:after { content: "\f005"; display: inline-block; position: relative; top: -.8em; padding: 0 .25em; font-family: FontAwesome; font-size: 2em; } hr.star-light, hr.star-dark { border-color: #fff; } hr.star-light:after { color: #fff; background-color: #18bc9c; } hr.star-dark:after { color: #fff; background-color: #2c3e50; } hr.star-primary { border-color: #2c3e50; } hr.star-primary:after { color: #2c3e50; background-color: #fff; } .img-centered { margin: 0 auto; } header { text-align: center; color: #fff; background: #18bc9c; } header .container { padding-top: 100px; padding-bottom: 50px; } header img { display: block; margin: 0 auto 20px; } header .intro-text .name { display: block; text-transform: uppercase; font-family: Montserrat, "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 2em; font-weight: 700; } header .intro-text .skills { font-size: 1.25em; font-weight: 300; } @media(min-width:768px) { header .container { padding-top: 200px; padding-bottom: 100px; } header .intro-text .name { font-size: 4.75em; } header .intro-text .skills { font-size: 1.75em; } } @media(min-width:768px) { .navbar-fixed-top { padding: 25px 0; -webkit-transition: padding .3s; -moz-transition: padding .3s; transition: padding .3s; } .navbar-fixed-top .navbar-brand { font-size: 2em; -webkit-transition: all .3s; -moz-transition: all .3s; transition: all .3s; } .navbar-fixed-top.navbar-shrink { padding: 10px 0; } .navbar-fixed-top.navbar-shrink .navbar-brand { font-size: 1.5em; } } .navbar { text-transform: uppercase; font-family: Montserrat, "Helvetica Neue", Helvetica, Arial, sans-serif; font-weight: 700; } .navbar a:focus { outline: 0; } .navbar .navbar-nav { letter-spacing: 1px; } .navbar .navbar-nav li a:focus { outline: 0; } .navbar-default, .navbar-inverse { border: 0; } section { padding: 100px 0; } section h2 { margin: 0; font-size: 3em; } section.success { color: #fff; background: #18bc9c; } @media(max-width:767px) { section { padding: 75px 0; } section.first { padding-top: 75px; } } #portfolio .portfolio-item { right: 0; margin: 0 0 15px; } #portfolio .portfolio-item .portfolio-link { display: block; position: relative; margin: 0 auto; max-width: 400px; } #portfolio .portfolio-item .portfolio-link .caption { position: absolute; width: 100%; height: 100%; opacity: 0; background: rgba(24, 188, 156, .9); -webkit-transition: all ease .5s; -moz-transition: all ease .5s; transition: all ease .5s; } #portfolio .portfolio-item .portfolio-link .caption:hover { opacity: 1; } #portfolio .portfolio-item .portfolio-link .caption .caption-content { position: absolute; top: 50%; width: 100%; height: 20px; margin-top: -12px; text-align: center; font-size: 20px; color: #fff; } #portfolio .portfolio-item .portfolio-link .caption .caption-content i { margin-top: -12px; } #portfolio .portfolio-item .portfolio-link .caption .caption-content h3, #portfolio .portfolio-item .portfolio-link .caption .caption-content h4 { margin: 0; } #portfolio * { z-index: 2; } @media(min-width:767px) { #portfolio .portfolio-item { margin: 0 0 30px; } } .btn-outline { margin-top: 15px; border: solid 2px #fff; font-size: 20px; color: #fff; background: 0 0; transition: all .3s ease-in-out; } .btn-outline:hover, .btn-outline:focus, .btn-outline:active, .btn-outline.active { border: solid 2px #fff; color: #18bc9c; background: #fff; } .floating-label-form-group { position: relative; margin-bottom: 0; padding-bottom: .5em; } .floating-label-form-group input, .floating-label-form-group textarea { z-index: 1; position: relative; padding-right: 0; padding-left: 0; border: 0; border-radius: 0; font-size: 1.5em; background: 0 0; box-shadow: none!important; resize: none; } .floating-label-form-group label { display: block; z-index: 0; position: relative; top: 2em; margin: 0; font-size: .85em; line-height: 1.764705882em; vertical-align: middle; vertical-align: baseline; opacity: 0; -webkit-transition: top .3s ease, opacity .3s ease; -moz-transition: top .3s ease, opacity .3s ease; -ms-transition: top .3s ease, opacity .3s ease; transition: top .3s ease, opacity .3s ease; } .floating-label-form-group::not(:first-child) { padding-left: 14px; } .floating-label-form-group-with-value label { top: 0; opacity: 1; } .floating-label-form-group-with-focus label { color: #18bc9c; } form .row:first-child .floating-label-form-group { } footer { color: #fff; } footer h3 { margin-bottom: 30px; } footer .footer-above { padding-top: 50px; background-color: #2c3e50; } footer .footer-col { margin-bottom: 50px; } footer .footer-below { padding: 25px 0; background-color: #233140; } .btn-social { display: inline-block; width: 50px; height: 50px; border: 2px solid #fff; border-radius: 100%; text-align: center; font-size: 20px; line-height: 45px; } .btn:focus, .btn:active, .btn.active { outline: 0; } .scroll-top { z-index: 1049; position: fixed; right: 2%; bottom: 2%; width: 50px; height: 50px; } .scroll-top .btn { width: 50px; height: 50px; border-radius: 100%; font-size: 20px; line-height: 28px; } .scroll-top .btn:focus { outline: 0; } .portfolio-modal .modal-content { padding: 100px 0; min-height: 100%; border: 0; border-radius: 0; text-align: center; background-clip: border-box; -webkit-box-shadow: none; box-shadow: none; } .portfolio-modal .modal-content h2 { margin: 0; font-size: 3em; } .portfolio-modal .modal-content img { margin-bottom: 30px; } .portfolio-modal .modal-content .item-details { margin: 30px 0; } .portfolio-modal .close-modal { position: absolute; top: 25px; right: 25px; width: 75px; height: 75px; background-color: transparent; cursor: pointer; } .portfolio-modal .close-modal:hover { opacity: .3; } .portfolio-modal .close-modal .lr { z-index: 1051; width: 1px; height: 75px; margin-left: 35px; background-color: #2c3e50; -webkit-transform: rotate(45deg); -ms-transform: rotate(45deg); transform: rotate(45deg); } .portfolio-modal .close-modal .lr .rl { z-index: 1052; width: 1px; height: 75px; background-color: #2c3e50; -webkit-transform: rotate(90deg); -ms-transform: rotate(90deg); transform: rotate(90deg); } .portfolio-modal .modal-backdrop { display: none; opacity: 0; } .bar { height: 18px; background: green; } /* * * jQuery File Upload Plugin CSS 1.3.0 * * https://github.com/blueimp/jQuery-File-Upload * * * * Copyright 2013, Sebastian Tschan * * https://blueimp.net * * * * Licensed under the MIT license: * * http://www.opensource.org/licenses/MIT * */ .fileinput-button { position: relative; overflow: hidden; } .fileinput-button input { position: absolute; top: 0; right: 0; margin: 0; opacity: 0; -ms-filter: 'alpha(opacity=0)'; font-size: 200px; direction: ltr; cursor: pointer; } /* Fixes for IE < 8 */ @media screen\9 { .fileinput-button input { filter: alpha(opacity=0); font-size: 100%; height: 100%; } }
therebelbeta/fontonite
css/freelancer.css
CSS
apache-2.0
8,057
<?php namespace Scalr\Service\CloudStack\Services\Vpn\DataType; use Scalr\Service\CloudStack\DataType\AbstractDataType; /** * AddVpnUserData * * @author Vlad Dobrovolskiy <v.dobrovolskiy@scalr.com> * @since 4.5.2 */ class AddVpnUserData extends AbstractDataType { /** * Required * Password for the username * * @var string */ public $password; /** * Required * Username for the vpn user * * @var string */ public $username; /** * An optional account for the vpn user. * Must be used with domainId. * * @var string */ public $account; /** * An optional domainId for the vpn user. * If the account parameter is used, domainId must also be used. * * @var string */ public $domainid; /** * Add vpn user to the specific project * * @var string */ public $projectid; /** * Constructor * * @param string $password Password for the username * @param string $username Username for the vpn user */ public function __construct($password, $username) { $this->password = $password; $this->username = $username; } }
kikov79/scalr
app/src/Scalr/Service/CloudStack/Services/Vpn/DataType/AddVpnUserData.php
PHP
apache-2.0
1,253
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.avro; /** Thrown for errors building schemas. */ public class SchemaBuilderException extends AvroRuntimeException { public SchemaBuilderException(Throwable cause) { super(cause); } public SchemaBuilderException(String message) { super(message); } }
apache/avro
lang/java/avro/src/main/java/org/apache/avro/SchemaBuilderException.java
Java
apache-2.0
1,094
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.beam.fn.harness.state; import static org.junit.Assert.assertArrayEquals; import com.google.common.collect.ImmutableMap; import com.google.common.collect.Iterables; import com.google.protobuf.ByteString; import java.io.IOException; import org.apache.beam.model.fnexecution.v1.BeamFnApi.StateKey; import org.apache.beam.sdk.coders.StringUtf8Coder; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; /** Tests for {@link MultimapSideInput}. */ @RunWith(JUnit4.class) public class MultimapSideInputTest { @Test public void testGet() throws Exception { FakeBeamFnStateClient fakeBeamFnStateClient = new FakeBeamFnStateClient(ImmutableMap.of( key("A"), encode("A1", "A2", "A3"), key("B"), encode("B1", "B2"))); MultimapSideInput<String, String> multimapSideInput = new MultimapSideInput<>( fakeBeamFnStateClient, "instructionId", "ptransformId", "sideInputId", ByteString.copyFromUtf8("encodedWindow"), StringUtf8Coder.of(), StringUtf8Coder.of()); assertArrayEquals(new String[]{ "A1", "A2", "A3" }, Iterables.toArray(multimapSideInput.get("A"), String.class)); assertArrayEquals(new String[]{ "B1", "B2" }, Iterables.toArray(multimapSideInput.get("B"), String.class)); assertArrayEquals(new String[]{ }, Iterables.toArray(multimapSideInput.get("unknown"), String.class)); } private StateKey key(String id) throws IOException { return StateKey.newBuilder().setMultimapSideInput( StateKey.MultimapSideInput.newBuilder() .setPtransformId("ptransformId") .setSideInputId("sideInputId") .setWindow(ByteString.copyFromUtf8("encodedWindow")) .setKey(encode(id))).build(); } private ByteString encode(String ... values) throws IOException { ByteString.Output out = ByteString.newOutput(); for (String value : values) { StringUtf8Coder.of().encode(value, out); } return out.toByteString(); } }
tgroh/incubator-beam
sdks/java/harness/src/test/java/org/apache/beam/fn/harness/state/MultimapSideInputTest.java
Java
apache-2.0
2,861
"use strict"; describe("Brisket server", function() { var Brisket = require("../../lib/brisket"); var MockBrisketApp = require("../mock/MockBrisketApp"); var nock = require("nock"); var supertest = require("supertest"); var brisketServer; beforeEach(function() { MockBrisketApp.initialize(); nock("http://api.example.com") .get("/fetch200") .reply(200, { ok: true }) .get("/fetch404") .reply(404, { ok: false }) .get("/fetch500") .reply(500, { ok: false }) .get("/fetch410") .reply(410, { ok: false }); brisketServer = Brisket.createServer({ apis: { "api": { host: "http://api.example.com", proxy: null } } }); }); afterEach(function() { MockBrisketApp.cleanup(); nock.cleanAll(); }); it("returns 200 when route is working", function(done) { supertest(brisketServer) .get("/working") .expect(200, mocha(done)); }); it("returns 500 when route is failing", function(done) { supertest(brisketServer) .get("/failing") .expect(500, mocha(done)); }); it("returns 302 when route is redirecting", function(done) { supertest(brisketServer) .get("/redirecting") .expect(302, mocha(done)); }); it("returns status from route when route sets status", function(done) { supertest(brisketServer) .get("/setsStatus") .expect(206, mocha(done)); }); it("returns 200 when data fetch is 200 AND route code doesn't error", function(done) { supertest(brisketServer) .get("/fetch200") .expect(200, mocha(done)); }); it("returns 500 when data fetch is 200 BUT route code errors", function(done) { supertest(brisketServer) .get("/fetch200ButRouteFails") .expect(500, mocha(done)); }); it("returns 302 when data fetch is 200 BUT route code redirects", function(done) { supertest(brisketServer) .get("/fetch200ButRouteRedirects") .expect(302, mocha(done)); }); it("returns status from route when data fetch is 200 BUT route sets status", function(done) { supertest(brisketServer) .get("/fetch200ButRouteSetsStatus") .expect(206, mocha(done)); }); it("returns 404 when route does NOT exist", function(done) { supertest(brisketServer) .get("/doesntexist") .expect(404, mocha(done)); }); it("returns 404 when data fetch is 404", function(done) { supertest(brisketServer) .get("/fetch404") .expect(404, mocha(done)); }); it("returns 500 when data fetch is 500", function(done) { supertest(brisketServer) .get("/fetch500") .expect(500, mocha(done)); }); it("returns 500 when data fetch is unexpected error code", function(done) { supertest(brisketServer) .get("/fetch410") .expect(500, mocha(done)); }); function mocha(done) { return function(err) { if (err) { done.fail(err); } else { done(); } }; } });
wawjr3d/brisket
spec/server/brisketServerSpec.js
JavaScript
apache-2.0
3,439
/** * @projectDescription The SDX controller library for the PatientRecordSet data-type. * @namespace i2b2.sdx.TypeControllers.ENS * @inherits i2b2.sdx.TypeControllers * @author Mike Mendis * @version 1.6 * @see i2b2.sdx * ---------------------------------------------------------------------------------------- */ console.group('Load & Execute component file: CRC > SDX > Encounter Record Set'); console.time('execute time'); i2b2.sdx.TypeControllers.ENS = {}; i2b2.sdx.TypeControllers.ENS.model = {}; // ********************************************************************************* // ENCAPSULATE DATA // ********************************************************************************* i2b2.sdx.TypeControllers.ENS.getEncapsulateInfo = function() { // this function returns the encapsulation head information return {sdxType: 'ENS', sdxKeyName: 'result_instance_id', sdxControlCell:'CRC', sdxDisplayNameKey: 'title'}; } i2b2.sdx.TypeControllers.ENS.SaveToDataModel = function(sdxData, sdxParentNode) { // save to CRC data model if (!sdxParentNode) { return false; } var qm_id = sdxData.sdxInfo.sdxKeyValue; var qm_hash = i2b2.sdx.Master._KeyHash(qm_id); // class for all SDX communications function i2b2_SDX_Encapsulation_EXTENDED() {} // create an instance and populate with info var t = new i2b2_SDX_Encapsulation_EXTENDED(); t.origData = Object.clone(sdxData.origData); t.sdxInfo = Object.clone(sdxData.sdxInfo); t.parent = sdxParentNode; t.children = new Hash(); t.children.loaded = false; // add to hash sdxParentNode.children.set(qm_hash, t); // TODO: send data update signal (use JOINING-MUTEX or AGGREGATING-MUTEX to avoid rapid fire of event!) return t; } i2b2.sdx.TypeControllers.ENS.LoadFromDataModel = function(key_value) {} i2b2.sdx.TypeControllers.ENS.ClearAllFromDataModel= function(sdxOptionalParent) { if (sdxOptionalParent) { try { var findFunc = function(item_rec) { // this function expects the second argument to be the target node's key value var hash_key = item_rec[0]; var QM_rec = item_rec[1]; if (QM_rec.sdxInfo.sdxKeyValue == this.strip()) { return true; } } var dm_loc = 'i2b2.CRC.model.QueryMasters.'+i2b2.sdx.Master._KeyHash(sdxOptionalParent.sdxInfo.sdxKeyValue); var targets = i2b2.CRC.model.QueryMasters.findAll(findFunc, sdxOptionalParent.sdxInfo.sdxKeyValue); for (var i=0; i < targets.length; i++) { var t = parent_QM[i].value; t.children = new Hash(); } } catch(e) { console.error('Could not clear children of given parent node!'); } } else { var dm_loc = 'i2b2.CRC.model.QueryMasters'; i2b2.CRC.model.QueryMasters.each(function(item_rec) { try { item_rec[1].children = new Hash(); } catch(e) { console.error('Could not clear children of all QueryMasters'); } }); } // TODO: send data update signal (use JOINING-MUTEX or AGGREGATING-MUTEX to avoid rapid fire of event!) // updated dm_loc of the data model return true; } // ********************************************************************************* // GENERATE HTML (DEFAULT HANDLER) // ********************************************************************************* i2b2.sdx.TypeControllers.ENS.RenderHTML= function(sdxData, options, targetDiv) { // OPTIONS: // title: string // showchildren: true | false // cssClass: string // icon: [data object] // icon: (filename of img, appended to i2b2_root+cellDir + '/assets') // iconExp: (filename of img, appended to i2b2_root+cellDir + '/assets') // dragdrop: string (function name) // context: string // click: string // dblclick: string if (Object.isUndefined(options)) { options = {}; } var render = {html: retHtml, htmlID: id}; var conceptId = sdxData.name; var id = "CRC_ID-" + i2b2.GUID(); // process drag drop controllers if (!Object.isUndefined(options.dragdrop)) { // NOTE TO SELF: should attachment of node dragdrop controller be handled by the SDX system as well? // This would ensure removal of the onmouseover call in a cross-browser way var sDD = ' onmouseover="' + options.dragdrop + '(\''+ targetDiv.id +'\',\'' + id + '\')" '; } else { var sDD = ''; } if (Object.isUndefined(options.cssClass)) { options.cssClass = 'sdxDefaultPRS';} // user can override bCanExp = true; if (Object.isBoolean(options.showchildren)) { bCanExp = options.showchildren; } render.canExpand = bCanExp; render.iconType = "PRS"; if (!Object.isUndefined(options.icon)) { render.icon = i2b2.hive.cfg.urlFramework + 'cells/CRC/assets/'+ options.icon } if (!Object.isUndefined(options.iconExp)) { render.iconExp = i2b2.hive.cfg.urlFramework + 'cells/CRC/assets/'+ options.iconExp } // in cases of one set icon, copy valid icon to the missing icon if (Object.isUndefined(render.icon) && !Object.isUndefined(render.iconExp)) { render.icon = render.iconExp; } if (!Object.isUndefined(render.icon) && Object.isUndefined(render.iconExp)) { render.iconExp = render.icon; } // handle the event controllers var sMainEvents = sDD; var sImgEvents = sDD; // **** Render the HTML *** var retHtml = '<DIV id="' + id + '" ' + sMainEvents + ' style="white-space:nowrap;cursor:pointer;">'; retHtml += '<DIV '; if (Object.isString(options.cssClass)) { retHtml += ' class="'+options.cssClass+'" '; } else { retHtml += ' class= "sdxDefaultPRS" '; } retHtml += sImgEvents; retHtml += '>'; retHtml += '<IMG src="'+render.icon+'"/> '; if (!Object.isUndefined(options.title)) { retHtml += options.title; } else { console.warn('[SDX RenderHTML] no title was given in the creation options for an CRC > ENS node!'); retHtml += ' PRS '+id; } retHtml += '</DIV></DIV>'; render.html = retHtml; render.htmlID = id; var retObj = {}; Object.extend(retObj, sdxData); retObj.renderData = render; return retObj; } // ********************************************************************************* // HANDLE HOVER OVER TARGET ENTRY (DEFAULT HANDLER) // ********************************************************************************* i2b2.sdx.TypeControllers.ENS.onHoverOver = function(e, id, ddProxy) { var el = $(id); if (el) { Element.addClassName(el,'ddPRSTarget'); } } // ********************************************************************************* // HANDLE HOVER OVER TARGET EXIT (DEFAULT HANDLER) // ********************************************************************************* i2b2.sdx.TypeControllers.ENS.onHoverOut = function(e, id, ddProxy) { var el = $(id); if (el) { Element.removeClassName(el,'ddPRSTarget'); } } // ********************************************************************************* // ADD DATA TO TREENODE (DEFAULT HANDLER) // ********************************************************************************* i2b2.sdx.TypeControllers.ENS.AppendTreeNode = function(yuiTree, yuiRootNode, sdxDataPack, callbackLoader) { var myobj = { html: sdxDataPack.renderData.html, nodeid: sdxDataPack.renderData.htmlID} var tmpNode = new YAHOO.widget.HTMLNode(myobj, yuiRootNode, false, true); if (sdxDataPack.renderData.canExpand && !Object.isUndefined(callbackLoader)) { // add the callback to load child nodes sdxDataPack.sdxInfo.sdxLoadChildren = callbackLoader; } tmpNode.data.i2b2_SDX= sdxDataPack; tmpNode.toggle = function() { if (!this.tree.locked && ( this.hasChildren(true) ) ) { var data = this.data.i2b2_SDX.renderData; var img = this.getContentEl(); img = Element.select(img,'img')[0]; if (this.expanded) { img.src = data.icon; this.collapse(); } else { img.src = data.iconExp; this.expand(); } } }; if (!sdxDataPack.renderData.canExpand) { tmpNode.dynamicLoadComplete = true; } return tmpNode; } // ********************************************************************************* // ATTACH DRAG TO DATA (DEFAULT HANDLER) // ********************************************************************************* i2b2.sdx.TypeControllers.ENS.AttachDrag2Data = function(divParentID, divDataID){ if (Object.isUndefined($(divDataID))) { return false; } // get the i2b2 data from the yuiTree node var tvTree = YAHOO.widget.TreeView.getTree(divParentID); var tvNode = tvTree.getNodeByProperty('nodeid', divDataID); if (!Object.isUndefined(tvNode.DDProxy)) { return true; } // attach DD var t = new i2b2.sdx.TypeControllers.ENS.DragDrop(divDataID) t.yuiTree = tvTree; t.yuiTreeNode = tvNode; tvNode.DDProxy = t; // clear the mouseover attachment function var tdn = $(divDataID); if (!Object.isUndefined(tdn.onmouseover)) { try { delete tdn.onmouseover; } catch(e) { tdn.onmouseover; } } if (!Object.isUndefined(tdn.attributes)) { for (var i=0;i<tdn.attributes.length; i++) { if (tdn.attributes[i].name=="onmouseover") { try { delete tdn.onmouseover; } catch(e) { tdn.onmouseover; } } } } } /** * Get the child records for the given PatientRecordSet. * @param {Object} sdxParentNode The parent node we want to find the children of. * @param {ScopedCallback} onCompleteCallback A scoped-callback function to be executed using the results array. * @return {Boolean} Returns true to the calling function. * @return {Array} Returns an array of PatientRecord data represented as SDX Objects (without render data) to the callback function passed. * @memberOf i2b2.sdx.TypeControllers.QI * @method * @author Nick Benik * @version 1.0 * @alias i2b2.sdx.Master.getChildRecords */ i2b2.sdx.TypeControllers.ENS.getChildRecords = function(sdxParentNode, onCompleteCallback, options) { var scopedCallback = new i2b2_scopedCallback(); scopedCallback.scope = sdxParentNode; scopedCallback.callback = function(results) { var cl_node = sdxParentNode; var cl_onCompleteCB = onCompleteCallback; // THIS function is used to process the AJAX results of the getChild call // results data object contains the following attributes: // refXML: xmlDomObject <--- for data processing // msgRequest: xml (string) // msgResponse: xml (string) // error: boolean // errorStatus: string [only with error=true] // errorMsg: string [only with error=true] var retMsg = { error: results.error, msgRequest: results.msgRequest, msgResponse: results.msgResponse, msgUrl: results.msgUrl, results: null }; var retChildren = []; // extract records from XML msg var ps = results.refXML.getElementsByTagName('event'); var dm = i2b2.CRC.model.QueryMasters; for(var i1=0; i1<ps.length; i1++) { var o = new Object; o.xmlOrig = ps[i1]; o.patient_id = i2b2.h.getXNodeVal(ps[i1],'patient_id'); o.event_id = i2b2.h.getXNodeVal(ps[i1],'event_id'); //o.vital_status = i2b2.h.XPath(ps[i1],'param[@name="vital_status_cd"]/text()')[0].nodeValue; //o.age = i2b2.h.XPath(ps[i1],'param[@name="age_in_years_num"]/text()')[0].nodeValue; //o.sex = i2b2.h.XPath(ps[i1],'param[@name="sex_cd"]/text()')[0].nodeValue; //o.race = i2b2.h.XPath(ps[i1],'param[@name="race_cd"]/text()')[0].nodeValue; //o.title = o.patient_id+" ["+o.age+" y/o "+ o.sex+" "+o.race+"]"; var sdxDataNode = i2b2.sdx.Master.EncapsulateData('PR',o); // save record in the SDX system sdxDataNode = i2b2.sdx.Master.Save(sdxDataNode, cl_node); // append the data node to our returned results retChildren.push(sdxDataNode); } cl_node.children.loaded = true; // TODO: broadcast a data update event of the CRC data model retMsg.results = retChildren; if (getObjectClass(cl_onCompleteCB)=='i2b2_scopedCallback') { cl_onCompleteCB.callback.call(cl_onCompleteCB.scope, retMsg); } else { cl_onCompleteCB(retMsg); } } var msg_filter = '<input_list>\n' + ' <event_list max="1000000" min="0">\n'+ ' <patient_event_coll_id>'+sdxParentNode.sdxInfo.sdxKeyValue+'</patient_event_coll_id>\n'+ ' </event_list>\n'+ '</input_list>\n'+ '<filter_list/>\n'+ '<output_option>\n'+ ' <event_set select="using_input_list" onlykeys="true"/>\n'+ '</output_option>\n'; // AJAX CALL var options = { patient_limit: 0, PDO_Request: msg_filter }; i2b2.CRC.ajax.getPDO_fromInputList("CRC:SDX:PatientRecordSet", options, scopedCallback); } i2b2.sdx.TypeControllers.ENS.LoadChildrenFromTreeview = function(node, onCompleteCallback) { var scopedCallback = new i2b2_scopedCallback(); scopedCallback.scope = node.data.i2b2_SDX; scopedCallback.callback = function(retCellPack) { var cl_node = node; var cl_onCompleteCB = onCompleteCallback; var results = retCellPack.results; for(var i1=0; i1<1*results.length; i1++) { var o = results[i1]; var renderOptions = { dragdrop: "i2b2.sdx.TypeControllers.PRC.AttachDrag2Data", icon: "sdx_CRC_PR.jpg", title: o.sdxInfo.sdxDisplayName, showchildren: false }; var sdxRenderData = i2b2.sdx.Master.RenderHTML(cl_node.tree.id, o, renderOptions); i2b2.sdx.Master.AppendTreeNode(cl_node.tree, cl_node, sdxRenderData); } // handle the callback if (getObjectClass(cl_onCompleteCB)=='i2b2_scopedCallback') { cl_onCompleteCB.callback.call(cl_onCompleteCB.scope, retCellPack); } else { cl_onCompleteCB(retCellPack); } } var sdxParentNode = node.data.i2b2_SDX; var options = i2b2.CRC.params; i2b2.sdx.Master.getChildRecords(sdxParentNode, scopedCallback, options); } // ********************************************************************************* // DRAG DROP PROXY CONTROLLER // ********************************************************************************* i2b2.sdx.TypeControllers.ENS.DragDrop = function(id, config) { if (id) { this.init(id, 'ENS',{isTarget:false}); this.initFrame(); } var s = this.getDragEl().style; s.borderColor = "transparent"; s.opacity = 0.75; s.filter = "alpha(opacity=75)"; s.whiteSpace = "nowrap"; s.overflow = "hidden"; s.textOverflow = "ellipsis"; }; YAHOO.extend(i2b2.sdx.TypeControllers.ENS.DragDrop, YAHOO.util.DDProxy); i2b2.sdx.TypeControllers.ENS.DragDrop.prototype.startDrag = function(x, y) { var dragEl = this.getDragEl(); var clickEl = this.getEl(); dragEl.innerHTML = clickEl.innerHTML; dragEl.className = clickEl.className; dragEl.style.backgroundColor = '#FFFFEE'; dragEl.style.color = clickEl.style.color; dragEl.style.border = "1px solid blue"; dragEl.style.width = "160px"; dragEl.style.height = "20px"; this.setDelta(15,10); }; i2b2.sdx.TypeControllers.ENS.DragDrop.prototype.endDrag = function(e) { // remove DragDrop targeting CCS var targets = YAHOO.util.DDM.getRelated(this, true); for (var i=0; i<targets.length; i++) { var targetEl = targets[i]._domRef; i2b2.sdx.Master.onHoverOut('ENS', e, targetEl, this); } }; i2b2.sdx.TypeControllers.ENS.DragDrop.prototype.alignElWithMouse = function(el, iPageX, iPageY) { var oCoord = this.getTargetCoord(iPageX, iPageY); if (!this.deltaSetXY) { var aCoord = [oCoord.x, oCoord.y]; YAHOO.util.Dom.setXY(el, aCoord); var newLeft = parseInt( YAHOO.util.Dom.getStyle(el, "left"), 10 ); var newTop = parseInt( YAHOO.util.Dom.getStyle(el, "top" ), 10 ); this.deltaSetXY = [ newLeft - oCoord.x, newTop - oCoord.y ]; } else { var posX = (oCoord.x + this.deltaSetXY[0]); var posY = (oCoord.y + this.deltaSetXY[1]); var scrSize = document.viewport.getDimensions(); var maxX = parseInt(scrSize.width-25-160); var maxY = parseInt(scrSize.height-25); if (posX > maxX) {posX = maxX;} if (posX < 6) {posX = 6;} if (posY > maxY) {posY = maxY;} if (posY < 6) {posY = 6;} YAHOO.util.Dom.setStyle(el, "left", posX + "px"); YAHOO.util.Dom.setStyle(el, "top", posY + "px"); } this.cachePosition(oCoord.x, oCoord.y); this.autoScroll(oCoord.x, oCoord.y, el.offsetHeight, el.offsetWidth); }; i2b2.sdx.TypeControllers.ENS.DragDrop.prototype.onDragOver = function(e, id) { // fire the onHoverOver (use SDX so targets can override default event handler) i2b2.sdx.Master.onHoverOver('ENS', e, id, this); }; i2b2.sdx.TypeControllers.ENS.DragDrop.prototype.onDragOut = function(e, id) { // fire the onHoverOut handler (use SDX so targets can override default event handlers) i2b2.sdx.Master.onHoverOut('ENS', e, id, this); }; i2b2.sdx.TypeControllers.ENS.DragDrop.prototype.onDragDrop = function(e, id) { i2b2.sdx.Master.onHoverOut('ENS', e, id, this); // retreive the concept data from the dragged element draggedData = this.yuiTreeNode.data.i2b2_SDX; i2b2.sdx.Master.ProcessDrop(draggedData, id); }; // ********************************************************************************* // <BLANK> DROP HANDLER // !!!! DO NOT EDIT - ATTACH YOUR OWN CUSTOM ROUTINE USING // !!!! THE i2b2.sdx.Master.setHandlerCustom FUNCTION // ********************************************************************************* i2b2.sdx.TypeControllers.ENS.DropHandler = function(sdxData) { alert('[PatientRecordSet DROPPED] You need to create your own custom drop event handler.'); } console.timeEnd('execute time'); console.groupEnd();
rdalej/i2b2-shibboleth
build/web/webclient/js-i2b2/cells/CRC/CRC_sdx_ENS.js
JavaScript
apache-2.0
17,357
from pony.orm.core import *
buddyli/private2w
libs/pony/orm/__init__.py
Python
apache-2.0
28
package com.mc.phonefinder.usersettings; import android.content.Intent; import android.content.SharedPreferences; import android.net.Uri; import android.preference.PreferenceManager; import android.support.v7.app.ActionBarActivity; import android.os.Bundle; import android.util.Log; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.Button; import android.widget.Toast; import com.mc.phonefinder.R; import com.mc.phonefinder.login.FindPhoneActivity; import com.mc.phonefinder.login.SampleApplication; import com.parse.FindCallback; import com.parse.ParseException; import com.parse.ParseGeoPoint; import com.parse.ParseObject; import com.parse.ParseQuery; import com.parse.ParseUser; import java.io.Serializable; import java.util.List; import java.util.Locale; import java.util.concurrent.atomic.AtomicBoolean; public class FindPhoneInterface extends ActionBarActivity { /* For the below: check if the setting is set for the user and if so let the user use the functionality. View location - Referes to location column in Settings table Show Phone finder image - Displays the image of the person who find the phone View nearby users - Refers to otherUsers in Settings table Alert my phone - Rings the phone to easily identify it */ static final boolean[] nearByUserSetting = new boolean[1]; static final boolean[] locationSetting = new boolean[1]; AtomicBoolean nearByUserSetting_check = new AtomicBoolean(); AtomicBoolean locPrefs_check = new AtomicBoolean(); public static String test = "Class"; static final String TAG="bharathdebug"; public void savePrefs(String key, boolean value) { SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(this); SharedPreferences.Editor edit = sp.edit(); edit.putBoolean(key, value); edit.commit(); } public boolean loadBoolPrefs(String key) { SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(this); boolean cbVal = sp.getBoolean(key, false); return cbVal; } public void savePrefs(String key, String value) { SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(this); SharedPreferences.Editor edit = sp.edit(); edit.putString(key, value); edit.commit(); } @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_find_phone_interface); final String ObjectId = (String)this.getIntent().getSerializableExtra("userObjectId"); nearByUserSetting[0] = false; locationSetting[0] = false; savePrefs("nearByUserSetting", false); savePrefs("locationSetting", false); Log.i(TAG,"Before inner class"+test); // final String ObjectId = (String)this.getIntent().getSerializableExtra("userObjectId"); ParseQuery<ParseObject> getSettings = new ParseQuery<ParseObject>("Settings"); getSettings.whereEqualTo("userObjectId", ObjectId); getSettings.findInBackground(new FindCallback<ParseObject>() { @Override public void done(List<ParseObject> objects, ParseException e) { if (objects != null) { Log.i(TAG, "Object not null"); if(objects.size()>0){ // nearByUserSetting[0] = objects.get(0).getBoolean("otherUser"); // locationSetting[0] = objects.get(0).getBoolean("location"); // test = "Inner class"; nearByUserSetting_check.set( objects.get(0).getBoolean("otherUser")); locPrefs_check.set(objects.get(0).getBoolean("location")); Log.i(TAG, "Inner class neary by " + String.valueOf(nearByUserSetting_check.get())); Log.i(TAG,"Inner class Location pref "+ (String.valueOf(locPrefs_check.get()))); // // savePrefs("nearByUserSetting", nearByUserSetting[0]); // savePrefs("locationSetting", locationSetting[0]); } } } }); // nearByUserSetting_check=loadBoolPrefs("nearByUserSetting"); // locPrefs_check = loadBoolPrefs("locationSetting"); // // Log.i(TAG,"Final val after inner class "+test); // System.out.print("Camera Setting " + nearByUserSetting[0]); Log.i(TAG,"Near by user "+ (String.valueOf(nearByUserSetting_check.get()))); Log.i(TAG,"Location pref "+ (String.valueOf(locPrefs_check.get()))); ((Button) findViewById(R.id.nearbyUsers)).setOnClickListener(new View.OnClickListener() { public void onClick(View v) { if(nearByUserSetting_check.get()) { Intent i = new Intent(); savePrefs("findPhoneId", ObjectId); Log.i(TAG, "FindPhoneInterface Object id " + ObjectId); i.setClass(FindPhoneInterface.this, NearbyUserView.class); //i.putExtra("userObjectId", ObjectId); startActivity(i); startActivity(new Intent(FindPhoneInterface.this, NearbyUserView.class)); } else { Toast.makeText(FindPhoneInterface.this, "Find nearby user service not set ", Toast.LENGTH_SHORT).show(); } } }); ((Button) findViewById(R.id.viewLocation)).setOnClickListener(new View.OnClickListener() { public void onClick(View v) { if(locPrefs_check.get()) { Toast.makeText(FindPhoneInterface.this, "Getting Your Location", Toast.LENGTH_LONG) .show(); String ObjectId = (String) FindPhoneInterface.this.getIntent().getSerializableExtra("userObjectId"); ParseQuery<ParseObject> query = ParseQuery.getQuery("Location"); if (!ObjectId.equals(null) && !ObjectId.equals("")) { query.whereEqualTo("userId", ObjectId); query.findInBackground(new FindCallback<ParseObject>() { @Override public void done(List<ParseObject> objects, ParseException e) { ParseGeoPoint userLocation; for (int i = 0; i < objects.size(); i++) { userLocation = objects.get(i).getParseGeoPoint("location"); String uri = String.format(Locale.ENGLISH, "geo:%f,%f?q=%f,%f", userLocation.getLatitude(), userLocation.getLongitude(), userLocation.getLatitude(), userLocation.getLongitude()); //Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("geo:%f,%f?q=%f,%f",userLocation.getLatitude(), userLocation.getLongitude(),userLocation.getLatitude(), userLocation.getLongitude())); Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(uri)); startActivity(intent); Toast.makeText(FindPhoneInterface.this, "Opening Maps", Toast.LENGTH_LONG) .show(); } } }); } } else { Toast.makeText(FindPhoneInterface.this, "Location Preference service not set ", Toast.LENGTH_SHORT).show(); } }}); //Bharath - View image of person who picked phone ((Button) findViewById(R.id.btn_phonepicker)).setOnClickListener(new View.OnClickListener() { public void onClick(View v) { // Starts an intent of the log in activity Log.i(TAG,"Find face object id "+ObjectId); savePrefs("findfaceObjId",ObjectId); startActivity(new Intent(FindPhoneInterface.this, ShowPhoneFinderImage.class)); } }); //Change ringer alert ((Button) findViewById(R.id.triggerAlert)).setOnClickListener(new View.OnClickListener() { public void onClick(View v) { ParseQuery<ParseObject> query = ParseQuery.getQuery("Settings"); query.whereEqualTo("userObjectId", ObjectId); query.findInBackground(new FindCallback<ParseObject>() { public void done(List<ParseObject> scoreList, ParseException e) { //get current user ParseUser user = ParseUser.getCurrentUser(); if (e == null) { if (scoreList != null) { if (scoreList.size() > 0) { //store the location of the user with the objectId of the user scoreList.get(0).put("alertPhone", true); scoreList.get(0).saveInBackground(); Toast.makeText(FindPhoneInterface.this, "Phone Alerted", Toast.LENGTH_LONG) .show(); } } else { ParseObject alertVal = new ParseObject("Settings"); alertVal.put("userObjectId", ObjectId); alertVal.put("alertPhone", true); scoreList.get(0).saveInBackground(); Toast.makeText(FindPhoneInterface.this, "Phone Alerted", Toast.LENGTH_LONG) .show(); } } } }); } }); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.menu_find_phone_interface, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); //noinspection SimplifiableIfStatement if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } }
Rakesh627/PhoneFinder
ParseStarterProject/src/main/java/com/mc/phonefinder/usersettings/FindPhoneInterface.java
Java
apache-2.0
10,791
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!-- NewPage --> <html lang="en"> <head> <!-- Generated by javadoc (1.8.0_60) on Mon Mar 28 17:12:17 AEST 2016 --> <title>Uses of Class org.apache.river.constants.TxnConstants (River-Internet vtrunk API Documentation (internals))</title> <meta name="date" content="2016-03-28"> <link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style"> <script type="text/javascript" src="../../../../../script.js"></script> </head> <body> <script type="text/javascript"><!-- try { if (location.href.indexOf('is-external=true') == -1) { parent.document.title="Uses of Class org.apache.river.constants.TxnConstants (River-Internet vtrunk API Documentation (internals))"; } } catch(err) { } //--> </script> <noscript> <div>JavaScript is disabled on your browser.</div> </noscript> <!-- ========= START OF TOP NAVBAR ======= --> <div class="topNav"><a name="navbar.top"> <!-- --> </a> <div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div> <a name="navbar.top.firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../../../overview-summary.html">Overview</a></li> <li><a href="../package-summary.html">Package</a></li> <li><a href="../../../../../org/apache/river/constants/TxnConstants.html" title="class in org.apache.river.constants">Class</a></li> <li class="navBarCell1Rev">Use</li> <li><a href="../package-tree.html">Tree</a></li> <li><a href="../../../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../../../index-all.html">Index</a></li> <li><a href="../../../../../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li>Prev</li> <li>Next</li> </ul> <ul class="navList"> <li><a href="../../../../../index.html?org/apache/river/constants/class-use/TxnConstants.html" target="_top">Frames</a></li> <li><a href="TxnConstants.html" target="_top">No&nbsp;Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_top"> <li><a href="../../../../../allclasses-noframe.html">All&nbsp;Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_top"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <a name="skip.navbar.top"> <!-- --> </a></div> <!-- ========= END OF TOP NAVBAR ========= --> <div class="header"> <h2 title="Uses of Class org.apache.river.constants.TxnConstants" class="title">Uses of Class<br>org.apache.river.constants.TxnConstants</h2> </div> <div class="classUseContainer">No usage of org.apache.river.constants.TxnConstants</div> <!-- ======= START OF BOTTOM NAVBAR ====== --> <div class="bottomNav"><a name="navbar.bottom"> <!-- --> </a> <div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div> <a name="navbar.bottom.firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../../../overview-summary.html">Overview</a></li> <li><a href="../package-summary.html">Package</a></li> <li><a href="../../../../../org/apache/river/constants/TxnConstants.html" title="class in org.apache.river.constants">Class</a></li> <li class="navBarCell1Rev">Use</li> <li><a href="../package-tree.html">Tree</a></li> <li><a href="../../../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../../../index-all.html">Index</a></li> <li><a href="../../../../../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li>Prev</li> <li>Next</li> </ul> <ul class="navList"> <li><a href="../../../../../index.html?org/apache/river/constants/class-use/TxnConstants.html" target="_top">Frames</a></li> <li><a href="TxnConstants.html" target="_top">No&nbsp;Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_bottom"> <li><a href="../../../../../allclasses-noframe.html">All&nbsp;Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_bottom"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <a name="skip.navbar.bottom"> <!-- --> </a></div> <!-- ======== END OF BOTTOM NAVBAR ======= --> <p class="legalCopy"><small>Copyright 2007-2013, multiple authors.<br>Licensed under the <a href=http://www.apache.org/licenses/LICENSE-2.0 target=child >Apache License, Version 2.0</a>, see the <a href=../../../../../doc-files/NOTICE target=child >NOTICE</a> file for attributions.</small></p> </body> </html>
pfirmstone/river-internet
JGDMS/src/site/resources/old-static-site/doc/internals/org/apache/river/constants/class-use/TxnConstants.html
HTML
apache-2.0
4,793
import AttributeCompression from "../Core/AttributeCompression.js"; import Cartesian3 from "../Core/Cartesian3.js"; import Cartographic from "../Core/Cartographic.js"; import Ellipsoid from "../Core/Ellipsoid.js"; import IndexDatatype from "../Core/IndexDatatype.js"; import CesiumMath from "../Core/Math.js"; import Rectangle from "../Core/Rectangle.js"; import createTaskProcessorWorker from "./createTaskProcessorWorker.js"; var maxShort = 32767; var scratchBVCartographic = new Cartographic(); var scratchEncodedPosition = new Cartesian3(); function decodePositions( positions, rectangle, minimumHeight, maximumHeight, ellipsoid ) { var positionsLength = positions.length / 3; var uBuffer = positions.subarray(0, positionsLength); var vBuffer = positions.subarray(positionsLength, 2 * positionsLength); var heightBuffer = positions.subarray( 2 * positionsLength, 3 * positionsLength ); AttributeCompression.zigZagDeltaDecode(uBuffer, vBuffer, heightBuffer); var decoded = new Float64Array(positions.length); for (var i = 0; i < positionsLength; ++i) { var u = uBuffer[i]; var v = vBuffer[i]; var h = heightBuffer[i]; var lon = CesiumMath.lerp(rectangle.west, rectangle.east, u / maxShort); var lat = CesiumMath.lerp(rectangle.south, rectangle.north, v / maxShort); var alt = CesiumMath.lerp(minimumHeight, maximumHeight, h / maxShort); var cartographic = Cartographic.fromRadians( lon, lat, alt, scratchBVCartographic ); var decodedPosition = ellipsoid.cartographicToCartesian( cartographic, scratchEncodedPosition ); Cartesian3.pack(decodedPosition, decoded, i * 3); } return decoded; } var scratchRectangle = new Rectangle(); var scratchEllipsoid = new Ellipsoid(); var scratchCenter = new Cartesian3(); var scratchMinMaxHeights = { min: undefined, max: undefined, }; function unpackBuffer(packedBuffer) { packedBuffer = new Float64Array(packedBuffer); var offset = 0; scratchMinMaxHeights.min = packedBuffer[offset++]; scratchMinMaxHeights.max = packedBuffer[offset++]; Rectangle.unpack(packedBuffer, offset, scratchRectangle); offset += Rectangle.packedLength; Ellipsoid.unpack(packedBuffer, offset, scratchEllipsoid); offset += Ellipsoid.packedLength; Cartesian3.unpack(packedBuffer, offset, scratchCenter); } var scratchP0 = new Cartesian3(); var scratchP1 = new Cartesian3(); var scratchPrev = new Cartesian3(); var scratchCur = new Cartesian3(); var scratchNext = new Cartesian3(); function createVectorTilePolylines(parameters, transferableObjects) { var encodedPositions = new Uint16Array(parameters.positions); var widths = new Uint16Array(parameters.widths); var counts = new Uint32Array(parameters.counts); var batchIds = new Uint16Array(parameters.batchIds); unpackBuffer(parameters.packedBuffer); var rectangle = scratchRectangle; var ellipsoid = scratchEllipsoid; var center = scratchCenter; var minimumHeight = scratchMinMaxHeights.min; var maximumHeight = scratchMinMaxHeights.max; var positions = decodePositions( encodedPositions, rectangle, minimumHeight, maximumHeight, ellipsoid ); var positionsLength = positions.length / 3; var size = positionsLength * 4 - 4; var curPositions = new Float32Array(size * 3); var prevPositions = new Float32Array(size * 3); var nextPositions = new Float32Array(size * 3); var expandAndWidth = new Float32Array(size * 2); var vertexBatchIds = new Uint16Array(size); var positionIndex = 0; var expandAndWidthIndex = 0; var batchIdIndex = 0; var i; var offset = 0; var length = counts.length; for (i = 0; i < length; ++i) { var count = counts[i]; var width = widths[i]; var batchId = batchIds[i]; for (var j = 0; j < count; ++j) { var previous; if (j === 0) { var p0 = Cartesian3.unpack(positions, offset * 3, scratchP0); var p1 = Cartesian3.unpack(positions, (offset + 1) * 3, scratchP1); previous = Cartesian3.subtract(p0, p1, scratchPrev); Cartesian3.add(p0, previous, previous); } else { previous = Cartesian3.unpack( positions, (offset + j - 1) * 3, scratchPrev ); } var current = Cartesian3.unpack(positions, (offset + j) * 3, scratchCur); var next; if (j === count - 1) { var p2 = Cartesian3.unpack( positions, (offset + count - 1) * 3, scratchP0 ); var p3 = Cartesian3.unpack( positions, (offset + count - 2) * 3, scratchP1 ); next = Cartesian3.subtract(p2, p3, scratchNext); Cartesian3.add(p2, next, next); } else { next = Cartesian3.unpack(positions, (offset + j + 1) * 3, scratchNext); } Cartesian3.subtract(previous, center, previous); Cartesian3.subtract(current, center, current); Cartesian3.subtract(next, center, next); var startK = j === 0 ? 2 : 0; var endK = j === count - 1 ? 2 : 4; for (var k = startK; k < endK; ++k) { Cartesian3.pack(current, curPositions, positionIndex); Cartesian3.pack(previous, prevPositions, positionIndex); Cartesian3.pack(next, nextPositions, positionIndex); positionIndex += 3; var direction = k - 2 < 0 ? -1.0 : 1.0; expandAndWidth[expandAndWidthIndex++] = 2 * (k % 2) - 1; expandAndWidth[expandAndWidthIndex++] = direction * width; vertexBatchIds[batchIdIndex++] = batchId; } } offset += count; } var indices = IndexDatatype.createTypedArray(size, positionsLength * 6 - 6); var index = 0; var indicesIndex = 0; length = positionsLength - 1; for (i = 0; i < length; ++i) { indices[indicesIndex++] = index; indices[indicesIndex++] = index + 2; indices[indicesIndex++] = index + 1; indices[indicesIndex++] = index + 1; indices[indicesIndex++] = index + 2; indices[indicesIndex++] = index + 3; index += 4; } transferableObjects.push( curPositions.buffer, prevPositions.buffer, nextPositions.buffer ); transferableObjects.push( expandAndWidth.buffer, vertexBatchIds.buffer, indices.buffer ); return { indexDatatype: indices.BYTES_PER_ELEMENT === 2 ? IndexDatatype.UNSIGNED_SHORT : IndexDatatype.UNSIGNED_INT, currentPositions: curPositions.buffer, previousPositions: prevPositions.buffer, nextPositions: nextPositions.buffer, expandAndWidth: expandAndWidth.buffer, batchIds: vertexBatchIds.buffer, indices: indices.buffer, }; } export default createTaskProcessorWorker(createVectorTilePolylines);
progsung/cesium
Source/WorkersES6/createVectorTilePolylines.js
JavaScript
apache-2.0
6,753
/* * Licensed to the Apache Software Foundation (ASF) under one or more contributor license * agreements. See the NOTICE file distributed with this work for additional information regarding * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance with the License. You may obtain a * copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed under the License * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express * or implied. See the License for the specific language governing permissions and limitations under * the License. */ package org.apache.geode.internal.cache; import java.io.File; import java.io.IOException; import java.io.Serializable; import java.util.UUID; import org.apache.geode.annotations.Immutable; import org.apache.geode.cache.DiskStore; import org.apache.geode.cache.DiskStoreFactory; import org.apache.geode.internal.cache.persistence.DefaultDiskDirs; /** * Creates an attribute object for DiskStore. * </p> * * @since GemFire prPersistSprint2 */ public class DiskStoreAttributes implements Serializable, DiskStore { private static final long serialVersionUID = 1L; public boolean allowForceCompaction; public boolean autoCompact; public int compactionThreshold; public int queueSize; public int writeBufferSize; public long maxOplogSizeInBytes; public long timeInterval; public int[] diskDirSizes; private DiskDirSizesUnit diskDirSizesUnit; public File[] diskDirs; public String name; private volatile float diskUsageWarningPct; private volatile float diskUsageCriticalPct; /** * The default disk directory size unit. */ @Immutable static final DiskDirSizesUnit DEFAULT_DISK_DIR_SIZES_UNIT = DiskDirSizesUnit.MEGABYTES; public DiskStoreAttributes() { // set all to defaults autoCompact = DiskStoreFactory.DEFAULT_AUTO_COMPACT; compactionThreshold = DiskStoreFactory.DEFAULT_COMPACTION_THRESHOLD; allowForceCompaction = DiskStoreFactory.DEFAULT_ALLOW_FORCE_COMPACTION; maxOplogSizeInBytes = DiskStoreFactory.DEFAULT_MAX_OPLOG_SIZE * (1024 * 1024); timeInterval = DiskStoreFactory.DEFAULT_TIME_INTERVAL; writeBufferSize = DiskStoreFactory.DEFAULT_WRITE_BUFFER_SIZE; queueSize = DiskStoreFactory.DEFAULT_QUEUE_SIZE; diskDirs = DefaultDiskDirs.getDefaultDiskDirs(); diskDirSizes = DiskStoreFactory.DEFAULT_DISK_DIR_SIZES; diskDirSizesUnit = DEFAULT_DISK_DIR_SIZES_UNIT; diskUsageWarningPct = DiskStoreFactory.DEFAULT_DISK_USAGE_WARNING_PERCENTAGE; diskUsageCriticalPct = DiskStoreFactory.DEFAULT_DISK_USAGE_CRITICAL_PERCENTAGE; } @Override public UUID getDiskStoreUUID() { throw new UnsupportedOperationException("Not Implemented!"); } /* * (non-Javadoc) * * @see org.apache.geode.cache.DiskStore#getAllowForceCompaction() */ @Override public boolean getAllowForceCompaction() { return allowForceCompaction; } /* * (non-Javadoc) * * @see org.apache.geode.cache.DiskStore#getAutoCompact() */ @Override public boolean getAutoCompact() { return autoCompact; } /* * (non-Javadoc) * * @see org.apache.geode.cache.DiskStore#getCompactionThreshold() */ @Override public int getCompactionThreshold() { return compactionThreshold; } /* * (non-Javadoc) * * @see org.apache.geode.cache.DiskStore#getDiskDirSizes() */ @Override public int[] getDiskDirSizes() { int[] result = new int[diskDirSizes.length]; System.arraycopy(diskDirSizes, 0, result, 0, diskDirSizes.length); return result; } public DiskDirSizesUnit getDiskDirSizesUnit() { return diskDirSizesUnit; } /* * (non-Javadoc) * * @see org.apache.geode.cache.DiskStore#getDiskDirs() */ @Override public File[] getDiskDirs() { File[] result = new File[diskDirs.length]; System.arraycopy(diskDirs, 0, result, 0, diskDirs.length); return result; } /* * (non-Javadoc) * * @see org.apache.geode.cache.DiskStore#getMaxOplogSize() */ @Override public long getMaxOplogSize() { return maxOplogSizeInBytes / (1024 * 1024); } /** * Used by unit tests */ public long getMaxOplogSizeInBytes() { return maxOplogSizeInBytes; } /* * (non-Javadoc) * * @see org.apache.geode.cache.DiskStore#getName() */ @Override public String getName() { return name; } /* * (non-Javadoc) * * @see org.apache.geode.cache.DiskStore#getQueueSize() */ @Override public int getQueueSize() { return queueSize; } /* * (non-Javadoc) * * @see org.apache.geode.cache.DiskStore#getTimeInterval() */ @Override public long getTimeInterval() { return timeInterval; } /* * (non-Javadoc) * * @see org.apache.geode.cache.DiskStore#getWriteBufferSize() */ @Override public int getWriteBufferSize() { return writeBufferSize; } @Override public void flush() { // nothing needed } @Override public void forceRoll() { // nothing needed } @Override public boolean forceCompaction() { return false; } @Override public void destroy() { // nothing needed } @Override public float getDiskUsageWarningPercentage() { return diskUsageWarningPct; } @Override public float getDiskUsageCriticalPercentage() { return diskUsageCriticalPct; } @Override public void setDiskUsageWarningPercentage(float warningPercent) { DiskStoreMonitor.checkWarning(warningPercent); diskUsageWarningPct = warningPercent; } @Override public void setDiskUsageCriticalPercentage(float criticalPercent) { DiskStoreMonitor.checkCritical(criticalPercent); diskUsageCriticalPct = criticalPercent; } public void setDiskDirSizesUnit(DiskDirSizesUnit unit) { diskDirSizesUnit = unit; } private void readObject(final java.io.ObjectInputStream in) throws IOException, ClassNotFoundException { in.defaultReadObject(); if (diskDirSizesUnit == null) { diskDirSizesUnit = DEFAULT_DISK_DIR_SIZES_UNIT; } } public static void checkMinAndMaxOplogSize(long maxOplogSize) { long MAX = Long.MAX_VALUE / (1024 * 1024); if (maxOplogSize > MAX) { throw new IllegalArgumentException( String.format( "%s has to be a number that does not exceed %s so the value given %s is not acceptable", "max oplog size", maxOplogSize, MAX)); } checkMinOplogSize(maxOplogSize); } public static void checkMinOplogSize(long maxOplogSize) { if (maxOplogSize < 0) { throw new IllegalArgumentException( String.format( "Maximum Oplog size specified has to be a non-negative number and the value given %s is not acceptable", maxOplogSize)); } } public static void checkQueueSize(int queueSize) { if (queueSize < 0) { throw new IllegalArgumentException( String.format( "Queue size specified has to be a non-negative number and the value given %s is not acceptable", queueSize)); } } public static void checkWriteBufferSize(int writeBufferSize) { if (writeBufferSize < 0) { throw new IllegalArgumentException( String.format( "Write buffer size specified has to be a non-negative number and the value given %s is not acceptable", writeBufferSize)); } } /** * Verify all directory sizes are positive */ public static void verifyNonNegativeDirSize(int[] sizes) { for (int size : sizes) { if (size < 0) { throw new IllegalArgumentException( String.format("Dir size cannot be negative : %s", size)); } } } public static void checkTimeInterval(long timeInterval) { if (timeInterval < 0) { throw new IllegalArgumentException( String.format( "Time Interval specified has to be a non-negative number and the value given %s is not acceptable", timeInterval)); } } }
jdeppe-pivotal/geode
geode-core/src/main/java/org/apache/geode/internal/cache/DiskStoreAttributes.java
Java
apache-2.0
8,257
/* Copyright 2017 The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ package signer import ( "crypto/x509" "io/ioutil" "reflect" "strings" "testing" "time" capi "k8s.io/api/certificates/v1beta1" "k8s.io/client-go/util/cert" ) func TestSigner(t *testing.T) { s, err := newCFSSLSigner("./testdata/ca.crt", "./testdata/ca.key", nil, 1*time.Hour) if err != nil { t.Fatalf("failed to create signer: %v", err) } csrb, err := ioutil.ReadFile("./testdata/kubelet.csr") if err != nil { t.Fatalf("failed to read CSR: %v", err) } csr := &capi.CertificateSigningRequest{ Spec: capi.CertificateSigningRequestSpec{ Request: []byte(csrb), Usages: []capi.KeyUsage{ capi.UsageSigning, capi.UsageKeyEncipherment, capi.UsageServerAuth, capi.UsageClientAuth, }, }, } csr, err = s.sign(csr) if err != nil { t.Fatalf("failed to sign CSR: %v", err) } certData := csr.Status.Certificate if len(certData) == 0 { t.Fatalf("expected a certificate after signing") } certs, err := cert.ParseCertsPEM(certData) if err != nil { t.Fatalf("failed to parse certificate: %v", err) } if len(certs) != 1 { t.Fatalf("expected one certificate") } crt := certs[0] if crt.Subject.CommonName != "system:node:k-a-node-s36b" { t.Errorf("expected common name of 'system:node:k-a-node-s36b', but got: %v", certs[0].Subject.CommonName) } if !reflect.DeepEqual(crt.Subject.Organization, []string{"system:nodes"}) { t.Errorf("expected organization to be [system:nodes] but got: %v", crt.Subject.Organization) } if crt.KeyUsage != x509.KeyUsageDigitalSignature|x509.KeyUsageKeyEncipherment { t.Errorf("bad key usage") } if !reflect.DeepEqual(crt.ExtKeyUsage, []x509.ExtKeyUsage{x509.ExtKeyUsageServerAuth, x509.ExtKeyUsageClientAuth}) { t.Errorf("bad extended key usage") } } func TestSignerExpired(t *testing.T) { hundredYearsFromNowFn := func() time.Time { return time.Now().Add(24 * time.Hour * 365 * 100) } s, err := newCFSSLSigner("./testdata/ca.crt", "./testdata/ca.key", nil, 1*time.Hour) if err != nil { t.Fatalf("failed to create signer: %v", err) } s.nowFn = hundredYearsFromNowFn csrb, err := ioutil.ReadFile("./testdata/kubelet.csr") if err != nil { t.Fatalf("failed to read CSR: %v", err) } csr := &capi.CertificateSigningRequest{ Spec: capi.CertificateSigningRequestSpec{ Request: []byte(csrb), Usages: []capi.KeyUsage{ capi.UsageSigning, capi.UsageKeyEncipherment, capi.UsageServerAuth, capi.UsageClientAuth, }, }, } _, err = s.sign(csr) if err == nil { t.Fatal("missing error") } if !strings.HasPrefix(err.Error(), "the signer has expired") { t.Fatal(err) } } func TestDurationLongerThanExpiry(t *testing.T) { testNow := time.Now() testNowFn := func() time.Time { return testNow } hundredYears := 24 * time.Hour * 365 * 100 s, err := newCFSSLSigner("./testdata/ca.crt", "./testdata/ca.key", nil, hundredYears) if err != nil { t.Fatalf("failed to create signer: %v", err) } s.nowFn = testNowFn csrb, err := ioutil.ReadFile("./testdata/kubelet.csr") if err != nil { t.Fatalf("failed to read CSR: %v", err) } csr := &capi.CertificateSigningRequest{ Spec: capi.CertificateSigningRequestSpec{ Request: []byte(csrb), Usages: []capi.KeyUsage{ capi.UsageSigning, capi.UsageKeyEncipherment, capi.UsageServerAuth, capi.UsageClientAuth, }, }, } _, err = s.sign(csr) if err != nil { t.Fatalf("failed to sign CSR: %v", err) } // now we just need to verify that the expiry is based on the signing cert certData := csr.Status.Certificate if len(certData) == 0 { t.Fatalf("expected a certificate after signing") } certs, err := cert.ParseCertsPEM(certData) if err != nil { t.Fatalf("failed to parse certificate: %v", err) } if len(certs) != 1 { t.Fatalf("expected one certificate") } crt := certs[0] expected, err := time.Parse("2006-01-02 15:04:05.999999999 -0700 MST", "2044-05-09 00:20:11 +0000 UTC") if err != nil { t.Fatal(err) } // there is some jitter that we need to tolerate diff := expected.Sub(crt.NotAfter) if diff > 10*time.Minute || diff < -10*time.Minute { t.Fatal(crt.NotAfter) } }
linzhaoming/origin
vendor/k8s.io/kubernetes/pkg/controller/certificates/signer/cfssl_signer_test.go
GO
apache-2.0
4,691
/* * SVG Salamander * Copyright (c) 2004, Mark McKay * All rights reserved. * * Redistribution and use in source and binary forms, with or * without modification, are permitted provided that the following * conditions are met: * * - Redistributions of source code must retain the above * copyright notice, this list of conditions and the following * disclaimer. * - Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. * * Mark McKay can be contacted at mark@kitfox.com. Salamander and other * projects can be found at http://www.kitfox.com * * Created on January 26, 2004, 8:40 PM */ package com.kitfox.svg.pathcmd; //import org.apache.batik.ext.awt.geom.ExtendedGeneralPath; import java.awt.*; import java.awt.geom.*; /** * This is a little used SVG function, as most editors will save curves as * Beziers. To reduce the need to rely on the Batik library, this functionallity * is being bypassed for the time being. In the future, it would be nice to * extend the GeneralPath command to include the arcTo ability provided by Batik. * * @author Mark McKay * @author <a href="mailto:mark@kitfox.com">Mark McKay</a> */ public class Arc extends PathCommand { public float rx = 0f; public float ry = 0f; public float xAxisRot = 0f; public boolean largeArc = false; public boolean sweep = false; public float x = 0f; public float y = 0f; /** Creates a new instance of MoveTo */ public Arc() { } public Arc(boolean isRelative, float rx, float ry, float xAxisRot, boolean largeArc, boolean sweep, float x, float y) { super(isRelative); this.rx = rx; this.ry = ry; this.xAxisRot = xAxisRot; this.largeArc = largeArc; this.sweep = sweep; this.x = x; this.y = y; } // public void appendPath(ExtendedGeneralPath path, BuildHistory hist) @Override public void appendPath(GeneralPath path, BuildHistory hist) { float offx = isRelative ? hist.lastPoint.x : 0f; float offy = isRelative ? hist.lastPoint.y : 0f; arcTo(path, rx, ry, xAxisRot, largeArc, sweep, x + offx, y + offy, hist.lastPoint.x, hist.lastPoint.y); // path.lineTo(x + offx, y + offy); // hist.setPoint(x + offx, y + offy); hist.setLastPoint(x + offx, y + offy); hist.setLastKnot(x + offx, y + offy); } @Override public int getNumKnotsAdded() { return 6; } /** * Adds an elliptical arc, defined by two radii, an angle from the * x-axis, a flag to choose the large arc or not, a flag to * indicate if we increase or decrease the angles and the final * point of the arc. * * @param rx the x radius of the ellipse * @param ry the y radius of the ellipse * * @param angle the angle from the x-axis of the current * coordinate system to the x-axis of the ellipse in degrees. * * @param largeArcFlag the large arc flag. If true the arc * spanning less than or equal to 180 degrees is chosen, otherwise * the arc spanning greater than 180 degrees is chosen * * @param sweepFlag the sweep flag. If true the line joining * center to arc sweeps through decreasing angles otherwise it * sweeps through increasing angles * * @param x the absolute x coordinate of the final point of the arc. * @param y the absolute y coordinate of the final point of the arc. * @param x0 - The absolute x coordinate of the initial point of the arc. * @param y0 - The absolute y coordinate of the initial point of the arc. */ public void arcTo(GeneralPath path, float rx, float ry, float angle, boolean largeArcFlag, boolean sweepFlag, float x, float y, float x0, float y0) { // Ensure radii are valid if (rx == 0 || ry == 0) { path.lineTo((float) x, (float) y); return; } if (x0 == x && y0 == y) { // If the endpoints (x, y) and (x0, y0) are identical, then this // is equivalent to omitting the elliptical arc segment entirely. return; } Arc2D arc = computeArc(x0, y0, rx, ry, angle, largeArcFlag, sweepFlag, x, y); if (arc == null) return; AffineTransform t = AffineTransform.getRotateInstance (Math.toRadians(angle), arc.getCenterX(), arc.getCenterY()); Shape s = t.createTransformedShape(arc); path.append(s, true); } /** * This constructs an unrotated Arc2D from the SVG specification of an * Elliptical arc. To get the final arc you need to apply a rotation * transform such as: * * AffineTransform.getRotateInstance * (angle, arc.getX()+arc.getWidth()/2, arc.getY()+arc.getHeight()/2); */ public static Arc2D computeArc(double x0, double y0, double rx, double ry, double angle, boolean largeArcFlag, boolean sweepFlag, double x, double y) { // // Elliptical arc implementation based on the SVG specification notes // // Compute the half distance between the current and the final point double dx2 = (x0 - x) / 2.0; double dy2 = (y0 - y) / 2.0; // Convert angle from degrees to radians angle = Math.toRadians(angle % 360.0); double cosAngle = Math.cos(angle); double sinAngle = Math.sin(angle); // // Step 1 : Compute (x1, y1) // double x1 = (cosAngle * dx2 + sinAngle * dy2); double y1 = (-sinAngle * dx2 + cosAngle * dy2); // Ensure radii are large enough rx = Math.abs(rx); ry = Math.abs(ry); double Prx = rx * rx; double Pry = ry * ry; double Px1 = x1 * x1; double Py1 = y1 * y1; // check that radii are large enough double radiiCheck = Px1/Prx + Py1/Pry; if (radiiCheck > 1) { rx = Math.sqrt(radiiCheck) * rx; ry = Math.sqrt(radiiCheck) * ry; Prx = rx * rx; Pry = ry * ry; } // // Step 2 : Compute (cx1, cy1) // double sign = (largeArcFlag == sweepFlag) ? -1 : 1; double sq = ((Prx*Pry)-(Prx*Py1)-(Pry*Px1)) / ((Prx*Py1)+(Pry*Px1)); sq = (sq < 0) ? 0 : sq; double coef = (sign * Math.sqrt(sq)); double cx1 = coef * ((rx * y1) / ry); double cy1 = coef * -((ry * x1) / rx); // // Step 3 : Compute (cx, cy) from (cx1, cy1) // double sx2 = (x0 + x) / 2.0; double sy2 = (y0 + y) / 2.0; double cx = sx2 + (cosAngle * cx1 - sinAngle * cy1); double cy = sy2 + (sinAngle * cx1 + cosAngle * cy1); // // Step 4 : Compute the angleStart (angle1) and the angleExtent (dangle) // double ux = (x1 - cx1) / rx; double uy = (y1 - cy1) / ry; double vx = (-x1 - cx1) / rx; double vy = (-y1 - cy1) / ry; double p, n; // Compute the angle start n = Math.sqrt((ux * ux) + (uy * uy)); p = ux; // (1 * ux) + (0 * uy) sign = (uy < 0) ? -1d : 1d; double angleStart = Math.toDegrees(sign * Math.acos(p / n)); // Compute the angle extent n = Math.sqrt((ux * ux + uy * uy) * (vx * vx + vy * vy)); p = ux * vx + uy * vy; sign = (ux * vy - uy * vx < 0) ? -1d : 1d; double angleExtent = Math.toDegrees(sign * Math.acos(p / n)); if(!sweepFlag && angleExtent > 0) { angleExtent -= 360f; } else if (sweepFlag && angleExtent < 0) { angleExtent += 360f; } angleExtent %= 360f; angleStart %= 360f; // // We can now build the resulting Arc2D in double precision // Arc2D.Double arc = new Arc2D.Double(); arc.x = cx - rx; arc.y = cy - ry; arc.width = rx * 2.0; arc.height = ry * 2.0; arc.start = -angleStart; arc.extent = -angleExtent; return arc; } @Override public String toString() { return "A " + rx + " " + ry + " " + xAxisRot + " " + largeArc + " " + sweep + " " + x + " " + y; } }
Longri/cachebox3.0
launcher/desktop_lwjgl/src/com/kitfox/svg/pathcmd/Arc.java
Java
apache-2.0
9,856
// Copyright (C) 2011-2012 the original author or authors. // See the LICENCE.txt file distributed with this work for additional // information regarding copyright ownership. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package org.scalastyle.file import org.junit.Test import org.scalatest.junit.AssertionsForJUnit // scalastyle:off magic.number multiple.string.literals class HeaderMatchesCheckerTest extends AssertionsForJUnit with CheckerTest { val key = "header.matches" val classUnderTest = classOf[HeaderMatchesChecker] val licenseLines = List( "/**", " * Copyright (C) 2009-2010 the original author or authors.", " * See the notice.md file distributed with this work for additional", " * information regarding copyright ownership.", " *", " * Licensed under the Apache License, Version 2.0 (the \"License\");", " * you may not use this file except in compliance with the License.", " * You may obtain a copy of the License at", " *", " * http://www.apache.org/licenses/LICENSE-2.0", " *", " * Unless required by applicable law or agreed to in writing, software", " * distributed under the License is distributed on an \"AS IS\" BASIS,", " * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.", " * See the License for the specific language governing permissions and", " * limitations under the License.", " */" ) val licenseUnix = licenseLines.mkString("\n") val licenseWin = licenseLines.mkString("\r\n") val baseSourceLines = List( "", "package foobar", "", " object Foobar {", "}", "" ) @Test def testOK(): Unit = { val sourceLines = licenseLines ::: baseSourceLines val sourceUnix = sourceLines.mkString("\n") val sourceWin = sourceLines.mkString("\r\n") assertErrors(List(), sourceUnix, Map("header" -> licenseUnix)) assertErrors(List(), sourceWin, Map("header" -> licenseWin)) assertErrors(List(), sourceUnix, Map("header" -> licenseWin)) assertErrors(List(), sourceWin, Map("header" -> licenseUnix)) } @Test def testKO(): Unit = { val sourceLines = licenseLines ::: baseSourceLines val sourceUnix = sourceLines.mkString("\n").replaceAll("BASIS,", "XXX") val sourceWin = sourceLines.mkString("\r\n").replaceAll("BASIS,", "XXX") assertErrors(List(lineError(13)), sourceUnix, Map("header" -> licenseUnix)) assertErrors(List(lineError(13)), sourceWin, Map("header" -> licenseWin)) assertErrors(List(lineError(13)), sourceUnix, Map("header" -> licenseWin)) assertErrors(List(lineError(13)), sourceWin, Map("header" -> licenseUnix)) } @Test def testTooShort(): Unit = { val shortSourceLines = licenseLines.take(4) val shortSourceUnix = shortSourceLines.mkString("\n") val shortSourceWin = shortSourceLines.mkString("\r\n") assertErrors(List(lineError(4)), shortSourceUnix, Map("header" -> licenseUnix)) assertErrors(List(lineError(4)), shortSourceWin, Map("header" -> licenseWin)) assertErrors(List(lineError(4)), shortSourceUnix, Map("header" -> licenseWin)) assertErrors(List(lineError(4)), shortSourceWin, Map("header" -> licenseUnix)) } def literalOK(c: Char): Boolean = c match { case ' '|'-'|':'|'/'|'\n' => true case ld: Any if ld.isLetterOrDigit => true case _ => false } val licenceRegexUnix = { (licenseUnix flatMap { c => if (literalOK(c)) c.toString else "\\" + c}).replace("2009-2010", "(?:\\d{4}-)?\\d{4}") } val licenceRegexWin = { (licenseWin flatMap { c => if (literalOK(c)) c.toString else "\\" + c}).replace("2009-2010", "(?:\\d{4}-)?\\d{4}") } @Test def testRegexOK(): Unit = { val sourceLines = licenseLines ::: baseSourceLines val sourceUnix = sourceLines.mkString("\n") val sourceWin = sourceLines.mkString("\r\n") assertErrors(List(), sourceUnix, Map("header" -> licenceRegexUnix, "regex" -> "true")) assertErrors(List(), sourceWin, Map("header" -> licenceRegexWin, "regex" -> "true")) assertErrors(List(), sourceUnix, Map("header" -> licenceRegexWin, "regex" -> "true")) assertErrors(List(), sourceWin, Map("header" -> licenceRegexUnix, "regex" -> "true")) } @Test def testRegexFlexible(): Unit = { val sourceLines = licenseLines ::: baseSourceLines val sourceUnix = sourceLines.mkString("\n").replace("2009-2010", "2009-2014") val sourceWin = sourceLines.mkString("\r\n").replace("2009-2010", "2009-2014") assertErrors(List(), sourceUnix, Map("header" -> licenceRegexUnix, "regex" -> "true")) assertErrors(List(), sourceWin, Map("header" -> licenceRegexWin, "regex" -> "true")) assertErrors(List(), sourceUnix, Map("header" -> licenceRegexWin, "regex" -> "true")) assertErrors(List(), sourceWin, Map("header" -> licenceRegexUnix, "regex" -> "true")) } @Test def testRegexKO(): Unit = { val sourceLines = licenseLines ::: baseSourceLines val sourceUnix = sourceLines.mkString("\n").replace("2009-2010", "xxxx-xxxx") val sourceWin = sourceLines.mkString("\r\n").replace("2009-2010", "xxxx-xxxx") assertErrors(List(fileError()), sourceUnix, Map("header" -> licenceRegexUnix, "regex" -> "true")) assertErrors(List(fileError()), sourceWin, Map("header" -> licenceRegexWin, "regex" -> "true")) assertErrors(List(fileError()), sourceUnix, Map("header" -> licenceRegexWin, "regex" -> "true")) assertErrors(List(fileError()), sourceWin, Map("header" -> licenceRegexUnix, "regex" -> "true")) } }
scalastyle/scalastyle
src/test/scala/org/scalastyle/file/HeaderMatchesCheckerTest.scala
Scala
apache-2.0
6,008
/* * Copyright (c) 2008-2020, Hazelcast, Inc. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.hazelcast.cache; import com.hazelcast.cache.impl.CachePartitionEventData; import com.hazelcast.cache.impl.CachePartitionSegment; import com.hazelcast.cache.impl.CacheService; import com.hazelcast.cache.impl.operation.CacheReplicationOperation; import com.hazelcast.cache.impl.record.CacheRecord; import com.hazelcast.cache.impl.record.CacheRecordFactory; import com.hazelcast.cluster.Address; import com.hazelcast.cluster.Member; import com.hazelcast.cluster.impl.MemberImpl; import com.hazelcast.config.InMemoryFormat; import com.hazelcast.core.HazelcastInstance; import com.hazelcast.instance.impl.HazelcastInstanceImpl; import com.hazelcast.instance.impl.HazelcastInstanceProxy; import com.hazelcast.internal.serialization.Data; import com.hazelcast.internal.serialization.SerializationService; import com.hazelcast.internal.serialization.SerializationServiceBuilder; import com.hazelcast.internal.serialization.impl.DefaultSerializationServiceBuilder; import com.hazelcast.internal.services.ServiceNamespace; import com.hazelcast.internal.util.Clock; import com.hazelcast.internal.util.CollectionUtil; import com.hazelcast.spi.impl.NodeEngineImpl; import com.hazelcast.test.HazelcastParallelClassRunner; import com.hazelcast.test.HazelcastTestSupport; import com.hazelcast.test.TestHazelcastInstanceFactory; import com.hazelcast.test.annotation.ParallelJVMTest; import com.hazelcast.test.annotation.QuickTest; import com.hazelcast.version.MemberVersion; import org.junit.After; import org.junit.Before; import org.junit.Test; import org.junit.experimental.categories.Category; import org.junit.runner.RunWith; import javax.cache.Cache; import javax.cache.CacheManager; import javax.cache.configuration.CompleteConfiguration; import javax.cache.configuration.MutableConfiguration; import javax.cache.spi.CachingProvider; import java.lang.reflect.Field; import java.net.UnknownHostException; import java.util.Collection; import static com.hazelcast.cache.CacheTestSupport.createServerCachingProvider; import static org.junit.Assert.assertEquals; /** * Serialization test class for JCache */ @RunWith(HazelcastParallelClassRunner.class) @Category({QuickTest.class, ParallelJVMTest.class}) public class CacheSerializationTest extends HazelcastTestSupport { SerializationService service; @Before public void setup() { SerializationServiceBuilder builder = new DefaultSerializationServiceBuilder(); service = builder.build(); } @After public void tearDown() { } @Test public void testCacheRecord_withBinaryInMemoryData() { String value = randomString(); CacheRecord cacheRecord = createRecord(InMemoryFormat.BINARY, value); Data cacheRecordData = service.toData(cacheRecord); CacheRecord deserialized = service.toObject(cacheRecordData); assertEquals(value, service.toObject(deserialized.getValue())); } @Test public void testCacheRecord_withObjectInMemoryData() { String value = randomString(); CacheRecord cacheRecord = createRecord(InMemoryFormat.OBJECT, value); Data cacheRecordData = service.toData(cacheRecord); CacheRecord deserialized = service.toObject(cacheRecordData); assertEquals(value, deserialized.getValue()); } @Test public void test_CacheReplicationOperation_serialization() throws Exception { TestHazelcastInstanceFactory factory = new TestHazelcastInstanceFactory(1); HazelcastInstance hazelcastInstance = factory.newHazelcastInstance(); try { CachingProvider provider = createServerCachingProvider(hazelcastInstance); CacheManager manager = provider.getCacheManager(); CompleteConfiguration configuration = new MutableConfiguration(); Cache cache1 = manager.createCache("cache1", configuration); Cache cache2 = manager.createCache("cache2", configuration); Cache cache3 = manager.createCache("cache3", configuration); for (int i = 0; i < 1000; i++) { cache1.put("key" + i, i); cache2.put("key" + i, i); cache3.put("key" + i, i); } HazelcastInstanceProxy proxy = (HazelcastInstanceProxy) hazelcastInstance; Field original = HazelcastInstanceProxy.class.getDeclaredField("original"); original.setAccessible(true); HazelcastInstanceImpl impl = (HazelcastInstanceImpl) original.get(proxy); NodeEngineImpl nodeEngine = impl.node.nodeEngine; CacheService cacheService = nodeEngine.getService(CacheService.SERVICE_NAME); int partitionCount = nodeEngine.getPartitionService().getPartitionCount(); for (int partitionId = 0; partitionId < partitionCount; partitionId++) { CachePartitionSegment segment = cacheService.getSegment(partitionId); int replicaIndex = 1; Collection<ServiceNamespace> namespaces = segment.getAllNamespaces(replicaIndex); if (CollectionUtil.isEmpty(namespaces)) { continue; } CacheReplicationOperation operation = new CacheReplicationOperation(); operation.prepare(segment, namespaces, replicaIndex); Data serialized = service.toData(operation); try { service.toObject(serialized); } catch (Exception e) { throw new Exception("Partition: " + partitionId, e); } } } finally { factory.shutdownAll(); } } @Test public void testCachePartitionEventData() throws UnknownHostException { Address address = new Address("127.0.0.1", 5701); Member member = new MemberImpl(address, MemberVersion.UNKNOWN, true); CachePartitionEventData cachePartitionEventData = new CachePartitionEventData("test", 1, member); CachePartitionEventData deserialized = service.toObject(cachePartitionEventData); assertEquals(cachePartitionEventData, deserialized); } private CacheRecord createRecord(InMemoryFormat format, String value) { CacheRecordFactory factory = new CacheRecordFactory(format, service); return factory.newRecordWithExpiry(value, Clock.currentTimeMillis(), -1); } }
mdogan/hazelcast
hazelcast/src/test/java/com/hazelcast/cache/CacheSerializationTest.java
Java
apache-2.0
7,031
'use strict'; angular.module('publisherApp') .config(function ($stateProvider) { $stateProvider .state('settings', { parent: 'account', url: '/settings', data: { roles: ['ROLE_USER'], pageTitle: 'global.menu.account.settings' }, views: { 'container@': { templateUrl: 'scripts/app/account/settings/settings.html', controller: 'SettingsController' } }, resolve: { translatePartialLoader: ['$translate', '$translatePartialLoader', function ($translate, $translatePartialLoader) { $translatePartialLoader.addPart('settings'); return $translate.refresh(); }] } }); });
GIP-RECIA/esup-publisher-ui
src/main/webapp/scripts/app/account/settings/settings.js
JavaScript
apache-2.0
949
package com.sean.im.client.push.handler; import com.alibaba.fastjson.JSON; import com.sean.im.client.constant.Global; import com.sean.im.client.core.ApplicationContext; import com.sean.im.client.core.PushHandler; import com.sean.im.client.form.MainForm; import com.sean.im.client.tray.TrayManager; import com.sean.im.client.util.MusicUtil; import com.sean.im.commom.core.Protocol; import com.sean.im.commom.entity.Message; /** * 移除群成员 * @author sean */ public class KickOutFlockHandler implements PushHandler { @Override public void execute(Protocol notify) { Message msg = JSON.parseObject(notify.getParameter("msg"), Message.class); // 界面上删除群 long flockId = Long.parseLong(msg.getContent()); MainForm.FORM.getFlockList().removeFlock(flockId); // 压入消息队列 ApplicationContext.CTX.getMessageQueue().add(msg); // 提示系统托盘闪烁 TrayManager.getInstance().startLight(0); MusicUtil.play(Global.Root + "resource/sound/msg.wav"); } }
seanzwx/tmp
seatalk/im/im-client/src/main/java/com/sean/im/client/push/handler/KickOutFlockHandler.java
Java
apache-2.0
1,004
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!-- NewPage --> <html lang="en"> <head> <!-- Generated by javadoc (1.8.0_60) on Mon Mar 28 17:12:30 AEST 2016 --> <title>Uses of Class org.apache.river.start.SharedActivatableServiceDescriptor (River-Internet vtrunk API Documentation (internals))</title> <meta name="date" content="2016-03-28"> <link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style"> <script type="text/javascript" src="../../../../../script.js"></script> </head> <body> <script type="text/javascript"><!-- try { if (location.href.indexOf('is-external=true') == -1) { parent.document.title="Uses of Class org.apache.river.start.SharedActivatableServiceDescriptor (River-Internet vtrunk API Documentation (internals))"; } } catch(err) { } //--> </script> <noscript> <div>JavaScript is disabled on your browser.</div> </noscript> <!-- ========= START OF TOP NAVBAR ======= --> <div class="topNav"><a name="navbar.top"> <!-- --> </a> <div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div> <a name="navbar.top.firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../../../overview-summary.html">Overview</a></li> <li><a href="../package-summary.html">Package</a></li> <li><a href="../../../../../org/apache/river/start/SharedActivatableServiceDescriptor.html" title="class in org.apache.river.start">Class</a></li> <li class="navBarCell1Rev">Use</li> <li><a href="../package-tree.html">Tree</a></li> <li><a href="../../../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../../../index-all.html">Index</a></li> <li><a href="../../../../../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li>Prev</li> <li>Next</li> </ul> <ul class="navList"> <li><a href="../../../../../index.html?org/apache/river/start/class-use/SharedActivatableServiceDescriptor.html" target="_top">Frames</a></li> <li><a href="SharedActivatableServiceDescriptor.html" target="_top">No&nbsp;Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_top"> <li><a href="../../../../../allclasses-noframe.html">All&nbsp;Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_top"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <a name="skip.navbar.top"> <!-- --> </a></div> <!-- ========= END OF TOP NAVBAR ========= --> <div class="header"> <h2 title="Uses of Class org.apache.river.start.SharedActivatableServiceDescriptor" class="title">Uses of Class<br>org.apache.river.start.SharedActivatableServiceDescriptor</h2> </div> <div class="classUseContainer"> <ul class="blockList"> <li class="blockList"> <table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing packages, and an explanation"> <caption><span>Packages that use <a href="../../../../../org/apache/river/start/SharedActivatableServiceDescriptor.html" title="class in org.apache.river.start">SharedActivatableServiceDescriptor</a></span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Package</th> <th class="colLast" scope="col">Description</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><a href="#org.apache.river.tool.envcheck.plugins">org.apache.river.tool.envcheck.plugins</a></td> <td class="colLast">&nbsp;</td> </tr> </tbody> </table> </li> <li class="blockList"> <ul class="blockList"> <li class="blockList"><a name="org.apache.river.tool.envcheck.plugins"> <!-- --> </a> <h3>Uses of <a href="../../../../../org/apache/river/start/SharedActivatableServiceDescriptor.html" title="class in org.apache.river.start">SharedActivatableServiceDescriptor</a> in <a href="../../../../../org/apache/river/tool/envcheck/plugins/package-summary.html">org.apache.river.tool.envcheck.plugins</a></h3> <table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing methods, and an explanation"> <caption><span>Methods in <a href="../../../../../org/apache/river/tool/envcheck/plugins/package-summary.html">org.apache.river.tool.envcheck.plugins</a> with parameters of type <a href="../../../../../org/apache/river/start/SharedActivatableServiceDescriptor.html" title="class in org.apache.river.start">SharedActivatableServiceDescriptor</a></span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colLast" scope="col">Method and Description</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><code>private <a href="http://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></code></td> <td class="colLast"><span class="typeNameLabel">CheckPersistence.</span><code><span class="memberNameLink"><a href="../../../../../org/apache/river/tool/envcheck/plugins/CheckPersistence.html#checkDir-java.lang.String-org.apache.river.start.SharedActivatableServiceDescriptor-">checkDir</a></span>(<a href="http://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;dir, <a href="../../../../../org/apache/river/start/SharedActivatableServiceDescriptor.html" title="class in org.apache.river.start">SharedActivatableServiceDescriptor</a>&nbsp;d)</code> <div class="block">Perform a check on the given persistence directory.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><code>private void</code></td> <td class="colLast"><span class="typeNameLabel">CheckPersistence.</span><code><span class="memberNameLink"><a href="../../../../../org/apache/river/tool/envcheck/plugins/CheckPersistence.html#checkDirectory-org.apache.river.start.SharedActivatableServiceDescriptor-">checkDirectory</a></span>(<a href="../../../../../org/apache/river/start/SharedActivatableServiceDescriptor.html" title="class in org.apache.river.start">SharedActivatableServiceDescriptor</a>&nbsp;d)</code> <div class="block">Launch a subtask for the given descriptor to obtain all the <code>persistenceDirectory</code> entries.</div> </td> </tr> <tr class="altColor"> <td class="colFirst"><code>private void</code></td> <td class="colLast"><span class="typeNameLabel">CheckPersistence.</span><code><span class="memberNameLink"><a href="../../../../../org/apache/river/tool/envcheck/plugins/CheckPersistence.html#checkEntries-java.lang.String:A-org.apache.river.start.SharedActivatableServiceDescriptor-java.lang.String-">checkEntries</a></span>(<a href="http://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>[]&nbsp;entries, <a href="../../../../../org/apache/river/start/SharedActivatableServiceDescriptor.html" title="class in org.apache.river.start">SharedActivatableServiceDescriptor</a>&nbsp;d, <a href="http://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;source)</code> <div class="block">Check <code>entries</code> for validity.</div> </td> </tr> </tbody> </table> </li> </ul> </li> </ul> </div> <!-- ======= START OF BOTTOM NAVBAR ====== --> <div class="bottomNav"><a name="navbar.bottom"> <!-- --> </a> <div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div> <a name="navbar.bottom.firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../../../overview-summary.html">Overview</a></li> <li><a href="../package-summary.html">Package</a></li> <li><a href="../../../../../org/apache/river/start/SharedActivatableServiceDescriptor.html" title="class in org.apache.river.start">Class</a></li> <li class="navBarCell1Rev">Use</li> <li><a href="../package-tree.html">Tree</a></li> <li><a href="../../../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../../../index-all.html">Index</a></li> <li><a href="../../../../../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li>Prev</li> <li>Next</li> </ul> <ul class="navList"> <li><a href="../../../../../index.html?org/apache/river/start/class-use/SharedActivatableServiceDescriptor.html" target="_top">Frames</a></li> <li><a href="SharedActivatableServiceDescriptor.html" target="_top">No&nbsp;Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_bottom"> <li><a href="../../../../../allclasses-noframe.html">All&nbsp;Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_bottom"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <a name="skip.navbar.bottom"> <!-- --> </a></div> <!-- ======== END OF BOTTOM NAVBAR ======= --> <p class="legalCopy"><small>Copyright 2007-2013, multiple authors.<br>Licensed under the <a href=http://www.apache.org/licenses/LICENSE-2.0 target=child >Apache License, Version 2.0</a>, see the <a href=../../../../../doc-files/NOTICE target=child >NOTICE</a> file for attributions.</small></p> </body> </html>
pfirmstone/JGDMS
JGDMS/src/site/resources/old-static-site/doc/internals/org/apache/river/start/class-use/SharedActivatableServiceDescriptor.html
HTML
apache-2.0
9,436
/* * Copyright 2000-2009 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.intellij.psi.impl.cache.impl.idCache; import com.intellij.lexer.Lexer; import com.intellij.lexer.XHtmlHighlightingLexer; import com.intellij.psi.impl.cache.impl.BaseFilterLexer; import com.intellij.psi.impl.cache.impl.id.LexerBasedIdIndexer; public class XHtmlIdIndexer extends LexerBasedIdIndexer { protected Lexer createLexer(final BaseFilterLexer.OccurrenceConsumer consumer) { return new XHtmlFilterLexer(new XHtmlHighlightingLexer(), consumer); } }
jexp/idea2
xml/impl/src/com/intellij/psi/impl/cache/impl/idCache/XHtmlIdIndexer.java
Java
apache-2.0
1,077
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id: XSValueTest.cpp 568078 2007-08-21 11:43:25Z amassari $ * $Log$ * Revision 1.17 2005/05/05 09:46:11 cargilld * Update XSValue to handle float and double the same way the main library does, converting values to infinityr or zero, as the C ranges for float and double are less than the schema ranges. * * Revision 1.16 2005/04/05 20:26:48 cargilld * Update XSValue to handle leading and trailing whitespace. * * Revision 1.15 2005/02/25 18:30:46 cargilld * Attempt to fix compiler errors. * * Revision 1.14 2005/02/25 09:38:23 gareth * Fix for compile under gcc 4. Patch by Scott Cantor. * * Revision 1.13 2004/12/23 16:11:21 cargilld * Various XSValue updates: use ulong for postiveInteger; reset date fields to zero; modifty XSValueTest to test the returned value from getActualValue. * * Revision 1.12 2004/11/14 19:02:21 peiyongz * error status for numeric data types tested * * Revision 1.11 2004/09/13 21:25:11 peiyongz * DATATYPE_TEST added * * Revision 1.10 2004/09/10 13:55:00 peiyongz * to run on 64 box * * Revision 1.9 2004/09/09 20:10:04 peiyongz * Using new error code * * Revision 1.8 2004/09/08 19:56:32 peiyongz * Remove parameter toValidate from validation interface * * Revision 1.7 2004/09/08 13:57:06 peiyongz * Apache License Version 2.0 * * Revision 1.6 2004/08/31 20:53:43 peiyongz * Testing time zone * * Revision 1.5 2004/08/31 15:15:16 peiyongz * remove XSValueContext * * Revision 1.4 2004/08/24 16:00:15 peiyongz * To build on AIX/Win2003-ecl * * Revision 1.3 2004/08/23 17:07:57 peiyongz * Minimum representable range on all platforms * * Revision 1.2 2004/08/19 21:29:28 peiyongz * no message * * Revision 1.1 2004/08/19 17:17:21 peiyongz * XSValueTest * * */ // --------------------------------------------------------------------------- // Includes // --------------------------------------------------------------------------- #include "XSValueTest.hpp" #include <xercesc/validators/schema/SchemaSymbols.hpp> #include <xercesc/util/XMLUni.hpp> #if defined(XERCES_NEW_IOSTREAMS) #include <fstream> #else #include <fstream.h> #endif #include <stdio.h> #include <math.h> #include <xercesc/framework/psvi/XSValue.hpp> #include <xercesc/util/PlatformUtils.hpp> static const bool EXP_RET_VALID_TRUE = true; static const bool EXP_RET_VALUE_TRUE = true; static const bool EXP_RET_CANREP_TRUE = true; static const bool EXP_RET_VALID_FALSE = false; static const bool EXP_RET_VALUE_FALSE = false; static const bool EXP_RET_CANREP_FALSE = false; static const XSValue::Status DONT_CARE = XSValue::st_UnknownType; static bool errSeen = false; static const XMLCh* getDataTypeString(const XSValue::DataType dt) { switch(dt) { case XSValue::dt_string: return SchemaSymbols::fgDT_STRING; case XSValue::dt_boolean: return SchemaSymbols::fgDT_BOOLEAN; case XSValue::dt_decimal: return SchemaSymbols::fgDT_DECIMAL; case XSValue::dt_float: return SchemaSymbols::fgDT_FLOAT; case XSValue::dt_double: return SchemaSymbols::fgDT_DOUBLE; case XSValue::dt_duration: return SchemaSymbols::fgDT_DURATION; case XSValue::dt_dateTime: return SchemaSymbols::fgDT_DATETIME; case XSValue::dt_time: return SchemaSymbols::fgDT_TIME; case XSValue::dt_date: return SchemaSymbols::fgDT_DATE; case XSValue::dt_gYearMonth: return SchemaSymbols::fgDT_YEARMONTH; case XSValue::dt_gYear: return SchemaSymbols::fgDT_YEAR; case XSValue::dt_gMonthDay: return SchemaSymbols::fgDT_MONTHDAY; case XSValue::dt_gDay: return SchemaSymbols::fgDT_DAY; case XSValue::dt_gMonth: return SchemaSymbols::fgDT_MONTH; case XSValue::dt_hexBinary: return SchemaSymbols::fgDT_HEXBINARY; case XSValue::dt_base64Binary: return SchemaSymbols::fgDT_BASE64BINARY; case XSValue::dt_anyURI: return SchemaSymbols::fgDT_ANYURI; case XSValue::dt_QName: return SchemaSymbols::fgDT_QNAME; case XSValue::dt_NOTATION: return XMLUni::fgNotationString; case XSValue::dt_normalizedString: return SchemaSymbols::fgDT_NORMALIZEDSTRING; case XSValue::dt_token: return SchemaSymbols::fgDT_TOKEN; case XSValue::dt_language: return SchemaSymbols::fgDT_LANGUAGE; case XSValue::dt_NMTOKEN: return XMLUni::fgNmTokenString; case XSValue::dt_NMTOKENS: return XMLUni::fgNmTokensString; case XSValue::dt_Name: return SchemaSymbols::fgDT_NAME; case XSValue::dt_NCName: return SchemaSymbols::fgDT_NCNAME; case XSValue::dt_ID: return XMLUni::fgIDString; case XSValue::dt_IDREF: return XMLUni::fgIDRefString; case XSValue::dt_IDREFS: return XMLUni::fgIDRefsString; case XSValue::dt_ENTITY: return XMLUni::fgEntityString; case XSValue::dt_ENTITIES: return XMLUni::fgEntitiesString; case XSValue::dt_integer: return SchemaSymbols::fgDT_INTEGER; case XSValue::dt_nonPositiveInteger: return SchemaSymbols::fgDT_NONPOSITIVEINTEGER; case XSValue::dt_negativeInteger: return SchemaSymbols::fgDT_NEGATIVEINTEGER; case XSValue::dt_long: return SchemaSymbols::fgDT_LONG; case XSValue::dt_int: return SchemaSymbols::fgDT_INT; case XSValue::dt_short: return SchemaSymbols::fgDT_SHORT; case XSValue::dt_byte: return SchemaSymbols::fgDT_BYTE; case XSValue::dt_nonNegativeInteger: return SchemaSymbols::fgDT_NONNEGATIVEINTEGER; case XSValue::dt_unsignedLong: return SchemaSymbols::fgDT_ULONG; case XSValue::dt_unsignedInt: return SchemaSymbols::fgDT_UINT; case XSValue::dt_unsignedShort: return SchemaSymbols::fgDT_USHORT; case XSValue::dt_unsignedByte: return SchemaSymbols::fgDT_UBYTE; case XSValue::dt_positiveInteger: return SchemaSymbols::fgDT_POSITIVEINTEGER; default: return 0; } } static bool compareActualValue( const XSValue::DataType datatype , const XSValue::XSValue_Data actValue , const XSValue::XSValue_Data expValue) { switch (datatype) { case XSValue::dt_boolean: if (actValue.fValue.f_bool == expValue.fValue.f_bool) return true; printf("ACTVALUE_TEST Unexpected XSValue for dt_boolean, got %d expected %d\n", actValue.fValue.f_bool, expValue.fValue.f_bool); return false; case XSValue::dt_decimal: if (fabs(actValue.fValue.f_double - expValue.fValue.f_double) < fabs(actValue.fValue.f_double)/1000) return true; printf("ACTVALUE_TEST Unexpected XSValue for datatype %s, got %f expected %f\n", StrX(getDataTypeString(datatype)).localForm(), actValue.fValue.f_double, expValue.fValue.f_double); return false; case XSValue::dt_double: if (actValue.fValue.f_doubleType.f_doubleEnum == XSValue::DoubleFloatType_Normal) { if (fabs(actValue.fValue.f_double - expValue.fValue.f_double) < fabs(actValue.fValue.f_double)/1000) return true; printf("ACTVALUE_TEST Unexpected XSValue for datatype %s, got %f expected %f\n", StrX(getDataTypeString(datatype)).localForm(), actValue.fValue.f_double, expValue.fValue.f_double); return false; } else { if (actValue.fValue.f_doubleType.f_doubleEnum == expValue.fValue.f_doubleType.f_doubleEnum) return true; printf("ACTVALUE_TEST Unexpected XSValue enum for datatype %s, got %d expected %d\n", StrX(getDataTypeString(datatype)).localForm(), actValue.fValue.f_doubleType.f_doubleEnum, expValue.fValue.f_doubleType.f_doubleEnum); return false; } case XSValue::dt_float: if (actValue.fValue.f_floatType.f_floatEnum == XSValue::DoubleFloatType_Normal) { if (fabs(actValue.fValue.f_float - expValue.fValue.f_float) < fabs(actValue.fValue.f_float)/1000) return true; printf("ACTVALUE_TEST Unexpected XSValue for datatype %s, got %f expected %f\n", StrX(getDataTypeString(datatype)).localForm(), actValue.fValue.f_float, expValue.fValue.f_float); return false; } else { if (actValue.fValue.f_floatType.f_floatEnum == expValue.fValue.f_floatType.f_floatEnum) return true; printf("ACTVALUE_TEST Unexpected XSValue enum for datatype %s, got %d expected %d\n", StrX(getDataTypeString(datatype)).localForm(), actValue.fValue.f_floatType.f_floatEnum, expValue.fValue.f_floatType.f_floatEnum); return false; } case XSValue::dt_duration: case XSValue::dt_dateTime: case XSValue::dt_time: case XSValue::dt_date: case XSValue::dt_gYearMonth: case XSValue::dt_gYear: case XSValue::dt_gMonthDay: case XSValue::dt_gDay: case XSValue::dt_gMonth: if (actValue.fValue.f_datetime.f_year == expValue.fValue.f_datetime.f_year && actValue.fValue.f_datetime.f_month == expValue.fValue.f_datetime.f_month && actValue.fValue.f_datetime.f_day == expValue.fValue.f_datetime.f_day && actValue.fValue.f_datetime.f_hour == expValue.fValue.f_datetime.f_hour && actValue.fValue.f_datetime.f_min == expValue.fValue.f_datetime.f_min && actValue.fValue.f_datetime.f_second == expValue.fValue.f_datetime.f_second && (fabs(actValue.fValue.f_datetime.f_milisec - expValue.fValue.f_datetime.f_milisec) < 0.01)) return true; printf("ACTVALUE_TEST Unexpected %s XSValue\n", StrX(getDataTypeString(datatype)).localForm()); printf(" Actual year = %d, month = %d, day = %d, hour = %d, min = %d, second = %d, milisec = %f\n", actValue.fValue.f_datetime.f_year, actValue.fValue.f_datetime.f_month, actValue.fValue.f_datetime.f_day, actValue.fValue.f_datetime.f_hour, actValue.fValue.f_datetime.f_min, actValue.fValue.f_datetime.f_second, actValue.fValue.f_datetime.f_milisec); printf(" Expect year = %d, month = %d, day = %d, hour = %d, min = %d, second = %d, milisec = %f\n", expValue.fValue.f_datetime.f_year, expValue.fValue.f_datetime.f_month, expValue.fValue.f_datetime.f_day, expValue.fValue.f_datetime.f_hour, expValue.fValue.f_datetime.f_min, expValue.fValue.f_datetime.f_second, expValue.fValue.f_datetime.f_milisec); return false; case XSValue::dt_hexBinary: // in the tests in this file the hexBinary data is always 2 long... if (actValue.fValue.f_byteVal[0] == expValue.fValue.f_byteVal[0] && actValue.fValue.f_byteVal[1] == expValue.fValue.f_byteVal[1]) return true; printf("ACTVALUE_TEST Unexpected hexBinary value\n"); printf(" Actual Value = %x:%x\n",actValue.fValue.f_byteVal[0],actValue.fValue.f_byteVal[1]); printf(" Expect Value = %x:%x\n",expValue.fValue.f_byteVal[0],expValue.fValue.f_byteVal[1]); return false; case XSValue::dt_base64Binary: // in the tests in this file the base64Binary data is always 9 long (XMLByte[9]) // however, a zero byte is used to indicate when the smaller data stream is empty { for (unsigned int i=0; i<9; i++) { if (!expValue.fValue.f_byteVal[i]) return true; if (actValue.fValue.f_byteVal[i] != expValue.fValue.f_byteVal[i]) { printf("ACTVALUE_TEST Unexpected base64Binary value for byte %d\n", i); printf(" Actual Value = %x\n",actValue.fValue.f_byteVal[i]); printf(" Expect Value = %x\n",expValue.fValue.f_byteVal[i]); return false; } } return true; } case XSValue::dt_string: case XSValue::dt_anyURI: case XSValue::dt_QName: case XSValue::dt_NOTATION: case XSValue::dt_normalizedString: case XSValue::dt_token: case XSValue::dt_language: case XSValue::dt_NMTOKEN: case XSValue::dt_NMTOKENS: case XSValue::dt_Name: case XSValue::dt_NCName: case XSValue::dt_ID: case XSValue::dt_IDREF: case XSValue::dt_IDREFS: case XSValue::dt_ENTITY: case XSValue::dt_ENTITIES: printf("ACTVALUE_TEST no Actual Value for datatype %s\n", StrX(getDataTypeString(datatype)).localForm()); return false; case XSValue::dt_integer: case XSValue::dt_nonPositiveInteger: case XSValue::dt_negativeInteger: case XSValue::dt_long: if (actValue.fValue.f_long == expValue.fValue.f_long) return true; printf("ACTVALUE_TEST Unexpected %s XSValue, got %d expected %d\n", StrX(getDataTypeString(datatype)).localForm(), actValue.fValue.f_long, expValue.fValue.f_long); return false; case XSValue::dt_int: if (actValue.fValue.f_int == expValue.fValue.f_int) return true; printf("ACTVALUE_TEST Unexpected dt_int XSValue, got %d expected %d\n", actValue.fValue.f_int, expValue.fValue.f_int); return false; case XSValue::dt_short: if (actValue.fValue.f_short == expValue.fValue.f_short) return true; printf("ACTVALUE_TEST Unexpected dt_short XSValue, got %d expected %d\n", actValue.fValue.f_short, expValue.fValue.f_short); return false; case XSValue::dt_byte: if (actValue.fValue.f_char == expValue.fValue.f_char) return true; printf("ACTVALUE_TEST Unexpected dt_byte XSValue, got %d expected %d\n", actValue.fValue.f_char, expValue.fValue.f_char); return false; case XSValue::dt_nonNegativeInteger: case XSValue::dt_unsignedLong: case XSValue::dt_positiveInteger: if (actValue.fValue.f_ulong == expValue.fValue.f_ulong) return true; printf("ACTVALUE_TEST Unexpected %s XSValue, got %d expected %d\n", StrX(getDataTypeString(datatype)).localForm(), actValue.fValue.f_ulong, expValue.fValue.f_ulong); return false; case XSValue::dt_unsignedInt: if (actValue.fValue.f_uint == expValue.fValue.f_uint) return true; printf("ACTVALUE_TEST Unexpected dt_unsignedIntXSValue, got %d expected %d\n", actValue.fValue.f_uint, expValue.fValue.f_uint); return false; case XSValue::dt_unsignedShort: if (actValue.fValue.f_ushort == expValue.fValue.f_ushort) return true; printf("ACTVALUE_TEST Unexpected dt_unsignedShort XSValue, got %d expected %d\n", actValue.fValue.f_ushort, expValue.fValue.f_ushort); return false; case XSValue::dt_unsignedByte: if (actValue.fValue.f_uchar == expValue.fValue.f_uchar) return true; printf("ACTVALUE_TEST Unexpected dt_unsignedByte XSValue, got %d expected %d\n", actValue.fValue.f_uchar, expValue.fValue.f_uchar); return false; default: printf("ACTVALUE_TEST Unexpected datatype\n"); return false; } } static char* getStatusString(const XSValue::Status status) { switch (status) { case XSValue::st_Init: return "st_Init"; break; case XSValue::st_NoContent: return "st_NoContent"; break; case XSValue::st_NoCanRep: return "st_NoCanRep"; break; case XSValue::st_NoActVal: return "st_NoActVal"; break; case XSValue::st_NotSupported: return "st_NotSupported"; break; case XSValue::st_CantCreateRegEx: return "st_CantCreateRegEx"; break; case XSValue::st_FOCA0002: return "st_FOCA0002"; break; case XSValue::st_FOCA0001: return "st_FOCA0001"; break; case XSValue::st_FOCA0003: return "st_FOCA0003"; break; case XSValue::st_FODT0003: return "st_FODT0003"; break; case XSValue::st_UnknownType: return "st_UnknownType"; break; default: return "st_UnknownType"; break; } } /** * This is to test methods for XSValue */ #ifdef _DEBUG void VALIDATE_TEST( const char* const data , const XSValue::DataType datatype , bool expRetValid , const XSValue::Status expStatus ) { XSValue::Status myStatus = XSValue::st_Init; bool actRetValid = XSValue::validate( StrX(data).unicodeForm() , datatype , myStatus , XSValue::ver_10 , XMLPlatformUtils::fgMemoryManager); if (actRetValid != expRetValid) { printf("VALIDATE_TEST Validation Fail: data=<%s>, datatype=<%s>, expRetVal=<%d>\n", data, StrX(getDataTypeString(datatype)).localForm(), expRetValid); errSeen = true; } else { if (!expRetValid && expStatus != DONT_CARE && expStatus != myStatus ) { printf("VALIDATE_TEST Context Diff, data=<%s> datatype=<%s>, expStatus=<%s>, actStatus=<%s>\n", data, StrX(getDataTypeString(datatype)).localForm(), getStatusString(expStatus), getStatusString(myStatus)); errSeen = true; } } } #else #define VALIDATE_TEST(data, datatype, expRetValid, expStatus) \ { \ XSValue::Status myStatus = XSValue::st_Init; \ bool actRetValid = XSValue::validate( \ StrX(data).unicodeForm() \ , datatype \ , myStatus \ , XSValue::ver_10 \ , XMLPlatformUtils::fgMemoryManager); \ if (actRetValid != expRetValid) { \ printf("VALIDATE_TEST Validation Fail: \ at line <%d>, data=<%s>, datatype=<%s>, expRetVal=<%d>\n" \ , __LINE__, data, StrX(getDataTypeString(datatype)).localForm() \ , expRetValid); \ errSeen = true; \ } \ else { \ if (!expRetValid && \ expStatus != DONT_CARE && \ expStatus != myStatus ) { \ printf("VALIDATE_TEST Context Diff, \ at line <%d>, data=<%s> datatype=<%s>, \ expStatus=<%s>, actStatus=<%s>\n" \ , __LINE__, data, StrX(getDataTypeString(datatype)).localForm(), \ getStatusString(expStatus), getStatusString(myStatus)); \ errSeen = true; \ } \ } \ } #endif #ifdef _DEBUG void ACTVALUE_TEST( const char* const data , const XSValue::DataType datatype , bool toValidate , bool expRetValue , const XSValue::Status expStatus , const XSValue::XSValue_Data expValue ) { XSValue::Status myStatus = XSValue::st_Init; XSValue* actRetValue = XSValue::getActualValue( StrX(data).unicodeForm() , datatype , myStatus , XSValue::ver_10 , toValidate , XMLPlatformUtils::fgMemoryManager); if (actRetValue) { if (!expRetValue) { printf("ACTVALUE_TEST XSValue returned: data=<%s>, datatype=<%s>\n", data, StrX(getDataTypeString(datatype)).localForm()); errSeen = true; } else if (!compareActualValue(datatype, actRetValue->fData, expValue)) { errSeen = true; } delete actRetValue; } else { if (expRetValue) { printf("ACTVALUE_TEST No XSValue returned, data=<%s>, datatype=<%s>\n" , data, StrX(getDataTypeString(datatype)).localForm()); errSeen = true; } else { if (expStatus != DONT_CARE && expStatus != myStatus ) { printf("ACTVALUE_TEST Context Diff, data=<%s>, datatype=<%s>, expStatus=<%s>, actStatus=<%s>\n" , data, StrX(getDataTypeString(datatype)).localForm(), getStatusString(expStatus), getStatusString(myStatus)); errSeen = true; } } } } #else #define ACTVALUE_TEST(data, datatype, toValidate, expRetValue, expStatus, expValue) \ { \ XSValue::Status myStatus = XSValue::st_Init; \ XSValue* actRetValue = XSValue::getActualValue( \ StrX(data).unicodeForm() \ , datatype \ , myStatus \ , XSValue::ver_10 \ , toValidate \ , XMLPlatformUtils::fgMemoryManager); \ if (actRetValue) { \ if (!expRetValue) { \ printf("ACTVALUE_TEST XSValue returned, \ at line <%d> data=<%s>, datatype=<%s>\n" \ ,__LINE__, data, StrX(getDataTypeString(datatype)).localForm()); \ errSeen = true; \ } \ else if (!compareActualValue(datatype, actRetValue->fData, expValue)) { \ errSeen = true; \ } \ delete actRetValue; \ } \ else { \ if (expRetValue) { \ printf("ACTVALUE_TEST No XSValue returned, \ at line <%d> data=<%s>, datatype=<%s>\n" \ , __LINE__, data, StrX(getDataTypeString(datatype)).localForm()); \ errSeen = true; \ } \ else { \ if (expStatus != DONT_CARE && \ expStatus != myStatus) { \ printf("ACTVALUE_TEST Context Diff, \ at line <%d> data=<%s>, datatype=<%s>, \ expStatus=<%s>, actStatus=<%s>\n" \ , __LINE__, data, StrX(getDataTypeString(datatype)).localForm() \ , getStatusString(expStatus), getStatusString(myStatus)); \ errSeen = true; \ } \ } \ } \ } #endif #ifdef _DEBUG void CANREP_TEST(const char* const data , const XSValue::DataType datatype , bool toValidate , bool expRetCanRep , const char* const toCompare , const XSValue::Status expStatus ) { XSValue::Status myStatus = XSValue::st_Init; XMLCh* actRetCanRep = XSValue::getCanonicalRepresentation( StrX(data).unicodeForm() , datatype , myStatus , XSValue::ver_10 , toValidate , XMLPlatformUtils::fgMemoryManager); if (actRetCanRep) { if (!expRetCanRep) { printf("CANREP_TEST CanRep returned, data=<%s>, datatype=<%s>\n" , data, StrX(getDataTypeString(datatype)).localForm()); XMLPlatformUtils::fgMemoryManager->deallocate(actRetCanRep); errSeen = true; } else { char* actRetCanRep_inchar = XMLString::transcode(actRetCanRep); if (!XMLString::equals(actRetCanRep_inchar, toCompare)) { printf("CANREP_TEST CanRep Diff , data=<%s>, datatype=<%s>, actCanRep=<%s>, toCompare=<%s>\n" , data, StrX(getDataTypeString(datatype)).localForm(), actRetCanRep_inchar, toCompare); errSeen = true; } XMLPlatformUtils::fgMemoryManager->deallocate(actRetCanRep); XMLString::release(&actRetCanRep_inchar); } } else { if (expRetCanRep) { printf("CANREP_TEST No CanRep returned, data=<%s>, datatype=<%s>\n" , data, StrX(getDataTypeString(datatype)).localForm()); errSeen = true; } else { if (expStatus != DONT_CARE && expStatus != myStatus ) { printf("CANREP_TEST Context Diff, data=<%s>, datatype=<%s>\n expStatus=<%s>, actStatus=<%s>\n" , data, StrX(getDataTypeString(datatype)).localForm(), getStatusString(expStatus), getStatusString(myStatus)); errSeen = true; } } } } #else #define CANREP_TEST(data, datatype, toValidate, expRetCanRep, toCompare, expStatus) \ { \ XSValue::Status myStatus = XSValue::st_Init; \ XMLCh* actRetCanRep = XSValue::getCanonicalRepresentation( \ StrX(data).unicodeForm() \ , datatype \ , myStatus \ , XSValue::ver_10 \ , toValidate \ , XMLPlatformUtils::fgMemoryManager); \ if (actRetCanRep) { \ if (!expRetCanRep) { \ printf("CANREP_TEST CanRep returned: \ at line <%d> data=<%s>, datatype=<%s>\n" \ , __LINE__, data, StrX(getDataTypeString(datatype)).localForm()); \ XMLPlatformUtils::fgMemoryManager->deallocate(actRetCanRep); \ errSeen = true; \ } \ else { \ char* actRetCanRep_inchar = XMLString::transcode(actRetCanRep); \ if (!XMLString::equals(actRetCanRep_inchar, toCompare)) { \ printf("CANREP_TEST CanRep Diff \ , at line <%d> data=<%s>, datatype=<%s>, \ actCanRep=<%s>, toCompare=<%s>\n" \ , __LINE__, data, StrX(getDataTypeString(datatype)).localForm() \ , actRetCanRep_inchar, toCompare); \ errSeen = true; \ } \ XMLPlatformUtils::fgMemoryManager->deallocate(actRetCanRep); \ XMLString::release(&actRetCanRep_inchar); \ } \ } \ else { \ if (expRetCanRep){ \ printf("CANREP_TEST No CanRep returned, \ at line <%d> data=<%s>, datatype=<%s>\n" \ , __LINE__, data, StrX(getDataTypeString(datatype)).localForm()); \ errSeen = true; \ } \ else { \ if (expStatus != myStatus) { \ printf("CANREP_TEST Context Diff, \ at line <%d> data=<%s>, datatype=<%s>\n \ expStatus=<%s>, actStatus=<%s>\n" \ , __LINE__, data, StrX(getDataTypeString(datatype)).localForm() \ , getStatusString(expStatus), getStatusString(myStatus)); \ errSeen = true; \ } \ } \ } \ } #endif #ifdef _DEBUG void DATATYPE_TEST( const XMLCh* const dt_String , const XSValue::DataType expDataType ) { XSValue::DataType actDataType = XSValue::getDataType(dt_String); if (actDataType != expDataType) { char* dt_str = XMLString::transcode(dt_String); printf("DATATYPE_TEST Fails: data=<%s>, actDataType=<%d>, expDataType=<%d>\n", dt_str, actDataType, expDataType); XMLString::release(&dt_str); errSeen = true; } } #else #define DATATYPE_TEST(dt_String, expDataType) \ { \ XSValue::DataType actDataType = XSValue::getDataType(dt_String); \ if (actDataType != expDataType) \ { \ char* dt_str = XMLString::transcode(dt_String); \ printf("DATATYPE_TEST Fails: data=<%s>, actDataType=<%d>, expDataType=<%d>\n", \ dt_str, actDataType, expDataType); \ XMLString::release(&dt_str); \ errSeen = true; \ } \ } #endif void testNoActVal(const char* const data , const XSValue::DataType datatype , const XSValue::Status expStatus) { XSValue::Status ret_Status = XSValue::st_Init; XSValue* actVal = XSValue::getActualValue(StrX(data).unicodeForm(), datatype, ret_Status); if (actVal) { printf("testNoActVal fails, data=<%s>\n", data); delete actVal; errSeen=true; return; } if (ret_Status != expStatus) { printf("testNoActVal fails, data=<%s> retStatus=<%s> expStatus=<%s>\n", data , getStatusString(ret_Status) , getStatusString(expStatus)); errSeen=true; } } void testNoCanRep(const char* const data , const XSValue::DataType datatype , const XSValue::Status expStatus) { XSValue::Status ret_Status = XSValue::st_Init; XMLCh* canRep = XSValue::getCanonicalRepresentation(StrX(data).unicodeForm(), datatype, ret_Status); if (canRep) { printf("testNoCanRep fails, data=<%s>\n", data); delete canRep; errSeen=true; return; } if (ret_Status != expStatus) { printf("testNoCanRep fails, data=<%s> retStatus=<%s> expStatus=<%s>\n", data , getStatusString(ret_Status) , getStatusString(expStatus)); errSeen=true; } } /*** * Test cases ***/ void test_dt_decimal() { const XSValue::DataType dt = XSValue::dt_decimal; bool toValidate = true; const char lex_v_ran_v_1[]=" 1234.567 \n"; const char lex_v_ran64_v_1[]="18446744073709551615.999"; const char lex_v_ran64_v_2[]="999.18446744073709551615"; const char lex_v_ran64_iv_1[]="18446744073709551616.999"; const char lex_v_ran64_iv_2[]="999.18446744073709551616"; const char lex_v_ran32_v_1[]="4294967295.999"; const char lex_v_ran32_v_2[]="999.4294967295"; const char lex_v_ran32_iv_1[]="4294967296.999"; const char lex_v_ran32_iv_2[]="999.4294967296"; const char lex_iv_1[]="12b34.456"; const char lex_iv_2[]="1234.56.789"; XSValue::XSValue_Data act_v_ran_v_1; act_v_ran_v_1.fValue.f_double = (double)1234.567; #if defined(XML_BITSTOBUILD_64) XSValue::XSValue_Data act_v_ran64_v_1; act_v_ran64_v_1.fValue.f_double = (double)18446744073709551615.999; XSValue::XSValue_Data act_v_ran64_v_2; act_v_ran64_v_2.fValue.f_double = (double)999.18446744073709551615; //XSValue::XSValue_Data act_v_ran64_iv_1;="18446744073709551616.999"; //XSValue::XSValue_Data act_v_ran64_iv_2;="999.18446744073709551616"; #endif XSValue::XSValue_Data act_v_ran32_v_1; act_v_ran32_v_1.fValue.f_double = (double)4294967295.999; XSValue::XSValue_Data act_v_ran32_v_2; act_v_ran32_v_2.fValue.f_double = (double)999.4294967295; //XSValue::XSValue_Data act_v_ran32_iv_1;="4294967296.999"; //XSValue::XSValue_Data act_v_ran32_iv_2;="999.4294967296"; /*** * 3.2.3.2 Canonical representation * * The canonical representation for decimal is defined by prohibiting certain options from the Lexical * representation (§3.2.3.1). Specifically, * 1. the preceding optional "+" sign is prohibited. * 2. The decimal point is required. * 3. Leading and trailing zeroes are prohibited subject to the following: * there must be at least one digit to the right and * to the left of the decimal point which may be a zero. ***/ const char data_rawstr_1[]=" -123.45 \n"; const char data_canrep_1[]="-123.45"; const char data_rawstr_2[]="+123.45"; const char data_canrep_2[]="123.45"; const char data_rawstr_3[]="12345"; const char data_canrep_3[]="12345.0"; const char data_rawstr_4[]="000123.45"; const char data_canrep_4[]="123.45"; const char data_rawstr_5[]="123.45000"; const char data_canrep_5[]="123.45"; const char data_rawstr_6[]="00.12345"; const char data_canrep_6[]="0.12345"; const char data_rawstr_7[]="123.00"; const char data_canrep_7[]="123.0"; /*** * * validate * --------- * availability return value context * ---------------------------------------------- * lexical valid * range valid true n/a * range invalid n/a * lexical invalid false st_FOCA0002 * ***/ // lexical valid VALIDATE_TEST(lex_v_ran_v_1 , dt, EXP_RET_VALID_TRUE, DONT_CARE); VALIDATE_TEST(lex_v_ran64_v_1 , dt, EXP_RET_VALID_TRUE, DONT_CARE); VALIDATE_TEST(lex_v_ran64_v_2 , dt, EXP_RET_VALID_TRUE, DONT_CARE); VALIDATE_TEST(lex_v_ran64_iv_1 , dt, EXP_RET_VALID_TRUE, DONT_CARE); VALIDATE_TEST(lex_v_ran64_iv_2 , dt, EXP_RET_VALID_TRUE, DONT_CARE); // lexical invalid VALIDATE_TEST(lex_iv_1 , dt, EXP_RET_VALID_FALSE, XSValue::st_FOCA0002); VALIDATE_TEST(lex_iv_2 , dt, EXP_RET_VALID_FALSE, XSValue::st_FOCA0002); /*** * * getActualValue * --------------- * availability return value context * ---------------------------------------------- * validation on * ============= * lexical valid * range valid XSValue n/a * range invalid 0 st_Unpresentable * lexical invalid 0 st_FOCA0002 * * validation off * ============== * lexical valid * range valid XSValue n/a * range invalid 0 st_Unpresentable * lexical invalid 0 st_FOCA0002 * ***/ for (int i = 0; i < 2; i++) { //validation on/off toValidate = ( 0 == i) ? true : false; ACTVALUE_TEST(lex_v_ran_v_1, dt, toValidate, EXP_RET_VALUE_TRUE, DONT_CARE, act_v_ran_v_1); #if defined(XML_BITSTOBUILD_64) ACTVALUE_TEST(lex_v_ran64_v_1 , dt, toValidate, EXP_RET_VALUE_TRUE, DONT_CARE, act_v_ran64_v_1); ACTVALUE_TEST(lex_v_ran64_v_2 , dt, toValidate, EXP_RET_VALUE_TRUE, DONT_CARE, act_v_ran64_v_2); //ACTVALUE_TEST(lex_v_ran64_iv_1, dt, toValidate, EXP_RET_VALUE_FALSE, XSValue::st_FOCA0001); //ACTVALUE_TEST(lex_v_ran64_iv_2, dt, toValidate, EXP_RET_VALUE_FALSE, XSValue::st_FOCA0001); #else ACTVALUE_TEST(lex_v_ran32_v_1, dt, toValidate, EXP_RET_VALUE_TRUE, DONT_CARE, act_v_ran32_v_1); ACTVALUE_TEST(lex_v_ran32_v_2, dt, toValidate, EXP_RET_VALUE_TRUE, DONT_CARE, act_v_ran32_v_2); //ACTVALUE_TEST(lex_v_ran32_iv_1, dt, toValidate, EXP_RET_VALUE_FALSE, XSValue::st_FOCA0001); //ACTVALUE_TEST(lex_v_ran32_iv_2, dt, toValidate, EXP_RET_VALUE_FALSE, XSValue::st_FOCA0001); #endif ACTVALUE_TEST(lex_iv_1, dt, toValidate, EXP_RET_VALUE_FALSE, XSValue::st_FOCA0002, act_v_ran32_v_1); ACTVALUE_TEST(lex_iv_2, dt, toValidate, EXP_RET_VALUE_FALSE, XSValue::st_FOCA0002, act_v_ran32_v_1); } /*** * * getCanonicalRepresentation * --------------------------- * availability return value context * ---------------------------------------------- * validation on * ============= * lexical valid * range valid XMLCh n/a * range invalid n/a * lexical invalid 0 st_FOCA0002 * * validation off * ============== * lexical valid * range valid XMLCh n/a * range invalid n/a * lexical invalid 0 st_FOCA0002 * ***/ for (int j = 0; j < 2; j++) { //validation on/off toValidate = ( 0 == j)? true : false; CANREP_TEST(data_rawstr_1, dt, toValidate, EXP_RET_CANREP_TRUE, data_canrep_1, DONT_CARE); CANREP_TEST(data_rawstr_2, dt, toValidate, EXP_RET_CANREP_TRUE, data_canrep_2, DONT_CARE); CANREP_TEST(data_rawstr_3, dt, toValidate, EXP_RET_CANREP_TRUE, data_canrep_3, DONT_CARE); CANREP_TEST(data_rawstr_4, dt, toValidate, EXP_RET_CANREP_TRUE, data_canrep_4, DONT_CARE); CANREP_TEST(data_rawstr_5, dt, toValidate, EXP_RET_CANREP_TRUE, data_canrep_5, DONT_CARE); CANREP_TEST(data_rawstr_6, dt, toValidate, EXP_RET_CANREP_TRUE, data_canrep_6, DONT_CARE); CANREP_TEST(data_rawstr_7, dt, toValidate, EXP_RET_CANREP_TRUE, data_canrep_7, DONT_CARE); CANREP_TEST(lex_v_ran64_v_1, dt, toValidate, EXP_RET_CANREP_TRUE, lex_v_ran64_v_1, DONT_CARE); CANREP_TEST(lex_v_ran64_v_2, dt, toValidate, EXP_RET_CANREP_TRUE, lex_v_ran64_v_2, DONT_CARE); CANREP_TEST(lex_v_ran64_iv_1, dt, toValidate, EXP_RET_CANREP_TRUE, lex_v_ran64_iv_1, DONT_CARE); CANREP_TEST(lex_v_ran64_iv_2, dt, toValidate, EXP_RET_CANREP_TRUE, lex_v_ran64_iv_2, DONT_CARE); CANREP_TEST(lex_iv_1 , dt, toValidate, EXP_RET_CANREP_FALSE, 0, XSValue::st_FOCA0002); CANREP_TEST(lex_iv_2 , dt, toValidate, EXP_RET_CANREP_FALSE, 0, XSValue::st_FOCA0002); } } /*** * FLT_EPSILON 1.192092896e-07F * FLT_MIN 1.175494351e-38F * FLT_MAX 3.402823466e+38F ***/ void test_dt_float() { const XSValue::DataType dt = XSValue::dt_float; bool toValidate = true; const char lex_v_ran_v_0[]=" 1234.e+10 \n"; const char lex_v_ran_v_1[]="+3.402823466e+38"; const char lex_v_ran_v_2[]="-3.402823466e+38"; const char lex_v_ran_v_3[]="+1.175494351e-38"; const char lex_v_ran_v_4[]="-1.175494351e-38"; XSValue::XSValue_Data act_v_ran_v_0; act_v_ran_v_0.fValue.f_float = (float)1234.e+10; XSValue::XSValue_Data act_v_ran_v_1; act_v_ran_v_1.fValue.f_float = (float)+3.402823466e+38; XSValue::XSValue_Data act_v_ran_v_2; act_v_ran_v_2.fValue.f_float = (float)-3.402823466e+38; XSValue::XSValue_Data act_v_ran_v_3; act_v_ran_v_3.fValue.f_float = (float)+1.175494351e-38; XSValue::XSValue_Data act_v_ran_v_4; act_v_ran_v_4.fValue.f_float = (float)-1.175494351e-38; const char lex_v_ran_iv_1[]="+3.402823466e+39"; const char lex_v_ran_iv_2[]="-3.402823466e+39"; const char lex_v_ran_iv_3[]="+1.175494351e-39"; const char lex_v_ran_iv_4[]="-1.175494351e-39"; XSValue::XSValue_Data lex_iv_ran_v_1; lex_iv_ran_v_1.fValue.f_float = (float)0.0; lex_iv_ran_v_1.fValue.f_floatType.f_floatEnum = XSValue::DoubleFloatType_PosINF; XSValue::XSValue_Data lex_iv_ran_v_2; lex_iv_ran_v_2.fValue.f_float = (float)0.0; lex_iv_ran_v_2.fValue.f_floatType.f_floatEnum = XSValue::DoubleFloatType_NegINF; XSValue::XSValue_Data lex_iv_ran_v_3; lex_iv_ran_v_3.fValue.f_float = (float)0.0; lex_iv_ran_v_3.fValue.f_floatType.f_floatEnum = XSValue::DoubleFloatType_Zero; XSValue::XSValue_Data lex_iv_ran_v_4; lex_iv_ran_v_4.fValue.f_float = (float)0.0; lex_iv_ran_v_4.fValue.f_floatType.f_floatEnum = XSValue::DoubleFloatType_Zero; const char lex_v_ran_iv_1_canrep[]="INF"; // 3.402823466E39"; const char lex_v_ran_iv_2_canrep[]="-INF"; //-3.402823466E39"; const char lex_v_ran_iv_3_canrep[]="0"; // 1.175494351E-39"; const char lex_v_ran_iv_4_canrep[]="0"; //-1.175494351E-39"; const char lex_iv_1[]="12x.e+10"; const char lex_iv_2[]="12.e+1x"; /*** * 3.2.4.2 Canonical representation * * The canonical representation for float is defined by prohibiting certain options from the Lexical * representation (§3.2.4.1). * Specifically, * 1. the exponent must be indicated by "E". * 2. Leading zeroes and the preceding optional "+" sign are prohibited in the exponent. * 3. For the mantissa, the preceding optional "+" sign is prohibited and the decimal point is required. * Leading and trailing zeroes are prohibited subject to the following: * number representations must be normalized such that there is a single digit to the left of the decimal point * and at least a single digit to the right of the decimal point. * ***/ const char data_rawstr_1[]=" -123.45 \n"; const char data_canrep_1[]="-1.2345E2"; const char data_rawstr_2[]="+123.45"; const char data_canrep_2[]="1.2345E2"; const char data_rawstr_3[]="+123.45e+0012"; const char data_canrep_3[]="1.2345E14"; const char data_rawstr_4[]="+100.000e2"; const char data_canrep_4[]="1.0E4"; const char data_rawstr_5[]="00100.23e2"; const char data_canrep_5[]="1.0023E4"; /*** * * validate * --------- * availability return value context * ---------------------------------------------- * lexical valid * range valid true n/a * range invalid false st_FOCA0002 * lexical invalid false st_FOCA0002 * ***/ // lexical valid, range valid VALIDATE_TEST(lex_v_ran_v_0 , dt, EXP_RET_VALID_TRUE, DONT_CARE); VALIDATE_TEST(lex_v_ran_v_1 , dt, EXP_RET_VALID_TRUE, DONT_CARE); VALIDATE_TEST(lex_v_ran_v_2 , dt, EXP_RET_VALID_TRUE, DONT_CARE); VALIDATE_TEST(lex_v_ran_v_3 , dt, EXP_RET_VALID_TRUE, DONT_CARE); VALIDATE_TEST(lex_v_ran_v_4 , dt, EXP_RET_VALID_TRUE, DONT_CARE); // lexical valid, range invalid VALIDATE_TEST(lex_v_ran_iv_1 , dt, EXP_RET_VALID_TRUE, DONT_CARE); VALIDATE_TEST(lex_v_ran_iv_2 , dt, EXP_RET_VALID_TRUE, DONT_CARE); VALIDATE_TEST(lex_v_ran_iv_3 , dt, EXP_RET_VALID_TRUE, DONT_CARE); VALIDATE_TEST(lex_v_ran_iv_4 , dt, EXP_RET_VALID_TRUE, DONT_CARE); // lexical invalid VALIDATE_TEST(lex_iv_1 , dt, EXP_RET_VALID_FALSE, XSValue::st_FOCA0002); VALIDATE_TEST(lex_iv_2 , dt, EXP_RET_VALID_FALSE, XSValue::st_FOCA0002); /*** * * getActualValue * --------------- * availability return value context * ---------------------------------------------- * validation on * ============= * lexical valid * range valid XSValue n/a * range invalid 0 st_Unpresentable * lexical invalid 0 st_FOCA0002 * * validation off * ============== * lexical valid * range valid XSValue n/a * range invalid 0 st_Unpresentable * lexical invalid 0 st_FOCA0002 * ***/ for (int i = 0; i < 2; i++) { //validation on/off toValidate = ( 0 == i) ? true : false; // lexical valid, range valid ACTVALUE_TEST(lex_v_ran_v_0, dt, toValidate, EXP_RET_VALUE_TRUE, DONT_CARE, act_v_ran_v_0); ACTVALUE_TEST(lex_v_ran_v_1, dt, toValidate, EXP_RET_VALUE_TRUE, DONT_CARE, act_v_ran_v_1); ACTVALUE_TEST(lex_v_ran_v_2, dt, toValidate, EXP_RET_VALUE_TRUE, DONT_CARE, act_v_ran_v_2); ACTVALUE_TEST(lex_v_ran_v_3, dt, toValidate, EXP_RET_VALUE_TRUE, DONT_CARE, act_v_ran_v_3); ACTVALUE_TEST(lex_v_ran_v_4, dt, toValidate, EXP_RET_VALUE_TRUE, DONT_CARE, act_v_ran_v_4); // lexical valid, range invalid ACTVALUE_TEST(lex_v_ran_iv_1, dt, toValidate, EXP_RET_VALUE_TRUE, DONT_CARE, lex_iv_ran_v_1); ACTVALUE_TEST(lex_v_ran_iv_2, dt, toValidate, EXP_RET_VALUE_TRUE, DONT_CARE, lex_iv_ran_v_2); ACTVALUE_TEST(lex_v_ran_iv_3, dt, toValidate, EXP_RET_VALUE_TRUE, DONT_CARE, lex_iv_ran_v_3); ACTVALUE_TEST(lex_v_ran_iv_4, dt, toValidate, EXP_RET_VALUE_TRUE, DONT_CARE, lex_iv_ran_v_4); // lexical invalid ACTVALUE_TEST(lex_iv_1 , dt, toValidate, EXP_RET_VALUE_FALSE, XSValue::st_FOCA0002, act_v_ran_v_0); ACTVALUE_TEST(lex_iv_2 , dt, toValidate, EXP_RET_VALUE_FALSE, XSValue::st_FOCA0002, act_v_ran_v_0); } /*** * * getCanonicalRepresentation * --------------------------- * availability return value context * ---------------------------------------------- * validation on * ============= * lexical valid * range valid XMLCh n/a * range invalid 0 st_FOCA0002 * lexical invalid 0 st_FOCA0002 * * validation off * ============== * lexical valid * range valid XMLCh n/a * range invalid XMLCh n/a * lexical invalid 0 st_FOCA0002 * ***/ for (int j = 0; j < 2; j++) { //validation on/off toValidate = ( 0 == j) ? true : false; // lexical valid, range valid CANREP_TEST(data_rawstr_1, dt, toValidate, EXP_RET_CANREP_TRUE, data_canrep_1, DONT_CARE); CANREP_TEST(data_rawstr_2, dt, toValidate, EXP_RET_CANREP_TRUE, data_canrep_2, DONT_CARE); CANREP_TEST(data_rawstr_3, dt, toValidate, EXP_RET_CANREP_TRUE, data_canrep_3, DONT_CARE); CANREP_TEST(data_rawstr_4, dt, toValidate, EXP_RET_CANREP_TRUE, data_canrep_4, DONT_CARE); CANREP_TEST(data_rawstr_5, dt, toValidate, EXP_RET_CANREP_TRUE, data_canrep_5, DONT_CARE); // lexical invalid CANREP_TEST(lex_iv_1, dt, toValidate, EXP_RET_CANREP_FALSE, 0, XSValue::st_FOCA0002); CANREP_TEST(lex_iv_2, dt, toValidate, EXP_RET_CANREP_FALSE, 0, XSValue::st_FOCA0002); // lexical valid, range invalid (however XML4C ignores that) CANREP_TEST(lex_v_ran_iv_1, dt, toValidate, EXP_RET_CANREP_TRUE, lex_v_ran_iv_1_canrep, DONT_CARE); CANREP_TEST(lex_v_ran_iv_2, dt, toValidate, EXP_RET_CANREP_TRUE, lex_v_ran_iv_2_canrep, DONT_CARE); CANREP_TEST(lex_v_ran_iv_3, dt, toValidate, EXP_RET_CANREP_TRUE, lex_v_ran_iv_3_canrep, DONT_CARE); CANREP_TEST(lex_v_ran_iv_4, dt, toValidate, EXP_RET_CANREP_TRUE, lex_v_ran_iv_4_canrep, DONT_CARE); } } /*** DBL_EPSILON 2.2204460492503131e-016 DBL_MAX 1.7976931348623158e+308 DBL_MIN 2.2250738585072014e-308 ***/ void test_dt_double() { const XSValue::DataType dt = XSValue::dt_double; bool toValidate = true; const char lex_v_ran_v_0[]=" 1234.e+10 \n"; const char lex_v_ran_v_1[]="+1.7976931348623158e+308"; const char lex_v_ran_v_2[]="-1.7976931348623158e+308"; const char lex_v_ran_v_3[]="+2.2250738585072014e-308"; const char lex_v_ran_v_4[]="-2.2250738585072014e-308"; XSValue::XSValue_Data act_v_ran_v_0; act_v_ran_v_0.fValue.f_double = (double)1234.e+10; XSValue::XSValue_Data act_v_ran_v_1; act_v_ran_v_1.fValue.f_double = (double)+1.7976931348623158e+308; XSValue::XSValue_Data act_v_ran_v_2; act_v_ran_v_2.fValue.f_double = (double)-1.7976931348623158e+308; XSValue::XSValue_Data act_v_ran_v_3; act_v_ran_v_3.fValue.f_double = (double)+2.2250738585072014e-308; XSValue::XSValue_Data act_v_ran_v_4; act_v_ran_v_4.fValue.f_double = (double)-2.2250738585072014e-308; const char lex_v_ran_iv_1[]="+1.7976931348623158e+309"; const char lex_v_ran_iv_2[]="-1.7976931348623158e+309"; // on linux, hp, aix, the representable range is around e-324 // or e-325, using e-329 to gain consistent result on all // platforms const char lex_v_ran_iv_3[]="+2.2250738585072014e-329"; const char lex_v_ran_iv_4[]="-2.2250738585072014e-329"; const char lex_v_ran_iv_1_canrep[]="INF"; // 1.7976931348623158E309"; const char lex_v_ran_iv_2_canrep[]="-INF"; //-1.7976931348623158E309"; const char lex_v_ran_iv_3_canrep[]="0"; // 2.2250738585072014E-329"; const char lex_v_ran_iv_4_canrep[]="0"; //-2.2250738585072014E-329"; XSValue::XSValue_Data lex_iv_ran_v_1; lex_iv_ran_v_1.fValue.f_double = (double)0.0; lex_iv_ran_v_1.fValue.f_doubleType.f_doubleEnum = XSValue::DoubleFloatType_PosINF; XSValue::XSValue_Data lex_iv_ran_v_2; lex_iv_ran_v_2.fValue.f_double = (double)0.0; lex_iv_ran_v_2.fValue.f_doubleType.f_doubleEnum = XSValue::DoubleFloatType_NegINF; XSValue::XSValue_Data lex_iv_ran_v_3; lex_iv_ran_v_3.fValue.f_double = (double)0.0; lex_iv_ran_v_3.fValue.f_doubleType.f_doubleEnum = XSValue::DoubleFloatType_Zero; XSValue::XSValue_Data lex_iv_ran_v_4; lex_iv_ran_v_4.fValue.f_double = (double)0.0; lex_iv_ran_v_4.fValue.f_doubleType.f_doubleEnum = XSValue::DoubleFloatType_Zero; const char lex_iv_1[]="12x.e+10"; const char lex_iv_2[]="12.e+1x"; /*** * 3.2.5.2 Canonical representation * * The canonical representation for float is defined by prohibiting certain options from the Lexical * representation (§3.2.5.1). * Specifically, * 1. the exponent must be indicated by "E". * 2. Leading zeroes and the preceding optional "+" sign are prohibited in the exponent. * 3. For the mantissa, the preceding optional "+" sign is prohibited and the decimal point is required. * Leading and trailing zeroes are prohibited subject to the following: * number representations must be normalized such that there is a single digit to the left of the decimal point * and at least a single digit to the right of the decimal point. * ***/ const char data_rawstr_1[]=" -123.45 \n"; const char data_canrep_1[]="-1.2345E2"; const char data_rawstr_2[]="+123.45"; const char data_canrep_2[]="1.2345E2"; const char data_rawstr_3[]="+123.45e+0012"; const char data_canrep_3[]="1.2345E14"; const char data_rawstr_4[]="+100.000e2"; const char data_canrep_4[]="1.0E4"; const char data_rawstr_5[]="00100.23e2"; const char data_canrep_5[]="1.0023E4"; /*** * * validate * --------- * availability return value context * ---------------------------------------------- * lexical valid * range valid true n/a * range invalid false st_FOCA0002 * lexical invalid false st_FOCA0002 * ***/ // lexical valid, range valid VALIDATE_TEST(lex_v_ran_v_0 , dt, EXP_RET_VALID_TRUE, DONT_CARE); VALIDATE_TEST(lex_v_ran_v_1 , dt, EXP_RET_VALID_TRUE, DONT_CARE); VALIDATE_TEST(lex_v_ran_v_2 , dt, EXP_RET_VALID_TRUE, DONT_CARE); VALIDATE_TEST(lex_v_ran_v_3 , dt, EXP_RET_VALID_TRUE, DONT_CARE); VALIDATE_TEST(lex_v_ran_v_4 , dt, EXP_RET_VALID_TRUE, DONT_CARE); // lexical valid, range invalid however XML4C converts to INF / ZERO VALIDATE_TEST(lex_v_ran_iv_1 , dt, EXP_RET_VALID_TRUE, DONT_CARE); VALIDATE_TEST(lex_v_ran_iv_2 , dt, EXP_RET_VALID_TRUE, DONT_CARE); VALIDATE_TEST(lex_v_ran_iv_3 , dt, EXP_RET_VALID_TRUE, DONT_CARE); VALIDATE_TEST(lex_v_ran_iv_4 , dt, EXP_RET_VALID_TRUE, DONT_CARE); // lexical invalid VALIDATE_TEST(lex_iv_1 , dt, EXP_RET_VALID_FALSE, XSValue::st_FOCA0002); VALIDATE_TEST(lex_iv_2 , dt, EXP_RET_VALID_FALSE, XSValue::st_FOCA0002); /*** * * getActualValue * --------------- * availability return value context * ---------------------------------------------- * validation on * ============= * lexical valid * range valid XSValue n/a * range invalid 0 st_Unpresentable * lexical invalid 0 st_FOCA0002 * * validation off * ============== * lexical valid * range valid XSValue n/a * range invalid 0 st_Unpresentable * lexical invalid 0 st_FOCA0002 * ***/ for (int i = 0; i < 2; i++) { //validation on/off toValidate = ( 0 == i) ? true : false; // lexical valid, range valid ACTVALUE_TEST(lex_v_ran_v_0, dt, toValidate, EXP_RET_VALUE_TRUE, DONT_CARE, act_v_ran_v_0); ACTVALUE_TEST(lex_v_ran_v_1, dt, toValidate, EXP_RET_VALUE_TRUE, DONT_CARE, act_v_ran_v_1); ACTVALUE_TEST(lex_v_ran_v_2, dt, toValidate, EXP_RET_VALUE_TRUE, DONT_CARE, act_v_ran_v_2); ACTVALUE_TEST(lex_v_ran_v_3, dt, toValidate, EXP_RET_VALUE_TRUE, DONT_CARE, act_v_ran_v_3); ACTVALUE_TEST(lex_v_ran_v_4, dt, toValidate, EXP_RET_VALUE_TRUE, DONT_CARE, act_v_ran_v_4); // lexical valid, range invalid ACTVALUE_TEST(lex_v_ran_iv_1, dt, toValidate, EXP_RET_VALUE_TRUE, DONT_CARE, lex_iv_ran_v_1); ACTVALUE_TEST(lex_v_ran_iv_2, dt, toValidate, EXP_RET_VALUE_TRUE, DONT_CARE, lex_iv_ran_v_2); ACTVALUE_TEST(lex_v_ran_iv_3, dt, toValidate, EXP_RET_VALUE_TRUE, DONT_CARE, lex_iv_ran_v_3); ACTVALUE_TEST(lex_v_ran_iv_4, dt, toValidate, EXP_RET_VALUE_TRUE, DONT_CARE, lex_iv_ran_v_4); // lexical invalid ACTVALUE_TEST(lex_iv_1 , dt, toValidate, EXP_RET_VALUE_FALSE, XSValue::st_FOCA0002, act_v_ran_v_0); ACTVALUE_TEST(lex_iv_2 , dt, toValidate, EXP_RET_VALUE_FALSE, XSValue::st_FOCA0002, act_v_ran_v_0); } /*** * * getCanonicalRepresentation * --------------------------- * availability return value context * ---------------------------------------------- * validation on * ============= * lexical valid * range valid XMLCh n/a * range invalid 0 st_FOCA0002 * lexical invalid 0 st_FOCA0002 * * validation off * ============== * lexical valid * range valid XMLCh n/a * range invalid XMLCh n/a * lexical invalid 0 st_FOCA0002 * ***/ for (int j = 0; j < 2; j++) { //validation on/off toValidate = ( 0 == j) ? true : false; // lexical valid, range valid CANREP_TEST(data_rawstr_1, dt, toValidate, EXP_RET_CANREP_TRUE, data_canrep_1, DONT_CARE); CANREP_TEST(data_rawstr_2, dt, toValidate, EXP_RET_CANREP_TRUE, data_canrep_2, DONT_CARE); CANREP_TEST(data_rawstr_3, dt, toValidate, EXP_RET_CANREP_TRUE, data_canrep_3, DONT_CARE); CANREP_TEST(data_rawstr_4, dt, toValidate, EXP_RET_CANREP_TRUE, data_canrep_4, DONT_CARE); CANREP_TEST(data_rawstr_5, dt, toValidate, EXP_RET_CANREP_TRUE, data_canrep_5, DONT_CARE); // lexical invalid CANREP_TEST(lex_iv_1, dt, toValidate, EXP_RET_CANREP_FALSE, 0, XSValue::st_FOCA0002); CANREP_TEST(lex_iv_2, dt, toValidate, EXP_RET_CANREP_FALSE, 0, XSValue::st_FOCA0002); // lexical valid, range invalid (XML4C doesn't treat as invalid) CANREP_TEST(lex_v_ran_iv_1, dt, toValidate, EXP_RET_CANREP_TRUE, lex_v_ran_iv_1_canrep, DONT_CARE); CANREP_TEST(lex_v_ran_iv_2, dt, toValidate, EXP_RET_CANREP_TRUE, lex_v_ran_iv_2_canrep, DONT_CARE); CANREP_TEST(lex_v_ran_iv_3, dt, toValidate, EXP_RET_CANREP_TRUE, lex_v_ran_iv_3_canrep, DONT_CARE); CANREP_TEST(lex_v_ran_iv_4, dt, toValidate, EXP_RET_CANREP_TRUE, lex_v_ran_iv_4_canrep, DONT_CARE); } } /*** * 9223372036854775807 * -9223372036854775808 * 2147483647 * -2147483648 ***/ void test_dt_integer() { const XSValue::DataType dt = XSValue::dt_integer; bool toValidate = true; const char lex_v_ran_v_1[]=" 1234 \n"; const char lex_v_ran64_v_1[]="+9223372036854775807"; const char lex_v_ran64_v_2[]="-9223372036854775808"; const char lex_v_ran64_iv_1[]="+9223372036854775808"; const char lex_v_ran64_iv_2[]="-9223372036854775809"; const char lex_v_ran32_v_1[]="+2147483647"; const char lex_v_ran32_v_2[]="-2147483648"; const char lex_v_ran32_iv_1[]="+2147483648"; const char lex_v_ran32_iv_2[]="-2147483649"; XSValue::XSValue_Data act_v_ran_v_1; act_v_ran_v_1.fValue.f_long = (long)1234; #if defined(XML_BITSTOBUILD_64) XSValue::XSValue_Data act_v_ran64_v_1; act_v_ran64_v_1.fValue.f_long = (long)+9223372036854775807; XSValue::XSValue_Data act_v_ran64_v_2; act_v_ran64_v_2.fValue.f_long = (long)-9223372036854775808; #endif XSValue::XSValue_Data act_v_ran32_v_1; act_v_ran32_v_1.fValue.f_long = (long)+2147483647; XSValue::XSValue_Data act_v_ran32_v_2; act_v_ran32_v_2.fValue.f_long = -(long)2147483648L; const char lex_v_ran64_v_1_canrep[]="9223372036854775807"; const char lex_v_ran64_v_2_canrep[]="-9223372036854775808"; const char lex_v_ran64_iv_1_canrep[]="9223372036854775808"; const char lex_v_ran64_iv_2_canrep[]="-9223372036854775809"; const char lex_iv_1[]="12b34.456"; const char lex_iv_2[]="1234b56"; /*** * 3.3.13.2 Canonical representation * * The canonical representation for integer is defined by prohibiting certain options from the Lexical * representation (§3.3.13.1). Specifically, * 1. the preceding optional "+" sign is prohibited and * 2. leading zeroes are prohibited. * ***/ const char data_rawstr_1[]=" +12345 \n"; const char data_canrep_1[]="12345"; const char data_rawstr_2[]="00012345"; const char data_canrep_2[]="12345"; /*** * * validate * --------- * availability return value context * ---------------------------------------------- * lexical valid * range valid true n/a * range invalid n/a * lexical invalid false st_FOCA0002 * ***/ // lexical valid VALIDATE_TEST(lex_v_ran_v_1 , dt, EXP_RET_VALID_TRUE, DONT_CARE); VALIDATE_TEST(lex_v_ran64_v_1 , dt, EXP_RET_VALID_TRUE, DONT_CARE); VALIDATE_TEST(lex_v_ran64_v_2 , dt, EXP_RET_VALID_TRUE, DONT_CARE); VALIDATE_TEST(lex_v_ran64_iv_1 , dt, EXP_RET_VALID_TRUE, DONT_CARE); VALIDATE_TEST(lex_v_ran64_iv_2 , dt, EXP_RET_VALID_TRUE, DONT_CARE); // lexical invalid VALIDATE_TEST(lex_iv_1 , dt, EXP_RET_VALID_FALSE, XSValue::st_FOCA0002); VALIDATE_TEST(lex_iv_2 , dt, EXP_RET_VALID_FALSE, XSValue::st_FOCA0002); /*** * * getActualValue * --------------- * availability return value context * ---------------------------------------------- * validation on * ============= * lexical valid * range valid XSValue n/a * range invalid 0 st_Unpresentable * lexical invalid 0 st_FOCA0002 * * validation off * ============== * lexical valid * range valid XSValue n/a * range invalid 0 st_Unpresentable * lexical invalid 0 st_FOCA0002 * ***/ for (int i = 0; i < 2; i++) { //validation on/off toValidate = ( 0 == i) ? true : false; ACTVALUE_TEST(lex_v_ran_v_1, dt, toValidate, EXP_RET_VALUE_TRUE, DONT_CARE, act_v_ran_v_1); #if defined(XML_BITSTOBUILD_64) ACTVALUE_TEST(lex_v_ran64_v_1 , dt, toValidate, EXP_RET_VALUE_TRUE, DONT_CARE, act_v_ran64_v_1); ACTVALUE_TEST(lex_v_ran64_v_2 , dt, toValidate, EXP_RET_VALUE_TRUE, DONT_CARE, act_v_ran64_v_2); ACTVALUE_TEST(lex_v_ran64_iv_1, dt, toValidate, EXP_RET_VALUE_FALSE, XSValue::st_FOCA0003, act_v_ran64_v_1); ACTVALUE_TEST(lex_v_ran64_iv_2, dt, toValidate, EXP_RET_VALUE_FALSE, XSValue::st_FOCA0003, act_v_ran64_v_1); #else ACTVALUE_TEST(lex_v_ran32_v_1, dt, toValidate, EXP_RET_VALUE_TRUE, DONT_CARE, act_v_ran32_v_1); ACTVALUE_TEST(lex_v_ran32_v_2, dt, toValidate, EXP_RET_VALUE_TRUE, DONT_CARE, act_v_ran32_v_2); ACTVALUE_TEST(lex_v_ran32_iv_1, dt, toValidate, EXP_RET_VALUE_FALSE, XSValue::st_FOCA0003, act_v_ran32_v_1); ACTVALUE_TEST(lex_v_ran32_iv_2, dt, toValidate, EXP_RET_VALUE_FALSE, XSValue::st_FOCA0003, act_v_ran32_v_1); #endif ACTVALUE_TEST(lex_iv_1, dt, toValidate, EXP_RET_VALUE_FALSE, XSValue::st_FOCA0002, act_v_ran32_v_1); ACTVALUE_TEST(lex_iv_2, dt, toValidate, EXP_RET_VALUE_FALSE, XSValue::st_FOCA0002, act_v_ran32_v_1); } /*** * * getCanonicalRepresentation * --------------------------- * availability return value context * ---------------------------------------------- * validation on * ============= * lexical valid * range valid XMLCh n/a * range invalid n/a * lexical invalid 0 st_FOCA0002 * * validation off * ============== * lexical valid * range valid XMLCh n/a * range invalid n/a * lexical invalid 0 st_FOCA0002 * ***/ for (int j = 0; j < 2; j++) { //validation on/off toValidate = ( 0 == j)? true : false; CANREP_TEST(data_rawstr_1, dt, toValidate, EXP_RET_CANREP_TRUE, data_canrep_1, DONT_CARE); CANREP_TEST(data_rawstr_2, dt, toValidate, EXP_RET_CANREP_TRUE, data_canrep_2, XSValue::st_FOCA0002); CANREP_TEST(lex_v_ran64_v_1, dt, toValidate, EXP_RET_CANREP_TRUE, lex_v_ran64_v_1_canrep, DONT_CARE); CANREP_TEST(lex_v_ran64_v_2, dt, toValidate, EXP_RET_CANREP_TRUE, lex_v_ran64_v_2_canrep, DONT_CARE); CANREP_TEST(lex_v_ran64_iv_1, dt, toValidate, EXP_RET_CANREP_TRUE, lex_v_ran64_iv_1_canrep, DONT_CARE); CANREP_TEST(lex_v_ran64_iv_2, dt, toValidate, EXP_RET_CANREP_TRUE, lex_v_ran64_iv_2_canrep, DONT_CARE); CANREP_TEST(lex_iv_1 , dt, toValidate, EXP_RET_CANREP_FALSE, 0, XSValue::st_FOCA0002); CANREP_TEST(lex_iv_2 , dt, toValidate, EXP_RET_CANREP_FALSE, 0, XSValue::st_FOCA0002); } } void test_dt_nonPositiveInteger() { const XSValue::DataType dt = XSValue::dt_nonPositiveInteger; bool toValidate = true; const char lex_v_ran_v_1[]=" -1234 \n"; const char lex_v_ran_iv_1[]="+1"; const char lex_v_ran64_v_2[]="-9223372036854775808"; const char lex_v_ran64_iv_2[]="-9223372036854775809"; const char lex_v_ran32_v_2[]="-2147483648"; const char lex_v_ran32_iv_2[]="-2147483649"; XSValue::XSValue_Data act_v_ran_v_1; act_v_ran_v_1.fValue.f_long = (long)-1234; #if defined(XML_BITSTOBUILD_64) XSValue::XSValue_Data act_v_ran64_v_2; act_v_ran64_v_2.fValue.f_long = (long)-9223372036854775808; #endif XSValue::XSValue_Data act_v_ran32_v_2; act_v_ran32_v_2.fValue.f_long = -(long)2147483648L; const char lex_v_ran64_v_2_canrep[]="-9223372036854775808"; const char lex_v_ran64_iv_2_canrep[]="-9223372036854775809"; const char lex_iv_1[]="12b34.456"; const char lex_iv_2[]="1234b56"; /*** * 3.3.14.2 Canonical representation * * The canonical representation for nonPositiveInteger is defined by prohibiting certain options from the * Lexical representation (§3.3.14.1). Specifically, * 1. the sign must be omitted for token "0" and * 2. leading zeroes are prohibited. * ***/ const char data_rawstr_1[]=" 0 \n"; const char data_canrep_1[]="0"; const char data_rawstr_2[]="-00012345"; const char data_canrep_2[]="-12345"; /*** * * validate * --------- * availability return value context * ---------------------------------------------- * lexical valid * range valid true n/a * range invalid n/a * lexical invalid false st_FOCA0002 * ***/ // lexical valid VALIDATE_TEST(lex_v_ran_v_1 , dt, EXP_RET_VALID_TRUE, DONT_CARE); VALIDATE_TEST(lex_v_ran_iv_1 , dt, EXP_RET_VALID_FALSE, XSValue::st_FOCA0002); VALIDATE_TEST(lex_v_ran64_v_2 , dt, EXP_RET_VALID_TRUE, DONT_CARE); VALIDATE_TEST(lex_v_ran64_iv_2 , dt, EXP_RET_VALID_TRUE, DONT_CARE); // lexical invalid VALIDATE_TEST(lex_iv_1 , dt, EXP_RET_VALID_FALSE, XSValue::st_FOCA0002); VALIDATE_TEST(lex_iv_2 , dt, EXP_RET_VALID_FALSE, XSValue::st_FOCA0002); /*** * * getActualValue * --------------- * availability return value context * ---------------------------------------------- * validation on * ============= * lexical valid * range valid XSValue n/a * range invalid 0 st_Unpresentable * lexical invalid 0 st_FOCA0002 * * validation off * ============== * lexical valid * range valid XSValue n/a * range invalid 0 st_Unpresentable * lexical invalid 0 st_FOCA0002 * ***/ for (int i = 0; i < 2; i++) { //validation on/off toValidate = ( 0 == i) ? true : false; ACTVALUE_TEST(lex_v_ran_v_1, dt, toValidate, EXP_RET_VALUE_TRUE, DONT_CARE, act_v_ran_v_1); #if defined(XML_BITSTOBUILD_64) ACTVALUE_TEST(lex_v_ran64_v_2 , dt, toValidate, EXP_RET_VALUE_TRUE, DONT_CARE, act_v_ran64_v_2); ACTVALUE_TEST(lex_v_ran64_iv_2, dt, toValidate, EXP_RET_VALUE_FALSE, XSValue::st_FOCA0003, act_v_ran64_v_2); #else ACTVALUE_TEST(lex_v_ran32_v_2, dt, toValidate, EXP_RET_VALUE_TRUE, DONT_CARE, act_v_ran32_v_2); ACTVALUE_TEST(lex_v_ran32_iv_2, dt, toValidate, EXP_RET_VALUE_FALSE, XSValue::st_FOCA0003, act_v_ran32_v_2); #endif ACTVALUE_TEST(lex_iv_1, dt, toValidate, EXP_RET_VALUE_FALSE, XSValue::st_FOCA0002, act_v_ran32_v_2); ACTVALUE_TEST(lex_iv_2, dt, toValidate, EXP_RET_VALUE_FALSE, XSValue::st_FOCA0002, act_v_ran32_v_2); } /*** * * getCanonicalRepresentation * --------------------------- * availability return value context * ---------------------------------------------- * validation on * ============= * lexical valid * range valid XMLCh n/a * range invalid n/a * lexical invalid 0 st_FOCA0002 * * validation off * ============== * lexical valid * range valid XMLCh n/a * range invalid n/a * lexical invalid 0 st_FOCA0002 * ***/ for (int j = 0; j < 2; j++) { //validation on/off toValidate = ( 0 == j)? true : false; CANREP_TEST(data_rawstr_1, dt, toValidate, EXP_RET_CANREP_TRUE, data_canrep_1, DONT_CARE); CANREP_TEST(data_rawstr_2, dt, toValidate, EXP_RET_CANREP_TRUE, data_canrep_2, DONT_CARE); CANREP_TEST(lex_v_ran64_v_2, dt, toValidate, EXP_RET_CANREP_TRUE, lex_v_ran64_v_2_canrep, DONT_CARE); CANREP_TEST(lex_v_ran64_iv_2, dt, toValidate, EXP_RET_CANREP_TRUE, lex_v_ran64_iv_2_canrep, DONT_CARE); CANREP_TEST(lex_iv_1 , dt, toValidate, EXP_RET_CANREP_FALSE, 0, XSValue::st_FOCA0002); CANREP_TEST(lex_iv_2 , dt, toValidate, EXP_RET_CANREP_FALSE, 0, XSValue::st_FOCA0002); } } void test_dt_negativeInteger() { const XSValue::DataType dt = XSValue::dt_negativeInteger; bool toValidate = true; const char lex_v_ran_v_1[]=" -1234 \n"; const char lex_v_ran_iv_1[]="0"; const char lex_v_ran64_v_2[]="-9223372036854775808"; const char lex_v_ran64_iv_2[]="-9223372036854775809"; const char lex_v_ran32_v_2[]="-2147483648"; const char lex_v_ran32_iv_2[]="-2147483649"; XSValue::XSValue_Data act_v_ran_v_1; act_v_ran_v_1.fValue.f_long = (long)-1234; #if defined(XML_BITSTOBUILD_64) XSValue::XSValue_Data act_v_ran64_v_2; act_v_ran64_v_2.fValue.f_long = (long)-9223372036854775808; #endif XSValue::XSValue_Data act_v_ran32_v_2; act_v_ran32_v_2.fValue.f_long = -(long)2147483648L; const char lex_v_ran64_v_2_canrep[]="-9223372036854775808"; const char lex_v_ran64_iv_2_canrep[]="-9223372036854775809"; const char lex_iv_1[]="12b34.456"; const char lex_iv_2[]="1234b56"; /*** * 3.3.15.2 Canonical representation * * The canonical representation for negativeInteger is defined by prohibiting certain options * from the Lexical representation (§3.3.15.1). Specifically, * 1. leading zeroes are prohibited. * ***/ const char data_rawstr_1[]=" -00012345 \n"; const char data_canrep_1[]="-12345"; /*** * * validate * --------- * availability return value context * ---------------------------------------------- * lexical valid * range valid true n/a * range invalid n/a * lexical invalid false st_FOCA0002 * ***/ // lexical valid VALIDATE_TEST(lex_v_ran_v_1 , dt, EXP_RET_VALID_TRUE, DONT_CARE); VALIDATE_TEST(lex_v_ran_iv_1 , dt, EXP_RET_VALID_FALSE, XSValue::st_FOCA0002); VALIDATE_TEST(lex_v_ran64_v_2 , dt, EXP_RET_VALID_TRUE, DONT_CARE); VALIDATE_TEST(lex_v_ran64_iv_2 , dt, EXP_RET_VALID_TRUE, DONT_CARE); // lexical invalid VALIDATE_TEST(lex_iv_1 , dt, EXP_RET_VALID_FALSE, XSValue::st_FOCA0002); VALIDATE_TEST(lex_iv_2 , dt, EXP_RET_VALID_FALSE, XSValue::st_FOCA0002); /*** * * getActualValue * --------------- * availability return value context * ---------------------------------------------- * validation on * ============= * lexical valid * range valid XSValue n/a * range invalid 0 st_Unpresentable * lexical invalid 0 st_FOCA0002 * * validation off * ============== * lexical valid * range valid XSValue n/a * range invalid 0 st_Unpresentable * lexical invalid 0 st_FOCA0002 * ***/ for (int i = 0; i < 2; i++) { //validation on/off toValidate = ( 0 == i) ? true : false; ACTVALUE_TEST(lex_v_ran_v_1, dt, toValidate, EXP_RET_VALUE_TRUE, DONT_CARE, act_v_ran_v_1); #if defined(XML_BITSTOBUILD_64) ACTVALUE_TEST(lex_v_ran64_v_2 , dt, toValidate, EXP_RET_VALUE_TRUE, DONT_CARE, act_v_ran64_v_2); ACTVALUE_TEST(lex_v_ran64_iv_2, dt, toValidate, EXP_RET_VALUE_FALSE, XSValue::st_FOCA0003, act_v_ran64_v_2); #else ACTVALUE_TEST(lex_v_ran32_v_2, dt, toValidate, EXP_RET_VALUE_TRUE, DONT_CARE, act_v_ran32_v_2); ACTVALUE_TEST(lex_v_ran32_iv_2, dt, toValidate, EXP_RET_VALUE_FALSE, XSValue::st_FOCA0003, act_v_ran32_v_2); #endif ACTVALUE_TEST(lex_iv_1, dt, toValidate, EXP_RET_VALUE_FALSE, XSValue::st_FOCA0002, act_v_ran32_v_2); ACTVALUE_TEST(lex_iv_2, dt, toValidate, EXP_RET_VALUE_FALSE, XSValue::st_FOCA0002, act_v_ran32_v_2); } /*** * * getCanonicalRepresentation * --------------------------- * availability return value context * ---------------------------------------------- * validation on * ============= * lexical valid * range valid XMLCh n/a * range invalid n/a * lexical invalid 0 st_FOCA0002 * * validation off * ============== * lexical valid * range valid XMLCh n/a * range invalid n/a * lexical invalid 0 st_FOCA0002 * ***/ for (int j = 0; j < 2; j++) { //validation on/off toValidate = ( 0 == j)? true : false; CANREP_TEST(data_rawstr_1, dt, toValidate, EXP_RET_CANREP_TRUE, data_canrep_1, DONT_CARE); CANREP_TEST(lex_v_ran64_v_2, dt, toValidate, EXP_RET_CANREP_TRUE, lex_v_ran64_v_2_canrep, DONT_CARE); CANREP_TEST(lex_v_ran64_iv_2, dt, toValidate, EXP_RET_CANREP_TRUE, lex_v_ran64_iv_2_canrep, DONT_CARE); CANREP_TEST(lex_iv_1 , dt, toValidate, EXP_RET_CANREP_FALSE, 0, XSValue::st_FOCA0002); CANREP_TEST(lex_iv_2 , dt, toValidate, EXP_RET_CANREP_FALSE, 0, XSValue::st_FOCA0002); } } void test_dt_long() { const XSValue::DataType dt = XSValue::dt_long; bool toValidate = true; const char lex_v_ran_v_1[]=" 1234 \n"; const char lex_v_ran64_v_1[]="+9223372036854775807"; const char lex_v_ran64_v_2[]="-9223372036854775808"; const char lex_v_ran64_iv_1[]="+9223372036854775808"; const char lex_v_ran64_iv_2[]="-9223372036854775809"; const char lex_v_ran32_v_1[]="+2147483647"; const char lex_v_ran32_v_2[]="-2147483648"; const char lex_v_ran32_iv_1[]="+2147483648"; const char lex_v_ran32_iv_2[]="-2147483649"; XSValue::XSValue_Data act_v_ran_v_1; act_v_ran_v_1.fValue.f_long = (long)1234; #if defined(XML_BITSTOBUILD_64) XSValue::XSValue_Data act_v_ran64_v_1; act_v_ran64_v_1.fValue.f_long = (long)+9223372036854775807; XSValue::XSValue_Data act_v_ran64_v_2; act_v_ran64_v_2.fValue.f_long = (long)-9223372036854775808; #endif XSValue::XSValue_Data act_v_ran32_v_1; act_v_ran32_v_1.fValue.f_long = (long)+2147483647; XSValue::XSValue_Data act_v_ran32_v_2; act_v_ran32_v_2.fValue.f_long = -(long)2147483648L; const char lex_v_ran64_v_1_canrep[]="9223372036854775807"; const char lex_v_ran64_v_2_canrep[]="-9223372036854775808"; const char lex_v_ran64_iv_1_canrep[]="9223372036854775808"; const char lex_v_ran64_iv_2_canrep[]="-9223372036854775809"; const char lex_iv_1[]="12b34.456"; const char lex_iv_2[]="1234b56"; /*** * 3.3.16.2 Canonical representation * * The canonical representation for long is defined by prohibiting certain options from the * Lexical representation (§3.3.16.1). Specifically, * 1. the the optional "+" sign is prohibited and * 2. leading zeroes are prohibited. ***/ const char data_rawstr_1[]=" +12345 \n"; const char data_canrep_1[]="12345"; const char data_rawstr_2[]="00012345"; const char data_canrep_2[]="12345"; /*** * * validate * --------- * availability return value context * ---------------------------------------------- * lexical valid * range valid true n/a * range invalid false st_FOCA0002 * lexical invalid false st_FOCA0002 * ***/ // lexical valid, valid range VALIDATE_TEST(lex_v_ran_v_1 , dt, EXP_RET_VALID_TRUE, DONT_CARE); VALIDATE_TEST(lex_v_ran64_v_1 , dt, EXP_RET_VALID_TRUE, DONT_CARE); VALIDATE_TEST(lex_v_ran64_v_2 , dt, EXP_RET_VALID_TRUE, DONT_CARE); // lexical valid, invalid range VALIDATE_TEST(lex_v_ran64_iv_1 , dt, EXP_RET_VALID_FALSE, XSValue::st_FOCA0002); VALIDATE_TEST(lex_v_ran64_iv_2 , dt, EXP_RET_VALID_FALSE, XSValue::st_FOCA0002); // lexical invalid VALIDATE_TEST(lex_iv_1 , dt, EXP_RET_VALID_FALSE, XSValue::st_FOCA0002); VALIDATE_TEST(lex_iv_2 , dt, EXP_RET_VALID_FALSE, XSValue::st_FOCA0002); /*** * * getActualValue * --------------- * availability return value context * ---------------------------------------------- * validation on * ============= * lexical valid * range valid XSValue n/a * range invalid 0 st_Unpresentable * lexical invalid 0 st_FOCA0002 * * validation off * ============== * lexical valid * range valid XSValue n/a * range invalid 0 st_Unpresentable * lexical invalid 0 st_FOCA0002 * ***/ for (int i = 0; i < 2; i++) { //validation on/off toValidate = ( 0 == i) ? true : false; ACTVALUE_TEST(lex_v_ran_v_1, dt, toValidate, EXP_RET_VALUE_TRUE, DONT_CARE, act_v_ran_v_1); #if defined(XML_BITSTOBUILD_64) ACTVALUE_TEST(lex_v_ran64_v_1 , dt, toValidate, EXP_RET_VALUE_TRUE, DONT_CARE, act_v_ran64_v_1); ACTVALUE_TEST(lex_v_ran64_v_2 , dt, toValidate, EXP_RET_VALUE_TRUE, DONT_CARE, act_v_ran64_v_2); ACTVALUE_TEST(lex_v_ran64_iv_1, dt, toValidate, EXP_RET_VALUE_FALSE, XSValue::st_FOCA0003, act_v_ran64_v_1); ACTVALUE_TEST(lex_v_ran64_iv_2, dt, toValidate, EXP_RET_VALUE_FALSE, XSValue::st_FOCA0003, act_v_ran64_v_1); #else ACTVALUE_TEST(lex_v_ran32_v_1, dt, toValidate, EXP_RET_VALUE_TRUE, DONT_CARE, act_v_ran32_v_1); ACTVALUE_TEST(lex_v_ran32_v_2, dt, toValidate, EXP_RET_VALUE_TRUE, DONT_CARE, act_v_ran32_v_2); ACTVALUE_TEST(lex_v_ran32_iv_1, dt, toValidate, EXP_RET_VALUE_FALSE, XSValue::st_FOCA0003, act_v_ran32_v_1); ACTVALUE_TEST(lex_v_ran32_iv_2, dt, toValidate, EXP_RET_VALUE_FALSE, XSValue::st_FOCA0003, act_v_ran32_v_1); #endif ACTVALUE_TEST(lex_iv_1, dt, toValidate, EXP_RET_VALUE_FALSE, XSValue::st_FOCA0002, act_v_ran32_v_1); ACTVALUE_TEST(lex_iv_2, dt, toValidate, EXP_RET_VALUE_FALSE, XSValue::st_FOCA0002, act_v_ran32_v_1); } /*** * * getCanonicalRepresentation * --------------------------- * availability return value context * ---------------------------------------------- * validation on * ============= * lexical valid * range valid XMLCh n/a * range invalid 0 st_FOCA0002 * lexical invalid 0 st_FOCA0002 * * validation off * ============== * lexical valid * range valid XMLCh n/a * range invalid XMLCh n/a * lexical invalid 0 st_FOCA0002 * ***/ for (int j = 0; j < 2; j++) { //validation on/off toValidate = ( 0 == j)? true : false; CANREP_TEST(data_rawstr_1, dt, toValidate, EXP_RET_CANREP_TRUE, data_canrep_1, DONT_CARE); CANREP_TEST(data_rawstr_2, dt, toValidate, EXP_RET_CANREP_TRUE, data_canrep_2, XSValue::st_FOCA0002); CANREP_TEST(lex_v_ran64_v_1, dt, toValidate, EXP_RET_CANREP_TRUE, lex_v_ran64_v_1_canrep, DONT_CARE); CANREP_TEST(lex_v_ran64_v_2, dt, toValidate, EXP_RET_CANREP_TRUE, lex_v_ran64_v_2_canrep, DONT_CARE); CANREP_TEST(lex_iv_1 , dt, toValidate, EXP_RET_CANREP_FALSE, 0, XSValue::st_FOCA0002); CANREP_TEST(lex_iv_2 , dt, toValidate, EXP_RET_CANREP_FALSE, 0, XSValue::st_FOCA0002); } //validation on CANREP_TEST(lex_v_ran64_iv_1, dt, true, EXP_RET_CANREP_FALSE, 0, XSValue::st_FOCA0002); CANREP_TEST(lex_v_ran64_iv_2, dt, true, EXP_RET_CANREP_FALSE, 0, XSValue::st_FOCA0002); //validation off CANREP_TEST(lex_v_ran64_iv_1, dt, false, EXP_RET_CANREP_TRUE, lex_v_ran64_iv_1_canrep, DONT_CARE); CANREP_TEST(lex_v_ran64_iv_2, dt, false, EXP_RET_CANREP_TRUE, lex_v_ran64_iv_2_canrep, DONT_CARE); } void test_dt_int() { const XSValue::DataType dt = XSValue::dt_int; bool toValidate = true; const char lex_v_ran_v_0[]=" 1234 \n"; const char lex_v_ran_v_1[]="+2147483647"; const char lex_v_ran_v_2[]="-2147483648"; const char lex_v_ran_iv_1[]="+2147483648"; const char lex_v_ran_iv_2[]="-2147483649"; XSValue::XSValue_Data act_v_ran_v_0; act_v_ran_v_0.fValue.f_int = (int)1234; XSValue::XSValue_Data act_v_ran_v_1; act_v_ran_v_1.fValue.f_int = (int)+2147483647; XSValue::XSValue_Data act_v_ran_v_2; act_v_ran_v_2.fValue.f_int = -(int)2147483648; const char lex_v_ran_v_1_canrep[]="2147483647"; const char lex_v_ran_v_2_canrep[]="-2147483648"; const char lex_v_ran_iv_1_canrep[]="2147483648"; const char lex_v_ran_iv_2_canrep[]="-2147483649"; const char lex_iv_1[]="1234.456"; const char lex_iv_2[]="1234b56"; /*** * 3.3.17.2 Canonical representation * * The canonical representation for int is defined by prohibiting certain options from the * Lexical representation (§3.3.17.1). Specifically, * 1. the the optional "+" sign is prohibited and * 2. leading zeroes are prohibited. * ***/ const char data_rawstr_1[]=" +12345 \n"; const char data_canrep_1[]="12345"; const char data_rawstr_2[]="00012345"; const char data_canrep_2[]="12345"; /*** * * validate * --------- * availability return value context * ---------------------------------------------- * lexical valid * range valid true n/a * range invalid false st_FOCA0002 * lexical invalid false st_FOCA0002 * ***/ // lexical valid, valid range VALIDATE_TEST(lex_v_ran_v_0 , dt, EXP_RET_VALID_TRUE, DONT_CARE); VALIDATE_TEST(lex_v_ran_v_1 , dt, EXP_RET_VALID_TRUE, DONT_CARE); VALIDATE_TEST(lex_v_ran_v_2 , dt, EXP_RET_VALID_TRUE, DONT_CARE); // lexical valid, invalid range VALIDATE_TEST(lex_v_ran_iv_1 , dt, EXP_RET_VALID_FALSE, XSValue::st_FOCA0002); VALIDATE_TEST(lex_v_ran_iv_2 , dt, EXP_RET_VALID_FALSE, XSValue::st_FOCA0002); // lexical invalid VALIDATE_TEST(lex_iv_1 , dt, EXP_RET_VALID_FALSE, XSValue::st_FOCA0002); VALIDATE_TEST(lex_iv_2 , dt, EXP_RET_VALID_FALSE, XSValue::st_FOCA0002); /*** * * getActualValue * --------------- * availability return value context * ---------------------------------------------- * validation on * ============= * lexical valid * range valid XSValue n/a * range invalid 0 st_Unpresentable * lexical invalid 0 st_FOCA0002 * * validation off * ============== * lexical valid * range valid XSValue n/a * range invalid 0 st_Unpresentable * lexical invalid 0 st_FOCA0002 * ***/ for (int i = 0; i < 2; i++) { //validation on/off toValidate = ( 0 == i) ? true : false; ACTVALUE_TEST(lex_v_ran_v_0, dt, toValidate, EXP_RET_VALUE_TRUE, DONT_CARE, act_v_ran_v_0); ACTVALUE_TEST(lex_v_ran_v_1, dt, toValidate, EXP_RET_VALUE_TRUE, DONT_CARE, act_v_ran_v_1); ACTVALUE_TEST(lex_v_ran_v_2, dt, toValidate, EXP_RET_VALUE_TRUE, DONT_CARE, act_v_ran_v_2); ACTVALUE_TEST(lex_v_ran_iv_1, dt, toValidate, EXP_RET_VALUE_FALSE, XSValue::st_FOCA0002, act_v_ran_v_0); ACTVALUE_TEST(lex_v_ran_iv_2, dt, toValidate, EXP_RET_VALUE_FALSE, XSValue::st_FOCA0002, act_v_ran_v_0); ACTVALUE_TEST(lex_iv_1, dt, toValidate, EXP_RET_VALUE_FALSE, XSValue::st_FOCA0002, act_v_ran_v_0); ACTVALUE_TEST(lex_iv_2, dt, toValidate, EXP_RET_VALUE_FALSE, XSValue::st_FOCA0002, act_v_ran_v_0); } /*** * * getCanonicalRepresentation * --------------------------- * availability return value context * ---------------------------------------------- * validation on * ============= * lexical valid * range valid XMLCh n/a * range invalid 0 st_FOCA0002 * lexical invalid 0 st_FOCA0002 * * validation off * ============== * lexical valid * range valid XMLCh n/a * range invalid XMLCh n/a * lexical invalid 0 st_FOCA0002 * ***/ for (int j = 0; j < 2; j++) { //validation on/off toValidate = ( 0 == j)? true : false; CANREP_TEST(data_rawstr_1, dt, toValidate, EXP_RET_CANREP_TRUE, data_canrep_1, DONT_CARE); CANREP_TEST(data_rawstr_2, dt, toValidate, EXP_RET_CANREP_TRUE, data_canrep_2, XSValue::st_FOCA0002); CANREP_TEST(lex_v_ran_v_1, dt, toValidate, EXP_RET_CANREP_TRUE, lex_v_ran_v_1_canrep, DONT_CARE); CANREP_TEST(lex_v_ran_v_2, dt, toValidate, EXP_RET_CANREP_TRUE, lex_v_ran_v_2_canrep, DONT_CARE); CANREP_TEST(lex_iv_1, dt, toValidate, EXP_RET_CANREP_FALSE, 0, XSValue::st_FOCA0002); CANREP_TEST(lex_iv_2, dt, toValidate, EXP_RET_CANREP_FALSE, 0, XSValue::st_FOCA0002); } //validation on CANREP_TEST(lex_v_ran_iv_1, dt, true, EXP_RET_CANREP_FALSE, 0, XSValue::st_FOCA0002); CANREP_TEST(lex_v_ran_iv_2, dt, true, EXP_RET_CANREP_FALSE, 0, XSValue::st_FOCA0002); //validation off CANREP_TEST(lex_v_ran_iv_1, dt, false, EXP_RET_CANREP_TRUE, lex_v_ran_iv_1_canrep, DONT_CARE); CANREP_TEST(lex_v_ran_iv_2, dt, false, EXP_RET_CANREP_TRUE, lex_v_ran_iv_2_canrep, DONT_CARE); } // 32767 // -32768 void test_dt_short() { const XSValue::DataType dt = XSValue::dt_short; bool toValidate = true; const char lex_v_ran_v_0[]=" 1234 \n"; const char lex_v_ran_v_1[]="+32767"; const char lex_v_ran_v_2[]="-32768"; const char lex_v_ran_iv_1[]="+32768"; const char lex_v_ran_iv_2[]="-32769"; XSValue::XSValue_Data act_v_ran_v_0; act_v_ran_v_0.fValue.f_short = (short)1234; XSValue::XSValue_Data act_v_ran_v_1; act_v_ran_v_1.fValue.f_short = (short)+32767; XSValue::XSValue_Data act_v_ran_v_2; act_v_ran_v_2.fValue.f_short = (short)-32768; const char lex_v_ran_v_1_canrep[]="32767"; const char lex_v_ran_v_2_canrep[]="-32768"; const char lex_v_ran_iv_1_canrep[]="32768"; const char lex_v_ran_iv_2_canrep[]="-32769"; const char lex_iv_1[]="1234.456"; const char lex_iv_2[]="1234b56"; /*** * * 3.3.18.2 Canonical representation * * The canonical representation for short is defined by prohibiting certain options from the * Lexical representation (§3.3.18.1). Specifically, * 1. the the optional "+" sign is prohibited and * 2. leading zeroes are prohibited. * ***/ const char data_rawstr_1[]=" +12345 \n"; const char data_canrep_1[]="12345"; const char data_rawstr_2[]="00012345"; const char data_canrep_2[]="12345"; /*** * * validate * --------- * availability return value context * ---------------------------------------------- * lexical valid * range valid true n/a * range invalid false st_FOCA0002 * lexical invalid false st_FOCA0002 * ***/ // lexical valid, valid range VALIDATE_TEST(lex_v_ran_v_0 , dt, EXP_RET_VALID_TRUE, DONT_CARE); VALIDATE_TEST(lex_v_ran_v_1 , dt, EXP_RET_VALID_TRUE, DONT_CARE); VALIDATE_TEST(lex_v_ran_v_2 , dt, EXP_RET_VALID_TRUE, DONT_CARE); // lexical valid, invalid range VALIDATE_TEST(lex_v_ran_iv_1 , dt, EXP_RET_VALID_FALSE, XSValue::st_FOCA0002); VALIDATE_TEST(lex_v_ran_iv_2 , dt, EXP_RET_VALID_FALSE, XSValue::st_FOCA0002); // lexical invalid VALIDATE_TEST(lex_iv_1 , dt, EXP_RET_VALID_FALSE, XSValue::st_FOCA0002); VALIDATE_TEST(lex_iv_2 , dt, EXP_RET_VALID_FALSE, XSValue::st_FOCA0002); /*** * * getActualValue * --------------- * availability return value context * ---------------------------------------------- * validation on * ============= * lexical valid * range valid XSValue n/a * range invalid 0 st_Unpresentable * lexical invalid 0 st_FOCA0002 * * validation off * ============== * lexical valid * range valid XSValue n/a * range invalid 0 st_Unpresentable * lexical invalid 0 st_FOCA0002 * ***/ for (int i = 0; i < 2; i++) { //validation on/off toValidate = ( 0 == i) ? true : false; ACTVALUE_TEST(lex_v_ran_v_0, dt, toValidate, EXP_RET_VALUE_TRUE, DONT_CARE, act_v_ran_v_0); ACTVALUE_TEST(lex_v_ran_v_1, dt, toValidate, EXP_RET_VALUE_TRUE, DONT_CARE, act_v_ran_v_1); ACTVALUE_TEST(lex_v_ran_v_2, dt, toValidate, EXP_RET_VALUE_TRUE, DONT_CARE, act_v_ran_v_2); ACTVALUE_TEST(lex_v_ran_iv_1, dt, toValidate, EXP_RET_VALUE_FALSE, XSValue::st_FOCA0002, act_v_ran_v_0); ACTVALUE_TEST(lex_v_ran_iv_2, dt, toValidate, EXP_RET_VALUE_FALSE, XSValue::st_FOCA0002, act_v_ran_v_0); ACTVALUE_TEST(lex_iv_1, dt, toValidate, EXP_RET_VALUE_FALSE, XSValue::st_FOCA0002, act_v_ran_v_0); ACTVALUE_TEST(lex_iv_2, dt, toValidate, EXP_RET_VALUE_FALSE, XSValue::st_FOCA0002, act_v_ran_v_0); } /*** * * getCanonicalRepresentation * --------------------------- * availability return value context * ---------------------------------------------- * validation on * ============= * lexical valid * range valid XMLCh n/a * range invalid 0 st_FOCA0002 * lexical invalid 0 st_FOCA0002 * * validation off * ============== * lexical valid * range valid XMLCh n/a * range invalid XMLCh n/a * lexical invalid 0 st_FOCA0002 * ***/ for (int j = 0; j < 2; j++) { //validation on/off toValidate = ( 0 == j)? true : false; CANREP_TEST(data_rawstr_1, dt, toValidate, EXP_RET_CANREP_TRUE, data_canrep_1, DONT_CARE); CANREP_TEST(data_rawstr_2, dt, toValidate, EXP_RET_CANREP_TRUE, data_canrep_2, XSValue::st_FOCA0002); CANREP_TEST(lex_v_ran_v_1, dt, toValidate, EXP_RET_CANREP_TRUE, lex_v_ran_v_1_canrep, DONT_CARE); CANREP_TEST(lex_v_ran_v_2, dt, toValidate, EXP_RET_CANREP_TRUE, lex_v_ran_v_2_canrep, DONT_CARE); CANREP_TEST(lex_iv_1, dt, toValidate, EXP_RET_CANREP_FALSE, 0, XSValue::st_FOCA0002); CANREP_TEST(lex_iv_2, dt, toValidate, EXP_RET_CANREP_FALSE, 0, XSValue::st_FOCA0002); } //validation on CANREP_TEST(lex_v_ran_iv_1, dt, true, EXP_RET_CANREP_FALSE, 0, XSValue::st_FOCA0002); CANREP_TEST(lex_v_ran_iv_2, dt, true, EXP_RET_CANREP_FALSE, 0, XSValue::st_FOCA0002); //validation off CANREP_TEST(lex_v_ran_iv_1, dt, false, EXP_RET_CANREP_TRUE, lex_v_ran_iv_1_canrep, DONT_CARE); CANREP_TEST(lex_v_ran_iv_2, dt, false, EXP_RET_CANREP_TRUE, lex_v_ran_iv_2_canrep, DONT_CARE); } //127 //-128 void test_dt_byte() { const XSValue::DataType dt = XSValue::dt_byte; bool toValidate = true; const char lex_v_ran_v_0[]=" 12 \n"; const char lex_v_ran_v_1[]="+127"; const char lex_v_ran_v_2[]="-128"; const char lex_v_ran_iv_1[]="+128"; const char lex_v_ran_iv_2[]="-129"; XSValue::XSValue_Data act_v_ran_v_0; act_v_ran_v_0.fValue.f_char = (char)12; XSValue::XSValue_Data act_v_ran_v_1; act_v_ran_v_1.fValue.f_char = (char)+127; XSValue::XSValue_Data act_v_ran_v_2; act_v_ran_v_2.fValue.f_char = (char)-128; const char lex_v_ran_v_1_canrep[]="127"; const char lex_v_ran_v_2_canrep[]="-128"; const char lex_v_ran_iv_1_canrep[]="128"; const char lex_v_ran_iv_2_canrep[]="-129"; const char lex_iv_1[]="1234.456"; const char lex_iv_2[]="1234b56"; /*** * * 3.3.19.2 Canonical representation * * The canonical representation for byte is defined by prohibiting certain options from the * Lexical representation (§3.3.19.1). Specifically, * 1. the the optional "+" sign is prohibited and * 2. leading zeroes are prohibited. * ***/ const char data_rawstr_1[]=" +123 \n"; const char data_canrep_1[]="123"; const char data_rawstr_2[]="000123"; const char data_canrep_2[]="123"; /*** * * validate * --------- * availability return value context * ---------------------------------------------- * lexical valid * range valid true n/a * range invalid false st_FOCA0002 * lexical invalid false st_FOCA0002 * ***/ // lexical valid, valid range VALIDATE_TEST(lex_v_ran_v_0 , dt, EXP_RET_VALID_TRUE, DONT_CARE); VALIDATE_TEST(lex_v_ran_v_1 , dt, EXP_RET_VALID_TRUE, DONT_CARE); VALIDATE_TEST(lex_v_ran_v_2 , dt, EXP_RET_VALID_TRUE, DONT_CARE); // lexical valid, invalid range VALIDATE_TEST(lex_v_ran_iv_1 , dt, EXP_RET_VALID_FALSE, XSValue::st_FOCA0002); VALIDATE_TEST(lex_v_ran_iv_2 , dt, EXP_RET_VALID_FALSE, XSValue::st_FOCA0002); // lexical invalid VALIDATE_TEST(lex_iv_1 , dt, EXP_RET_VALID_FALSE, XSValue::st_FOCA0002); VALIDATE_TEST(lex_iv_2 , dt, EXP_RET_VALID_FALSE, XSValue::st_FOCA0002); /*** * * getActualValue * --------------- * availability return value context * ---------------------------------------------- * validation on * ============= * lexical valid * range valid XSValue n/a * range invalid 0 st_Unpresentable * lexical invalid 0 st_FOCA0002 * * validation off * ============== * lexical valid * range valid XSValue n/a * range invalid 0 st_Unpresentable * lexical invalid 0 st_FOCA0002 * ***/ for (int i = 0; i < 2; i++) { //validation on/off toValidate = ( 0 == i) ? true : false; ACTVALUE_TEST(lex_v_ran_v_0, dt, toValidate, EXP_RET_VALUE_TRUE, DONT_CARE, act_v_ran_v_0); ACTVALUE_TEST(lex_v_ran_v_1, dt, toValidate, EXP_RET_VALUE_TRUE, DONT_CARE, act_v_ran_v_1); ACTVALUE_TEST(lex_v_ran_v_2, dt, toValidate, EXP_RET_VALUE_TRUE, DONT_CARE, act_v_ran_v_2); ACTVALUE_TEST(lex_v_ran_iv_1, dt, toValidate, EXP_RET_VALUE_FALSE, XSValue::st_FOCA0002, act_v_ran_v_0); ACTVALUE_TEST(lex_v_ran_iv_2, dt, toValidate, EXP_RET_VALUE_FALSE, XSValue::st_FOCA0002, act_v_ran_v_0); ACTVALUE_TEST(lex_iv_1, dt, toValidate, EXP_RET_VALUE_FALSE, XSValue::st_FOCA0002, act_v_ran_v_0); ACTVALUE_TEST(lex_iv_2, dt, toValidate, EXP_RET_VALUE_FALSE, XSValue::st_FOCA0002, act_v_ran_v_0); } /*** * * getCanonicalRepresentation * --------------------------- * availability return value context * ---------------------------------------------- * validation on * ============= * lexical valid * range valid XMLCh n/a * range invalid 0 st_FOCA0002 * lexical invalid 0 st_FOCA0002 * * validation off * ============== * lexical valid * range valid XMLCh n/a * range invalid XMLCh n/a * lexical invalid 0 st_FOCA0002 * ***/ for (int j = 0; j < 2; j++) { //validation on/off toValidate = ( 0 == j)? true : false; CANREP_TEST(data_rawstr_1, dt, toValidate, EXP_RET_CANREP_TRUE, data_canrep_1, DONT_CARE); CANREP_TEST(data_rawstr_2, dt, toValidate, EXP_RET_CANREP_TRUE, data_canrep_2, XSValue::st_FOCA0002); CANREP_TEST(lex_v_ran_v_1, dt, toValidate, EXP_RET_CANREP_TRUE, lex_v_ran_v_1_canrep, DONT_CARE); CANREP_TEST(lex_v_ran_v_2, dt, toValidate, EXP_RET_CANREP_TRUE, lex_v_ran_v_2_canrep, DONT_CARE); CANREP_TEST(lex_iv_1, dt, toValidate, EXP_RET_CANREP_FALSE, 0, XSValue::st_FOCA0002); CANREP_TEST(lex_iv_2, dt, toValidate, EXP_RET_CANREP_FALSE, 0, XSValue::st_FOCA0002); } //validation on CANREP_TEST(lex_v_ran_iv_1, dt, true, EXP_RET_CANREP_FALSE, 0, XSValue::st_FOCA0002); CANREP_TEST(lex_v_ran_iv_2, dt, true, EXP_RET_CANREP_FALSE, 0, XSValue::st_FOCA0002); //validation off CANREP_TEST(lex_v_ran_iv_1, dt, false, EXP_RET_CANREP_TRUE, lex_v_ran_iv_1_canrep, DONT_CARE); CANREP_TEST(lex_v_ran_iv_2, dt, false, EXP_RET_CANREP_TRUE, lex_v_ran_iv_2_canrep, DONT_CARE); } void test_dt_nonNegativeInteger() { const XSValue::DataType dt = XSValue::dt_nonNegativeInteger; bool toValidate = true; const char lex_v_ran_v_1[]=" 1234 \n"; const char lex_v_ran_iv_1[]="-1"; const char lex_v_ran64_v_2[]="+18446744073709551615"; const char lex_v_ran64_iv_2[]="+18446744073709551616"; const char lex_v_ran32_v_2[]="4294967295"; const char lex_v_ran32_iv_2[]="4294967296"; XSValue::XSValue_Data act_v_ran_v_1; act_v_ran_v_1.fValue.f_ulong = (unsigned long)1234; #if defined(XML_BITSTOBUILD_64) XSValue::XSValue_Data act_v_ran64_v_2; act_v_ran64_v_2.fValue.f_ulong = (unsigned long)+18446744073709551615; #endif XSValue::XSValue_Data act_v_ran32_v_2; act_v_ran32_v_2.fValue.f_ulong = (unsigned long)4294967295; const char lex_v_ran64_v_2_canrep[]="18446744073709551615"; const char lex_v_ran64_iv_2_canrep[]="18446744073709551616"; const char lex_iv_1[]="12b34.456"; const char lex_iv_2[]="1234b56"; /*** * 3.3.20.2 Canonical representation * * The canonical representation for nonNegativeInteger is defined by prohibiting certain options from the * Lexical representation (§3.3.20.1). Specifically, * 1. the the optional "+" sign is prohibited and * 2. leading zeroes are prohibited. * ***/ const char data_rawstr_1[]=" 0 \n"; const char data_canrep_1[]="0"; const char data_rawstr_2[]="+00012345"; const char data_canrep_2[]="12345"; /*** * * validate * --------- * availability return value context * ---------------------------------------------- * lexical valid * range valid true n/a * range invalid n/a * lexical invalid false st_FOCA0002 * ***/ // lexical valid VALIDATE_TEST(lex_v_ran_v_1 , dt, EXP_RET_VALID_TRUE, DONT_CARE); VALIDATE_TEST(lex_v_ran_iv_1 , dt, EXP_RET_VALID_FALSE, XSValue::st_FOCA0002); VALIDATE_TEST(lex_v_ran64_v_2 , dt, EXP_RET_VALID_TRUE, DONT_CARE); VALIDATE_TEST(lex_v_ran64_iv_2 , dt, EXP_RET_VALID_TRUE, DONT_CARE); // lexical invalid VALIDATE_TEST(lex_iv_1 , dt, EXP_RET_VALID_FALSE, XSValue::st_FOCA0002); VALIDATE_TEST(lex_iv_2 , dt, EXP_RET_VALID_FALSE, XSValue::st_FOCA0002); /*** * * getActualValue * --------------- * availability return value context * ---------------------------------------------- * validation on * ============= * lexical valid * range valid XSValue n/a * range invalid 0 st_Unpresentable * lexical invalid 0 st_FOCA0002 * * validation off * ============== * lexical valid * range valid XSValue n/a * range invalid 0 st_Unpresentable * lexical invalid 0 st_FOCA0002 * ***/ for (int i = 0; i < 2; i++) { //validation on/off toValidate = ( 0 == i) ? true : false; ACTVALUE_TEST(lex_v_ran_v_1, dt, toValidate, EXP_RET_VALUE_TRUE, DONT_CARE, act_v_ran_v_1); #if defined(XML_BITSTOBUILD_64) ACTVALUE_TEST(lex_v_ran64_v_2 , dt, toValidate, EXP_RET_VALUE_TRUE, DONT_CARE, act_v_ran64_v_2); ACTVALUE_TEST(lex_v_ran64_iv_2, dt, toValidate, EXP_RET_VALUE_FALSE, XSValue::st_FOCA0003, act_v_ran64_v_2); #else ACTVALUE_TEST(lex_v_ran32_v_2, dt, toValidate, EXP_RET_VALUE_TRUE, DONT_CARE, act_v_ran32_v_2); ACTVALUE_TEST(lex_v_ran32_iv_2, dt, toValidate, EXP_RET_VALUE_FALSE, XSValue::st_FOCA0003, act_v_ran32_v_2); #endif ACTVALUE_TEST(lex_iv_1, dt, toValidate, EXP_RET_VALUE_FALSE, XSValue::st_FOCA0002, act_v_ran32_v_2); ACTVALUE_TEST(lex_iv_2, dt, toValidate, EXP_RET_VALUE_FALSE, XSValue::st_FOCA0002, act_v_ran32_v_2); } /*** * * getCanonicalRepresentation * --------------------------- * availability return value context * ---------------------------------------------- * validation on * ============= * lexical valid * range valid XMLCh n/a * range invalid n/a * lexical invalid 0 st_FOCA0002 * * validation off * ============== * lexical valid * range valid XMLCh n/a * range invalid n/a * lexical invalid 0 st_FOCA0002 * ***/ for (int j = 0; j < 2; j++) { //validation on/off toValidate = ( 0 == j)? true : false; CANREP_TEST(data_rawstr_1, dt, toValidate, EXP_RET_CANREP_TRUE, data_canrep_1, DONT_CARE); CANREP_TEST(data_rawstr_2, dt, toValidate, EXP_RET_CANREP_TRUE, data_canrep_2, DONT_CARE); CANREP_TEST(lex_v_ran64_v_2, dt, toValidate, EXP_RET_CANREP_TRUE, lex_v_ran64_v_2_canrep, DONT_CARE); CANREP_TEST(lex_v_ran64_iv_2, dt, toValidate, EXP_RET_CANREP_TRUE, lex_v_ran64_iv_2_canrep, DONT_CARE); CANREP_TEST(lex_iv_1 , dt, toValidate, EXP_RET_CANREP_FALSE, 0, XSValue::st_FOCA0002); CANREP_TEST(lex_iv_2 , dt, toValidate, EXP_RET_CANREP_FALSE, 0, XSValue::st_FOCA0002); } } //18446744073709551615 // 4294967295 void test_dt_unsignedLong() { const XSValue::DataType dt = XSValue::dt_unsignedLong; bool toValidate = true; const char lex_v_ran_v_1[]=" 1234 \n"; const char lex_v_ran64_v_1[]="+18446744073709551615"; const char lex_v_ran64_v_2[]="0"; const char lex_v_ran64_iv_1[]="+18446744073709551616"; const char lex_v_ran64_iv_2[]="-1"; const char lex_v_ran32_v_1[]="+4294967295"; const char lex_v_ran32_v_2[]="0"; const char lex_v_ran32_iv_1[]="4294967296"; const char lex_v_ran32_iv_2[]="-1"; XSValue::XSValue_Data act_v_ran_v_1; act_v_ran_v_1.fValue.f_ulong = (unsigned long)1234; #if defined(XML_BITSTOBUILD_64) XSValue::XSValue_Data act_v_ran64_v_1; act_v_ran64_v_1.fValue.f_ulong = (unsigned long)+18446744073709551615; XSValue::XSValue_Data act_v_ran64_v_2; act_v_ran64_v_2.fValue.f_ulong = (unsigned long)0; #endif XSValue::XSValue_Data act_v_ran32_v_1; act_v_ran32_v_1.fValue.f_ulong = (unsigned long)+4294967295; XSValue::XSValue_Data act_v_ran32_v_2; act_v_ran32_v_2.fValue.f_ulong = (unsigned long)0; const char lex_v_ran64_v_1_canrep[]="18446744073709551615"; const char lex_v_ran64_v_2_canrep[]="0"; const char lex_v_ran64_iv_1_canrep[]="18446744073709551616"; const char lex_v_ran64_iv_2_canrep[]="-1"; const char lex_iv_1[]="12b34.456"; const char lex_iv_2[]="1234b56"; /*** * 3.3.16.2 Canonical representation * * The canonical representation for long is defined by prohibiting certain options from the * Lexical representation (§3.3.16.1). Specifically, * 1. the the optional "+" sign is prohibited and * 2. leading zeroes are prohibited. ***/ const char data_rawstr_1[]=" +12345 \n"; const char data_canrep_1[]="12345"; const char data_rawstr_2[]="00012345"; const char data_canrep_2[]="12345"; /*** * * validate * --------- * availability return value context * ---------------------------------------------- * lexical valid * range valid true n/a * range invalid false st_FOCA0002 * lexical invalid false st_FOCA0002 * ***/ // lexical valid, valid range VALIDATE_TEST(lex_v_ran_v_1 , dt, EXP_RET_VALID_TRUE, DONT_CARE); VALIDATE_TEST(lex_v_ran64_v_1 , dt, EXP_RET_VALID_TRUE, DONT_CARE); VALIDATE_TEST(lex_v_ran64_v_2 , dt, EXP_RET_VALID_TRUE, DONT_CARE); // lexical valid, invalid range VALIDATE_TEST(lex_v_ran64_iv_1 , dt, EXP_RET_VALID_FALSE, XSValue::st_FOCA0002); VALIDATE_TEST(lex_v_ran64_iv_2 , dt, EXP_RET_VALID_FALSE, XSValue::st_FOCA0002); // lexical invalid VALIDATE_TEST(lex_iv_1 , dt, EXP_RET_VALID_FALSE, XSValue::st_FOCA0002); VALIDATE_TEST(lex_iv_2 , dt, EXP_RET_VALID_FALSE, XSValue::st_FOCA0002); /*** * * getActualValue * --------------- * availability return value context * ---------------------------------------------- * validation on * ============= * lexical valid * range valid XSValue n/a * range invalid 0 st_Unpresentable * lexical invalid 0 st_FOCA0002 * * validation off * ============== * lexical valid * range valid XSValue n/a * range invalid 0 st_Unpresentable * lexical invalid 0 st_FOCA0002 * ***/ for (int i = 0; i < 2; i++) { //validation on/off toValidate = ( 0 == i) ? true : false; ACTVALUE_TEST(lex_v_ran_v_1, dt, toValidate, EXP_RET_VALUE_TRUE, DONT_CARE, act_v_ran_v_1); #if defined(XML_BITSTOBUILD_64) ACTVALUE_TEST(lex_v_ran64_v_1 , dt, toValidate, EXP_RET_VALUE_TRUE, DONT_CARE, act_v_ran64_v_1); ACTVALUE_TEST(lex_v_ran64_v_2 , dt, toValidate, EXP_RET_VALUE_TRUE, DONT_CARE, act_v_ran64_v_2); ACTVALUE_TEST(lex_v_ran64_iv_1, dt, toValidate, EXP_RET_VALUE_FALSE, XSValue::st_FOCA0003, act_v_ran64_v_1); ACTVALUE_TEST(lex_v_ran64_iv_2, dt, toValidate, EXP_RET_VALUE_FALSE, XSValue::st_FOCA0002, act_v_ran64_v_1); #else ACTVALUE_TEST(lex_v_ran32_v_1, dt, toValidate, EXP_RET_VALUE_TRUE, DONT_CARE, act_v_ran32_v_1); ACTVALUE_TEST(lex_v_ran32_v_2, dt, toValidate, EXP_RET_VALUE_TRUE, DONT_CARE, act_v_ran32_v_2); ACTVALUE_TEST(lex_v_ran32_iv_1, dt, toValidate, EXP_RET_VALUE_FALSE, XSValue::st_FOCA0003, act_v_ran32_v_1); ACTVALUE_TEST(lex_v_ran32_iv_2, dt, toValidate, EXP_RET_VALUE_FALSE, XSValue::st_FOCA0002, act_v_ran32_v_1); #endif ACTVALUE_TEST(lex_iv_1, dt, toValidate, EXP_RET_VALUE_FALSE, XSValue::st_FOCA0002, act_v_ran32_v_1); ACTVALUE_TEST(lex_iv_2, dt, toValidate, EXP_RET_VALUE_FALSE, XSValue::st_FOCA0002, act_v_ran32_v_1); } /*** * * getCanonicalRepresentation * --------------------------- * availability return value context * ---------------------------------------------- * validation on * ============= * lexical valid * range valid XMLCh n/a * range invalid 0 st_FOCA0002 * lexical invalid 0 st_FOCA0002 * * validation off * ============== * lexical valid * range valid XMLCh n/a * range invalid XMLCh n/a * lexical invalid 0 st_FOCA0002 * ***/ for (int j = 0; j < 2; j++) { //validation on/off toValidate = ( 0 == j)? true : false; CANREP_TEST(data_rawstr_1, dt, toValidate, EXP_RET_CANREP_TRUE, data_canrep_1, DONT_CARE); CANREP_TEST(data_rawstr_2, dt, toValidate, EXP_RET_CANREP_TRUE, data_canrep_2, XSValue::st_FOCA0002); CANREP_TEST(lex_v_ran64_v_1, dt, toValidate, EXP_RET_CANREP_TRUE, lex_v_ran64_v_1_canrep, DONT_CARE); CANREP_TEST(lex_v_ran64_v_2, dt, toValidate, EXP_RET_CANREP_TRUE, lex_v_ran64_v_2_canrep, DONT_CARE); CANREP_TEST(lex_iv_1 , dt, toValidate, EXP_RET_CANREP_FALSE, 0, XSValue::st_FOCA0002); CANREP_TEST(lex_iv_2 , dt, toValidate, EXP_RET_CANREP_FALSE, 0, XSValue::st_FOCA0002); } //validation on CANREP_TEST(lex_v_ran64_iv_1, dt, true, EXP_RET_CANREP_FALSE, 0, XSValue::st_FOCA0002); CANREP_TEST(lex_v_ran64_iv_2, dt, true, EXP_RET_CANREP_FALSE, 0, XSValue::st_FOCA0002); //validation off CANREP_TEST(lex_v_ran64_iv_1, dt, false, EXP_RET_CANREP_TRUE, lex_v_ran64_iv_1_canrep, DONT_CARE); CANREP_TEST(lex_v_ran64_iv_2, dt, false, EXP_RET_CANREP_TRUE, lex_v_ran64_iv_2_canrep, DONT_CARE); } //4294967295 void test_dt_unsignedInt() { const XSValue::DataType dt = XSValue::dt_unsignedInt; bool toValidate = true; const char lex_v_ran_v_0[]=" 1234 \n"; const char lex_v_ran_v_1[]="+4294967295"; const char lex_v_ran_v_2[]="0"; const char lex_v_ran_iv_1[]="4294967296"; const char lex_v_ran_iv_2[]="-1"; XSValue::XSValue_Data act_v_ran_v_0; act_v_ran_v_0.fValue.f_uint = (unsigned int)1234; XSValue::XSValue_Data act_v_ran_v_1; act_v_ran_v_1.fValue.f_uint = (unsigned int)+4294967295; XSValue::XSValue_Data act_v_ran_v_2; act_v_ran_v_2.fValue.f_uint = (unsigned int)0; const char lex_v_ran_v_1_canrep[]="4294967295"; const char lex_v_ran_v_2_canrep[]="0"; const char lex_v_ran_iv_1_canrep[]="4294967296"; const char lex_v_ran_iv_2_canrep[]="-1"; const char lex_iv_1[]="12b34.456"; const char lex_iv_2[]="1234b56"; /*** * 3.3.22.2 Canonical representation * * The canonical representation for unsignedInt is defined by prohibiting certain options from the * Lexical representation (§3.3.22.1). Specifically, * leading zeroes are prohibited. * ***/ const char data_rawstr_1[]=" +12345 \n"; const char data_canrep_1[]="12345"; const char data_rawstr_2[]="00012345"; const char data_canrep_2[]="12345"; /*** * * validate * --------- * availability return value context * ---------------------------------------------- * lexical valid * range valid true n/a * range invalid false st_FOCA0002 * lexical invalid false st_FOCA0002 * ***/ // lexical valid, valid range VALIDATE_TEST(lex_v_ran_v_0 , dt, EXP_RET_VALID_TRUE, DONT_CARE); VALIDATE_TEST(lex_v_ran_v_1 , dt, EXP_RET_VALID_TRUE, DONT_CARE); VALIDATE_TEST(lex_v_ran_v_2 , dt, EXP_RET_VALID_TRUE, DONT_CARE); // lexical valid, invalid range VALIDATE_TEST(lex_v_ran_iv_1 , dt, EXP_RET_VALID_FALSE, XSValue::st_FOCA0002); VALIDATE_TEST(lex_v_ran_iv_2 , dt, EXP_RET_VALID_FALSE, XSValue::st_FOCA0002); // lexical invalid VALIDATE_TEST(lex_iv_1 , dt, EXP_RET_VALID_FALSE, XSValue::st_FOCA0002); VALIDATE_TEST(lex_iv_2 , dt, EXP_RET_VALID_FALSE, XSValue::st_FOCA0002); /*** * * getActualValue * --------------- * availability return value context * ---------------------------------------------- * validation on * ============= * lexical valid * range valid XSValue n/a * range invalid 0 st_Unpresentable * lexical invalid 0 st_FOCA0002 * * validation off * ============== * lexical valid * range valid XSValue n/a * range invalid 0 st_Unpresentable * lexical invalid 0 st_FOCA0002 * ***/ for (int i = 0; i < 2; i++) { //validation on/off toValidate = ( 0 == i) ? true : false; ACTVALUE_TEST(lex_v_ran_v_0, dt, toValidate, EXP_RET_VALUE_TRUE, DONT_CARE, act_v_ran_v_0); ACTVALUE_TEST(lex_v_ran_v_1, dt, toValidate, EXP_RET_VALUE_TRUE, DONT_CARE, act_v_ran_v_1); ACTVALUE_TEST(lex_v_ran_v_2, dt, toValidate, EXP_RET_VALUE_TRUE, DONT_CARE, act_v_ran_v_2); ACTVALUE_TEST(lex_v_ran_iv_1, dt, toValidate, EXP_RET_VALUE_FALSE, XSValue::st_FOCA0002, act_v_ran_v_0); ACTVALUE_TEST(lex_v_ran_iv_2, dt, toValidate, EXP_RET_VALUE_FALSE, XSValue::st_FOCA0002, act_v_ran_v_0); ACTVALUE_TEST(lex_iv_1, dt, toValidate, EXP_RET_VALUE_FALSE, XSValue::st_FOCA0002, act_v_ran_v_0); ACTVALUE_TEST(lex_iv_2, dt, toValidate, EXP_RET_VALUE_FALSE, XSValue::st_FOCA0002, act_v_ran_v_0); } /*** * * getCanonicalRepresentation * --------------------------- * availability return value context * ---------------------------------------------- * validation on * ============= * lexical valid * range valid XMLCh n/a * range invalid 0 st_FOCA0002 * lexical invalid 0 st_FOCA0002 * * validation off * ============== * lexical valid * range valid XMLCh n/a * range invalid XMLCh n/a * lexical invalid 0 st_FOCA0002 * ***/ for (int j = 0; j < 2; j++) { //validation on/off toValidate = ( 0 == j)? true : false; CANREP_TEST(data_rawstr_1, dt, toValidate, EXP_RET_CANREP_TRUE, data_canrep_1, DONT_CARE); CANREP_TEST(data_rawstr_2, dt, toValidate, EXP_RET_CANREP_TRUE, data_canrep_2, XSValue::st_FOCA0002); CANREP_TEST(lex_v_ran_v_1, dt, toValidate, EXP_RET_CANREP_TRUE, lex_v_ran_v_1_canrep, DONT_CARE); CANREP_TEST(lex_v_ran_v_2, dt, toValidate, EXP_RET_CANREP_TRUE, lex_v_ran_v_2_canrep, DONT_CARE); CANREP_TEST(lex_iv_1 , dt, toValidate, EXP_RET_CANREP_FALSE, 0, XSValue::st_FOCA0002); CANREP_TEST(lex_iv_2 , dt, toValidate, EXP_RET_CANREP_FALSE, 0, XSValue::st_FOCA0002); } //validation on CANREP_TEST(lex_v_ran_iv_1, dt, true, EXP_RET_CANREP_FALSE, 0, XSValue::st_FOCA0002); CANREP_TEST(lex_v_ran_iv_2, dt, true, EXP_RET_CANREP_FALSE, 0, XSValue::st_FOCA0002); //validation off CANREP_TEST(lex_v_ran_iv_1, dt, false, EXP_RET_CANREP_TRUE, lex_v_ran_iv_1_canrep, DONT_CARE); CANREP_TEST(lex_v_ran_iv_2, dt, false, EXP_RET_CANREP_TRUE, lex_v_ran_iv_2_canrep, DONT_CARE); } //65535 void test_dt_unsignedShort() { const XSValue::DataType dt = XSValue::dt_unsignedShort; bool toValidate = true; const char lex_v_ran_v_0[]=" 1234 \n"; const char lex_v_ran_v_1[]="+65535"; const char lex_v_ran_v_2[]="0"; const char lex_v_ran_iv_1[]="+65536"; const char lex_v_ran_iv_2[]="-1"; XSValue::XSValue_Data act_v_ran_v_0; act_v_ran_v_0.fValue.f_ushort = (unsigned short)1234; XSValue::XSValue_Data act_v_ran_v_1; act_v_ran_v_1.fValue.f_ushort = (unsigned short)+65535; XSValue::XSValue_Data act_v_ran_v_2; act_v_ran_v_2.fValue.f_ushort = (unsigned short)0; const char lex_v_ran_v_1_canrep[]="65535"; const char lex_v_ran_v_2_canrep[]="0"; const char lex_v_ran_iv_1_canrep[]="65536"; const char lex_v_ran_iv_2_canrep[]="-1"; const char lex_iv_1[]="12b34.456"; const char lex_iv_2[]="1234b56"; /*** * 3.3.23.2 Canonical representation * * The canonical representation for unsignedShort is defined by prohibiting certain options from the * Lexical representation (§3.3.23.1). Specifically, * 1. the leading zeroes are prohibited. * ***/ const char data_rawstr_1[]=" +12345 \n"; const char data_canrep_1[]="12345"; const char data_rawstr_2[]="00012345"; const char data_canrep_2[]="12345"; /*** * * validate * --------- * availability return value context * ---------------------------------------------- * lexical valid * range valid true n/a * range invalid false st_FOCA0002 * lexical invalid false st_FOCA0002 * ***/ // lexical valid, valid range VALIDATE_TEST(lex_v_ran_v_0 , dt, EXP_RET_VALID_TRUE, DONT_CARE); VALIDATE_TEST(lex_v_ran_v_1 , dt, EXP_RET_VALID_TRUE, DONT_CARE); VALIDATE_TEST(lex_v_ran_v_2 , dt, EXP_RET_VALID_TRUE, DONT_CARE); // lexical valid, invalid range VALIDATE_TEST(lex_v_ran_iv_1 , dt, EXP_RET_VALID_FALSE, XSValue::st_FOCA0002); VALIDATE_TEST(lex_v_ran_iv_2 , dt, EXP_RET_VALID_FALSE, XSValue::st_FOCA0002); // lexical invalid VALIDATE_TEST(lex_iv_1 , dt, EXP_RET_VALID_FALSE, XSValue::st_FOCA0002); VALIDATE_TEST(lex_iv_2 , dt, EXP_RET_VALID_FALSE, XSValue::st_FOCA0002); /*** * * getActualValue * --------------- * availability return value context * ---------------------------------------------- * validation on * ============= * lexical valid * range valid XSValue n/a * range invalid 0 st_Unpresentable * lexical invalid 0 st_FOCA0002 * * validation off * ============== * lexical valid * range valid XSValue n/a * range invalid 0 st_Unpresentable * lexical invalid 0 st_FOCA0002 * ***/ for (int i = 0; i < 2; i++) { //validation on/off toValidate = ( 0 == i) ? true : false; ACTVALUE_TEST(lex_v_ran_v_0, dt, toValidate, EXP_RET_VALUE_TRUE, DONT_CARE, act_v_ran_v_0); ACTVALUE_TEST(lex_v_ran_v_1, dt, toValidate, EXP_RET_VALUE_TRUE, DONT_CARE, act_v_ran_v_1); ACTVALUE_TEST(lex_v_ran_v_2, dt, toValidate, EXP_RET_VALUE_TRUE, DONT_CARE, act_v_ran_v_2); ACTVALUE_TEST(lex_v_ran_iv_1, dt, toValidate, EXP_RET_VALUE_FALSE, XSValue::st_FOCA0002, act_v_ran_v_0); ACTVALUE_TEST(lex_v_ran_iv_2, dt, toValidate, EXP_RET_VALUE_FALSE, XSValue::st_FOCA0002, act_v_ran_v_0); ACTVALUE_TEST(lex_iv_1, dt, toValidate, EXP_RET_VALUE_FALSE, XSValue::st_FOCA0002, act_v_ran_v_0); ACTVALUE_TEST(lex_iv_2, dt, toValidate, EXP_RET_VALUE_FALSE, XSValue::st_FOCA0002, act_v_ran_v_0); } /*** * * getCanonicalRepresentation * --------------------------- * availability return value context * ---------------------------------------------- * validation on * ============= * lexical valid * range valid XMLCh n/a * range invalid 0 st_FOCA0002 * lexical invalid 0 st_FOCA0002 * * validation off * ============== * lexical valid * range valid XMLCh n/a * range invalid XMLCh n/a * lexical invalid 0 st_FOCA0002 * ***/ for (int j = 0; j < 2; j++) { //validation on/off toValidate = ( 0 == j)? true : false; CANREP_TEST(data_rawstr_1, dt, toValidate, EXP_RET_CANREP_TRUE, data_canrep_1, DONT_CARE); CANREP_TEST(data_rawstr_2, dt, toValidate, EXP_RET_CANREP_TRUE, data_canrep_2, XSValue::st_FOCA0002); CANREP_TEST(lex_v_ran_v_1, dt, toValidate, EXP_RET_CANREP_TRUE, lex_v_ran_v_1_canrep, DONT_CARE); CANREP_TEST(lex_v_ran_v_2, dt, toValidate, EXP_RET_CANREP_TRUE, lex_v_ran_v_2_canrep, DONT_CARE); CANREP_TEST(lex_iv_1 , dt, toValidate, EXP_RET_CANREP_FALSE, 0, XSValue::st_FOCA0002); CANREP_TEST(lex_iv_2 , dt, toValidate, EXP_RET_CANREP_FALSE, 0, XSValue::st_FOCA0002); } //validation on CANREP_TEST(lex_v_ran_iv_1, dt, true, EXP_RET_CANREP_FALSE, 0, XSValue::st_FOCA0002); CANREP_TEST(lex_v_ran_iv_2, dt, true, EXP_RET_CANREP_FALSE, 0, XSValue::st_FOCA0002); //validation off CANREP_TEST(lex_v_ran_iv_1, dt, false, EXP_RET_CANREP_TRUE, lex_v_ran_iv_1_canrep, DONT_CARE); CANREP_TEST(lex_v_ran_iv_2, dt, false, EXP_RET_CANREP_TRUE, lex_v_ran_iv_2_canrep, DONT_CARE); } // 255 void test_dt_unsignedByte() { const XSValue::DataType dt = XSValue::dt_unsignedByte; bool toValidate = true; const char lex_v_ran_v_0[]=" 123 \n"; const char lex_v_ran_v_1[]="+255"; const char lex_v_ran_v_2[]="0"; const char lex_v_ran_iv_1[]="+256"; const char lex_v_ran_iv_2[]="-1"; XSValue::XSValue_Data act_v_ran_v_0; act_v_ran_v_0.fValue.f_uchar = (unsigned char)123; XSValue::XSValue_Data act_v_ran_v_1; act_v_ran_v_1.fValue.f_uchar = (unsigned char)+255; XSValue::XSValue_Data act_v_ran_v_2; act_v_ran_v_2.fValue.f_uchar = (unsigned char)0; const char lex_v_ran_v_1_canrep[]="255"; const char lex_v_ran_v_2_canrep[]="0"; const char lex_v_ran_iv_1_canrep[]="256"; const char lex_v_ran_iv_2_canrep[]="-1"; const char lex_iv_1[]="12b34.456"; const char lex_iv_2[]="1234b56"; /*** * 3.3.24.2 Canonical representation * * The canonical representation for unsignedByte is defined by prohibiting certain options from the * Lexical representation (§3.3.24.1). Specifically, * 1. leading zeroes are prohibited. * ***/ const char data_rawstr_1[]=" +123 \n"; const char data_canrep_1[]="123"; const char data_rawstr_2[]="000123"; const char data_canrep_2[]="123"; /*** * * validate * --------- * availability return value context * ---------------------------------------------- * lexical valid * range valid true n/a * range invalid false st_FOCA0002 * lexical invalid false st_FOCA0002 * ***/ // lexical valid, valid range VALIDATE_TEST(lex_v_ran_v_0 , dt, EXP_RET_VALID_TRUE, DONT_CARE); VALIDATE_TEST(lex_v_ran_v_1 , dt, EXP_RET_VALID_TRUE, DONT_CARE); VALIDATE_TEST(lex_v_ran_v_2 , dt, EXP_RET_VALID_TRUE, DONT_CARE); // lexical valid, invalid range VALIDATE_TEST(lex_v_ran_iv_1 , dt, EXP_RET_VALID_FALSE, XSValue::st_FOCA0002); VALIDATE_TEST(lex_v_ran_iv_2 , dt, EXP_RET_VALID_FALSE, XSValue::st_FOCA0002); // lexical invalid VALIDATE_TEST(lex_iv_1 , dt, EXP_RET_VALID_FALSE, XSValue::st_FOCA0002); VALIDATE_TEST(lex_iv_2 , dt, EXP_RET_VALID_FALSE, XSValue::st_FOCA0002); /*** * * getActualValue * --------------- * availability return value context * ---------------------------------------------- * validation on * ============= * lexical valid * range valid XSValue n/a * range invalid 0 st_Unpresentable * lexical invalid 0 st_FOCA0002 * * validation off * ============== * lexical valid * range valid XSValue n/a * range invalid 0 st_Unpresentable * lexical invalid 0 st_FOCA0002 * ***/ for (int i = 0; i < 2; i++) { //validation on/off toValidate = ( 0 == i) ? true : false; ACTVALUE_TEST(lex_v_ran_v_0, dt, toValidate, EXP_RET_VALUE_TRUE, DONT_CARE, act_v_ran_v_0); ACTVALUE_TEST(lex_v_ran_v_1, dt, toValidate, EXP_RET_VALUE_TRUE, DONT_CARE, act_v_ran_v_1); ACTVALUE_TEST(lex_v_ran_v_2, dt, toValidate, EXP_RET_VALUE_TRUE, DONT_CARE, act_v_ran_v_2); ACTVALUE_TEST(lex_v_ran_iv_1, dt, toValidate, EXP_RET_VALUE_FALSE, XSValue::st_FOCA0002, act_v_ran_v_0); ACTVALUE_TEST(lex_v_ran_iv_2, dt, toValidate, EXP_RET_VALUE_FALSE, XSValue::st_FOCA0002, act_v_ran_v_0); ACTVALUE_TEST(lex_iv_1, dt, toValidate, EXP_RET_VALUE_FALSE, XSValue::st_FOCA0002, act_v_ran_v_0); ACTVALUE_TEST(lex_iv_2, dt, toValidate, EXP_RET_VALUE_FALSE, XSValue::st_FOCA0002, act_v_ran_v_0); } /*** * * getCanonicalRepresentation * --------------------------- * availability return value context * ---------------------------------------------- * validation on * ============= * lexical valid * range valid XMLCh n/a * range invalid 0 st_FOCA0002 * lexical invalid 0 st_FOCA0002 * * validation off * ============== * lexical valid * range valid XMLCh n/a * range invalid XMLCh n/a * lexical invalid 0 st_FOCA0002 * ***/ for (int j = 0; j < 2; j++) { //validation on/off toValidate = ( 0 == j)? true : false; CANREP_TEST(data_rawstr_1, dt, toValidate, EXP_RET_CANREP_TRUE, data_canrep_1, DONT_CARE); CANREP_TEST(data_rawstr_2, dt, toValidate, EXP_RET_CANREP_TRUE, data_canrep_2, XSValue::st_FOCA0002); CANREP_TEST(lex_v_ran_v_1, dt, toValidate, EXP_RET_CANREP_TRUE, lex_v_ran_v_1_canrep, DONT_CARE); CANREP_TEST(lex_v_ran_v_2, dt, toValidate, EXP_RET_CANREP_TRUE, lex_v_ran_v_2_canrep, DONT_CARE); CANREP_TEST(lex_iv_1 , dt, toValidate, EXP_RET_CANREP_FALSE, 0, XSValue::st_FOCA0002); CANREP_TEST(lex_iv_2 , dt, toValidate, EXP_RET_CANREP_FALSE, 0, XSValue::st_FOCA0002); } //validation on CANREP_TEST(lex_v_ran_iv_1, dt, true, EXP_RET_CANREP_FALSE, 0, XSValue::st_FOCA0002); CANREP_TEST(lex_v_ran_iv_2, dt, true, EXP_RET_CANREP_FALSE, 0, XSValue::st_FOCA0002); //validation off CANREP_TEST(lex_v_ran_iv_1, dt, false, EXP_RET_CANREP_TRUE, lex_v_ran_iv_1_canrep, DONT_CARE); CANREP_TEST(lex_v_ran_iv_2, dt, false, EXP_RET_CANREP_TRUE, lex_v_ran_iv_2_canrep, DONT_CARE); } void test_dt_positiveInteger() { const XSValue::DataType dt = XSValue::dt_positiveInteger; bool toValidate = true; const char lex_v_ran_v_1[]=" 1234 \n"; const char lex_v_ran_iv_1[]="0"; const char lex_v_ran64_v_2[]="+18446744073709551615"; const char lex_v_ran64_iv_2[]="+18446744073709551616"; const char lex_v_ran32_v_2[]="4294967295"; const char lex_v_ran32_iv_2[]="4294967296"; XSValue::XSValue_Data act_v_ran_v_1; act_v_ran_v_1.fValue.f_ulong = (unsigned long)1234; #if defined(XML_BITSTOBUILD_64) XSValue::XSValue_Data act_v_ran64_v_2; act_v_ran64_v_2.fValue.f_ulong = (unsigned long)+18446744073709551615; #endif XSValue::XSValue_Data act_v_ran32_v_2; act_v_ran32_v_2.fValue.f_ulong = (unsigned long)+4294967295; const char lex_v_ran64_v_2_canrep[]="18446744073709551615"; const char lex_v_ran64_iv_2_canrep[]="18446744073709551616"; const char lex_iv_1[]="12b34.456"; const char lex_iv_2[]="1234b56"; /*** * 3.3.25.2 Canonical representation * * The canonical representation for positiveInteger is defined by prohibiting certain options from the * Lexical representation (§3.3.25.1). Specifically, * 1. the optional "+" sign is prohibited and * 2. leading zeroes are prohibited. * ***/ const char data_rawstr_1[]=" +1 \n"; const char data_canrep_1[]="1"; const char data_rawstr_2[]="+00012345"; const char data_canrep_2[]="12345"; /*** * * validate * --------- * availability return value context * ---------------------------------------------- * lexical valid * range valid true n/a * range invalid n/a * lexical invalid false st_FOCA0002 * ***/ // lexical valid VALIDATE_TEST(lex_v_ran_v_1 , dt, EXP_RET_VALID_TRUE, DONT_CARE); VALIDATE_TEST(lex_v_ran_iv_1 , dt, EXP_RET_VALID_FALSE, XSValue::st_FOCA0002); VALIDATE_TEST(lex_v_ran64_v_2 , dt, EXP_RET_VALID_TRUE, DONT_CARE); VALIDATE_TEST(lex_v_ran64_iv_2 , dt, EXP_RET_VALID_TRUE, DONT_CARE); // lexical invalid VALIDATE_TEST(lex_iv_1 , dt, EXP_RET_VALID_FALSE, XSValue::st_FOCA0002); VALIDATE_TEST(lex_iv_2 , dt, EXP_RET_VALID_FALSE, XSValue::st_FOCA0002); /*** * * getActualValue * --------------- * availability return value context * ---------------------------------------------- * validation on * ============= * lexical valid * range valid XSValue n/a * range invalid 0 st_Unpresentable * lexical invalid 0 st_FOCA0002 * * validation off * ============== * lexical valid * range valid XSValue n/a * range invalid 0 st_Unpresentable * lexical invalid 0 st_FOCA0002 * ***/ for (int i = 0; i < 2; i++) { //validation on/off toValidate = ( 0 == i) ? true : false; ACTVALUE_TEST(lex_v_ran_v_1, dt, toValidate, EXP_RET_VALUE_TRUE, DONT_CARE, act_v_ran_v_1); #if defined(XML_BITSTOBUILD_64) ACTVALUE_TEST(lex_v_ran64_v_2 , dt, toValidate, EXP_RET_VALUE_TRUE, DONT_CARE, act_v_ran64_v_2); ACTVALUE_TEST(lex_v_ran64_iv_2, dt, toValidate, EXP_RET_VALUE_FALSE, XSValue::st_FOCA0003, act_v_ran64_v_2); #else ACTVALUE_TEST(lex_v_ran32_v_2, dt, toValidate, EXP_RET_VALUE_TRUE, DONT_CARE, act_v_ran32_v_2); ACTVALUE_TEST(lex_v_ran32_iv_2, dt, toValidate, EXP_RET_VALUE_FALSE, XSValue::st_FOCA0003, act_v_ran32_v_2); #endif ACTVALUE_TEST(lex_iv_1, dt, toValidate, EXP_RET_VALUE_FALSE, XSValue::st_FOCA0002, act_v_ran32_v_2); ACTVALUE_TEST(lex_iv_2, dt, toValidate, EXP_RET_VALUE_FALSE, XSValue::st_FOCA0002, act_v_ran32_v_2); } /*** * * getCanonicalRepresentation * --------------------------- * availability return value context * ---------------------------------------------- * validation on * ============= * lexical valid * range valid XMLCh n/a * range invalid n/a * lexical invalid 0 st_FOCA0002 * * validation off * ============== * lexical valid * range valid XMLCh n/a * range invalid n/a * lexical invalid 0 st_FOCA0002 * ***/ for (int j = 0; j < 2; j++) { //validation on/off toValidate = ( 0 == j)? true : false; CANREP_TEST(data_rawstr_1, dt, toValidate, EXP_RET_CANREP_TRUE, data_canrep_1, DONT_CARE); CANREP_TEST(data_rawstr_2, dt, toValidate, EXP_RET_CANREP_TRUE, data_canrep_2, DONT_CARE); CANREP_TEST(lex_v_ran64_v_2, dt, toValidate, EXP_RET_CANREP_TRUE, lex_v_ran64_v_2_canrep, DONT_CARE); CANREP_TEST(lex_v_ran64_iv_2, dt, toValidate, EXP_RET_CANREP_TRUE, lex_v_ran64_iv_2_canrep, DONT_CARE); CANREP_TEST(lex_iv_1 , dt, toValidate, EXP_RET_CANREP_FALSE, 0, XSValue::st_FOCA0002); CANREP_TEST(lex_iv_2 , dt, toValidate, EXP_RET_CANREP_FALSE, 0, XSValue::st_FOCA0002); } } void test_dt_boolean() { const XSValue::DataType dt = XSValue::dt_boolean; bool toValidate = true; const char lex_v_1[]=" 1 \n"; const char lex_v_2[]="0"; const char lex_v_3[]="true"; const char lex_v_4[]="false"; XSValue::XSValue_Data act_v_ran_v_1; act_v_ran_v_1.fValue.f_bool = true; XSValue::XSValue_Data act_v_ran_v_2; act_v_ran_v_2.fValue.f_bool = false; XSValue::XSValue_Data act_v_ran_v_3; act_v_ran_v_3.fValue.f_bool = true; XSValue::XSValue_Data act_v_ran_v_4; act_v_ran_v_4.fValue.f_bool = false; const char lex_iv_1[]="2"; const char lex_v_1_canrep[]="true"; const char lex_v_2_canrep[]="false"; const char lex_v_3_canrep[]="true"; const char lex_v_4_canrep[]="false"; /*** * 3.2.2.2 Canonical representation * * The canonical representation for boolean is the set of literals {true, false}. * ***/ /*** * * validate * --------- * availability return value context * ---------------------------------------------- * lexical valid true n/a * lexical invalid false st_FOCA0002 * ***/ // lexical valid VALIDATE_TEST(lex_v_1, dt, EXP_RET_VALID_TRUE, DONT_CARE); VALIDATE_TEST(lex_v_2, dt, EXP_RET_VALID_TRUE, DONT_CARE); VALIDATE_TEST(lex_v_3, dt, EXP_RET_VALID_TRUE, DONT_CARE); VALIDATE_TEST(lex_v_4, dt, EXP_RET_VALID_TRUE, DONT_CARE); // lexical invalid VALIDATE_TEST(lex_iv_1, dt, EXP_RET_VALID_FALSE, XSValue::st_FOCA0002); /*** * * getActualValue * --------------- * availability return value context * ---------------------------------------------- * validation on * ============= * lexical valid XSValue n/a * lexical invalid 0 st_FOCA0002 * * validation off * ============== * lexical valid XSValue n/a * lexical invalid 0 st_FOCA0002 * ***/ for (int i = 0; i < 2; i++) { //validation on/off toValidate = ( 0 == i) ? true : false; // lexical valid ACTVALUE_TEST(lex_v_1, dt, toValidate, EXP_RET_VALUE_TRUE, DONT_CARE, act_v_ran_v_1); ACTVALUE_TEST(lex_v_2, dt, toValidate, EXP_RET_VALUE_TRUE, DONT_CARE, act_v_ran_v_2); ACTVALUE_TEST(lex_v_3, dt, toValidate, EXP_RET_VALUE_TRUE, DONT_CARE, act_v_ran_v_3); ACTVALUE_TEST(lex_v_4, dt, toValidate, EXP_RET_VALUE_TRUE, DONT_CARE, act_v_ran_v_4); // lexical invalid ACTVALUE_TEST(lex_iv_1, dt, toValidate, EXP_RET_VALUE_FALSE, XSValue::st_FOCA0002, act_v_ran_v_1); } /*** * * getCanonicalRepresentation * --------------------------- * availability return value context * ---------------------------------------------- * * validation on * ============= * lexical valid XMLCh n/a * lexical invalid 0 st_FOCA0002 * * validation off * ============== * lexical valid XMLCh n/a * lexical invalid 0 st_FOCA0002 * ***/ for (int j = 0; j < 2; j++) { //validation on/off toValidate = ( 0 == j) ? true : false; // lexical valid CANREP_TEST(lex_v_1, dt, toValidate, EXP_RET_CANREP_TRUE, lex_v_1_canrep, DONT_CARE); CANREP_TEST(lex_v_2, dt, toValidate, EXP_RET_CANREP_TRUE, lex_v_2_canrep, DONT_CARE); CANREP_TEST(lex_v_3, dt, toValidate, EXP_RET_CANREP_TRUE, lex_v_3_canrep, DONT_CARE); CANREP_TEST(lex_v_4, dt, toValidate, EXP_RET_CANREP_TRUE, lex_v_4_canrep, DONT_CARE); // lexical invalid CANREP_TEST(lex_iv_1, dt, toValidate, EXP_RET_CANREP_FALSE, 0, XSValue::st_FOCA0002); } } void test_dt_hexBinary() { const XSValue::DataType dt = XSValue::dt_hexBinary; bool toValidate = true; const char lex_v_1[]=" 0fb7 \n"; const char lex_v_2[]="1234"; const char lex_iv_1[]="0gb7"; const char lex_iv_2[]="123"; XSValue::XSValue_Data act_v_ran_v_1; XSValue::XSValue_Data act_v_ran_v_2; act_v_ran_v_1.fValue.f_byteVal = new XMLByte[2]; act_v_ran_v_1.fValue.f_byteVal[0] = 0xf; act_v_ran_v_1.fValue.f_byteVal[1] = 0xb7; act_v_ran_v_2.fValue.f_byteVal = new XMLByte[2]; act_v_ran_v_2.fValue.f_byteVal[0] = 0x12; act_v_ran_v_2.fValue.f_byteVal[1] = 0x34; const char lex_v_1_canrep[]="0FB7"; const char lex_v_2_canrep[]="1234"; /*** * 3.2.15.2 Canonical Rrepresentation * * The canonical representation for hexBinary is defined by prohibiting certain options from the * Lexical Representation (§3.2.15.1). Specifically, * 1. the lower case hexadecimal digits ([a-f]) are not allowed. * ***/ /*** * * validate * --------- * availability return value context * ---------------------------------------------- * lexical valid true n/a * lexical invalid false st_FOCA0002 * ***/ // lexical valid VALIDATE_TEST(lex_v_1, dt, EXP_RET_VALID_TRUE, DONT_CARE); VALIDATE_TEST(lex_v_2, dt, EXP_RET_VALID_TRUE, DONT_CARE); // lexical invalid VALIDATE_TEST(lex_iv_1, dt, EXP_RET_VALID_FALSE, XSValue::st_FOCA0002); VALIDATE_TEST(lex_iv_2, dt, EXP_RET_VALID_FALSE, XSValue::st_FOCA0002); /*** * * getActualValue * --------------- * availability return value context * ---------------------------------------------- * validation on * ============= * lexical valid XSValue n/a * lexical invalid 0 st_FOCA0002 * * validation off * ============== * lexical valid XSValue n/a * lexical invalid 0 st_FOCA0002 * ***/ for (int i = 0; i < 2; i++) { //validation on/off toValidate = ( 0 == i) ? true : false; // lexical valid ACTVALUE_TEST(lex_v_1, dt, toValidate, EXP_RET_VALUE_TRUE, DONT_CARE, act_v_ran_v_1); ACTVALUE_TEST(lex_v_2, dt, toValidate, EXP_RET_VALUE_TRUE, DONT_CARE, act_v_ran_v_2); // lexical invalid ACTVALUE_TEST(lex_iv_1, dt, toValidate, EXP_RET_VALUE_FALSE, XSValue::st_FOCA0002, act_v_ran_v_1); ACTVALUE_TEST(lex_iv_2, dt, toValidate, EXP_RET_VALUE_FALSE, XSValue::st_FOCA0002, act_v_ran_v_1); } /*** * * getCanonicalRepresentation * --------------------------- * availability return value context * ---------------------------------------------- * * validation on * ============= * lexical valid XMLCh n/a * lexical invalid 0 st_FOCA0002 * * validation off * ============== * lexical valid XMLCh n/a * lexical invalid 0 st_FOCA0002 * ***/ for (int j = 0; j < 2; j++) { //validation on/off toValidate = ( 0 == j) ? true : false; // lexical valid CANREP_TEST(lex_v_1, dt, toValidate, EXP_RET_CANREP_TRUE, lex_v_1_canrep, DONT_CARE); CANREP_TEST(lex_v_2, dt, toValidate, EXP_RET_CANREP_TRUE, lex_v_2_canrep, DONT_CARE); // lexical invalid CANREP_TEST(lex_iv_1, dt, toValidate, EXP_RET_CANREP_FALSE, 0, XSValue::st_FOCA0002); CANREP_TEST(lex_iv_2, dt, toValidate, EXP_RET_CANREP_FALSE, 0, XSValue::st_FOCA0002); } } void test_dt_base64Binary() { const XSValue::DataType dt = XSValue::dt_base64Binary; bool toValidate = true; const char lex_v_1[]=" 134x cv56 gui0 \n"; const char lex_v_2[]="wxtz 8e4k"; const char lex_iv_2[]="134xcv56gui"; const char lex_iv_1[]="wxtz8e4"; XSValue::XSValue_Data act_v_ran_v_1; XSValue::XSValue_Data act_v_ran_v_2; //actual values: //"134x cv56 gui0" : D7 7E 31 72 FE 7A 82 E8 B4 //"wxtz 8e4k" : C3 1B 73 F1 EE 24 act_v_ran_v_1.fValue.f_byteVal = new XMLByte[9]; act_v_ran_v_1.fValue.f_byteVal[0] = 0xd7; act_v_ran_v_1.fValue.f_byteVal[1] = 0x7e; act_v_ran_v_1.fValue.f_byteVal[2] = 0x31; act_v_ran_v_1.fValue.f_byteVal[3] = 0x72; act_v_ran_v_1.fValue.f_byteVal[4] = 0xfe; act_v_ran_v_1.fValue.f_byteVal[5] = 0x7a; act_v_ran_v_1.fValue.f_byteVal[6] = 0x82; act_v_ran_v_1.fValue.f_byteVal[7] = 0xe8; act_v_ran_v_1.fValue.f_byteVal[8] = 0xb4; act_v_ran_v_2.fValue.f_byteVal = new XMLByte[9]; act_v_ran_v_2.fValue.f_byteVal[0] = 0xc3; act_v_ran_v_2.fValue.f_byteVal[1] = 0x1b; act_v_ran_v_2.fValue.f_byteVal[2] = 0x73; act_v_ran_v_2.fValue.f_byteVal[3] = 0xf1; act_v_ran_v_2.fValue.f_byteVal[4] = 0xee; act_v_ran_v_2.fValue.f_byteVal[5] = 0x24; act_v_ran_v_2.fValue.f_byteVal[6] = 0; act_v_ran_v_2.fValue.f_byteVal[7] = 0; act_v_ran_v_2.fValue.f_byteVal[8] = 0; const char lex_v_1_canrep[]="134xcv56gui0"; const char lex_v_2_canrep[]="wxtz8e4k"; /*** * * validate * --------- * availability return value context * ---------------------------------------------- * lexical valid true n/a * lexical invalid false st_FOCA0002 * ***/ // lexical valid VALIDATE_TEST(lex_v_1, dt, EXP_RET_VALID_TRUE, DONT_CARE); VALIDATE_TEST(lex_v_2, dt, EXP_RET_VALID_TRUE, DONT_CARE); // lexical invalid VALIDATE_TEST(lex_iv_1, dt, EXP_RET_VALID_FALSE, XSValue::st_FOCA0002); VALIDATE_TEST(lex_iv_2, dt, EXP_RET_VALID_FALSE, XSValue::st_FOCA0002); /*** * * getActualValue * --------------- * availability return value context * ---------------------------------------------- * validation on * ============= * lexical valid XSValue n/a * lexical invalid 0 st_FOCA0002 * * validation off * ============== * lexical valid XSValue n/a * lexical invalid 0 st_FOCA0002 * ***/ for (int i = 0; i < 2; i++) { //validation on/off toValidate = ( 0 == i) ? true : false; // lexical valid ACTVALUE_TEST(lex_v_1, dt, toValidate, EXP_RET_VALUE_TRUE, DONT_CARE, act_v_ran_v_1); ACTVALUE_TEST(lex_v_2, dt, toValidate, EXP_RET_VALUE_TRUE, DONT_CARE, act_v_ran_v_2); // lexical invalid ACTVALUE_TEST(lex_iv_1, dt, toValidate, EXP_RET_VALUE_FALSE, XSValue::st_FOCA0002, act_v_ran_v_1); ACTVALUE_TEST(lex_iv_2, dt, toValidate, EXP_RET_VALUE_FALSE, XSValue::st_FOCA0002, act_v_ran_v_1); } /*** * * getCanonicalRepresentation * --------------------------- * availability return value context * ---------------------------------------------- * * validation on * ============= * lexical valid XMLCh n/a * lexical invalid 0 st_FOCA0002 * * validation off * ============== * lexical valid XMLCh n/a * lexical invalid 0 st_FOCA0002 * ***/ for (int j = 0; j < 2; j++) { //validation on/off toValidate = ( 0 == j) ? true : false; // lexical valid CANREP_TEST(lex_v_1, dt, toValidate, EXP_RET_CANREP_TRUE, lex_v_1_canrep, DONT_CARE); CANREP_TEST(lex_v_2, dt, toValidate, EXP_RET_CANREP_TRUE, lex_v_2_canrep, DONT_CARE); // lexical invalid CANREP_TEST(lex_iv_1, dt, toValidate, EXP_RET_CANREP_FALSE, 0, XSValue::st_FOCA0002); CANREP_TEST(lex_iv_2, dt, toValidate, EXP_RET_CANREP_FALSE, 0, XSValue::st_FOCA0002); } } void test_dt_duration() { const XSValue::DataType dt = XSValue::dt_duration; bool toValidate = true; const char v_1[]=" P1Y1M1DT1H1M1S \n"; const char v_2[]="P1Y1M31DT23H119M120S"; const char v_3[]="-P1Y1M1DT23H"; const char iv_1[]="P-1Y2M3DT10H30M"; const char iv_2[]="P1Y1M1DT1H1M1X"; const char iv_3[]="P1Z1M1DT23H"; XSValue::XSValue_Data act_v_ran_v_1; XSValue::XSValue_Data act_v_ran_v_2; XSValue::XSValue_Data act_v_ran_v_3; act_v_ran_v_1.fValue.f_datetime.f_year = 1; act_v_ran_v_1.fValue.f_datetime.f_month = 1; act_v_ran_v_1.fValue.f_datetime.f_day = 1; act_v_ran_v_1.fValue.f_datetime.f_hour = 1; act_v_ran_v_1.fValue.f_datetime.f_min = 1; act_v_ran_v_1.fValue.f_datetime.f_second = 1; act_v_ran_v_1.fValue.f_datetime.f_milisec = 0; act_v_ran_v_2.fValue.f_datetime.f_year = 1; act_v_ran_v_2.fValue.f_datetime.f_month = 1; act_v_ran_v_2.fValue.f_datetime.f_day = 31; act_v_ran_v_2.fValue.f_datetime.f_hour = 23; act_v_ran_v_2.fValue.f_datetime.f_min = 119; act_v_ran_v_2.fValue.f_datetime.f_second = 120; act_v_ran_v_2.fValue.f_datetime.f_milisec = 0; act_v_ran_v_3.fValue.f_datetime.f_year = -1; act_v_ran_v_3.fValue.f_datetime.f_month = -1; act_v_ran_v_3.fValue.f_datetime.f_day = -1; act_v_ran_v_3.fValue.f_datetime.f_hour = -23; act_v_ran_v_3.fValue.f_datetime.f_min = 0; act_v_ran_v_3.fValue.f_datetime.f_second = 0; act_v_ran_v_3.fValue.f_datetime.f_milisec = 0; /*** * * validate * --------- * availability return value context * ---------------------------------------------- * valid true n/a * invalid false st_FOCA0002 * ***/ // valid VALIDATE_TEST(v_1, dt, EXP_RET_VALID_TRUE, DONT_CARE); VALIDATE_TEST(v_2, dt, EXP_RET_VALID_TRUE, DONT_CARE); VALIDATE_TEST(v_3, dt, EXP_RET_VALID_TRUE, DONT_CARE); // invalid VALIDATE_TEST(iv_1, dt, EXP_RET_VALID_FALSE, XSValue::st_FOCA0002); VALIDATE_TEST(iv_2, dt, EXP_RET_VALID_FALSE, XSValue::st_FOCA0002); VALIDATE_TEST(iv_3, dt, EXP_RET_VALID_FALSE, XSValue::st_FOCA0002); /*** * * getActualValue * --------------- * availability return value context * ---------------------------------------------- * validation on * ============= * valid XSValue n/a * invalid 0 st_FOCA0002 * * validation off * ============== * valid XSValue n/a * invalid 0 st_FOCA0002 * ***/ for (int i = 0; i < 2; i++) { //validation on/off toValidate = ( 0 == i) ? true : false; // valid ACTVALUE_TEST(v_1, dt, toValidate, EXP_RET_VALUE_TRUE, DONT_CARE, act_v_ran_v_1); ACTVALUE_TEST(v_2, dt, toValidate, EXP_RET_VALUE_TRUE, DONT_CARE, act_v_ran_v_2); ACTVALUE_TEST(v_3, dt, toValidate, EXP_RET_VALUE_TRUE, DONT_CARE, act_v_ran_v_3); // invalid ACTVALUE_TEST(iv_1, dt, toValidate, EXP_RET_VALUE_FALSE, XSValue::st_FOCA0002, act_v_ran_v_1); ACTVALUE_TEST(iv_2, dt, toValidate, EXP_RET_VALUE_FALSE, XSValue::st_FOCA0002, act_v_ran_v_1); ACTVALUE_TEST(iv_3, dt, toValidate, EXP_RET_VALUE_FALSE, XSValue::st_FOCA0002, act_v_ran_v_1); } /*** * * getCanonicalRepresentation * --------------------------- * availability return value context * ---------------------------------------------- * * validation on * ============= * valid XMLCh st_NoCanRep * invalid 0 st_FOCA0002 * * validation off * ============== * valid XMLCh st_NoCanRep * invalid 0 st_NoCanRep * ***/ for (int j = 0; j < 2; j++) { //validation on/off toValidate = ( 0 == j) ? true : false; // valid CANREP_TEST(v_1, dt, toValidate, EXP_RET_CANREP_FALSE, 0, XSValue::st_NoCanRep); CANREP_TEST(v_2, dt, toValidate, EXP_RET_CANREP_FALSE, 0, XSValue::st_NoCanRep); CANREP_TEST(v_3, dt, toValidate, EXP_RET_CANREP_FALSE, 0, XSValue::st_NoCanRep); // invalid CANREP_TEST(iv_1, dt, toValidate, EXP_RET_CANREP_FALSE, 0, (toValidate? XSValue::st_FOCA0002: XSValue::st_NoCanRep)); CANREP_TEST(iv_2, dt, toValidate, EXP_RET_CANREP_FALSE, 0, (toValidate? XSValue::st_FOCA0002: XSValue::st_NoCanRep)); CANREP_TEST(iv_3, dt, toValidate, EXP_RET_CANREP_FALSE, 0, (toValidate? XSValue::st_FOCA0002: XSValue::st_NoCanRep)); } } void test_dt_date() { const XSValue::DataType dt = XSValue::dt_date; bool toValidate = true; const char v_1[]=" 1991-05-31 \n"; const char v_2[]="9999-06-30Z"; const char v_3[]="99991-07-31+14:00"; const char iv_1[]="2000-12-32"; const char iv_2[]="2001-02-29"; const char iv_3[]="2001-06-31"; XSValue::XSValue_Data act_v_ran_v_1; XSValue::XSValue_Data act_v_ran_v_2; XSValue::XSValue_Data act_v_ran_v_3; const char v_1_canrep[]="1991-05-31"; const char v_2_canrep[]="9999-06-30Z"; const char v_3_canrep[]="99991-07-30-10:00"; /* * Case Date Actual Value Canonical Value * 1 yyyy-mm-dd yyyy-mm-dd yyyy-mm-dd * 2 yyyy-mm-ddZ yyyy-mm-ddT00:00Z yyyy-mm-ddZ * 3 yyyy-mm-dd+00:00 yyyy-mm-ddT00:00Z yyyy-mm-ddZ * 4 yyyy-mm-dd+00:01 YYYY-MM-DCT23:59Z yyyy-mm-dd+00:01 * 5 yyyy-mm-dd+12:00 YYYY-MM-DCT12:00Z yyyy-mm-dd+12:00 * 6 yyyy-mm-dd+12:01 YYYY-MM-DCT11:59Z YYYY-MM-DC-11:59 * 7 yyyy-mm-dd+14:00 YYYY-MM-DCT10:00Z YYYY-MM-DC-10:00 * 8 yyyy-mm-dd-00:00 yyyy-mm-ddT00:00Z yyyy-mm-ddZ * 9 yyyy-mm-dd-00:01 yyyy-mm-ddT00:01Z yyyy-mm-dd-00:01 * 11 yyyy-mm-dd-11:59 yyyy-mm-ddT11:59Z YYYY-MM-DD-11:59 * 10 yyyy-mm-dd-12:00 yyyy-mm-ddT12:00Z YYYY-MM-DD+12:00 * 12 yyyy-mm-dd-14:00 yyyy-mm-ddT14:00Z YYYY-MM-DD+10:00 */ const char c_1[] = " 1993-05-31 "; const char r_1[] = "1993-05-31"; const char c_2[] = " 1993-05-31Z "; const char r_2[] = "1993-05-31Z"; const char c_3[] = " 1993-05-31+00:00 "; const char r_3[] = "1993-05-31Z"; const char c_4[] = " 1993-05-31+00:01 "; const char r_4[] = "1993-05-31+00:01"; const char c_5[] = " 1993-05-31+12:00 "; const char r_5[] = "1993-05-31+12:00"; const char c_6[] = " 1994-01-01+12:01 "; const char r_6[] = "1993-12-31-11:59"; const char c_7[] = " 1994-01-01+14:00 "; const char r_7[] = "1993-12-31-10:00"; const char c_8[] = " 1993-06-01-00:00 "; const char r_8[] = "1993-06-01Z"; const char c_9[] = " 1993-06-01-00:01 "; const char r_9[] = "1993-06-01-00:01"; const char c_a[] = " 1993-06-01-11:59 "; const char r_a[] = "1993-06-01-11:59"; const char c_b[] = " 1993-05-31-12:00 "; const char r_b[] = "1993-06-01+12:00"; const char c_c[] = " 1993-05-31-14:00 "; const char r_c[] = "1993-06-01+10:00"; act_v_ran_v_1.fValue.f_datetime.f_year = 1991; act_v_ran_v_1.fValue.f_datetime.f_month = 05; act_v_ran_v_1.fValue.f_datetime.f_day = 31; act_v_ran_v_1.fValue.f_datetime.f_hour = 0; act_v_ran_v_1.fValue.f_datetime.f_min = 0; act_v_ran_v_1.fValue.f_datetime.f_second = 0; act_v_ran_v_1.fValue.f_datetime.f_milisec = 0; act_v_ran_v_2.fValue.f_datetime.f_year = 9999; act_v_ran_v_2.fValue.f_datetime.f_month = 06; act_v_ran_v_2.fValue.f_datetime.f_day = 30; act_v_ran_v_2.fValue.f_datetime.f_hour = 0; act_v_ran_v_2.fValue.f_datetime.f_min = 0; act_v_ran_v_2.fValue.f_datetime.f_second = 0; act_v_ran_v_2.fValue.f_datetime.f_milisec = 0; act_v_ran_v_3.fValue.f_datetime.f_year = 99991; act_v_ran_v_3.fValue.f_datetime.f_month = 07; act_v_ran_v_3.fValue.f_datetime.f_day = 30; act_v_ran_v_3.fValue.f_datetime.f_hour = 00; act_v_ran_v_3.fValue.f_datetime.f_min = 0; act_v_ran_v_3.fValue.f_datetime.f_second = 0; act_v_ran_v_3.fValue.f_datetime.f_milisec = 0; /*** * * validate * --------- * availability return value context * ---------------------------------------------- * valid true n/a * invalid false st_FOCA0002 * ***/ // valid VALIDATE_TEST(v_1, dt, EXP_RET_VALID_TRUE, DONT_CARE); VALIDATE_TEST(v_2, dt, EXP_RET_VALID_TRUE, DONT_CARE); VALIDATE_TEST(v_3, dt, EXP_RET_VALID_TRUE, DONT_CARE); // invalid VALIDATE_TEST(iv_1, dt, EXP_RET_VALID_FALSE, XSValue::st_FOCA0002); VALIDATE_TEST(iv_2, dt, EXP_RET_VALID_FALSE, XSValue::st_FOCA0002); VALIDATE_TEST(iv_3, dt, EXP_RET_VALID_FALSE, XSValue::st_FOCA0002); /*** * * getActualValue * --------------- * availability return value context * ---------------------------------------------- * validation on * ============= * valid XSValue n/a * invalid 0 st_FOCA0002 * * validation off * ============== * valid XSValue n/a * invalid 0 st_FOCA0002 * ***/ for (int i = 0; i < 2; i++) { //validation on/off toValidate = ( 0 == i) ? true : false; // valid ACTVALUE_TEST(v_1, dt, toValidate, EXP_RET_VALUE_TRUE, DONT_CARE, act_v_ran_v_1); ACTVALUE_TEST(v_2, dt, toValidate, EXP_RET_VALUE_TRUE, DONT_CARE, act_v_ran_v_2); ACTVALUE_TEST(v_3, dt, toValidate, EXP_RET_VALUE_TRUE, DONT_CARE, act_v_ran_v_3); // invalid ACTVALUE_TEST(iv_1, dt, toValidate, EXP_RET_VALUE_FALSE, XSValue::st_FOCA0002, act_v_ran_v_1); ACTVALUE_TEST(iv_2, dt, toValidate, EXP_RET_VALUE_FALSE, XSValue::st_FOCA0002, act_v_ran_v_1); ACTVALUE_TEST(iv_3, dt, toValidate, EXP_RET_VALUE_FALSE, XSValue::st_FOCA0002, act_v_ran_v_1); } /*** * * getCanonicalRepresentation * --------------------------- * availability return value context * ---------------------------------------------- * * validation on * ============= * valid XMLCh n/a * invalid 0 st_FOCA0002 * * validation off * ============== * valid XMLCh n/a * invalid 0 st_FOCA0002 * ***/ for (int j = 0; j < 2; j++) { //validation on/off toValidate = ( 0 == j) ? true : false; // valid CANREP_TEST(v_1, dt, toValidate, EXP_RET_CANREP_TRUE, v_1_canrep, DONT_CARE); CANREP_TEST(v_2, dt, toValidate, EXP_RET_CANREP_TRUE, v_2_canrep, DONT_CARE); CANREP_TEST(v_3, dt, toValidate, EXP_RET_CANREP_TRUE, v_3_canrep, DONT_CARE); CANREP_TEST(c_1, dt, toValidate, EXP_RET_CANREP_TRUE, r_1, DONT_CARE); CANREP_TEST(c_2, dt, toValidate, EXP_RET_CANREP_TRUE, r_2, DONT_CARE); CANREP_TEST(c_3, dt, toValidate, EXP_RET_CANREP_TRUE, r_3, DONT_CARE); CANREP_TEST(c_4, dt, toValidate, EXP_RET_CANREP_TRUE, r_4, DONT_CARE); CANREP_TEST(c_5, dt, toValidate, EXP_RET_CANREP_TRUE, r_5, DONT_CARE); CANREP_TEST(c_6, dt, toValidate, EXP_RET_CANREP_TRUE, r_6, DONT_CARE); CANREP_TEST(c_7, dt, toValidate, EXP_RET_CANREP_TRUE, r_7, DONT_CARE); CANREP_TEST(c_8, dt, toValidate, EXP_RET_CANREP_TRUE, r_8, DONT_CARE); CANREP_TEST(c_9, dt, toValidate, EXP_RET_CANREP_TRUE, r_9, DONT_CARE); CANREP_TEST(c_a, dt, toValidate, EXP_RET_CANREP_TRUE, r_a, DONT_CARE); CANREP_TEST(c_b, dt, toValidate, EXP_RET_CANREP_TRUE, r_b, DONT_CARE); CANREP_TEST(c_c, dt, toValidate, EXP_RET_CANREP_TRUE, r_c, DONT_CARE); // invalid // invalid CANREP_TEST(iv_1, dt, toValidate, EXP_RET_CANREP_FALSE, 0, XSValue::st_FOCA0002); CANREP_TEST(iv_2, dt, toValidate, EXP_RET_CANREP_FALSE, 0, XSValue::st_FOCA0002); CANREP_TEST(iv_3, dt, toValidate, EXP_RET_CANREP_FALSE, 0, XSValue::st_FOCA0002); } } void test_dt_gYearMonth() { const XSValue::DataType dt = XSValue::dt_gYearMonth; bool toValidate = true; const char v_1[]=" 20000-02 \n"; const char v_2[]="0200-11+14:00"; const char v_3[]="2000-02-14:00"; const char iv_1[]="0000-12"; const char iv_2[]="+2000-11"; const char iv_3[]="2000.90-02"; XSValue::XSValue_Data act_v_ran_v_1; XSValue::XSValue_Data act_v_ran_v_2; XSValue::XSValue_Data act_v_ran_v_3; act_v_ran_v_1.fValue.f_datetime.f_year = 20000; act_v_ran_v_1.fValue.f_datetime.f_month = 02; act_v_ran_v_1.fValue.f_datetime.f_day = 0; act_v_ran_v_1.fValue.f_datetime.f_hour = 0; act_v_ran_v_1.fValue.f_datetime.f_min = 0; act_v_ran_v_1.fValue.f_datetime.f_second = 0; act_v_ran_v_1.fValue.f_datetime.f_milisec = 0; act_v_ran_v_2.fValue.f_datetime.f_year = 200; act_v_ran_v_2.fValue.f_datetime.f_month = 11; act_v_ran_v_2.fValue.f_datetime.f_day = 0; act_v_ran_v_2.fValue.f_datetime.f_hour = 0; act_v_ran_v_2.fValue.f_datetime.f_min = 0; act_v_ran_v_2.fValue.f_datetime.f_second = 0; act_v_ran_v_2.fValue.f_datetime.f_milisec = 0; act_v_ran_v_3.fValue.f_datetime.f_year = 2000; act_v_ran_v_3.fValue.f_datetime.f_month = 02; act_v_ran_v_3.fValue.f_datetime.f_day = 0; act_v_ran_v_3.fValue.f_datetime.f_hour = 0; act_v_ran_v_3.fValue.f_datetime.f_min = 0; act_v_ran_v_3.fValue.f_datetime.f_second = 0; act_v_ran_v_3.fValue.f_datetime.f_milisec = 0; /*** * * validate * --------- * availability return value context * ---------------------------------------------- * valid true n/a * invalid false st_FOCA0002 * ***/ // valid VALIDATE_TEST(v_1, dt, EXP_RET_VALID_TRUE, DONT_CARE); VALIDATE_TEST(v_2, dt, EXP_RET_VALID_TRUE, DONT_CARE); VALIDATE_TEST(v_3, dt, EXP_RET_VALID_TRUE, DONT_CARE); // invalid VALIDATE_TEST(iv_1, dt, EXP_RET_VALID_FALSE, XSValue::st_FOCA0002); VALIDATE_TEST(iv_2, dt, EXP_RET_VALID_FALSE, XSValue::st_FOCA0002); VALIDATE_TEST(iv_3, dt, EXP_RET_VALID_FALSE, XSValue::st_FOCA0002); /*** * * getActualValue * --------------- * availability return value context * ---------------------------------------------- * validation on * ============= * valid XSValue n/a * invalid 0 st_FOCA0002 * * validation off * ============== * valid XSValue n/a * invalid 0 st_FOCA0002 * ***/ for (int i = 0; i < 2; i++) { //validation on/off toValidate = ( 0 == i) ? true : false; // valid ACTVALUE_TEST(v_1, dt, toValidate, EXP_RET_VALUE_TRUE, DONT_CARE, act_v_ran_v_1); ACTVALUE_TEST(v_2, dt, toValidate, EXP_RET_VALUE_TRUE, DONT_CARE, act_v_ran_v_2); ACTVALUE_TEST(v_3, dt, toValidate, EXP_RET_VALUE_TRUE, DONT_CARE, act_v_ran_v_3); // invalid ACTVALUE_TEST(iv_1, dt, toValidate, EXP_RET_VALUE_FALSE, XSValue::st_FOCA0002, act_v_ran_v_1); ACTVALUE_TEST(iv_2, dt, toValidate, EXP_RET_VALUE_FALSE, XSValue::st_FOCA0002, act_v_ran_v_1); ACTVALUE_TEST(iv_3, dt, toValidate, EXP_RET_VALUE_FALSE, XSValue::st_FOCA0002, act_v_ran_v_1); } /*** * * getCanonicalRepresentation * --------------------------- * availability return value context * ---------------------------------------------- * * validation on * ============= * valid XMLCh st_NoCanRep * invalid 0 st_FOCA0002 * * validation off * ============== * valid XMLCh st_NoCanRep * invalid 0 st_NoCanRep * ***/ for (int j = 0; j < 2; j++) { //validation on/off toValidate = ( 0 == j) ? true : false; // valid CANREP_TEST(v_1, dt, toValidate, EXP_RET_CANREP_FALSE, 0, XSValue::st_NoCanRep); CANREP_TEST(v_2, dt, toValidate, EXP_RET_CANREP_FALSE, 0, XSValue::st_NoCanRep); CANREP_TEST(v_3, dt, toValidate, EXP_RET_CANREP_FALSE, 0, XSValue::st_NoCanRep); // invalid CANREP_TEST(iv_1, dt, toValidate, EXP_RET_CANREP_FALSE, 0, (toValidate? XSValue::st_FOCA0002: XSValue::st_NoCanRep)); CANREP_TEST(iv_2, dt, toValidate, EXP_RET_CANREP_FALSE, 0, (toValidate? XSValue::st_FOCA0002: XSValue::st_NoCanRep)); CANREP_TEST(iv_3, dt, toValidate, EXP_RET_CANREP_FALSE, 0, (toValidate? XSValue::st_FOCA0002: XSValue::st_NoCanRep)); } } void test_dt_gYear() { const XSValue::DataType dt = XSValue::dt_gYear; bool toValidate = true; const char v_1[]=" 0001-14:00 \n"; const char v_2[]="9999+14:00"; const char v_3[]="-1999"; const char iv_1[]="0000"; const char iv_2[]="+2000"; const char iv_3[]="2000.90"; XSValue::XSValue_Data act_v_ran_v_1; XSValue::XSValue_Data act_v_ran_v_2; XSValue::XSValue_Data act_v_ran_v_3; act_v_ran_v_1.fValue.f_datetime.f_year = 1; act_v_ran_v_1.fValue.f_datetime.f_month = 0; act_v_ran_v_1.fValue.f_datetime.f_day = 0; act_v_ran_v_1.fValue.f_datetime.f_hour = 0; act_v_ran_v_1.fValue.f_datetime.f_min = 0; act_v_ran_v_1.fValue.f_datetime.f_second = 0; act_v_ran_v_1.fValue.f_datetime.f_milisec = 0; act_v_ran_v_2.fValue.f_datetime.f_year = 9999; act_v_ran_v_2.fValue.f_datetime.f_month = 0; act_v_ran_v_2.fValue.f_datetime.f_day = 0; act_v_ran_v_2.fValue.f_datetime.f_hour = 0; act_v_ran_v_2.fValue.f_datetime.f_min = 0; act_v_ran_v_2.fValue.f_datetime.f_second = 0; act_v_ran_v_2.fValue.f_datetime.f_milisec = 0; act_v_ran_v_3.fValue.f_datetime.f_year = -1999; act_v_ran_v_3.fValue.f_datetime.f_month = 0; act_v_ran_v_3.fValue.f_datetime.f_day = 0; act_v_ran_v_3.fValue.f_datetime.f_hour = 0; act_v_ran_v_3.fValue.f_datetime.f_min = 0; act_v_ran_v_3.fValue.f_datetime.f_second = 0; act_v_ran_v_3.fValue.f_datetime.f_milisec = 0; /*** * * validate * --------- * availability return value context * ---------------------------------------------- * valid true n/a * invalid false st_FOCA0002 * ***/ // valid VALIDATE_TEST(v_1, dt, EXP_RET_VALID_TRUE, DONT_CARE); VALIDATE_TEST(v_2, dt, EXP_RET_VALID_TRUE, DONT_CARE); VALIDATE_TEST(v_3, dt, EXP_RET_VALID_TRUE, DONT_CARE); // invalid VALIDATE_TEST(iv_1, dt, EXP_RET_VALID_FALSE, XSValue::st_FOCA0002); VALIDATE_TEST(iv_2, dt, EXP_RET_VALID_FALSE, XSValue::st_FOCA0002); VALIDATE_TEST(iv_3, dt, EXP_RET_VALID_FALSE, XSValue::st_FOCA0002); /*** * * getActualValue * --------------- * availability return value context * ---------------------------------------------- * validation on * ============= * valid XSValue n/a * invalid 0 st_FOCA0002 * * validation off * ============== * valid XSValue n/a * invalid 0 st_FOCA0002 * ***/ for (int i = 0; i < 2; i++) { //validation on/off toValidate = ( 0 == i) ? true : false; // valid ACTVALUE_TEST(v_1, dt, toValidate, EXP_RET_VALUE_TRUE, DONT_CARE, act_v_ran_v_1); ACTVALUE_TEST(v_2, dt, toValidate, EXP_RET_VALUE_TRUE, DONT_CARE, act_v_ran_v_2); ACTVALUE_TEST(v_3, dt, toValidate, EXP_RET_VALUE_TRUE, DONT_CARE, act_v_ran_v_3); // invalid ACTVALUE_TEST(iv_1, dt, toValidate, EXP_RET_VALUE_FALSE, XSValue::st_FOCA0002, act_v_ran_v_1); ACTVALUE_TEST(iv_2, dt, toValidate, EXP_RET_VALUE_FALSE, XSValue::st_FOCA0002, act_v_ran_v_1); ACTVALUE_TEST(iv_3, dt, toValidate, EXP_RET_VALUE_FALSE, XSValue::st_FOCA0002, act_v_ran_v_1); } /*** * * getCanonicalRepresentation * --------------------------- * availability return value context * ---------------------------------------------- * * validation on * ============= * valid XMLCh st_NoCanRep * invalid 0 st_FOCA0002 * * validation off * ============== * valid XMLCh st_NoCanRep * invalid 0 st_NoCanRep * ***/ for (int j = 0; j < 2; j++) { //validation on/off toValidate = ( 0 == j) ? true : false; // valid CANREP_TEST(v_1, dt, toValidate, EXP_RET_CANREP_FALSE, 0, XSValue::st_NoCanRep); CANREP_TEST(v_2, dt, toValidate, EXP_RET_CANREP_FALSE, 0, XSValue::st_NoCanRep); CANREP_TEST(v_3, dt, toValidate, EXP_RET_CANREP_FALSE, 0, XSValue::st_NoCanRep); // invalid CANREP_TEST(iv_1, dt, toValidate, EXP_RET_CANREP_FALSE, 0, (toValidate? XSValue::st_FOCA0002: XSValue::st_NoCanRep)); CANREP_TEST(iv_2, dt, toValidate, EXP_RET_CANREP_FALSE, 0, (toValidate? XSValue::st_FOCA0002: XSValue::st_NoCanRep)); CANREP_TEST(iv_3, dt, toValidate, EXP_RET_CANREP_FALSE, 0, (toValidate? XSValue::st_FOCA0002: XSValue::st_NoCanRep)); } } void test_dt_gMonthDay() { const XSValue::DataType dt = XSValue::dt_gMonthDay; bool toValidate = true; const char v_1[]=" --01-31+00:01 \n"; const char v_2[]="--03-31-00:01"; const char v_3[]="--04-01"; const char iv_1[]="--14-31"; const char iv_2[]="--12-32"; const char iv_3[]="--02-30"; XSValue::XSValue_Data act_v_ran_v_1; XSValue::XSValue_Data act_v_ran_v_2; XSValue::XSValue_Data act_v_ran_v_3; act_v_ran_v_1.fValue.f_datetime.f_year = 0; act_v_ran_v_1.fValue.f_datetime.f_month = 1; act_v_ran_v_1.fValue.f_datetime.f_day = 30; act_v_ran_v_1.fValue.f_datetime.f_hour = 0; act_v_ran_v_1.fValue.f_datetime.f_min = 0; act_v_ran_v_1.fValue.f_datetime.f_second = 0; act_v_ran_v_1.fValue.f_datetime.f_milisec = 0; act_v_ran_v_2.fValue.f_datetime.f_year = 0; act_v_ran_v_2.fValue.f_datetime.f_month = 3; act_v_ran_v_2.fValue.f_datetime.f_day = 31; act_v_ran_v_2.fValue.f_datetime.f_hour = 0; act_v_ran_v_2.fValue.f_datetime.f_min = 0; act_v_ran_v_2.fValue.f_datetime.f_second = 0; act_v_ran_v_2.fValue.f_datetime.f_milisec = 0; act_v_ran_v_3.fValue.f_datetime.f_year = 0; act_v_ran_v_3.fValue.f_datetime.f_month = 4; act_v_ran_v_3.fValue.f_datetime.f_day = 1; act_v_ran_v_3.fValue.f_datetime.f_hour = 0; act_v_ran_v_3.fValue.f_datetime.f_min = 0; act_v_ran_v_3.fValue.f_datetime.f_second = 0; act_v_ran_v_3.fValue.f_datetime.f_milisec = 0; /*** * * validate * --------- * availability return value context * ---------------------------------------------- * valid true n/a * invalid false st_FOCA0002 * ***/ // valid VALIDATE_TEST(v_1, dt, EXP_RET_VALID_TRUE, DONT_CARE); VALIDATE_TEST(v_2, dt, EXP_RET_VALID_TRUE, DONT_CARE); VALIDATE_TEST(v_3, dt, EXP_RET_VALID_TRUE, DONT_CARE); // invalid VALIDATE_TEST(iv_1, dt, EXP_RET_VALID_FALSE, XSValue::st_FOCA0002); VALIDATE_TEST(iv_2, dt, EXP_RET_VALID_FALSE, XSValue::st_FOCA0002); VALIDATE_TEST(iv_3, dt, EXP_RET_VALID_FALSE, XSValue::st_FOCA0002); /*** * * getActualValue * --------------- * availability return value context * ---------------------------------------------- * validation on * ============= * valid XSValue n/a * invalid 0 st_FOCA0002 * * validation off * ============== * valid XSValue n/a * invalid 0 st_FOCA0002 * ***/ for (int i = 0; i < 2; i++) { //validation on/off toValidate = ( 0 == i) ? true : false; // valid ACTVALUE_TEST(v_1, dt, toValidate, EXP_RET_VALUE_TRUE, DONT_CARE, act_v_ran_v_1); ACTVALUE_TEST(v_2, dt, toValidate, EXP_RET_VALUE_TRUE, DONT_CARE, act_v_ran_v_2); ACTVALUE_TEST(v_3, dt, toValidate, EXP_RET_VALUE_TRUE, DONT_CARE, act_v_ran_v_3); // invalid ACTVALUE_TEST(iv_1, dt, toValidate, EXP_RET_VALUE_FALSE, XSValue::st_FOCA0002, act_v_ran_v_1); ACTVALUE_TEST(iv_2, dt, toValidate, EXP_RET_VALUE_FALSE, XSValue::st_FOCA0002, act_v_ran_v_1); ACTVALUE_TEST(iv_3, dt, toValidate, EXP_RET_VALUE_FALSE, XSValue::st_FOCA0002, act_v_ran_v_1); } /*** * * getCanonicalRepresentation * --------------------------- * availability return value context * ---------------------------------------------- * * validation on * ============= * valid XMLCh st_NoCanRep * invalid 0 st_FOCA0002 * * validation off * ============== * valid XMLCh st_NoCanRep * invalid 0 st_NoCanRep * ***/ for (int j = 0; j < 2; j++) { //validation on/off toValidate = ( 0 == j) ? true : false; // valid CANREP_TEST(v_1, dt, toValidate, EXP_RET_CANREP_FALSE, 0, XSValue::st_NoCanRep); CANREP_TEST(v_2, dt, toValidate, EXP_RET_CANREP_FALSE, 0, XSValue::st_NoCanRep); CANREP_TEST(v_3, dt, toValidate, EXP_RET_CANREP_FALSE, 0, XSValue::st_NoCanRep); // invalid CANREP_TEST(iv_1, dt, toValidate, EXP_RET_CANREP_FALSE, 0, (toValidate? XSValue::st_FOCA0002: XSValue::st_NoCanRep)); CANREP_TEST(iv_2, dt, toValidate, EXP_RET_CANREP_FALSE, 0, (toValidate? XSValue::st_FOCA0002: XSValue::st_NoCanRep)); CANREP_TEST(iv_3, dt, toValidate, EXP_RET_CANREP_FALSE, 0, (toValidate? XSValue::st_FOCA0002: XSValue::st_NoCanRep)); } } void test_dt_gDay() { const XSValue::DataType dt = XSValue::dt_gDay; bool toValidate = true; const char v_1[]=" ---31+01:30 \n"; const char v_2[]="---01-01:30"; const char v_3[]="---28"; const char iv_1[]="---+31"; const char iv_2[]="---28.00"; const char iv_3[]="--31"; XSValue::XSValue_Data act_v_ran_v_1; XSValue::XSValue_Data act_v_ran_v_2; XSValue::XSValue_Data act_v_ran_v_3; act_v_ran_v_1.fValue.f_datetime.f_year = 0; act_v_ran_v_1.fValue.f_datetime.f_month = 0; act_v_ran_v_1.fValue.f_datetime.f_day = 30; act_v_ran_v_1.fValue.f_datetime.f_hour = 0; act_v_ran_v_1.fValue.f_datetime.f_min = 0; act_v_ran_v_1.fValue.f_datetime.f_second = 0; act_v_ran_v_1.fValue.f_datetime.f_milisec = 0; act_v_ran_v_2.fValue.f_datetime.f_year = 0; act_v_ran_v_2.fValue.f_datetime.f_month = 0; act_v_ran_v_2.fValue.f_datetime.f_day = 1; act_v_ran_v_2.fValue.f_datetime.f_hour = 0; act_v_ran_v_2.fValue.f_datetime.f_min = 0; act_v_ran_v_2.fValue.f_datetime.f_second = 0; act_v_ran_v_2.fValue.f_datetime.f_milisec = 0; act_v_ran_v_3.fValue.f_datetime.f_year = 0; act_v_ran_v_3.fValue.f_datetime.f_month = 0; act_v_ran_v_3.fValue.f_datetime.f_day = 28; act_v_ran_v_3.fValue.f_datetime.f_hour = 0; act_v_ran_v_3.fValue.f_datetime.f_min = 0; act_v_ran_v_3.fValue.f_datetime.f_second = 0; act_v_ran_v_3.fValue.f_datetime.f_milisec = 0; /*** * * validate * --------- * availability return value context * ---------------------------------------------- * valid true n/a * invalid false st_FOCA0002 * ***/ // valid VALIDATE_TEST(v_1, dt, EXP_RET_VALID_TRUE, DONT_CARE); VALIDATE_TEST(v_2, dt, EXP_RET_VALID_TRUE, DONT_CARE); VALIDATE_TEST(v_3, dt, EXP_RET_VALID_TRUE, DONT_CARE); // invalid VALIDATE_TEST(iv_1, dt, EXP_RET_VALID_FALSE, XSValue::st_FOCA0002); VALIDATE_TEST(iv_2, dt, EXP_RET_VALID_FALSE, XSValue::st_FOCA0002); VALIDATE_TEST(iv_3, dt, EXP_RET_VALID_FALSE, XSValue::st_FOCA0002); /*** * * getActualValue * --------------- * availability return value context * ---------------------------------------------- * validation on * ============= * valid XSValue n/a * invalid 0 st_FOCA0002 * * validation off * ============== * valid XSValue n/a * invalid 0 st_FOCA0002 * ***/ for (int i = 0; i < 2; i++) { //validation on/off toValidate = ( 0 == i) ? true : false; // valid ACTVALUE_TEST(v_1, dt, toValidate, EXP_RET_VALUE_TRUE, DONT_CARE, act_v_ran_v_1); ACTVALUE_TEST(v_2, dt, toValidate, EXP_RET_VALUE_TRUE, DONT_CARE, act_v_ran_v_2); ACTVALUE_TEST(v_3, dt, toValidate, EXP_RET_VALUE_TRUE, DONT_CARE, act_v_ran_v_3); // invalid ACTVALUE_TEST(iv_1, dt, toValidate, EXP_RET_VALUE_FALSE, XSValue::st_FOCA0002, act_v_ran_v_1); ACTVALUE_TEST(iv_2, dt, toValidate, EXP_RET_VALUE_FALSE, XSValue::st_FOCA0002, act_v_ran_v_2); ACTVALUE_TEST(iv_3, dt, toValidate, EXP_RET_VALUE_FALSE, XSValue::st_FOCA0002, act_v_ran_v_3); } /*** * * getCanonicalRepresentation * --------------------------- * availability return value context * ---------------------------------------------- * * validation on * ============= * valid XMLCh st_NoCanRep * invalid 0 st_FOCA0002 * * validation off * ============== * valid XMLCh st_NoCanRep * invalid 0 st_NoCanRep * ***/ for (int j = 0; j < 2; j++) { //validation on/off toValidate = ( 0 == j) ? true : false; // valid CANREP_TEST(v_1, dt, toValidate, EXP_RET_CANREP_FALSE, 0, XSValue::st_NoCanRep); CANREP_TEST(v_2, dt, toValidate, EXP_RET_CANREP_FALSE, 0, XSValue::st_NoCanRep); CANREP_TEST(v_3, dt, toValidate, EXP_RET_CANREP_FALSE, 0, XSValue::st_NoCanRep); // invalid CANREP_TEST(iv_1, dt, toValidate, EXP_RET_CANREP_FALSE, 0, (toValidate? XSValue::st_FOCA0002: XSValue::st_NoCanRep)); CANREP_TEST(iv_2, dt, toValidate, EXP_RET_CANREP_FALSE, 0, (toValidate? XSValue::st_FOCA0002: XSValue::st_NoCanRep)); CANREP_TEST(iv_3, dt, toValidate, EXP_RET_CANREP_FALSE, 0, (toValidate? XSValue::st_FOCA0002: XSValue::st_NoCanRep)); } } void test_dt_gMonth() { const XSValue::DataType dt = XSValue::dt_gMonth; bool toValidate = true; const char v_1[]=" --02+10:10 \n"; const char v_2[]="--10-12:12"; const char v_3[]="--12"; const char iv_1[]="--+11"; const char iv_2[]="---02.09"; const char iv_3[]="--14--"; XSValue::XSValue_Data act_v_ran_v_1; XSValue::XSValue_Data act_v_ran_v_2; XSValue::XSValue_Data act_v_ran_v_3; act_v_ran_v_1.fValue.f_datetime.f_year = 0; act_v_ran_v_1.fValue.f_datetime.f_month = 2; act_v_ran_v_1.fValue.f_datetime.f_day = 0; act_v_ran_v_1.fValue.f_datetime.f_hour = 0; act_v_ran_v_1.fValue.f_datetime.f_min = 0; act_v_ran_v_1.fValue.f_datetime.f_second = 0; act_v_ran_v_1.fValue.f_datetime.f_milisec = 0; act_v_ran_v_2.fValue.f_datetime.f_year = 0; act_v_ran_v_2.fValue.f_datetime.f_month = 10; act_v_ran_v_2.fValue.f_datetime.f_day = 0; act_v_ran_v_2.fValue.f_datetime.f_hour = 0; act_v_ran_v_2.fValue.f_datetime.f_min = 0; act_v_ran_v_2.fValue.f_datetime.f_second = 0; act_v_ran_v_2.fValue.f_datetime.f_milisec = 0; act_v_ran_v_3.fValue.f_datetime.f_year = 0; act_v_ran_v_3.fValue.f_datetime.f_month = 12; act_v_ran_v_3.fValue.f_datetime.f_day = 0; act_v_ran_v_3.fValue.f_datetime.f_hour = 0; act_v_ran_v_3.fValue.f_datetime.f_min = 0; act_v_ran_v_3.fValue.f_datetime.f_second = 0; act_v_ran_v_3.fValue.f_datetime.f_milisec = 0; /*** * * validate * --------- * availability return value context * ---------------------------------------------- * valid true n/a * invalid false st_FOCA0002 * ***/ // valid VALIDATE_TEST(v_1, dt, EXP_RET_VALID_TRUE, DONT_CARE); VALIDATE_TEST(v_2, dt, EXP_RET_VALID_TRUE, DONT_CARE); VALIDATE_TEST(v_3, dt, EXP_RET_VALID_TRUE, DONT_CARE); // invalid VALIDATE_TEST(iv_1, dt, EXP_RET_VALID_FALSE, XSValue::st_FOCA0002); VALIDATE_TEST(iv_2, dt, EXP_RET_VALID_FALSE, XSValue::st_FOCA0002); VALIDATE_TEST(iv_3, dt, EXP_RET_VALID_FALSE, XSValue::st_FOCA0002); /*** * * getActualValue * --------------- * availability return value context * ---------------------------------------------- * validation on * ============= * valid XSValue n/a * invalid 0 st_FOCA0002 * * validation off * ============== * valid XSValue n/a * invalid 0 st_FOCA0002 * ***/ for (int i = 0; i < 2; i++) { //validation on/off toValidate = ( 0 == i) ? true : false; // valid ACTVALUE_TEST(v_1, dt, toValidate, EXP_RET_VALUE_TRUE, DONT_CARE, act_v_ran_v_1); ACTVALUE_TEST(v_2, dt, toValidate, EXP_RET_VALUE_TRUE, DONT_CARE, act_v_ran_v_2); ACTVALUE_TEST(v_3, dt, toValidate, EXP_RET_VALUE_TRUE, DONT_CARE, act_v_ran_v_3); // invalid ACTVALUE_TEST(iv_1, dt, toValidate, EXP_RET_VALUE_FALSE, XSValue::st_FOCA0002, act_v_ran_v_1); ACTVALUE_TEST(iv_2, dt, toValidate, EXP_RET_VALUE_FALSE, XSValue::st_FOCA0002, act_v_ran_v_2); ACTVALUE_TEST(iv_3, dt, toValidate, EXP_RET_VALUE_FALSE, XSValue::st_FOCA0002, act_v_ran_v_3); } /*** * * getCanonicalRepresentation * --------------------------- * availability return value context * ---------------------------------------------- * * validation on * ============= * valid XMLCh st_NoCanRep * invalid 0 st_FOCA0002 * * validation off * ============== * valid XMLCh st_NoCanRep * invalid 0 st_NoCanRep * ***/ for (int j = 0; j < 2; j++) { //validation on/off toValidate = ( 0 == j) ? true : false; // valid CANREP_TEST(v_1, dt, toValidate, EXP_RET_CANREP_FALSE, 0, XSValue::st_NoCanRep); CANREP_TEST(v_2, dt, toValidate, EXP_RET_CANREP_FALSE, 0, XSValue::st_NoCanRep); CANREP_TEST(v_3, dt, toValidate, EXP_RET_CANREP_FALSE, 0, XSValue::st_NoCanRep); // invalid CANREP_TEST(iv_1, dt, toValidate, EXP_RET_CANREP_FALSE, 0, (toValidate? XSValue::st_FOCA0002: XSValue::st_NoCanRep)); CANREP_TEST(iv_2, dt, toValidate, EXP_RET_CANREP_FALSE, 0, (toValidate? XSValue::st_FOCA0002: XSValue::st_NoCanRep)); CANREP_TEST(iv_3, dt, toValidate, EXP_RET_CANREP_FALSE, 0, (toValidate? XSValue::st_FOCA0002: XSValue::st_NoCanRep)); } } void test_dt_dateTime() { const XSValue::DataType dt = XSValue::dt_dateTime; bool toValidate = true; const char v_1[]=" 2000-12-31T23:59:59.00389 \n"; const char v_2[]="2000-10-01T11:10:20+13:30"; const char v_3[]="2000-10-01T11:10:20-06:00"; const char iv_1[]="0000-12-31T23:59:59"; const char iv_2[]="+2000-11-30T23:59:59Z"; const char iv_3[]="2000-02-28T23:59.1:59Z"; const char iv_4[]="2000-11-30T01:01:01Z99"; const char iv_5[]="2000-02-28T01:01:01Z10:61"; XSValue::XSValue_Data act_v_ran_v_1; XSValue::XSValue_Data act_v_ran_v_2; XSValue::XSValue_Data act_v_ran_v_3; const char v_1_canrep[]="2000-12-31T23:59:59.00389"; const char v_2_canrep[]="2000-09-30T21:40:20Z"; const char v_3_canrep[]="2000-10-01T17:10:20Z"; act_v_ran_v_1.fValue.f_datetime.f_year = 2000; act_v_ran_v_1.fValue.f_datetime.f_month = 12; act_v_ran_v_1.fValue.f_datetime.f_day = 31; act_v_ran_v_1.fValue.f_datetime.f_hour = 23; act_v_ran_v_1.fValue.f_datetime.f_min = 59; act_v_ran_v_1.fValue.f_datetime.f_second = 59; act_v_ran_v_1.fValue.f_datetime.f_milisec = 0.00389; act_v_ran_v_2.fValue.f_datetime.f_year = 2000; act_v_ran_v_2.fValue.f_datetime.f_month = 9; act_v_ran_v_2.fValue.f_datetime.f_day = 30; act_v_ran_v_2.fValue.f_datetime.f_hour = 21; act_v_ran_v_2.fValue.f_datetime.f_min = 40; act_v_ran_v_2.fValue.f_datetime.f_second = 20; act_v_ran_v_2.fValue.f_datetime.f_milisec = 0; act_v_ran_v_3.fValue.f_datetime.f_year = 2000; act_v_ran_v_3.fValue.f_datetime.f_month = 10; act_v_ran_v_3.fValue.f_datetime.f_day = 1; act_v_ran_v_3.fValue.f_datetime.f_hour = 17; act_v_ran_v_3.fValue.f_datetime.f_min = 10; act_v_ran_v_3.fValue.f_datetime.f_second = 20; act_v_ran_v_3.fValue.f_datetime.f_milisec = 0; /*** * E2-41 * * 3.2.7.2 Canonical representation * * Except for trailing fractional zero digits in the seconds representation, * '24:00:00' time representations, and timezone (for timezoned values), * the mapping from literals to values is one-to-one. Where there is more * than one possible representation, the canonical representation is as follows: * redundant trailing zero digits in fractional-second literals are prohibited. * An hour representation of '24' is prohibited. Timezoned values are canonically * represented by appending 'Z' to the nontimezoned representation. (All * timezoned dateTime values are UTC.) * * .'24:00:00' -> '00:00:00' * .milisecond: trailing zeros removed * .'Z' * ***/ /*** * * validate * --------- * availability return value context * ---------------------------------------------- * valid true n/a * invalid false st_FOCA0002 * ***/ // valid VALIDATE_TEST(v_1, dt, EXP_RET_VALID_TRUE, DONT_CARE); VALIDATE_TEST(v_2, dt, EXP_RET_VALID_TRUE, DONT_CARE); VALIDATE_TEST(v_3, dt, EXP_RET_VALID_TRUE, DONT_CARE); // invalid VALIDATE_TEST(iv_1, dt, EXP_RET_VALID_FALSE, XSValue::st_FOCA0002); VALIDATE_TEST(iv_2, dt, EXP_RET_VALID_FALSE, XSValue::st_FOCA0002); VALIDATE_TEST(iv_3, dt, EXP_RET_VALID_FALSE, XSValue::st_FOCA0002); VALIDATE_TEST(iv_4, dt, EXP_RET_VALID_FALSE, XSValue::st_FODT0003); VALIDATE_TEST(iv_5, dt, EXP_RET_VALID_FALSE, XSValue::st_FODT0003); /*** * * getActualValue * --------------- * availability return value context * ---------------------------------------------- * validation on * ============= * valid XSValue n/a * invalid 0 st_FOCA0002 * * validation off * ============== * valid XSValue n/a * invalid 0 st_FOCA0002 * ***/ for (int i = 0; i < 2; i++) { //validation on/off toValidate = ( 0 == i) ? true : false; // valid ACTVALUE_TEST(v_1, dt, toValidate, EXP_RET_VALUE_TRUE, DONT_CARE, act_v_ran_v_1); ACTVALUE_TEST(v_2, dt, toValidate, EXP_RET_VALUE_TRUE, DONT_CARE, act_v_ran_v_2); ACTVALUE_TEST(v_3, dt, toValidate, EXP_RET_VALUE_TRUE, DONT_CARE, act_v_ran_v_3); // invalid ACTVALUE_TEST(iv_1, dt, toValidate, EXP_RET_VALUE_FALSE, XSValue::st_FOCA0002, act_v_ran_v_1); ACTVALUE_TEST(iv_2, dt, toValidate, EXP_RET_VALUE_FALSE, XSValue::st_FOCA0002, act_v_ran_v_1); ACTVALUE_TEST(iv_3, dt, toValidate, EXP_RET_VALUE_FALSE, XSValue::st_FOCA0002, act_v_ran_v_1); ACTVALUE_TEST(iv_4, dt, toValidate, EXP_RET_VALUE_FALSE, XSValue::st_FODT0003, act_v_ran_v_1); ACTVALUE_TEST(iv_5, dt, toValidate, EXP_RET_VALUE_FALSE, XSValue::st_FODT0003, act_v_ran_v_1); } /*** * * getCanonicalRepresentation * --------------------------- * availability return value context * ---------------------------------------------- * * validation on * ============= * valid XMLCh n/a * invalid 0 st_FOCA0002 * * validation off * ============== * valid XMLCh n/a * invalid 0 st_FOCA0002 * ***/ for (int j = 0; j < 2; j++) { //validation on/off toValidate = ( 0 == j) ? true : false; // valid CANREP_TEST(v_1, dt, toValidate, EXP_RET_CANREP_TRUE, v_1_canrep, DONT_CARE); CANREP_TEST(v_2, dt, toValidate, EXP_RET_CANREP_TRUE, v_2_canrep, DONT_CARE); CANREP_TEST(v_3, dt, toValidate, EXP_RET_CANREP_TRUE, v_3_canrep, DONT_CARE); // invalid CANREP_TEST(iv_1, dt, toValidate, EXP_RET_CANREP_FALSE, 0, XSValue::st_FOCA0002); CANREP_TEST(iv_2, dt, toValidate, EXP_RET_CANREP_FALSE, 0, XSValue::st_FOCA0002); CANREP_TEST(iv_3, dt, toValidate, EXP_RET_CANREP_FALSE, 0, XSValue::st_FOCA0002); CANREP_TEST(iv_4, dt, toValidate, EXP_RET_CANREP_FALSE, 0, XSValue::st_FODT0003); CANREP_TEST(iv_5, dt, toValidate, EXP_RET_CANREP_FALSE, 0, XSValue::st_FODT0003); } } void test_dt_time() { const XSValue::DataType dt = XSValue::dt_time; bool toValidate = true; const char v_1[]=" 23:59:59.38900Z \n"; const char v_2[]="24:00:00"; const char v_3[]="23:59:59+00:01"; const char iv_1[]="55:59:59"; const char iv_2[]="03:99:59"; const char iv_3[]="23:59.1:59"; const char iv_4[]="01:01:01Z99"; const char iv_5[]="01:01:01Z10:61"; XSValue::XSValue_Data act_v_ran_v_1; XSValue::XSValue_Data act_v_ran_v_2; XSValue::XSValue_Data act_v_ran_v_3; const char v_1_canrep[]="23:59:59.389Z"; const char v_2_canrep[]="00:00:00"; const char v_3_canrep[]="23:58:59Z"; act_v_ran_v_1.fValue.f_datetime.f_year = 0; act_v_ran_v_1.fValue.f_datetime.f_month = 0; act_v_ran_v_1.fValue.f_datetime.f_day = 0; act_v_ran_v_1.fValue.f_datetime.f_hour = 23; act_v_ran_v_1.fValue.f_datetime.f_min = 59; act_v_ran_v_1.fValue.f_datetime.f_second = 59; act_v_ran_v_1.fValue.f_datetime.f_milisec = 0.389; act_v_ran_v_2.fValue.f_datetime.f_year = 0; act_v_ran_v_2.fValue.f_datetime.f_month = 0; act_v_ran_v_2.fValue.f_datetime.f_day = 0; act_v_ran_v_2.fValue.f_datetime.f_hour = 24; act_v_ran_v_2.fValue.f_datetime.f_min = 0; act_v_ran_v_2.fValue.f_datetime.f_second = 0; act_v_ran_v_2.fValue.f_datetime.f_milisec = 0; act_v_ran_v_3.fValue.f_datetime.f_year = 0; act_v_ran_v_3.fValue.f_datetime.f_month = 0; act_v_ran_v_3.fValue.f_datetime.f_day = 0; act_v_ran_v_3.fValue.f_datetime.f_hour = 23; act_v_ran_v_3.fValue.f_datetime.f_min = 58; act_v_ran_v_3.fValue.f_datetime.f_second = 59; act_v_ran_v_3.fValue.f_datetime.f_milisec = 0; /*** * 3.2.8.2 Canonical representation * * The canonical representation for time is defined by prohibiting certain options * from the Lexical representation (§3.2.8.1). Specifically, * 1. either the time zone must be omitted or, * 2. if present, the time zone must be Coordinated Universal Time (UTC) * indicated by a "Z". * 3. Additionally, the canonical representation for midnight is 00:00:00. * ***/ /*** * * validate * --------- * availability return value context * ---------------------------------------------- * valid true n/a * invalid false st_FOCA0002 * ***/ // valid VALIDATE_TEST(v_1, dt, EXP_RET_VALID_TRUE, DONT_CARE); VALIDATE_TEST(v_2, dt, EXP_RET_VALID_TRUE, DONT_CARE); VALIDATE_TEST(v_3, dt, EXP_RET_VALID_TRUE, DONT_CARE); // invalid VALIDATE_TEST(iv_1, dt, EXP_RET_VALID_FALSE, XSValue::st_FOCA0002); VALIDATE_TEST(iv_2, dt, EXP_RET_VALID_FALSE, XSValue::st_FOCA0002); VALIDATE_TEST(iv_3, dt, EXP_RET_VALID_FALSE, XSValue::st_FOCA0002); VALIDATE_TEST(iv_4, dt, EXP_RET_VALID_FALSE, XSValue::st_FODT0003); VALIDATE_TEST(iv_5, dt, EXP_RET_VALID_FALSE, XSValue::st_FODT0003); /*** * * getActualValue * --------------- * availability return value context * ---------------------------------------------- * validation on * ============= * valid XSValue n/a * invalid 0 st_FOCA0002 * * validation off * ============== * valid XSValue n/a * invalid 0 st_FOCA0002 * ***/ for (int i = 0; i < 2; i++) { //validation on/off toValidate = ( 0 == i) ? true : false; // valid ACTVALUE_TEST(v_1, dt, toValidate, EXP_RET_VALUE_TRUE, DONT_CARE, act_v_ran_v_1); ACTVALUE_TEST(v_2, dt, toValidate, EXP_RET_VALUE_TRUE, DONT_CARE, act_v_ran_v_2); ACTVALUE_TEST(v_3, dt, toValidate, EXP_RET_VALUE_TRUE, DONT_CARE, act_v_ran_v_3); // invalid ACTVALUE_TEST(iv_1, dt, toValidate, EXP_RET_VALUE_FALSE, XSValue::st_FOCA0002, act_v_ran_v_1); ACTVALUE_TEST(iv_2, dt, toValidate, EXP_RET_VALUE_FALSE, XSValue::st_FOCA0002, act_v_ran_v_1); ACTVALUE_TEST(iv_3, dt, toValidate, EXP_RET_VALUE_FALSE, XSValue::st_FOCA0002, act_v_ran_v_1); ACTVALUE_TEST(iv_4, dt, toValidate, EXP_RET_VALUE_FALSE, XSValue::st_FODT0003, act_v_ran_v_1); ACTVALUE_TEST(iv_5, dt, toValidate, EXP_RET_VALUE_FALSE, XSValue::st_FODT0003, act_v_ran_v_1); } /*** * * getCanonicalRepresentation * --------------------------- * availability return value context * ---------------------------------------------- * * validation on * ============= * valid XMLCh n/a * invalid 0 st_FOCA0002 * * validation off * ============== * valid XMLCh n/a * invalid 0 st_FOCA0002 * ***/ for (int j = 0; j < 2; j++) { //validation on/off toValidate = ( 0 == j) ? true : false; // valid CANREP_TEST(v_1, dt, toValidate, EXP_RET_CANREP_TRUE, v_1_canrep, DONT_CARE); CANREP_TEST(v_2, dt, toValidate, EXP_RET_CANREP_TRUE, v_2_canrep, DONT_CARE); CANREP_TEST(v_3, dt, toValidate, EXP_RET_CANREP_TRUE, v_3_canrep, DONT_CARE); // invalid CANREP_TEST(iv_1, dt, toValidate, EXP_RET_CANREP_FALSE, 0, XSValue::st_FOCA0002); CANREP_TEST(iv_2, dt, toValidate, EXP_RET_CANREP_FALSE, 0, XSValue::st_FOCA0002); CANREP_TEST(iv_3, dt, toValidate, EXP_RET_CANREP_FALSE, 0, XSValue::st_FOCA0002); CANREP_TEST(iv_4, dt, toValidate, EXP_RET_CANREP_FALSE, 0, XSValue::st_FODT0003); CANREP_TEST(iv_5, dt, toValidate, EXP_RET_CANREP_FALSE, 0, XSValue::st_FODT0003); } } void test_dt_string() { const XSValue::DataType dt = XSValue::dt_string; bool toValidate = true; const char v_1[]="mystring"; XSValue::XSValue_Data act_v_ran_v_1; act_v_ran_v_1.fValue.f_strVal = 0; /*** * * validate * --------- * availability return value context * ---------------------------------------------- * valid true n/a * invalid n/a false st_FOCA0002 * ***/ // valid VALIDATE_TEST(v_1, dt, EXP_RET_VALID_TRUE, DONT_CARE); // invalid /*** * * getActualValue * --------------- * availability return value context * ---------------------------------------------- * validation on * ============= * valid 0 n/a * invalid n/a 0 st_FOCA0002 * * validation off * ============== * valid 0 n/a * invalid n/a 0 st_FOCA0002 * ***/ for (int i = 0; i < 2; i++) { //validation on/off toValidate = ( 0 == i) ? true : false; // valid ACTVALUE_TEST(v_1, dt, toValidate, EXP_RET_VALUE_FALSE, XSValue::st_NoActVal, act_v_ran_v_1); // invalid } /*** * * getCanonicalRepresentation * --------------------------- * availability return value context * ---------------------------------------------- * * validation on * ============= * valid 0 n/a * invalid n/a 0 st_FOCA0002 * * validation off * ============== * valid 0 n/a * invalid n/a 0 st_FOCA0002 * ***/ for (int j = 0; j < 2; j++) { //validation on/off toValidate = ( 0 == j) ? true : false; // valid CANREP_TEST(v_1, dt, toValidate, EXP_RET_CANREP_FALSE, 0, XSValue::st_NoCanRep); // invalid } } void test_dt_anyURI() { const XSValue::DataType dt = XSValue::dt_anyURI; bool toValidate = true; const char v_1[]=" http://www.schemaTest.org/IBMd3_2_17v01 \n"; const char v_2[]="gopher://spinaltap.micro.umn.edu/00/Weather/California/Los%20Angeles"; const char v_3[]="ftp://www.noNamespace.edu"; XSValue::XSValue_Data act_v_ran_v_1; act_v_ran_v_1.fValue.f_strVal = 0; XSValue::XSValue_Data act_v_ran_v_2; act_v_ran_v_2.fValue.f_strVal = 0; XSValue::XSValue_Data act_v_ran_v_3; act_v_ran_v_3.fValue.f_strVal = 0; const char iv_1[]="+htp://peiyongz@:90"; const char iv_2[]=">////1.2.3.4."; const char iv_3[]="<///www.ibm.9om"; /*** * * validate * --------- * availability return value context * ---------------------------------------------- * valid true n/a * invalid false st_FOCA0002 * ***/ // valid VALIDATE_TEST(v_1, dt, EXP_RET_VALID_TRUE, DONT_CARE); VALIDATE_TEST(v_2, dt, EXP_RET_VALID_TRUE, DONT_CARE); VALIDATE_TEST(v_3, dt, EXP_RET_VALID_TRUE, DONT_CARE); // invalid VALIDATE_TEST(iv_1, dt, EXP_RET_VALID_FALSE, DONT_CARE); VALIDATE_TEST(iv_2, dt, EXP_RET_VALID_FALSE, DONT_CARE); VALIDATE_TEST(iv_3, dt, EXP_RET_VALID_FALSE, DONT_CARE); /*** * * getActualValue * --------------- * availability return value context * ---------------------------------------------- * validation on * ============= * valid 0 st_NoActVal * invalid 0 st_FOCA0002 * * validation off * ============== * valid 0 st_NoActVal * invalid 0 st_NoActVal * ***/ for (int i = 0; i < 2; i++) { //validation on/off toValidate = ( 0 == i) ? true : false; // valid ACTVALUE_TEST(v_1, dt, toValidate, EXP_RET_VALUE_FALSE, XSValue::st_NoActVal, act_v_ran_v_1); ACTVALUE_TEST(v_2, dt, toValidate, EXP_RET_VALUE_FALSE, XSValue::st_NoActVal, act_v_ran_v_2); ACTVALUE_TEST(v_3, dt, toValidate, EXP_RET_VALUE_FALSE, XSValue::st_NoActVal, act_v_ran_v_3); // invalid ACTVALUE_TEST(iv_1, dt, toValidate, EXP_RET_VALUE_FALSE, (toValidate? XSValue::st_FOCA0002: XSValue::st_NoActVal), act_v_ran_v_1); ACTVALUE_TEST(iv_2, dt, toValidate, EXP_RET_VALUE_FALSE, (toValidate? XSValue::st_FOCA0002: XSValue::st_NoActVal), act_v_ran_v_1); ACTVALUE_TEST(iv_3, dt, toValidate, EXP_RET_VALUE_FALSE, (toValidate? XSValue::st_FOCA0002: XSValue::st_NoActVal), act_v_ran_v_1); } /*** * * getCanonicalRepresentation * --------------------------- * availability return value context * ---------------------------------------------- * * validation on * ============= * valid 0 st_NoCanRep * invalid 0 st_FOCA0002 * * validation off * ============== * valid 0 st_NoCanRep * invalid 0 st_NoCanRep * ***/ for (int j = 0; j < 2; j++) { //validation on/off toValidate = ( 0 == j) ? true : false; // valid CANREP_TEST(v_1, dt, toValidate, EXP_RET_CANREP_FALSE, 0, XSValue::st_NoCanRep); CANREP_TEST(v_2, dt, toValidate, EXP_RET_CANREP_FALSE, 0, XSValue::st_NoCanRep); CANREP_TEST(v_3, dt, toValidate, EXP_RET_CANREP_FALSE, 0, XSValue::st_NoCanRep); // invalid CANREP_TEST(iv_1, dt, toValidate, EXP_RET_CANREP_FALSE, 0, (toValidate? XSValue::st_FOCA0002: XSValue::st_NoCanRep)); CANREP_TEST(iv_2, dt, toValidate, EXP_RET_CANREP_FALSE, 0, (toValidate? XSValue::st_FOCA0002: XSValue::st_NoCanRep)); CANREP_TEST(iv_3, dt, toValidate, EXP_RET_CANREP_FALSE, 0, (toValidate? XSValue::st_FOCA0002: XSValue::st_NoCanRep)); } } void test_dt_QName() { const XSValue::DataType dt = XSValue::dt_QName; bool toValidate = true; const char v_1[]=" Ant:Eater \n"; const char v_2[]="Minimum_Length"; const char v_3[]="abcde:a2345"; XSValue::XSValue_Data act_v_ran_v_1; act_v_ran_v_1.fValue.f_strVal = 0; XSValue::XSValue_Data act_v_ran_v_2; act_v_ran_v_2.fValue.f_strVal = 0; XSValue::XSValue_Data act_v_ran_v_3; act_v_ran_v_3.fValue.f_strVal = 0; const char iv_1[]="Three:Two:One"; const char iv_2[]=":my"; const char iv_3[]="+name"; /*** * * validate * --------- * availability return value context * ---------------------------------------------- * valid true n/a * invalid false st_FOCA0002 * ***/ // valid VALIDATE_TEST(v_1, dt, EXP_RET_VALID_TRUE, DONT_CARE); VALIDATE_TEST(v_2, dt, EXP_RET_VALID_TRUE, DONT_CARE); VALIDATE_TEST(v_3, dt, EXP_RET_VALID_TRUE, DONT_CARE); // invalid VALIDATE_TEST(iv_1, dt, EXP_RET_VALID_FALSE, DONT_CARE); VALIDATE_TEST(iv_2, dt, EXP_RET_VALID_FALSE, DONT_CARE); VALIDATE_TEST(iv_3, dt, EXP_RET_VALID_FALSE, DONT_CARE); /*** * * getActualValue * --------------- * availability return value context * ---------------------------------------------- * validation on * ============= * valid 0 st_NoActVal * invalid 0 st_FOCA0002 * * validation off * ============== * valid 0 st_NoActVal * invalid 0 st_NoActVal * ***/ for (int i = 0; i < 2; i++) { //validation on/off toValidate = ( 0 == i) ? true : false; // valid ACTVALUE_TEST(v_1, dt, toValidate, EXP_RET_VALUE_FALSE, XSValue::st_NoActVal, act_v_ran_v_1); ACTVALUE_TEST(v_2, dt, toValidate, EXP_RET_VALUE_FALSE, XSValue::st_NoActVal, act_v_ran_v_2); ACTVALUE_TEST(v_3, dt, toValidate, EXP_RET_VALUE_FALSE, XSValue::st_NoActVal, act_v_ran_v_3); // invalid ACTVALUE_TEST(iv_1, dt, toValidate, EXP_RET_VALUE_FALSE, (toValidate? XSValue::st_FOCA0002: XSValue::st_NoActVal), act_v_ran_v_1); ACTVALUE_TEST(iv_2, dt, toValidate, EXP_RET_VALUE_FALSE, (toValidate? XSValue::st_FOCA0002: XSValue::st_NoActVal), act_v_ran_v_1); ACTVALUE_TEST(iv_3, dt, toValidate, EXP_RET_VALUE_FALSE, (toValidate? XSValue::st_FOCA0002: XSValue::st_NoActVal), act_v_ran_v_1); } /*** * * getCanonicalRepresentation * --------------------------- * availability return value context * ---------------------------------------------- * * validation on * ============= * valid 0 st_NoCanRep * invalid 0 st_FOCA0002 * * validation off * ============== * valid 0 st_NoCanRep * invalid 0 st_NoCanRep * ***/ for (int j = 0; j < 2; j++) { //validation on/off toValidate = ( 0 == j) ? true : false; // valid CANREP_TEST(v_1, dt, toValidate, EXP_RET_CANREP_FALSE, 0, XSValue::st_NoCanRep); CANREP_TEST(v_2, dt, toValidate, EXP_RET_CANREP_FALSE, 0, XSValue::st_NoCanRep); CANREP_TEST(v_3, dt, toValidate, EXP_RET_CANREP_FALSE, 0, XSValue::st_NoCanRep); // invalid CANREP_TEST(iv_1, dt, toValidate, EXP_RET_CANREP_FALSE, 0, (toValidate? XSValue::st_FOCA0002: XSValue::st_NoCanRep)); CANREP_TEST(iv_2, dt, toValidate, EXP_RET_CANREP_FALSE, 0, (toValidate? XSValue::st_FOCA0002: XSValue::st_NoCanRep)); CANREP_TEST(iv_3, dt, toValidate, EXP_RET_CANREP_FALSE, 0, (toValidate? XSValue::st_FOCA0002: XSValue::st_NoCanRep)); } } void test_dt_NOTATION() { const XSValue::DataType dt = XSValue::dt_NOTATION; bool toValidate = true; const char v_1[]=" http://www.ibm.com/test:notation1 \n"; const char iv_1[]="invaliduri:notation2"; XSValue::XSValue_Data act_v_ran_v_1; act_v_ran_v_1.fValue.f_strVal = 0; /*** * * validate * --------- * availability return value context * ---------------------------------------------- * valid true n/a * invalid n/a false st_FOCA0002 * ***/ // valid VALIDATE_TEST(v_1, dt, EXP_RET_VALID_TRUE, DONT_CARE); // invalid VALIDATE_TEST(iv_1, dt, EXP_RET_VALID_FALSE, DONT_CARE); /*** * * getActualValue * --------------- * availability return value context * ---------------------------------------------- * validation on * ============= * valid 0 st_NoActVal * invalid n/a 0 st_FOCA0002 * * validation off * ============== * valid 0 st_NoActVal * invalid n/a 0 st_NoActVal * ***/ for (int i = 0; i < 2; i++) { //validation on/off toValidate = ( 0 == i) ? true : false; // valid ACTVALUE_TEST(v_1, dt, toValidate, EXP_RET_VALUE_FALSE, XSValue::st_NoActVal, act_v_ran_v_1); // invalid } /*** * * getCanonicalRepresentation * --------------------------- * availability return value context * ---------------------------------------------- * * validation on * ============= * valid 0 st_NoCanRep * invalid n/a 0 st_FOCA0002 * * validation off * ============== * valid 0 st_NoCanRep * invalid n/a 0 st_NoCanRep * ***/ for (int j = 0; j < 2; j++) { //validation on/off toValidate = ( 0 == j) ? true : false; // valid CANREP_TEST(v_1, dt, toValidate, EXP_RET_CANREP_FALSE, 0, XSValue::st_NoCanRep); // invalid } } void test_dt_normalizedString() { const XSValue::DataType dt = XSValue::dt_normalizedString; bool toValidate = true; const char v_1[]="4+4=8"; const char v_2[]="a b"; const char v_3[]="someChars=*_-"; const char iv_1[]="a\tb"; const char iv_2[]="a\nb"; XSValue::XSValue_Data act_v_ran_v_1; act_v_ran_v_1.fValue.f_strVal = 0; XSValue::XSValue_Data act_v_ran_v_2; act_v_ran_v_2.fValue.f_strVal = 0; XSValue::XSValue_Data act_v_ran_v_3; act_v_ran_v_3.fValue.f_strVal = 0; /*** * * validate * --------- * availability return value context * ---------------------------------------------- * valid true n/a * invalid n/a false st_FOCA0002 * ***/ // valid VALIDATE_TEST(v_1, dt, EXP_RET_VALID_TRUE, DONT_CARE); VALIDATE_TEST(v_2, dt, EXP_RET_VALID_TRUE, DONT_CARE); VALIDATE_TEST(v_3, dt, EXP_RET_VALID_TRUE, DONT_CARE); // invalid VALIDATE_TEST(iv_1, dt, EXP_RET_VALID_FALSE, DONT_CARE); VALIDATE_TEST(iv_2, dt, EXP_RET_VALID_FALSE, DONT_CARE); /*** * * getActualValue * --------------- * availability return value context * ---------------------------------------------- * validation on * ============= * valid 0 st_NoActVal * invalid 0 st_FOCA0002 * * validation off * ============== * valid 0 st_NoActVal * invalid 0 st_NoActVal * ***/ for (int i = 0; i < 2; i++) { //validation on/off toValidate = ( 0 == i) ? true : false; // valid ACTVALUE_TEST(v_1, dt, toValidate, EXP_RET_VALUE_FALSE, XSValue::st_NoActVal, act_v_ran_v_1); ACTVALUE_TEST(v_2, dt, toValidate, EXP_RET_VALUE_FALSE, XSValue::st_NoActVal, act_v_ran_v_2); ACTVALUE_TEST(v_3, dt, toValidate, EXP_RET_VALUE_FALSE, XSValue::st_NoActVal, act_v_ran_v_3); // invalid ACTVALUE_TEST(iv_1, dt, toValidate, EXP_RET_VALUE_FALSE, (toValidate ? XSValue::st_FOCA0002 : XSValue::st_NoActVal), act_v_ran_v_1); ACTVALUE_TEST(iv_2, dt, toValidate, EXP_RET_VALUE_FALSE, (toValidate ? XSValue::st_FOCA0002 : XSValue::st_NoActVal), act_v_ran_v_2); } /*** * * getCanonicalRepresentation * --------------------------- * availability return value context * ---------------------------------------------- * * validation on * ============= * valid 0 st_NoCanRep * invalid 0 st_FOCA0002 * * validation off * ============== * valid 0 st_NoCanRep * invalid 0 st_NoCanRep * ***/ for (int j = 0; j < 2; j++) { //validation on/off toValidate = ( 0 == j) ? true : false; // valid CANREP_TEST(v_1, dt, toValidate, EXP_RET_CANREP_FALSE, 0, XSValue::st_NoCanRep); CANREP_TEST(v_2, dt, toValidate, EXP_RET_CANREP_FALSE, 0, XSValue::st_NoCanRep); CANREP_TEST(v_3, dt, toValidate, EXP_RET_CANREP_FALSE, 0, XSValue::st_NoCanRep); // invalid CANREP_TEST(iv_1, dt, toValidate, EXP_RET_CANREP_FALSE, 0, (toValidate ? XSValue::st_FOCA0002 : XSValue::st_NoCanRep)); CANREP_TEST(iv_2, dt, toValidate, EXP_RET_CANREP_FALSE, 0, (toValidate ? XSValue::st_FOCA0002 : XSValue::st_NoCanRep)); } } void test_dt_token() { const XSValue::DataType dt = XSValue::dt_token; bool toValidate = true; const char v_1[]="4+4=8"; const char v_2[]="Number2"; const char v_3[]="someChars=*_-"; XSValue::XSValue_Data act_v_ran_v_1; act_v_ran_v_1.fValue.f_strVal = 0; XSValue::XSValue_Data act_v_ran_v_2; act_v_ran_v_2.fValue.f_strVal = 0; XSValue::XSValue_Data act_v_ran_v_3; act_v_ran_v_3.fValue.f_strVal = 0; const char iv_1[]="a\tb"; const char iv_2[]="a\nb"; const char iv_3[]="a b"; /*** * * validate * --------- * availability return value context * ---------------------------------------------- * valid true n/a * invalid n/a false st_FOCA0002 * ***/ // valid VALIDATE_TEST(v_1, dt, EXP_RET_VALID_TRUE, DONT_CARE); VALIDATE_TEST(v_2, dt, EXP_RET_VALID_TRUE, DONT_CARE); VALIDATE_TEST(v_3, dt, EXP_RET_VALID_TRUE, DONT_CARE); // invalid VALIDATE_TEST(iv_1, dt, EXP_RET_VALID_FALSE, DONT_CARE); VALIDATE_TEST(iv_2, dt, EXP_RET_VALID_FALSE, DONT_CARE); VALIDATE_TEST(iv_3, dt, EXP_RET_VALID_FALSE, DONT_CARE); /*** * * getActualValue * --------------- * availability return value context * ---------------------------------------------- * validation on * ============= * valid 0 st_NoActVal * invalid 0 st_FOCA0002 * * validation off * ============== * valid 0 st_NoActVal * invalid 0 st_NoActVal * ***/ for (int i = 0; i < 2; i++) { //validation on/off toValidate = ( 0 == i) ? true : false; // valid ACTVALUE_TEST(v_1, dt, toValidate, EXP_RET_VALUE_FALSE, XSValue::st_NoActVal, act_v_ran_v_1); ACTVALUE_TEST(v_2, dt, toValidate, EXP_RET_VALUE_FALSE, XSValue::st_NoActVal, act_v_ran_v_1); ACTVALUE_TEST(v_3, dt, toValidate, EXP_RET_VALUE_FALSE, XSValue::st_NoActVal, act_v_ran_v_1); // invalid ACTVALUE_TEST(iv_1, dt, toValidate, EXP_RET_VALUE_FALSE, (toValidate ? XSValue::st_FOCA0002 : XSValue::st_NoActVal), act_v_ran_v_1); ACTVALUE_TEST(iv_2, dt, toValidate, EXP_RET_VALUE_FALSE, (toValidate ? XSValue::st_FOCA0002 : XSValue::st_NoActVal), act_v_ran_v_1); ACTVALUE_TEST(iv_3, dt, toValidate, EXP_RET_VALUE_FALSE, (toValidate ? XSValue::st_FOCA0002 : XSValue::st_NoActVal), act_v_ran_v_1); } /*** * * getCanonicalRepresentation * --------------------------- * availability return value context * ---------------------------------------------- * * validation on * ============= * valid 0 st_NoCanRep * invalid 0 st_FOCA0002 * * validation off * ============== * valid 0 st_NoCanRep * invalid 0 st_NoCanRep * ***/ for (int j = 0; j < 2; j++) { //validation on/off toValidate = ( 0 == j) ? true : false; // valid CANREP_TEST(v_1, dt, toValidate, EXP_RET_CANREP_FALSE, 0, XSValue::st_NoCanRep); CANREP_TEST(v_2, dt, toValidate, EXP_RET_CANREP_FALSE, 0, XSValue::st_NoCanRep); CANREP_TEST(v_3, dt, toValidate, EXP_RET_CANREP_FALSE, 0, XSValue::st_NoCanRep); // invalid CANREP_TEST(iv_1, dt, toValidate, EXP_RET_CANREP_FALSE, 0, (toValidate ? XSValue::st_FOCA0002 : XSValue::st_NoCanRep)); CANREP_TEST(iv_2, dt, toValidate, EXP_RET_CANREP_FALSE, 0, (toValidate ? XSValue::st_FOCA0002 : XSValue::st_NoCanRep)); CANREP_TEST(iv_3, dt, toValidate, EXP_RET_CANREP_FALSE, 0, (toValidate ? XSValue::st_FOCA0002 : XSValue::st_NoCanRep)); } } void test_dt_language() { const XSValue::DataType dt = XSValue::dt_language; bool toValidate = true; const char v_1[]="en-AT"; const char v_2[]="ja"; const char v_3[]="uk-GB"; const char iv_1[]="ja_JP"; const char iv_2[]="en+US"; const char iv_3[]="12-en"; XSValue::XSValue_Data act_v_ran_v_1; act_v_ran_v_1.fValue.f_strVal = 0; XSValue::XSValue_Data act_v_ran_v_2; act_v_ran_v_2.fValue.f_strVal = 0; XSValue::XSValue_Data act_v_ran_v_3; act_v_ran_v_3.fValue.f_strVal = 0; /*** * * validate * --------- * availability return value context * ---------------------------------------------- * valid true n/a * invalid n/a false st_FOCA0002 * ***/ // valid VALIDATE_TEST(v_1, dt, EXP_RET_VALID_TRUE, DONT_CARE); VALIDATE_TEST(v_2, dt, EXP_RET_VALID_TRUE, DONT_CARE); VALIDATE_TEST(v_3, dt, EXP_RET_VALID_TRUE, DONT_CARE); // invalid VALIDATE_TEST(iv_1, dt, EXP_RET_VALID_FALSE, DONT_CARE); VALIDATE_TEST(iv_2, dt, EXP_RET_VALID_FALSE, DONT_CARE); VALIDATE_TEST(iv_3, dt, EXP_RET_VALID_FALSE, DONT_CARE); /*** * * getActualValue * --------------- * availability return value context * ---------------------------------------------- * validation on * ============= * valid 0 st_NoActVal * invalid 0 st_FOCA0002 * * validation off * ============== * valid 0 st_NoActVal * invalid 0 st_NoActVal * ***/ for (int i = 0; i < 2; i++) { //validation on/off toValidate = ( 0 == i) ? true : false; // valid ACTVALUE_TEST(v_1, dt, toValidate, EXP_RET_VALUE_FALSE, XSValue::st_NoActVal, act_v_ran_v_1); ACTVALUE_TEST(v_2, dt, toValidate, EXP_RET_VALUE_FALSE, XSValue::st_NoActVal, act_v_ran_v_2); ACTVALUE_TEST(v_3, dt, toValidate, EXP_RET_VALUE_FALSE, XSValue::st_NoActVal, act_v_ran_v_3); // invalid ACTVALUE_TEST(iv_1, dt, toValidate, EXP_RET_VALUE_FALSE, (toValidate ? XSValue::st_FOCA0002 : XSValue::st_NoActVal), act_v_ran_v_1); ACTVALUE_TEST(iv_2, dt, toValidate, EXP_RET_VALUE_FALSE, (toValidate ? XSValue::st_FOCA0002 : XSValue::st_NoActVal), act_v_ran_v_1); ACTVALUE_TEST(iv_3, dt, toValidate, EXP_RET_VALUE_FALSE, (toValidate ? XSValue::st_FOCA0002 : XSValue::st_NoActVal), act_v_ran_v_1); } /*** * * getCanonicalRepresentation * --------------------------- * availability return value context * ---------------------------------------------- * * validation on * ============= * valid 0 st_NoCanRep * invalid 0 st_FOCA0002 * * validation off * ============== * valid 0 st_NoCanRep * invalid 0 st_NoCanRep * ***/ for (int j = 0; j < 2; j++) { //validation on/off toValidate = ( 0 == j) ? true : false; // valid CANREP_TEST(v_1, dt, toValidate, EXP_RET_CANREP_FALSE, 0, XSValue::st_NoCanRep); CANREP_TEST(v_2, dt, toValidate, EXP_RET_CANREP_FALSE, 0, XSValue::st_NoCanRep); CANREP_TEST(v_3, dt, toValidate, EXP_RET_CANREP_FALSE, 0, XSValue::st_NoCanRep); // invalid CANREP_TEST(iv_1, dt, toValidate, EXP_RET_CANREP_FALSE, 0, (toValidate ? XSValue::st_FOCA0002 : XSValue::st_NoCanRep)); CANREP_TEST(iv_2, dt, toValidate, EXP_RET_CANREP_FALSE, 0, (toValidate ? XSValue::st_FOCA0002 : XSValue::st_NoCanRep)); CANREP_TEST(iv_3, dt, toValidate, EXP_RET_CANREP_FALSE, 0, (toValidate ? XSValue::st_FOCA0002 : XSValue::st_NoCanRep)); } } void test_dt_NMTOKEN() { const XSValue::DataType dt = XSValue::dt_NMTOKEN; bool toValidate = true; const char v_1[]="Four:-_."; const char v_2[]="Zeerochert"; const char v_3[]="007"; const char iv_1[]="#board"; const char iv_2[]="@com"; const char iv_3[]=";abc"; XSValue::XSValue_Data act_v_ran_v_1; act_v_ran_v_1.fValue.f_strVal = 0; XSValue::XSValue_Data act_v_ran_v_2; act_v_ran_v_2.fValue.f_strVal = 0; XSValue::XSValue_Data act_v_ran_v_3; act_v_ran_v_3.fValue.f_strVal = 0; /*** * * validate * --------- * availability return value context * ---------------------------------------------- * valid true n/a * invalid n/a false st_FOCA0002 * ***/ // valid VALIDATE_TEST(v_1, dt, EXP_RET_VALID_TRUE, DONT_CARE); VALIDATE_TEST(v_2, dt, EXP_RET_VALID_TRUE, DONT_CARE); VALIDATE_TEST(v_3, dt, EXP_RET_VALID_TRUE, DONT_CARE); // invalid VALIDATE_TEST(iv_1, dt, EXP_RET_VALID_FALSE, DONT_CARE); VALIDATE_TEST(iv_2, dt, EXP_RET_VALID_FALSE, DONT_CARE); VALIDATE_TEST(iv_3, dt, EXP_RET_VALID_FALSE, DONT_CARE); /*** * * getActualValue * --------------- * availability return value context * ---------------------------------------------- * validation on * ============= * valid 0 st_NoActVal * invalid 0 st_FOCA0002 * * validation off * ============== * valid 0 st_NoActVal * invalid 0 st_NoActVal * ***/ for (int i = 0; i < 2; i++) { //validation on/off toValidate = ( 0 == i) ? true : false; // valid ACTVALUE_TEST(v_1, dt, toValidate, EXP_RET_VALUE_FALSE, XSValue::st_NoActVal, act_v_ran_v_1); ACTVALUE_TEST(v_2, dt, toValidate, EXP_RET_VALUE_FALSE, XSValue::st_NoActVal, act_v_ran_v_2); ACTVALUE_TEST(v_3, dt, toValidate, EXP_RET_VALUE_FALSE, XSValue::st_NoActVal, act_v_ran_v_3); // invalid ACTVALUE_TEST(iv_1, dt, toValidate, EXP_RET_VALUE_FALSE, (toValidate ? XSValue::st_FOCA0002 : XSValue::st_NoActVal), act_v_ran_v_1); ACTVALUE_TEST(iv_2, dt, toValidate, EXP_RET_VALUE_FALSE, (toValidate ? XSValue::st_FOCA0002 : XSValue::st_NoActVal), act_v_ran_v_2); ACTVALUE_TEST(iv_3, dt, toValidate, EXP_RET_VALUE_FALSE, (toValidate ? XSValue::st_FOCA0002 : XSValue::st_NoActVal), act_v_ran_v_3); } /*** * * getCanonicalRepresentation * --------------------------- * availability return value context * ---------------------------------------------- * * validation on * ============= * valid 0 st_NoCanRep * invalid 0 st_FOCA0002 * * validation off * ============== * valid 0 st_NoCanRep * invalid 0 st_NoCanRep * ***/ for (int j = 0; j < 2; j++) { //validation on/off toValidate = ( 0 == j) ? true : false; // valid CANREP_TEST(v_1, dt, toValidate, EXP_RET_CANREP_FALSE, 0, XSValue::st_NoCanRep); CANREP_TEST(v_2, dt, toValidate, EXP_RET_CANREP_FALSE, 0, XSValue::st_NoCanRep); CANREP_TEST(v_3, dt, toValidate, EXP_RET_CANREP_FALSE, 0, XSValue::st_NoCanRep); // invalid CANREP_TEST(iv_1, dt, toValidate, EXP_RET_CANREP_FALSE, 0, (toValidate ? XSValue::st_FOCA0002 : XSValue::st_NoCanRep)); CANREP_TEST(iv_2, dt, toValidate, EXP_RET_CANREP_FALSE, 0, (toValidate ? XSValue::st_FOCA0002 : XSValue::st_NoCanRep)); CANREP_TEST(iv_3, dt, toValidate, EXP_RET_CANREP_FALSE, 0, (toValidate ? XSValue::st_FOCA0002 : XSValue::st_NoCanRep)); } } void test_dt_NMTOKENS() { const XSValue::DataType dt = XSValue::dt_NMTOKENS; bool toValidate = true; const char v_1[]="name1 name2 name3 "; const char v_2[]="Zeerochert total number"; const char v_3[]="007 009 123"; const char iv_1[]="#board"; const char iv_2[]="@com"; const char iv_3[]=";abc"; XSValue::XSValue_Data act_v_ran_v_1; act_v_ran_v_1.fValue.f_strVal = 0; XSValue::XSValue_Data act_v_ran_v_2; act_v_ran_v_2.fValue.f_strVal = 0; XSValue::XSValue_Data act_v_ran_v_3; act_v_ran_v_3.fValue.f_strVal = 0; /*** * * validate * --------- * availability return value context * ---------------------------------------------- * valid true n/a * invalid n/a false st_FOCA0002 * ***/ // valid VALIDATE_TEST(v_1, dt, EXP_RET_VALID_TRUE, DONT_CARE); VALIDATE_TEST(v_2, dt, EXP_RET_VALID_TRUE, DONT_CARE); VALIDATE_TEST(v_3, dt, EXP_RET_VALID_TRUE, DONT_CARE); // invalid VALIDATE_TEST(iv_1, dt, EXP_RET_VALID_FALSE, DONT_CARE); VALIDATE_TEST(iv_2, dt, EXP_RET_VALID_FALSE, DONT_CARE); VALIDATE_TEST(iv_3, dt, EXP_RET_VALID_FALSE, DONT_CARE); /*** * * getActualValue * --------------- * availability return value context * ---------------------------------------------- * validation on * ============= * valid 0 st_NoActVal * invalid 0 st_FOCA0002 * * validation off * ============== * valid 0 st_NoActVal * invalid 0 st_NoActVal * ***/ for (int i = 0; i < 2; i++) { //validation on/off toValidate = ( 0 == i) ? true : false; // valid ACTVALUE_TEST(v_1, dt, toValidate, EXP_RET_VALUE_FALSE, XSValue::st_NoActVal, act_v_ran_v_1); ACTVALUE_TEST(v_2, dt, toValidate, EXP_RET_VALUE_FALSE, XSValue::st_NoActVal, act_v_ran_v_2); ACTVALUE_TEST(v_3, dt, toValidate, EXP_RET_VALUE_FALSE, XSValue::st_NoActVal, act_v_ran_v_3); // invalid ACTVALUE_TEST(iv_1, dt, toValidate, EXP_RET_VALUE_FALSE, (toValidate ? XSValue::st_FOCA0002 : XSValue::st_NoActVal), act_v_ran_v_1); ACTVALUE_TEST(iv_2, dt, toValidate, EXP_RET_VALUE_FALSE, (toValidate ? XSValue::st_FOCA0002 : XSValue::st_NoActVal), act_v_ran_v_1); ACTVALUE_TEST(iv_3, dt, toValidate, EXP_RET_VALUE_FALSE, (toValidate ? XSValue::st_FOCA0002 : XSValue::st_NoActVal), act_v_ran_v_1); } /*** * * getCanonicalRepresentation * --------------------------- * availability return value context * ---------------------------------------------- * * validation on * ============= * valid 0 st_NoCanRep * invalid 0 st_FOCA0002 * * validation off * ============== * valid 0 st_NoCanRep * invalid 0 st_NoCanRep * ***/ for (int j = 0; j < 2; j++) { //validation on/off toValidate = ( 0 == j) ? true : false; // valid CANREP_TEST(v_1, dt, toValidate, EXP_RET_CANREP_FALSE, 0, XSValue::st_NoCanRep); CANREP_TEST(v_2, dt, toValidate, EXP_RET_CANREP_FALSE, 0, XSValue::st_NoCanRep); CANREP_TEST(v_3, dt, toValidate, EXP_RET_CANREP_FALSE, 0, XSValue::st_NoCanRep); // invalid CANREP_TEST(iv_1, dt, toValidate, EXP_RET_CANREP_FALSE, 0, (toValidate ? XSValue::st_FOCA0002 : XSValue::st_NoCanRep)); CANREP_TEST(iv_2, dt, toValidate, EXP_RET_CANREP_FALSE, 0, (toValidate ? XSValue::st_FOCA0002 : XSValue::st_NoCanRep)); CANREP_TEST(iv_3, dt, toValidate, EXP_RET_CANREP_FALSE, 0, (toValidate ? XSValue::st_FOCA0002 : XSValue::st_NoCanRep)); } } void test_dt_Name() { const XSValue::DataType dt = XSValue::dt_Name; bool toValidate = true; const char v_1[]="Four:-_."; const char v_2[]="_Zeerochert"; const char v_3[]=":007"; const char iv_1[]="9name"; const char iv_2[]="-name"; const char iv_3[]=".name"; XSValue::XSValue_Data act_v_ran_v_1; act_v_ran_v_1.fValue.f_strVal = 0; XSValue::XSValue_Data act_v_ran_v_2; act_v_ran_v_2.fValue.f_strVal = 0; XSValue::XSValue_Data act_v_ran_v_3; act_v_ran_v_3.fValue.f_strVal = 0; /*** * * validate * --------- * availability return value context * ---------------------------------------------- * valid true n/a * invalid n/a false st_FOCA0002 * ***/ // valid VALIDATE_TEST(v_1, dt, EXP_RET_VALID_TRUE, DONT_CARE); VALIDATE_TEST(v_2, dt, EXP_RET_VALID_TRUE, DONT_CARE); VALIDATE_TEST(v_3, dt, EXP_RET_VALID_TRUE, DONT_CARE); // invalid VALIDATE_TEST(iv_1, dt, EXP_RET_VALID_FALSE, DONT_CARE); VALIDATE_TEST(iv_2, dt, EXP_RET_VALID_FALSE, DONT_CARE); VALIDATE_TEST(iv_3, dt, EXP_RET_VALID_FALSE, DONT_CARE); /*** * * getActualValue * --------------- * availability return value context * ---------------------------------------------- * validation on * ============= * valid 0 st_NoActVal * invalid 0 st_FOCA0002 * * validation off * ============== * valid 0 st_NoActVal * invalid 0 st_NoActVal * ***/ for (int i = 0; i < 2; i++) { //validation on/off toValidate = ( 0 == i) ? true : false; // valid ACTVALUE_TEST(v_1, dt, toValidate, EXP_RET_VALUE_FALSE, XSValue::st_NoActVal, act_v_ran_v_1); ACTVALUE_TEST(v_2, dt, toValidate, EXP_RET_VALUE_FALSE, XSValue::st_NoActVal, act_v_ran_v_2); ACTVALUE_TEST(v_3, dt, toValidate, EXP_RET_VALUE_FALSE, XSValue::st_NoActVal, act_v_ran_v_1); // invalid ACTVALUE_TEST(iv_1, dt, toValidate, EXP_RET_VALUE_FALSE, (toValidate ? XSValue::st_FOCA0002 : XSValue::st_NoActVal), act_v_ran_v_1); ACTVALUE_TEST(iv_2, dt, toValidate, EXP_RET_VALUE_FALSE, (toValidate ? XSValue::st_FOCA0002 : XSValue::st_NoActVal), act_v_ran_v_2); ACTVALUE_TEST(iv_3, dt, toValidate, EXP_RET_VALUE_FALSE, (toValidate ? XSValue::st_FOCA0002 : XSValue::st_NoActVal), act_v_ran_v_3); } /*** * * getCanonicalRepresentation * --------------------------- * availability return value context * ---------------------------------------------- * * validation on * ============= * valid 0 st_NoCanRep * invalid 0 st_FOCA0002 * * validation off * ============== * valid 0 st_NoCanRep * invalid 0 st_NoCanRep * ***/ for (int j = 0; j < 2; j++) { //validation on/off toValidate = ( 0 == j) ? true : false; // valid CANREP_TEST(v_1, dt, toValidate, EXP_RET_CANREP_FALSE, 0, XSValue::st_NoCanRep); CANREP_TEST(v_2, dt, toValidate, EXP_RET_CANREP_FALSE, 0, XSValue::st_NoCanRep); CANREP_TEST(v_3, dt, toValidate, EXP_RET_CANREP_FALSE, 0, XSValue::st_NoCanRep); // invalid CANREP_TEST(iv_1, dt, toValidate, EXP_RET_CANREP_FALSE, 0, (toValidate ? XSValue::st_FOCA0002 : XSValue::st_NoCanRep)); CANREP_TEST(iv_2, dt, toValidate, EXP_RET_CANREP_FALSE, 0, (toValidate ? XSValue::st_FOCA0002 : XSValue::st_NoCanRep)); CANREP_TEST(iv_3, dt, toValidate, EXP_RET_CANREP_FALSE, 0, (toValidate ? XSValue::st_FOCA0002 : XSValue::st_NoCanRep)); } } void test_dt_NCName_ID_IDREF_ENTITY(XSValue::DataType dt) { bool toValidate = true; const char v_1[]="Four-_."; const char v_2[]="_Zeerochert"; const char v_3[]="L007"; const char iv_1[]=":Four-_."; const char iv_2[]="_Zeerochert:"; const char iv_3[]="0:07"; XSValue::XSValue_Data act_v_ran_v_1; act_v_ran_v_1.fValue.f_strVal = 0; XSValue::XSValue_Data act_v_ran_v_2; act_v_ran_v_2.fValue.f_strVal = 0; XSValue::XSValue_Data act_v_ran_v_3; act_v_ran_v_3.fValue.f_strVal = 0; /*** * * validate * --------- * availability return value context * ---------------------------------------------- * valid true n/a * invalid n/a false st_FOCA0002 * ***/ // valid VALIDATE_TEST(v_1, dt, EXP_RET_VALID_TRUE, DONT_CARE); VALIDATE_TEST(v_2, dt, EXP_RET_VALID_TRUE, DONT_CARE); VALIDATE_TEST(v_3, dt, EXP_RET_VALID_TRUE, DONT_CARE); // invalid VALIDATE_TEST(iv_1, dt, EXP_RET_VALID_FALSE, DONT_CARE); VALIDATE_TEST(iv_2, dt, EXP_RET_VALID_FALSE, DONT_CARE); VALIDATE_TEST(iv_3, dt, EXP_RET_VALID_FALSE, DONT_CARE); /*** * * getActualValue * --------------- * availability return value context * ---------------------------------------------- * validation on * ============= * valid 0 st_NoActVal * invalid 0 st_FOCA0002 * * validation off * ============== * valid 0 st_NoActVal * invalid 0 st_NoActVal * ***/ for (int i = 0; i < 2; i++) { //validation on/off toValidate = ( 0 == i) ? true : false; // valid ACTVALUE_TEST(v_1, dt, toValidate, EXP_RET_VALUE_FALSE, XSValue::st_NoActVal, act_v_ran_v_1); ACTVALUE_TEST(v_2, dt, toValidate, EXP_RET_VALUE_FALSE, XSValue::st_NoActVal, act_v_ran_v_2); ACTVALUE_TEST(v_3, dt, toValidate, EXP_RET_VALUE_FALSE, XSValue::st_NoActVal, act_v_ran_v_3); // invalid ACTVALUE_TEST(iv_1, dt, toValidate, EXP_RET_VALUE_FALSE, (toValidate ? XSValue::st_FOCA0002 : XSValue::st_NoActVal), act_v_ran_v_1); ACTVALUE_TEST(iv_2, dt, toValidate, EXP_RET_VALUE_FALSE, (toValidate ? XSValue::st_FOCA0002 : XSValue::st_NoActVal), act_v_ran_v_1); ACTVALUE_TEST(iv_3, dt, toValidate, EXP_RET_VALUE_FALSE, (toValidate ? XSValue::st_FOCA0002 : XSValue::st_NoActVal), act_v_ran_v_1); } /*** * * getCanonicalRepresentation * --------------------------- * availability return value context * ---------------------------------------------- * * validation on * ============= * valid 0 st_NoCanRep * invalid 0 st_FOCA0002 * * validation off * ============== * valid 0 st_NoCanRep * invalid 0 st_NoCanRep * ***/ for (int j = 0; j < 2; j++) { //validation on/off toValidate = ( 0 == j) ? true : false; // valid CANREP_TEST(v_1, dt, toValidate, EXP_RET_CANREP_FALSE, 0, XSValue::st_NoCanRep); CANREP_TEST(v_2, dt, toValidate, EXP_RET_CANREP_FALSE, 0, XSValue::st_NoCanRep); CANREP_TEST(v_3, dt, toValidate, EXP_RET_CANREP_FALSE, 0, XSValue::st_NoCanRep); // invalid CANREP_TEST(iv_1, dt, toValidate, EXP_RET_CANREP_FALSE, 0, (toValidate ? XSValue::st_FOCA0002 : XSValue::st_NoCanRep)); CANREP_TEST(iv_2, dt, toValidate, EXP_RET_CANREP_FALSE, 0, (toValidate ? XSValue::st_FOCA0002 : XSValue::st_NoCanRep)); CANREP_TEST(iv_3, dt, toValidate, EXP_RET_CANREP_FALSE, 0, (toValidate ? XSValue::st_FOCA0002 : XSValue::st_NoCanRep)); } } void test_dt_IDREFS_ENTITIES(XSValue::DataType dt) { bool toValidate = true; const char v_1[]="Four-_. Five Seven"; const char v_2[]="_Zeerochert _Hundere Bye"; const char v_3[]="L007 L009 L008"; const char iv_1[]=":Four-_."; const char iv_2[]="_Zeerochert:"; const char iv_3[]="0:07"; XSValue::XSValue_Data act_v_ran_v_1; act_v_ran_v_1.fValue.f_strVal = 0; XSValue::XSValue_Data act_v_ran_v_2; act_v_ran_v_2.fValue.f_strVal = 0; XSValue::XSValue_Data act_v_ran_v_3; act_v_ran_v_3.fValue.f_strVal = 0; /*** * * validate * --------- * availability return value context * ---------------------------------------------- * valid true n/a * invalid n/a false st_FOCA0002 * ***/ // valid VALIDATE_TEST(v_1, dt, EXP_RET_VALID_TRUE, DONT_CARE); VALIDATE_TEST(v_2, dt, EXP_RET_VALID_TRUE, DONT_CARE); VALIDATE_TEST(v_3, dt, EXP_RET_VALID_TRUE, DONT_CARE); // invalid VALIDATE_TEST(iv_1, dt, EXP_RET_VALID_FALSE, DONT_CARE); VALIDATE_TEST(iv_2, dt, EXP_RET_VALID_FALSE, DONT_CARE); VALIDATE_TEST(iv_3, dt, EXP_RET_VALID_FALSE, DONT_CARE); /*** * * getActualValue * --------------- * availability return value context * ---------------------------------------------- * validation on * ============= * valid 0 st_NoActVal * invalid 0 st_FOCA0002 * * validation off * ============== * valid 0 st_NoActVal * invalid 0 st_NoActVal * ***/ for (int i = 0; i < 2; i++) { //validation on/off toValidate = ( 0 == i) ? true : false; // valid ACTVALUE_TEST(v_1, dt, toValidate, EXP_RET_VALUE_FALSE, XSValue::st_NoActVal, act_v_ran_v_1); ACTVALUE_TEST(v_2, dt, toValidate, EXP_RET_VALUE_FALSE, XSValue::st_NoActVal, act_v_ran_v_2); ACTVALUE_TEST(v_3, dt, toValidate, EXP_RET_VALUE_FALSE, XSValue::st_NoActVal, act_v_ran_v_3); // invalid ACTVALUE_TEST(iv_1, dt, toValidate, EXP_RET_VALUE_FALSE, (toValidate ? XSValue::st_FOCA0002 : XSValue::st_NoActVal), act_v_ran_v_1); ACTVALUE_TEST(iv_2, dt, toValidate, EXP_RET_VALUE_FALSE, (toValidate ? XSValue::st_FOCA0002 : XSValue::st_NoActVal), act_v_ran_v_1); ACTVALUE_TEST(iv_3, dt, toValidate, EXP_RET_VALUE_FALSE, (toValidate ? XSValue::st_FOCA0002 : XSValue::st_NoActVal), act_v_ran_v_1); } /*** * * getCanonicalRepresentation * --------------------------- * availability return value context * ---------------------------------------------- * * validation on * ============= * valid 0 st_NoCanRep * invalid 0 st_FOCA0002 * * validation off * ============== * valid 0 st_NoCanRep * invalid 0 st_NoCanRep * ***/ for (int j = 0; j < 2; j++) { //validation on/off toValidate = ( 0 == j) ? true : false; // valid CANREP_TEST(v_1, dt, toValidate, EXP_RET_CANREP_FALSE, 0, XSValue::st_NoCanRep); CANREP_TEST(v_2, dt, toValidate, EXP_RET_CANREP_FALSE, 0, XSValue::st_NoCanRep); CANREP_TEST(v_3, dt, toValidate, EXP_RET_CANREP_FALSE, 0, XSValue::st_NoCanRep); // invalid CANREP_TEST(iv_1, dt, toValidate, EXP_RET_CANREP_FALSE, 0, (toValidate ? XSValue::st_FOCA0002 : XSValue::st_NoCanRep)); CANREP_TEST(iv_2, dt, toValidate, EXP_RET_CANREP_FALSE, 0, (toValidate ? XSValue::st_FOCA0002 : XSValue::st_NoCanRep)); CANREP_TEST(iv_3, dt, toValidate, EXP_RET_CANREP_FALSE, 0, (toValidate ? XSValue::st_FOCA0002 : XSValue::st_NoCanRep)); } } void test_DataType() { DATATYPE_TEST( SchemaSymbols::fgDT_STRING, XSValue::dt_string); DATATYPE_TEST( SchemaSymbols::fgDT_BOOLEAN, XSValue::dt_boolean); DATATYPE_TEST( SchemaSymbols::fgDT_DECIMAL, XSValue::dt_decimal); DATATYPE_TEST( SchemaSymbols::fgDT_FLOAT, XSValue::dt_float); DATATYPE_TEST( SchemaSymbols::fgDT_DOUBLE, XSValue::dt_double); DATATYPE_TEST( SchemaSymbols::fgDT_DURATION, XSValue::dt_duration); DATATYPE_TEST( SchemaSymbols::fgDT_DATETIME, XSValue::dt_dateTime); DATATYPE_TEST( SchemaSymbols::fgDT_TIME, XSValue::dt_time); DATATYPE_TEST( SchemaSymbols::fgDT_DATE, XSValue::dt_date); DATATYPE_TEST( SchemaSymbols::fgDT_YEARMONTH, XSValue::dt_gYearMonth); DATATYPE_TEST( SchemaSymbols::fgDT_YEAR, XSValue::dt_gYear); DATATYPE_TEST( SchemaSymbols::fgDT_MONTHDAY, XSValue::dt_gMonthDay); DATATYPE_TEST( SchemaSymbols::fgDT_DAY, XSValue::dt_gDay); DATATYPE_TEST( SchemaSymbols::fgDT_MONTH, XSValue::dt_gMonth); DATATYPE_TEST( SchemaSymbols::fgDT_HEXBINARY, XSValue::dt_hexBinary); DATATYPE_TEST( SchemaSymbols::fgDT_BASE64BINARY, XSValue::dt_base64Binary); DATATYPE_TEST( SchemaSymbols::fgDT_ANYURI, XSValue::dt_anyURI); DATATYPE_TEST( SchemaSymbols::fgDT_QNAME, XSValue::dt_QName); DATATYPE_TEST( XMLUni::fgNotationString, XSValue::dt_NOTATION); DATATYPE_TEST( SchemaSymbols::fgDT_NORMALIZEDSTRING, XSValue::dt_normalizedString); DATATYPE_TEST( SchemaSymbols::fgDT_TOKEN, XSValue::dt_token); DATATYPE_TEST( SchemaSymbols::fgDT_LANGUAGE, XSValue::dt_language); DATATYPE_TEST( XMLUni::fgNmTokenString, XSValue::dt_NMTOKEN); DATATYPE_TEST( XMLUni::fgNmTokensString, XSValue::dt_NMTOKENS); DATATYPE_TEST( SchemaSymbols::fgDT_NAME, XSValue::dt_Name); DATATYPE_TEST( SchemaSymbols::fgDT_NCNAME, XSValue::dt_NCName); DATATYPE_TEST( XMLUni::fgIDString, XSValue::dt_ID); DATATYPE_TEST( XMLUni::fgIDRefString, XSValue::dt_IDREF); DATATYPE_TEST( XMLUni::fgIDRefsString, XSValue::dt_IDREFS); DATATYPE_TEST( XMLUni::fgEntityString, XSValue::dt_ENTITY); DATATYPE_TEST( XMLUni::fgEntitiesString, XSValue::dt_ENTITIES); DATATYPE_TEST( SchemaSymbols::fgDT_INTEGER, XSValue::dt_integer); DATATYPE_TEST( SchemaSymbols::fgDT_NONPOSITIVEINTEGER, XSValue::dt_nonPositiveInteger); DATATYPE_TEST( SchemaSymbols::fgDT_NEGATIVEINTEGER, XSValue::dt_negativeInteger); DATATYPE_TEST( SchemaSymbols::fgDT_LONG, XSValue::dt_long); DATATYPE_TEST( SchemaSymbols::fgDT_INT, XSValue::dt_int); DATATYPE_TEST( SchemaSymbols::fgDT_SHORT, XSValue::dt_short); DATATYPE_TEST( SchemaSymbols::fgDT_BYTE, XSValue::dt_byte); DATATYPE_TEST( SchemaSymbols::fgDT_NONNEGATIVEINTEGER, XSValue::dt_nonNegativeInteger); DATATYPE_TEST( SchemaSymbols::fgDT_ULONG, XSValue::dt_unsignedLong); DATATYPE_TEST( SchemaSymbols::fgDT_UINT, XSValue::dt_unsignedInt); DATATYPE_TEST( SchemaSymbols::fgDT_USHORT, XSValue::dt_unsignedShort); DATATYPE_TEST( SchemaSymbols::fgDT_UBYTE, XSValue::dt_unsignedByte); DATATYPE_TEST( SchemaSymbols::fgDT_POSITIVEINTEGER, XSValue::dt_positiveInteger); DATATYPE_TEST( XMLUni::fgLongMaxInc, XSValue::dt_MAXCOUNT); } void testErrorStatus() { /*** DataType Interface Inv Char Out-Of-Bound To Big for C Type dt_decimal canRep st_FOCA0002 n.a. n.a. actVal st_FOCA0002 n.a. st_FOCA0001 ***/ { const char d1[]="12b34.456"; const char d2[]="44444444444466666666666666666666666666666666666666666666666666666555555555555555555555555555555555555555555555555444294967296444444444444444444444444444445555555555555555555555555555555555555555555555555555555555555555555555555222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222.999"; testNoCanRep(d1, XSValue::dt_decimal, XSValue::st_FOCA0002); testNoActVal(d1, XSValue::dt_decimal, XSValue::st_FOCA0002); testNoActVal(d2, XSValue::dt_decimal, XSValue::st_FOCA0001); } /*** dt_float canRep st_FOCA0002 st_FOCA0002 n.a. actVal st_FOCA0002 st_FOCA0002 n.a. ***/ { const char d1[]="+3.402823466e+39"; const char d2[]="-3.4028234x66"; const char d3[]="+1.175494351e-39"; testNoCanRep(d1, XSValue::dt_float, XSValue::st_FOCA0002); testNoCanRep(d2, XSValue::dt_float, XSValue::st_FOCA0002); testNoCanRep(d3, XSValue::dt_float, XSValue::st_FOCA0002); testNoActVal(d1, XSValue::dt_float, XSValue::st_FOCA0002); testNoActVal(d2, XSValue::dt_float, XSValue::st_FOCA0002); testNoActVal(d3, XSValue::dt_float, XSValue::st_FOCA0002); } /*** dt_double canRep st_FOCA0002 st_FOCA0002 n.a. actVal st_FOCA0002 st_FOCA0002 n.a. ***/ { const char d1[]="+3.402823466e+308"; const char d2[]="-3.4028234x66"; const char d3[]="+1.175494351e-329"; testNoCanRep(d1, XSValue::dt_double, XSValue::st_FOCA0002); testNoCanRep(d2, XSValue::dt_double, XSValue::st_FOCA0002); testNoCanRep(d3, XSValue::dt_double, XSValue::st_FOCA0002); testNoActVal(d1, XSValue::dt_double, XSValue::st_FOCA0002); testNoActVal(d2, XSValue::dt_double, XSValue::st_FOCA0002); testNoActVal(d3, XSValue::dt_double, XSValue::st_FOCA0002); } /*** dt_integer canRep st_FOCA0002 n.a. n.a. actVal st_FOCA0002 n.a. st_FOCA0003 ***/ { const char d1[]="+2147483648"; const char d2[]="-2147483649"; const char d3[]="123x456"; const char d4[]="123.456"; testNoCanRep(d3, XSValue::dt_integer, XSValue::st_FOCA0002); testNoCanRep(d4, XSValue::dt_integer, XSValue::st_FOCA0002); testNoActVal(d1, XSValue::dt_integer, XSValue::st_FOCA0003); testNoActVal(d2, XSValue::dt_integer, XSValue::st_FOCA0003); testNoActVal(d3, XSValue::dt_integer, XSValue::st_FOCA0002); testNoActVal(d4, XSValue::dt_integer, XSValue::st_FOCA0002); } /*** dt_negativeInteger canRep st_FOCA0002 st_FOCA0002 n.a. actVal st_FOCA0002 st_FOCA0002 st_FOCA0003 ***/ { const char d1[]="0"; const char d2[]="-2147483649"; const char d3[]="123x456"; const char d4[]="123.456"; testNoCanRep(d1, XSValue::dt_negativeInteger, XSValue::st_FOCA0002); testNoCanRep(d3, XSValue::dt_negativeInteger, XSValue::st_FOCA0002); testNoCanRep(d4, XSValue::dt_negativeInteger, XSValue::st_FOCA0002); testNoActVal(d1, XSValue::dt_negativeInteger, XSValue::st_FOCA0002); testNoActVal(d2, XSValue::dt_negativeInteger, XSValue::st_FOCA0003); testNoActVal(d3, XSValue::dt_negativeInteger, XSValue::st_FOCA0002); testNoActVal(d4, XSValue::dt_negativeInteger, XSValue::st_FOCA0002); } /*** dt_nonPositiveInteger canRep st_FOCA0002 st_FOCA0002 n.a. actVal st_FOCA0002 st_FOCA0002 st_FOCA0003 ***/ { const char d1[]="1"; const char d2[]="-2147483649"; const char d3[]="123x456"; const char d4[]="123.456"; testNoCanRep(d1, XSValue::dt_nonPositiveInteger, XSValue::st_FOCA0002); testNoCanRep(d3, XSValue::dt_nonPositiveInteger, XSValue::st_FOCA0002); testNoCanRep(d4, XSValue::dt_nonPositiveInteger, XSValue::st_FOCA0002); testNoActVal(d1, XSValue::dt_nonPositiveInteger, XSValue::st_FOCA0002); testNoActVal(d2, XSValue::dt_nonPositiveInteger, XSValue::st_FOCA0003); testNoActVal(d3, XSValue::dt_nonPositiveInteger, XSValue::st_FOCA0002); testNoActVal(d4, XSValue::dt_nonPositiveInteger, XSValue::st_FOCA0002); } /*** dt_nonNegativeInteger canRep st_FOCA0002 st_FOCA0002 n.a. actVal st_FOCA0002 st_FOCA0002 st_FOCA0003 ***/ { const char d1[]="-1"; const char d2[]="+2147483649"; const char d3[]="123x456"; const char d4[]="123.456"; testNoCanRep(d1, XSValue::dt_nonNegativeInteger, XSValue::st_FOCA0002); testNoCanRep(d3, XSValue::dt_nonNegativeInteger, XSValue::st_FOCA0002); testNoCanRep(d4, XSValue::dt_nonNegativeInteger, XSValue::st_FOCA0002); testNoActVal(d1, XSValue::dt_nonNegativeInteger, XSValue::st_FOCA0002); testNoActVal(d2, XSValue::dt_nonNegativeInteger, XSValue::st_FOCA0003); testNoActVal(d3, XSValue::dt_nonNegativeInteger, XSValue::st_FOCA0002); testNoActVal(d4, XSValue::dt_nonNegativeInteger, XSValue::st_FOCA0002); } /*** dt_positiveInteger canRep st_FOCA0002 st_FOCA0002 n.a. actVal st_FOCA0002 st_FOCA0002 st_FOCA0003 ***/ { const char d1[]="0"; const char d2[]="+2147483649"; const char d3[]="123x456"; const char d4[]="123.456"; testNoCanRep(d1, XSValue::dt_positiveInteger, XSValue::st_FOCA0002); testNoCanRep(d3, XSValue::dt_positiveInteger, XSValue::st_FOCA0002); testNoCanRep(d4, XSValue::dt_positiveInteger, XSValue::st_FOCA0002); testNoActVal(d1, XSValue::dt_positiveInteger, XSValue::st_FOCA0002); testNoActVal(d2, XSValue::dt_positiveInteger, XSValue::st_FOCA0003); testNoActVal(d3, XSValue::dt_positiveInteger, XSValue::st_FOCA0002); testNoActVal(d4, XSValue::dt_positiveInteger, XSValue::st_FOCA0002); } /*** dt_long canRep st_FOCA0002 st_FOCA0002 n.a. actVal st_FOCA0002 st_FOCA0002 st_FOCA0003. ***/ { const char d1[]="-9223372036854775809"; const char d2[]="+9223372036854775808"; const char d3[]="123x456"; const char d4[]="123.456"; const char d5[]="-92233720368547758"; const char d6[]="+92233720368547758"; testNoCanRep(d1, XSValue::dt_long, XSValue::st_FOCA0002); testNoCanRep(d2, XSValue::dt_long, XSValue::st_FOCA0002); testNoCanRep(d3, XSValue::dt_long, XSValue::st_FOCA0002); testNoCanRep(d4, XSValue::dt_long, XSValue::st_FOCA0002); testNoActVal(d5, XSValue::dt_long, XSValue::st_FOCA0003); testNoActVal(d6, XSValue::dt_long, XSValue::st_FOCA0003); testNoActVal(d3, XSValue::dt_long, XSValue::st_FOCA0002); testNoActVal(d4, XSValue::dt_long, XSValue::st_FOCA0002); } /*** dt_int canRep st_FOCA0002 st_FOCA0002 n.a. actVal st_FOCA0002 st_FOCA0002 n.a. ***/ { const char d1[]="-2147483649"; const char d2[]="+2147483648"; const char d3[]="123x456"; const char d4[]="123.456"; testNoCanRep(d1, XSValue::dt_int, XSValue::st_FOCA0002); testNoCanRep(d2, XSValue::dt_int, XSValue::st_FOCA0002); testNoCanRep(d3, XSValue::dt_int, XSValue::st_FOCA0002); testNoCanRep(d4, XSValue::dt_int, XSValue::st_FOCA0002); testNoActVal(d1, XSValue::dt_int, XSValue::st_FOCA0002); testNoActVal(d2, XSValue::dt_int, XSValue::st_FOCA0002); testNoActVal(d3, XSValue::dt_int, XSValue::st_FOCA0002); testNoActVal(d4, XSValue::dt_int, XSValue::st_FOCA0002); } /*** dt_short canRep st_FOCA0002 st_FOCA0002 n.a. actVal st_FOCA0002 st_FOCA0002 n.a. ***/ { const char d1[]="-32769"; const char d2[]="+32768"; const char d3[]="123x456"; const char d4[]="123.456"; testNoCanRep(d1, XSValue::dt_short, XSValue::st_FOCA0002); testNoCanRep(d2, XSValue::dt_short, XSValue::st_FOCA0002); testNoCanRep(d3, XSValue::dt_short, XSValue::st_FOCA0002); testNoCanRep(d4, XSValue::dt_short, XSValue::st_FOCA0002); testNoActVal(d1, XSValue::dt_short, XSValue::st_FOCA0002); testNoActVal(d2, XSValue::dt_short, XSValue::st_FOCA0002); testNoActVal(d3, XSValue::dt_short, XSValue::st_FOCA0002); testNoActVal(d4, XSValue::dt_short, XSValue::st_FOCA0002); } /*** dt_byte canRep st_FOCA0002 st_FOCA0002 n.a. actVal st_FOCA0002 st_FOCA0002 n.a. ***/ { const char d1[]="-129"; const char d2[]="+128"; const char d3[]="123x456"; const char d4[]="123.456"; testNoCanRep(d1, XSValue::dt_byte, XSValue::st_FOCA0002); testNoCanRep(d2, XSValue::dt_byte, XSValue::st_FOCA0002); testNoCanRep(d3, XSValue::dt_byte, XSValue::st_FOCA0002); testNoCanRep(d4, XSValue::dt_byte, XSValue::st_FOCA0002); testNoActVal(d1, XSValue::dt_byte, XSValue::st_FOCA0002); testNoActVal(d2, XSValue::dt_byte, XSValue::st_FOCA0002); testNoActVal(d3, XSValue::dt_byte, XSValue::st_FOCA0002); testNoActVal(d4, XSValue::dt_byte, XSValue::st_FOCA0002); } /*** dt_unsignedLong canRep st_FOCA0002 st_FOCA0002 n.a. actVal st_FOCA0002 st_FOCA0002 n.a. ***/ { const char d1[]="-1"; const char d2[]="+18446744073709551616"; const char d3[]="123x456"; const char d4[]="123.456"; const char d5[]="-3"; const char d6[]="+92233720368547758"; testNoCanRep(d1, XSValue::dt_unsignedLong, XSValue::st_FOCA0002); testNoCanRep(d2, XSValue::dt_unsignedLong, XSValue::st_FOCA0002); testNoCanRep(d3, XSValue::dt_unsignedLong, XSValue::st_FOCA0002); testNoCanRep(d4, XSValue::dt_unsignedLong, XSValue::st_FOCA0002); testNoActVal(d5, XSValue::dt_unsignedLong, XSValue::st_FOCA0002); testNoActVal(d6, XSValue::dt_unsignedLong, XSValue::st_FOCA0003); testNoActVal(d3, XSValue::dt_unsignedLong, XSValue::st_FOCA0002); testNoActVal(d4, XSValue::dt_unsignedLong, XSValue::st_FOCA0002); } /*** dt_unsignedInt canRep st_FOCA0002 st_FOCA0002 n.a. actVal st_FOCA0002 st_FOCA0002 n.a. ***/ { const char d1[]="-1"; const char d2[]="+4294967296"; const char d3[]="123x456"; const char d4[]="123.456"; testNoCanRep(d1, XSValue::dt_unsignedInt, XSValue::st_FOCA0002); testNoCanRep(d2, XSValue::dt_unsignedInt, XSValue::st_FOCA0002); testNoCanRep(d3, XSValue::dt_unsignedInt, XSValue::st_FOCA0002); testNoCanRep(d4, XSValue::dt_unsignedInt, XSValue::st_FOCA0002); testNoActVal(d1, XSValue::dt_unsignedInt, XSValue::st_FOCA0002); testNoActVal(d2, XSValue::dt_unsignedInt, XSValue::st_FOCA0002); testNoActVal(d3, XSValue::dt_unsignedInt, XSValue::st_FOCA0002); testNoActVal(d4, XSValue::dt_unsignedInt, XSValue::st_FOCA0002); } /*** dt_unsignedShort canRep st_FOCA0002 st_FOCA0002 n.a. actVal st_FOCA0002 st_FOCA0002 n.a. ***/ { const char d1[]="-1"; const char d2[]="+65536"; const char d3[]="123x456"; const char d4[]="123.456"; testNoCanRep(d1, XSValue::dt_unsignedShort, XSValue::st_FOCA0002); testNoCanRep(d2, XSValue::dt_unsignedShort, XSValue::st_FOCA0002); testNoCanRep(d3, XSValue::dt_unsignedShort, XSValue::st_FOCA0002); testNoCanRep(d4, XSValue::dt_unsignedShort, XSValue::st_FOCA0002); testNoActVal(d1, XSValue::dt_unsignedShort, XSValue::st_FOCA0002); testNoActVal(d2, XSValue::dt_unsignedShort, XSValue::st_FOCA0002); testNoActVal(d3, XSValue::dt_unsignedShort, XSValue::st_FOCA0002); testNoActVal(d4, XSValue::dt_unsignedShort, XSValue::st_FOCA0002); } /*** dt_unsignedByte canRep st_FOCA0002 st_FOCA0002 n.a. actVal st_FOCA0002 st_FOCA0002 n.a. ***/ { const char d1[]="-1"; const char d2[]="+256"; const char d3[]="123x456"; const char d4[]="123.456"; testNoCanRep(d1, XSValue::dt_unsignedByte, XSValue::st_FOCA0002); testNoCanRep(d2, XSValue::dt_unsignedByte, XSValue::st_FOCA0002); testNoCanRep(d3, XSValue::dt_unsignedByte, XSValue::st_FOCA0002); testNoCanRep(d4, XSValue::dt_unsignedByte, XSValue::st_FOCA0002); testNoActVal(d1, XSValue::dt_unsignedByte, XSValue::st_FOCA0002); testNoActVal(d2, XSValue::dt_unsignedByte, XSValue::st_FOCA0002); testNoActVal(d3, XSValue::dt_unsignedByte, XSValue::st_FOCA0002); testNoActVal(d4, XSValue::dt_unsignedByte, XSValue::st_FOCA0002); } } // --------------------------------------------------------------------------- // Program entry point // --------------------------------------------------------------------------- int main(int, char* ) { // Initialize the XML4C system try { XMLPlatformUtils::Initialize(); } catch (const XMLException& toCatch) { StrX msg(toCatch.getMessage()); XERCES_STD_QUALIFIER cerr << "Error during initialization! Message:\n" << msg << XERCES_STD_QUALIFIER endl; return 1; } test_dt_string(); test_dt_boolean(); test_dt_decimal(); test_dt_float(); test_dt_double(); test_dt_duration(); test_dt_dateTime(); test_dt_time(); test_dt_date(); test_dt_gYearMonth(); test_dt_gYear(); test_dt_gMonthDay(); test_dt_gDay(); test_dt_gMonth(); test_dt_hexBinary(); test_dt_base64Binary(); test_dt_anyURI(); test_dt_QName(); test_dt_NOTATION(); test_dt_normalizedString(); test_dt_token(); test_dt_language(); test_dt_NMTOKEN(); test_dt_NMTOKENS(); test_dt_Name(); test_dt_NCName_ID_IDREF_ENTITY(XSValue::dt_NCName); test_dt_NCName_ID_IDREF_ENTITY(XSValue::dt_ID); test_dt_NCName_ID_IDREF_ENTITY(XSValue::dt_IDREF); test_dt_IDREFS_ENTITIES(XSValue::dt_IDREFS); test_dt_NCName_ID_IDREF_ENTITY(XSValue::dt_ENTITY); test_dt_IDREFS_ENTITIES(XSValue::dt_ENTITIES); test_dt_integer(); test_dt_nonPositiveInteger(); test_dt_negativeInteger(); test_dt_long(); test_dt_int(); test_dt_short(); test_dt_byte(); test_dt_nonNegativeInteger(); test_dt_unsignedLong(); test_dt_unsignedInt(); test_dt_unsignedShort(); test_dt_unsignedByte(); test_dt_positiveInteger(); test_DataType(); printf("\nXSValueTest %s\n", errSeen? "Fail" : "Pass"); // And call the termination method XMLPlatformUtils::Terminate(); return 0; }
xin3liang/platform_external_xerces-cpp
tests/XSValueTest/XSValueTest.cpp
C++
apache-2.0
286,961
# =============================================================================== # Copyright 2013 Jake Ross # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # =============================================================================== # ============= enthought library imports ======================= from chaco.data_label import DataLabel from chaco.plot_label import PlotLabel # ============= standard library imports ======================== from numpy import max from traits.api import Bool, Str # ============= local library imports ========================== from pychron.pipeline.plot.overlays.mean_indicator_overlay import MovableMixin try: class FlowPlotLabel(PlotLabel, MovableMixin): def overlay(self, component, gc, *args, **kw): if self.ox: self.x = self.ox - self.offset_x self.y = self.oy - self.offset_y super(FlowPlotLabel, self).overlay(component, gc, *args, **kw) def hittest(self, pt): x, y = pt w, h = self.get_preferred_size() return abs(x - self.x) < w and abs(y - self.y) < h except TypeError: # documentation auto doc hack class FlowPlotLabel: pass class FlowDataLabel(DataLabel): """ this label repositions itself if doesn't fit within the its component bounds. """ constrain_x = Bool(True) constrain_y = Bool(True) # position_event=Event id = Str # _ox=None # def _draw(self, gc, **kw): # self.font='modern 18' # gc.set_font(self.font) # print 'draw', self.font # super(FlowDataLabel, self)._draw(gc,**kw) # def _set_x(self, val): # super(FlowDataLabel, self)._set_x(val) # if self._ox is None: # self._ox = val # elif self._ox != val: # self.position_event=(self.x, self.y) # # def _set_y(self, val): # super(FlowDataLabel, self)._set_y(val) # if val>0: # self.position_event = (self.x, self.y) def overlay(self, component, gc, *args, **kw): # face name was getting set to "Helvetica" by reportlab during pdf generation # set face_name back to "" to prevent font display issue. see issue #72 self.font.face_name = "" super(FlowDataLabel, self).overlay(component, gc, *args, **kw) def do_layout(self, **kw): DataLabel.do_layout(self, **kw) ws, hs = self._cached_line_sizes.T if self.constrain_x: w = max(ws) d = self.component.x2 - (self.x + w + 3 * self.border_padding) if d < 0: self.x += d self.x = max((self.x, 0)) if self.constrain_y: h = max(hs) self.y = max((self.y, 0)) yd = self.component.y2 - h - 2 * self.border_padding - self.line_spacing self.y = min((self.y, yd)) # ============= EOF =============================================
USGSDenverPychron/pychron
pychron/pipeline/plot/flow_label.py
Python
apache-2.0
3,470
CREATE CONSTRAINT ON (c:Concept) ASSERT c.name IS UNIQUE; ##Creating all the nodes from CSV file USING PERIODIC COMMIT 50 LOAD CSV WITH HEADERS FROM "file:///food.csv" AS Line WITH Line WHERE Line.name IS NOT NULL MERGE (c:Concept {name:Line.name}) SET c.conceptid = Line.`node id` SET c.context = Line.context SET c.desc = Line.description SET c.parent = Line.`parent node id` #---End of creating nodes--- ## create a relationship between nodes dynamically USING PERIODIC COMMIT 50 LOAD CSV WITH HEADERS FROM "file:///food.csv" AS Line WITH Line WHERE Line.name IS NOT NULL MATCH (c:concept {name:Line.name}) MATCH (pc:concept {conceptid:Line.`parent node id`}) call apoc.create.relationship(c, Line.`parent relation`, {}, pc) YIELD rel return c, pc, rel ##Create a relationship if you know the relation between nodes USING PERIODIC COMMIT 50 LOAD CSV WITH HEADERS FROM "file:///food.csv" AS Line WITH Line, Line.`parent relation` as rl WHERE Line.name IS NOT NULL MATCH (c:Concept {name:Line.name}) MATCH (pc:Concept {conceptid:Line.`parent node id`}) FOREACH(ignoreme in CASE WHEN rl = "subconcept of" THEN [1] ELSE [] END | MERGE (c)-[:`subconcept of`]->(pc)) FOREACH(ignoreme in CASE WHEN rl = "related" THEN [1] ELSE [] END | MERGE (c)-[:`related`]->(pc)) ##Creating a Domain and create relation between domain and concepts Match (c:Concept {context: 'Food'}) merge (d:Domain {name:'Food'}) merge (c)-[r:ConceptOf]->(d) return c,r,d ##To return all the node from database MATCH (c:Concept) MATCH (pc:Concept) MATCH (d:Domain) MATCH (c)-[]-(pc) MATCH (c)-[]-(d)
stackroute/oxygen
notes/graphDB/importingFoodConceptGraph.md
Markdown
apache-2.0
1,576
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.synapse.deployers; import org.apache.axiom.om.OMElement; import org.apache.axis2.deployment.DeploymentException; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.synapse.Startup; import org.apache.synapse.config.xml.MultiXMLConfigurationBuilder; import org.apache.synapse.config.xml.StartupFinder; import java.io.File; import java.util.Properties; /** * Handles the <code>Startup Task</code> deployment and undeployment * * @see org.apache.synapse.deployers.AbstractSynapseArtifactDeployer */ public class TaskDeployer extends AbstractSynapseArtifactDeployer { private static Log log = LogFactory.getLog(TaskDeployer.class); @Override public String deploySynapseArtifact(OMElement artifactConfig, String fileName, Properties properties) { if (log.isDebugEnabled()) { log.debug("StartupTask Deployment from file : " + fileName + " : Started"); } try { Startup st = StartupFinder.getInstance().getStartup(artifactConfig, properties); st.setFileName((new File(fileName)).getName()); if (log.isDebugEnabled()) { log.debug("StartupTask named '" + st.getName() + "' has been built from the file " + fileName); } st.init(getSynapseEnvironment()); if (log.isDebugEnabled()) { log.debug("Initialized the StartupTask : " + st.getName()); } getSynapseConfiguration().addStartup(st); if (log.isDebugEnabled()) { log.debug("StartupTask Deployment from file : " + fileName + " : Completed"); } log.info("StartupTask named '" + st.getName() + "' has been deployed from file : " + fileName); return st.getName(); } catch (Exception e) { handleSynapseArtifactDeploymentError( "StartupTask Deployment from the file : " + fileName + " : Failed.", e); } return null; } @Override public String updateSynapseArtifact(OMElement artifactConfig, String fileName, String existingArtifactName, Properties properties) { if (log.isDebugEnabled()) { log.debug("StartupTask update from file : " + fileName + " has started"); } try { Startup st = StartupFinder.getInstance().getStartup(artifactConfig, properties); st.setFileName((new File(fileName)).getName()); if (log.isDebugEnabled()) { log.debug("StartupTask: " + st.getName() + " has been built from the file: " + fileName); } Startup existingSt = getSynapseConfiguration().getStartup(existingArtifactName); existingSt.destroy(); st.init(getSynapseEnvironment()); if (existingArtifactName.equals(st.getName())) { getSynapseConfiguration().updateStartup(st); } else { getSynapseConfiguration().addStartup(st); getSynapseConfiguration().removeStartup(existingArtifactName); log.info("StartupTask: " + existingArtifactName + " has been undeployed"); } log.info("StartupTask: " + st.getName() + " has been updated from the file: " + fileName); return st.getName(); } catch (DeploymentException e) { handleSynapseArtifactDeploymentError("Error while updating the startup task from the " + "file: " + fileName); } return null; } @Override public void undeploySynapseArtifact(String artifactName) { if (log.isDebugEnabled()) { log.debug("StartupTask Undeployment of the task named : " + artifactName + " : Started"); } try { Startup st = getSynapseConfiguration().getStartup(artifactName); if (st != null) { getSynapseConfiguration().removeStartup(artifactName); if (log.isDebugEnabled()) { log.debug("Destroying the StartupTask named : " + artifactName); } st.destroy(); if (log.isDebugEnabled()) { log.debug("StartupTask Undeployment of the sequence named : " + artifactName + " : Completed"); } log.info("StartupTask named '" + st.getName() + "' has been undeployed"); } else if (log.isDebugEnabled()) { log.debug("Startup task " + artifactName + " has already been undeployed"); } } catch (Exception e) { handleSynapseArtifactDeploymentError( "StartupTask Undeployement of task named : " + artifactName + " : Failed", e); } } @Override public void restoreSynapseArtifact(String artifactName) { if (log.isDebugEnabled()) { log.debug("Restoring the StartupTask with name : " + artifactName + " : Started"); } try { Startup st = getSynapseConfiguration().getStartup(artifactName); OMElement stElem = StartupFinder.getInstance().serializeStartup(null, st); if (st.getFileName() != null) { String fileName = getServerConfigurationInformation().getSynapseXMLLocation() + File.separator + MultiXMLConfigurationBuilder.TASKS_DIR + File.separator + st.getFileName(); writeToFile(stElem, fileName); if (log.isDebugEnabled()) { log.debug("Restoring the StartupTask with name : " + artifactName + " : Completed"); } log.info("StartupTask named '" + artifactName + "' has been restored"); } else { handleSynapseArtifactDeploymentError("Couldn't restore the StartupTask named '" + artifactName + "', filename cannot be found"); } } catch (Exception e) { handleSynapseArtifactDeploymentError( "Restoring of the StartupTask named '" + artifactName + "' has failed", e); } } }
asanka88/apache-synapse
modules/core/src/main/java/org/apache/synapse/deployers/TaskDeployer.java
Java
apache-2.0
7,123
/* Copyright 2017 The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ // Package setmilestone implements the `/milestone` command which allows members of the milestone // maintainers team to specify a milestone to be applied to an Issue or PR. package milestone import ( "fmt" "regexp" "sort" "strings" "github.com/sirupsen/logrus" "k8s.io/test-infra/prow/github" "k8s.io/test-infra/prow/pluginhelp" "k8s.io/test-infra/prow/plugins" ) const pluginName = "milestone" var ( milestoneRegex = regexp.MustCompile(`(?m)^/milestone\s+(.+?)\s*$`) mustBeSigLead = "You must be a member of the [%s/%s](https://github.com/orgs/%s/teams/%s/members) github team to set the milestone." invalidMilestone = "The provided milestone is not valid for this repository. Milestones in this repository: [%s]\n\nUse `/milestone %s` to clear the milestone." milestoneTeamMsg = "The milestone maintainers team is the Github team with ID: %d." clearKeyword = "clear" ) type githubClient interface { CreateComment(owner, repo string, number int, comment string) error ClearMilestone(org, repo string, num int) error SetMilestone(org, repo string, issueNum, milestoneNum int) error ListTeamMembers(id int, role string) ([]github.TeamMember, error) ListMilestones(org, repo string) ([]github.Milestone, error) } func init() { plugins.RegisterGenericCommentHandler(pluginName, handleGenericComment, helpProvider) } func helpProvider(config *plugins.Configuration, enabledRepos []string) (*pluginhelp.PluginHelp, error) { pluginHelp := &pluginhelp.PluginHelp{ Description: "The milestone plugin allows members of a configurable GitHub team to set the milestone on an issue or pull request.", Config: func(repos []string) map[string]string { configMap := make(map[string]string) for _, repo := range repos { team, exists := config.RepoMilestone[repo] if exists { configMap[repo] = fmt.Sprintf(milestoneTeamMsg, team) } } configMap[""] = fmt.Sprintf(milestoneTeamMsg, config.RepoMilestone[""]) return configMap }(enabledRepos), } pluginHelp.AddCommand(pluginhelp.Command{ Usage: "/milestone <version> or /milestone clear", Description: "Updates the milestone for an issue or PR", Featured: false, WhoCanUse: "Members of the milestone maintainers GitHub team can use the '/milestone' command.", Examples: []string{"/milestone v1.10", "/milestone v1.9", "/milestone clear"}, }) return pluginHelp, nil } func handleGenericComment(pc plugins.PluginClient, e github.GenericCommentEvent) error { return handle(pc.GitHubClient, pc.Logger, &e, pc.PluginConfig.RepoMilestone) } func buildMilestoneMap(milestones []github.Milestone) map[string]int { m := make(map[string]int) for _, ms := range milestones { m[ms.Title] = ms.Number } return m } func handle(gc githubClient, log *logrus.Entry, e *github.GenericCommentEvent, repoMilestone map[string]plugins.Milestone) error { if e.Action != github.GenericCommentActionCreated { return nil } milestoneMatch := milestoneRegex.FindStringSubmatch(e.Body) if len(milestoneMatch) != 2 { return nil } org := e.Repo.Owner.Login repo := e.Repo.Name milestone, exists := repoMilestone[fmt.Sprintf("%s/%s", org, repo)] if !exists { // fallback default milestone = repoMilestone[""] } milestoneMaintainers, err := gc.ListTeamMembers(milestone.MaintainersID, github.RoleAll) if err != nil { return err } found := false for _, person := range milestoneMaintainers { login := github.NormLogin(e.User.Login) if github.NormLogin(person.Login) == login { found = true break } } if !found { // not in the milestone maintainers team msg := fmt.Sprintf(mustBeSigLead, org, milestone.MaintainersTeam, org, milestone.MaintainersTeam) return gc.CreateComment(org, repo, e.Number, plugins.FormatResponseRaw(e.Body, e.HTMLURL, e.User.Login, msg)) } milestones, err := gc.ListMilestones(org, repo) if err != nil { log.WithError(err).Errorf("Error listing the milestones in the %s/%s repo", org, repo) return err } proposedMilestone := milestoneMatch[1] // special case, if the clear keyword is used if proposedMilestone == clearKeyword { if err := gc.ClearMilestone(org, repo, e.Number); err != nil { log.WithError(err).Errorf("Error clearing the milestone for %s/%s#%d.", org, repo, e.Number) } return nil } milestoneMap := buildMilestoneMap(milestones) milestoneNumber, ok := milestoneMap[proposedMilestone] if !ok { slice := make([]string, 0, len(milestoneMap)) for k := range milestoneMap { slice = append(slice, fmt.Sprintf("`%s`", k)) } sort.Strings(slice) msg := fmt.Sprintf(invalidMilestone, strings.Join(slice, ", "), clearKeyword) return gc.CreateComment(org, repo, e.Number, plugins.FormatResponseRaw(e.Body, e.HTMLURL, e.User.Login, msg)) } if err := gc.SetMilestone(org, repo, e.Number, milestoneNumber); err != nil { log.WithError(err).Errorf("Error adding the milestone %s to %s/%s#%d.", proposedMilestone, org, repo, e.Number) } return nil }
mindprince/test-infra
prow/plugins/milestone/milestone.go
GO
apache-2.0
5,550
// Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #pragma once #include <string> #include "paddle/fluid/framework/ir/fuse_pass_base.h" #include "paddle/fluid/framework/ir/graph.h" namespace paddle { namespace framework { namespace ir { /* * \brief Fuse the FC and activation operators into single OneDNN's * FC with post-op. * * \note Currently only GeLU, hardswish, sigmoid, mish and tanh are supported * as an activation function. */ class FuseFCActOneDNNPass : public FusePassBase { public: virtual ~FuseFCActOneDNNPass() {} protected: void ApplyImpl(ir::Graph *graph) const override; void FuseFCAct(ir::Graph *graph, const std::string &act_types) const; }; } // namespace ir } // namespace framework } // namespace paddle
PaddlePaddle/Paddle
paddle/fluid/framework/ir/mkldnn/fc_act_mkldnn_fuse_pass.h
C
apache-2.0
1,338
/* * Copyright 2012 Rolando Martins, CRACS & INESC-TEC, DCC/FCUP * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ /* * File: PeerProvider.h * Author: rmartins * * Created on July 26, 2010, 6:13 PM */ #ifndef PEERPROVIDER_H #define PEERPROVIDER_H #include <stheno/core/p2p/discovery/DiscoveryProvider.h> #include <stheno/core/p2p/common/PeerMap.h> #include <stheno/core/p2p/mesh/Mesh.h> class PeerProvider: public DiscoveryProvider { public: static const UInt PEER_PROVIDER; PeerProvider(MeshPtr& meshService); virtual ~PeerProvider(); virtual void close(); virtual DiscoveryQueryReply* executeQuery( DiscoveryQuery* query, DiscoveryQoS* qos = 0) throw (DiscoveryException&); virtual AsyncDiscoveryQueryReply* executeAsyncQuery( DiscoveryQuery* query, DiscoveryQoS* qos = 0, ACE_Time_Value* timeout = 0) throw (DiscoveryException&); virtual void cancelAsyncQuery(AsyncDiscoveryQueryReply* token) throw (DiscoveryException&); virtual UInt getProviderID(); //caller must free list virtual list<UInt>& getProvidedEvents(); protected: list<UInt> m_providedEvents; MeshPtr m_meshService; PeerMapPtr& getPeerMap(); }; #endif /* PEERPROVIDER_H */
rolandomar/stheno
stheno/src/org/cracs/stheno/core/p2p/discovery/peer_provider/PeerProvider.h
C
apache-2.0
1,840
// // Copyright 2014, Sander van Harmelen // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // package cloudstack44 import ( "encoding/json" "net/url" "strconv" ) type ListStorageProvidersParams struct { p map[string]interface{} } func (p *ListStorageProvidersParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["keyword"]; found { u.Set("keyword", v.(string)) } if v, found := p.p["page"]; found { vv := strconv.Itoa(v.(int)) u.Set("page", vv) } if v, found := p.p["pagesize"]; found { vv := strconv.Itoa(v.(int)) u.Set("pagesize", vv) } if v, found := p.p["type"]; found { u.Set("type", v.(string)) } return u } func (p *ListStorageProvidersParams) SetKeyword(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["keyword"] = v return } func (p *ListStorageProvidersParams) SetPage(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["page"] = v return } func (p *ListStorageProvidersParams) SetPagesize(v int) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["pagesize"] = v return } func (p *ListStorageProvidersParams) SetType(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["storagePoolType"] = v return } // You should always use this function to get a new ListStorageProvidersParams instance, // as then you are sure you have configured all required params func (s *StoragePoolService) NewListStorageProvidersParams(storagePoolType string) *ListStorageProvidersParams { p := &ListStorageProvidersParams{} p.p = make(map[string]interface{}) p.p["storagePoolType"] = storagePoolType return p } // Lists storage providers. func (s *StoragePoolService) ListStorageProviders(p *ListStorageProvidersParams) (*ListStorageProvidersResponse, error) { resp, err := s.cs.newRequest("listStorageProviders", p.toURLValues()) if err != nil { return nil, err } var r ListStorageProvidersResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } return &r, nil } type ListStorageProvidersResponse struct { Count int `json:"count"` StorageProviders []*StorageProvider `json:"storageprovider"` } type StorageProvider struct { Name string `json:"name,omitempty"` Type string `json:"type,omitempty"` } type EnableStorageMaintenanceParams struct { p map[string]interface{} } func (p *EnableStorageMaintenanceParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } return u } func (p *EnableStorageMaintenanceParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } // You should always use this function to get a new EnableStorageMaintenanceParams instance, // as then you are sure you have configured all required params func (s *StoragePoolService) NewEnableStorageMaintenanceParams(id string) *EnableStorageMaintenanceParams { p := &EnableStorageMaintenanceParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Puts storage pool into maintenance state func (s *StoragePoolService) EnableStorageMaintenance(p *EnableStorageMaintenanceParams) (*EnableStorageMaintenanceResponse, error) { resp, err := s.cs.newRequest("enableStorageMaintenance", p.toURLValues()) if err != nil { return nil, err } var r EnableStorageMaintenanceResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, warn, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { return nil, err } // If 'warn' has a value it means the job is running longer than the configured // timeout, the resonse will contain the jobid of the running async job if warn != nil { return &r, warn } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type EnableStorageMaintenanceResponse struct { JobID string `json:"jobid,omitempty"` Capacityiops int64 `json:"capacityiops,omitempty"` Clusterid string `json:"clusterid,omitempty"` Clustername string `json:"clustername,omitempty"` Created string `json:"created,omitempty"` Disksizeallocated int64 `json:"disksizeallocated,omitempty"` Disksizetotal int64 `json:"disksizetotal,omitempty"` Disksizeused int64 `json:"disksizeused,omitempty"` Hypervisor string `json:"hypervisor,omitempty"` Id string `json:"id,omitempty"` Ipaddress string `json:"ipaddress,omitempty"` Name string `json:"name,omitempty"` Overprovisionfactor string `json:"overprovisionfactor,omitempty"` Path string `json:"path,omitempty"` Podid string `json:"podid,omitempty"` Podname string `json:"podname,omitempty"` Scope string `json:"scope,omitempty"` State string `json:"state,omitempty"` Storagecapabilities map[string]string `json:"storagecapabilities,omitempty"` Suitableformigration bool `json:"suitableformigration,omitempty"` Tags string `json:"tags,omitempty"` Type string `json:"type,omitempty"` Zoneid string `json:"zoneid,omitempty"` Zonename string `json:"zonename,omitempty"` } type CancelStorageMaintenanceParams struct { p map[string]interface{} } func (p *CancelStorageMaintenanceParams) toURLValues() url.Values { u := url.Values{} if p.p == nil { return u } if v, found := p.p["id"]; found { u.Set("id", v.(string)) } return u } func (p *CancelStorageMaintenanceParams) SetId(v string) { if p.p == nil { p.p = make(map[string]interface{}) } p.p["id"] = v return } // You should always use this function to get a new CancelStorageMaintenanceParams instance, // as then you are sure you have configured all required params func (s *StoragePoolService) NewCancelStorageMaintenanceParams(id string) *CancelStorageMaintenanceParams { p := &CancelStorageMaintenanceParams{} p.p = make(map[string]interface{}) p.p["id"] = id return p } // Cancels maintenance for primary storage func (s *StoragePoolService) CancelStorageMaintenance(p *CancelStorageMaintenanceParams) (*CancelStorageMaintenanceResponse, error) { resp, err := s.cs.newRequest("cancelStorageMaintenance", p.toURLValues()) if err != nil { return nil, err } var r CancelStorageMaintenanceResponse if err := json.Unmarshal(resp, &r); err != nil { return nil, err } // If we have a async client, we need to wait for the async result if s.cs.async { b, warn, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout) if err != nil { return nil, err } // If 'warn' has a value it means the job is running longer than the configured // timeout, the resonse will contain the jobid of the running async job if warn != nil { return &r, warn } b, err = getRawValue(b) if err != nil { return nil, err } if err := json.Unmarshal(b, &r); err != nil { return nil, err } } return &r, nil } type CancelStorageMaintenanceResponse struct { JobID string `json:"jobid,omitempty"` Capacityiops int64 `json:"capacityiops,omitempty"` Clusterid string `json:"clusterid,omitempty"` Clustername string `json:"clustername,omitempty"` Created string `json:"created,omitempty"` Disksizeallocated int64 `json:"disksizeallocated,omitempty"` Disksizetotal int64 `json:"disksizetotal,omitempty"` Disksizeused int64 `json:"disksizeused,omitempty"` Hypervisor string `json:"hypervisor,omitempty"` Id string `json:"id,omitempty"` Ipaddress string `json:"ipaddress,omitempty"` Name string `json:"name,omitempty"` Overprovisionfactor string `json:"overprovisionfactor,omitempty"` Path string `json:"path,omitempty"` Podid string `json:"podid,omitempty"` Podname string `json:"podname,omitempty"` Scope string `json:"scope,omitempty"` State string `json:"state,omitempty"` Storagecapabilities map[string]string `json:"storagecapabilities,omitempty"` Suitableformigration bool `json:"suitableformigration,omitempty"` Tags string `json:"tags,omitempty"` Type string `json:"type,omitempty"` Zoneid string `json:"zoneid,omitempty"` Zonename string `json:"zonename,omitempty"` }
benjvi/go-cloudstack
cloudstack44/StoragePoolService.go
GO
apache-2.0
9,719
/* * Copyright (C) 2013 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.tools.idea.lang.rs; import com.intellij.lang.ASTNode; import com.intellij.lang.PsiBuilder; import com.intellij.lang.PsiParser; import com.intellij.psi.tree.IElementType; import org.jetbrains.annotations.NotNull; public class RenderscriptParser implements PsiParser { @NotNull @Override public ASTNode parse(IElementType root, PsiBuilder builder) { final PsiBuilder.Marker rootMarker = builder.mark(); while (!builder.eof()) { builder.advanceLexer(); } rootMarker.done(root); return builder.getTreeBuilt(); } }
consulo/consulo-android
android/android/src/com/android/tools/idea/lang/rs/RenderscriptParser.java
Java
apache-2.0
1,189
module m integer::i=3 integer::j=4 end module m program t use m,only:i integer::j=77 print '(i0)',i,j end program t
thender/ppp
tests/t0223r/t.f90
FORTRAN
apache-2.0
127
--TEST-- Deregisters UDF module at the Aerospike DB which is present. --FILE-- <?php include dirname(__FILE__)."/../../astestframework/astest-phpt-loader.inc"; aerospike_phpt_runtest("Udf", "testUdfDeregisterModulePositive"); --EXPECT-- OK
aerospike/aerospike-client-php
src/tests/phpt/Udf/TestUdfDeregisterModulePositive.phpt
PHP
apache-2.0
241
--- layout: base title: 'Dependencies' generated: 'true' permalink: uk/dep/all.html --- {% capture lcode %}{{ page.permalink | split:"/" | first }}{% endcapture %} # Dependencies <span about="." property="rdf:type" resource="owl:Ontology"> <span property="owl:imports" resource=" https://www.w3.org/2012/pyRdfa/extract?uri=http://universaldependencies.org/docs/u/dep/all.html&format=xml&rdfagraph=output&vocab_expansion=false&rdfa_lite=false&embedded_rdf=true&space_preserve=false&vocab_cache=true&vocab_cache_report=false&vocab_cache_refresh=false"/> </span> {% include uk-dep-table.html %} <span about="#dep_{{ lcode }}" property="rdfs:label" style="visibility: hidden">{{ page.title }}</span> <span about="#dep_{{ lcode }}" property="rdfs:subClassOf" resource="_:{{ lcode }}"> <span about="_:{{ lcode }}" property="rdf:type" resource="owl:Restriction"> <span property="owl:onProperty" resource="http://purl.org/dc/terms/language"/> <span property="owl:hasValue" lang="" style="visibility: hidden">{{ lcode }}</span> </span> </span> ---------- {% assign sorted = site.uk-dep | sort: 'title' %} {% for p in sorted %} {% capture concept %}{{ p.title | split:':' | first }}{% endcapture %} <div about="#{{ p.title | url_encode }}_{{ lcode }}" property="rdf:type" resource="#dep_{{ lcode }}"> <div property="rdf:type" resource="../../u/dep/all.html#{{ concept }}"/> <a id="al-{{ lcode }}-dep/{{ p.title }}" class="al-dest"/> <h2><code property="oliasystem:hasTag" lang="">{{ p.title }}</code>: <div property="rdfs:label">{{ p.shortdef }}</div></h2> <div property="rdfs:comment"> {% if p.content contains "<!--details-->" %} {{ p.content | split:"<!--details-->" | first | markdownify }} <a property="rdfs:seeAlso" href="{{ p.title }}" class="al-doc">See details</a> {% else %} {{ p.content | markdownify }} {% endif %} </div> <a href="{{ site.git_edit }}/{% if p.collection %}{{ p.relative_path }}{% else %}{{ p.path }}{% endif %}" target="#">edit {{ p.title }}</a> </div> {% endfor %}
fginter/docs-fginterfork
_uk-overview/dep-all.md
Markdown
apache-2.0
2,011
<?php namespace edu\wisc\services\caos; class GetCourseByCatalogNumberRequest { /** * @var termCodeType $termCode */ protected $termCode = null; /** * @var string $subjectCode */ protected $subjectCode = null; /** * @var string $catalogNumber */ protected $catalogNumber = null; /** * @param termCodeType $termCode * @param string $subjectCode * @param string $catalogNumber */ public function __construct($termCode, $subjectCode, $catalogNumber) { $this->termCode = $termCode; $this->subjectCode = $subjectCode; $this->catalogNumber = $catalogNumber; } /** * @return termCodeType */ public function getTermCode() { return $this->termCode; } /** * @param termCodeType $termCode * @return \edu\wisc\services\caos\GetCourseByCatalogNumberRequest */ public function setTermCode($termCode) { $this->termCode = $termCode; return $this; } /** * @return string */ public function getSubjectCode() { return $this->subjectCode; } /** * @param string $subjectCode * @return \edu\wisc\services\caos\GetCourseByCatalogNumberRequest */ public function setSubjectCode($subjectCode) { $this->subjectCode = $subjectCode; return $this; } /** * @return string */ public function getCatalogNumber() { return $this->catalogNumber; } /** * @param string $catalogNumber * @return \edu\wisc\services\caos\GetCourseByCatalogNumberRequest */ public function setCatalogNumber($catalogNumber) { $this->catalogNumber = $catalogNumber; return $this; } }
ahoffmann-wi/caos-php-client
src/main/GetCourseByCatalogNumberRequest.php
PHP
apache-2.0
1,771
/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.wss4j.stax.impl.securityToken; import org.apache.wss4j.common.bsp.BSPRule; import org.apache.wss4j.common.ext.WSSecurityException; import org.apache.wss4j.common.principal.UsernameTokenPrincipal; import org.apache.wss4j.common.util.UsernameTokenUtil; import org.apache.wss4j.stax.ext.WSInboundSecurityContext; import org.apache.wss4j.stax.ext.WSSConstants; import org.apache.wss4j.stax.securityToken.UsernameSecurityToken; import org.apache.wss4j.stax.securityToken.WSSecurityTokenConstants; import org.apache.xml.security.exceptions.XMLSecurityException; import org.apache.xml.security.stax.config.JCEAlgorithmMapper; import org.apache.xml.security.stax.ext.XMLSecurityConstants; import org.apache.xml.security.stax.impl.securityToken.AbstractInboundSecurityToken; import javax.crypto.spec.SecretKeySpec; import javax.security.auth.Subject; import java.security.Key; import java.security.Principal; public class UsernameSecurityTokenImpl extends AbstractInboundSecurityToken implements UsernameSecurityToken { private static final long DEFAULT_ITERATION = 1000; private WSSConstants.UsernameTokenPasswordType usernameTokenPasswordType; private String username; private String password; private String createdTime; private byte[] nonce; private byte[] salt; private Long iteration; private final WSInboundSecurityContext wsInboundSecurityContext; private Subject subject; private Principal principal; public UsernameSecurityTokenImpl(WSSConstants.UsernameTokenPasswordType usernameTokenPasswordType, String username, String password, String createdTime, byte[] nonce, byte[] salt, Long iteration, WSInboundSecurityContext wsInboundSecurityContext, String id, WSSecurityTokenConstants.KeyIdentifier keyIdentifier) { super(wsInboundSecurityContext, id, keyIdentifier, true); this.usernameTokenPasswordType = usernameTokenPasswordType; this.username = username; this.password = password; this.createdTime = createdTime; this.nonce = nonce; this.salt = salt; this.iteration = iteration; this.wsInboundSecurityContext = wsInboundSecurityContext; } @Override public boolean isAsymmetric() throws XMLSecurityException { return false; } @Override protected Key getKey(String algorithmURI, XMLSecurityConstants.AlgorithmUsage algorithmUsage, String correlationID) throws XMLSecurityException { Key key = getSecretKey().get(algorithmURI); if (key != null) { return key; } byte[] secretToken = generateDerivedKey(wsInboundSecurityContext); String algoFamily = JCEAlgorithmMapper.getJCEKeyAlgorithmFromURI(algorithmURI); key = new SecretKeySpec(secretToken, algoFamily); setSecretKey(algorithmURI, key); return key; } @Override public WSSecurityTokenConstants.TokenType getTokenType() { return WSSecurityTokenConstants.UsernameToken; } /** * This method generates a derived key as defined in WSS Username * Token Profile. * * @return Returns the derived key a byte array * @throws WSSecurityException */ public byte[] generateDerivedKey() throws WSSecurityException { return generateDerivedKey(wsInboundSecurityContext); } /** * This method generates a derived key as defined in WSS Username * Token Profile. * * @return Returns the derived key a byte array * @throws org.apache.wss4j.common.ext.WSSecurityException * */ protected byte[] generateDerivedKey(WSInboundSecurityContext wsInboundSecurityContext) throws WSSecurityException { if (wsInboundSecurityContext != null) { if (salt == null || salt.length == 0) { wsInboundSecurityContext.handleBSPRule(BSPRule.R4217); } if (iteration == null || iteration < DEFAULT_ITERATION) { wsInboundSecurityContext.handleBSPRule(BSPRule.R4218); } } return UsernameTokenUtil.generateDerivedKey(password, salt, iteration.intValue()); } @Override public Principal getPrincipal() throws WSSecurityException { if (this.principal == null) { this.principal = new UsernameTokenPrincipal() { //todo passwordType and passwordDigest return Enum-Type ? @Override public boolean isPasswordDigest() { return usernameTokenPasswordType == WSSConstants.UsernameTokenPasswordType.PASSWORD_DIGEST; } @Override public String getPasswordType() { return usernameTokenPasswordType.getNamespace(); } @Override public String getName() { return username; } @Override public String getPassword() { return password; } @Override public String getCreatedTime() { return createdTime; } @Override public byte[] getNonce() { return nonce; } }; } return this.principal; } public WSSConstants.UsernameTokenPasswordType getUsernameTokenPasswordType() { return usernameTokenPasswordType; } public String getCreatedTime() { return createdTime; } public String getPassword() { return password; } public String getUsername() { return username; } public byte[] getNonce() { return nonce; } public byte[] getSalt() { return salt; } public Long getIteration() { return iteration; } public void setSubject(Subject subject) { this.subject = subject; } @Override public Subject getSubject() throws WSSecurityException { return subject; } }
asoldano/wss4j
ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/securityToken/UsernameSecurityTokenImpl.java
Java
apache-2.0
7,035
# # Author:: Adam Jacob (<adam@opscode.com>) # Copyright:: Copyright (c) 2008 Opscode, Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # require "chef/resource/script" require "chef/provider/script" class Chef class Resource class Bash < Chef::Resource::Script def initialize(name, run_context=nil) super @interpreter = "bash" end end end end
BackSlasher/chef
lib/chef/resource/bash.rb
Ruby
apache-2.0
930
/********************************************************************** Copyright (c) 2005 Erik Bengtson and others. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. Contributors: ... **********************************************************************/ package org.datanucleus.samples.metadata.datastoreidentity; public class D3 { private String name; /** * @return Returns the name. */ public String getName() { return name; } /** * @param name The name to set. */ public void setName(String name) { this.name = name; } }
datanucleus/tests
jdo/general/src/java/org/datanucleus/samples/metadata/datastoreidentity/D3.java
Java
apache-2.0
1,143
package com.mic.log.spouts; import java.util.Map; import backtype.storm.spout.SpoutOutputCollector; import backtype.storm.task.TopologyContext; import backtype.storm.topology.OutputFieldsDeclarer; import backtype.storm.topology.base.BaseRichSpout; import backtype.storm.tuple.Fields; import backtype.storm.tuple.Values; public class AppLogWriterSpout extends BaseRichSpout { private SpoutOutputCollector _collector; public void open(Map conf, TopologyContext context, SpoutOutputCollector collector) { this._collector = collector; } @Override public void nextTuple() { try { Thread.sleep(2000); } catch (InterruptedException e) { e.printStackTrace(); } _collector.emit(new Values("command")); } @Override public void declareOutputFields(OutputFieldsDeclarer declarer) { declarer.declare(new Fields("command")); } }
yifzhang/storm-miclog
src/jvm/com/mic/log/spouts/AppLogWriterSpout.java
Java
apache-2.0
885
// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "base/nix/mime_util_xdg.h" #include <cstdlib> #include <list> #include <map> #include <vector> #include "base/environment.h" #include "base/file_util.h" #include "base/lazy_instance.h" #include "base/logging.h" #include "base/memory/scoped_ptr.h" #include "base/memory/singleton.h" #include "base/nix/xdg_util.h" #include "base/strings/string_split.h" #include "base/strings/string_util.h" #include "base/synchronization/lock.h" #include "base/third_party/xdg_mime/xdgmime.h" #include "base/threading/thread_restrictions.h" #include "base/time/time.h" namespace base { namespace nix { namespace { class IconTheme; // None of the XDG stuff is thread-safe, so serialize all access under // this lock. LazyInstance<Lock>::Leaky g_mime_util_xdg_lock = LAZY_INSTANCE_INITIALIZER; class MimeUtilConstants { public: typedef std::map<std::string, IconTheme*> IconThemeMap; typedef std::map<FilePath, Time> IconDirMtimeMap; typedef std::vector<std::string> IconFormats; // Specified by XDG icon theme specs. static const int kUpdateIntervalInSeconds = 5; static const size_t kDefaultThemeNum = 4; static MimeUtilConstants* GetInstance() { return Singleton<MimeUtilConstants>::get(); } // Store icon directories and their mtimes. IconDirMtimeMap icon_dirs_; // Store icon formats. IconFormats icon_formats_; // Store loaded icon_theme. IconThemeMap icon_themes_; // The default theme. IconTheme* default_themes_[kDefaultThemeNum]; TimeTicks last_check_time_; // The current icon theme, usually set through GTK theme integration. std::string icon_theme_name_; private: MimeUtilConstants() { icon_formats_.push_back(".png"); icon_formats_.push_back(".svg"); icon_formats_.push_back(".xpm"); for (size_t i = 0; i < kDefaultThemeNum; ++i) default_themes_[i] = NULL; } ~MimeUtilConstants(); friend struct DefaultSingletonTraits<MimeUtilConstants>; DISALLOW_COPY_AND_ASSIGN(MimeUtilConstants); }; // IconTheme represents an icon theme as defined by the xdg icon theme spec. // Example themes on GNOME include 'Human' and 'Mist'. // Example themes on KDE include 'crystalsvg' and 'kdeclassic'. class IconTheme { public: // A theme consists of multiple sub-directories, like '32x32' and 'scalable'. class SubDirInfo { public: // See spec for details. enum Type { Fixed, Scalable, Threshold }; SubDirInfo() : size(0), type(Threshold), max_size(0), min_size(0), threshold(2) { } size_t size; // Nominal size of the icons in this directory. Type type; // Type of the icon size. size_t max_size; // Maximum size that the icons can be scaled to. size_t min_size; // Minimum size that the icons can be scaled to. size_t threshold; // Maximum difference from desired size. 2 by default. }; explicit IconTheme(const std::string& name); ~IconTheme() {} // Returns the path to an icon with the name |icon_name| and a size of |size| // pixels. If the icon does not exist, but |inherits| is true, then look for // the icon in the parent theme. FilePath GetIconPath(const std::string& icon_name, int size, bool inherits); // Load a theme with the name |theme_name| into memory. Returns null if theme // is invalid. static IconTheme* LoadTheme(const std::string& theme_name); private: // Returns the path to an icon with the name |icon_name| in |subdir|. FilePath GetIconPathUnderSubdir(const std::string& icon_name, const std::string& subdir); // Whether the theme loaded properly. bool IsValid() { return index_theme_loaded_; } // Read and parse |file| which is usually named 'index.theme' per theme spec. bool LoadIndexTheme(const FilePath& file); // Checks to see if the icons in |info| matches |size| (in pixels). Returns // 0 if they match, or the size difference in pixels. size_t MatchesSize(SubDirInfo* info, size_t size); // Yet another function to read a line. std::string ReadLine(FILE* fp); // Set directories to search for icons to the comma-separated list |dirs|. bool SetDirectories(const std::string& dirs); bool index_theme_loaded_; // True if an instance is properly loaded. // store the scattered directories of this theme. std::list<FilePath> dirs_; // store the subdirs of this theme and array index of |info_array_|. std::map<std::string, int> subdirs_; scoped_ptr<SubDirInfo[]> info_array_; // List of sub-directories. std::string inherits_; // Name of the theme this one inherits from. }; IconTheme::IconTheme(const std::string& name) : index_theme_loaded_(false) { ThreadRestrictions::AssertIOAllowed(); // Iterate on all icon directories to find directories of the specified // theme and load the first encountered index.theme. MimeUtilConstants::IconDirMtimeMap::iterator iter; FilePath theme_path; MimeUtilConstants::IconDirMtimeMap* icon_dirs = &MimeUtilConstants::GetInstance()->icon_dirs_; for (iter = icon_dirs->begin(); iter != icon_dirs->end(); ++iter) { theme_path = iter->first.Append(name); if (!DirectoryExists(theme_path)) continue; FilePath theme_index = theme_path.Append("index.theme"); if (!index_theme_loaded_ && PathExists(theme_index)) { if (!LoadIndexTheme(theme_index)) return; index_theme_loaded_ = true; } dirs_.push_back(theme_path); } } FilePath IconTheme::GetIconPath(const std::string& icon_name, int size, bool inherits) { std::map<std::string, int>::iterator subdir_iter; FilePath icon_path; for (subdir_iter = subdirs_.begin(); subdir_iter != subdirs_.end(); ++subdir_iter) { SubDirInfo* info = &info_array_[subdir_iter->second]; if (MatchesSize(info, size) == 0) { icon_path = GetIconPathUnderSubdir(icon_name, subdir_iter->first); if (!icon_path.empty()) return icon_path; } } // Now looking for the mostly matched. size_t min_delta_seen = 9999; for (subdir_iter = subdirs_.begin(); subdir_iter != subdirs_.end(); ++subdir_iter) { SubDirInfo* info = &info_array_[subdir_iter->second]; size_t delta = MatchesSize(info, size); if (delta < min_delta_seen) { FilePath path = GetIconPathUnderSubdir(icon_name, subdir_iter->first); if (!path.empty()) { min_delta_seen = delta; icon_path = path; } } } if (!icon_path.empty() || !inherits || inherits_ == "") return icon_path; IconTheme* theme = LoadTheme(inherits_); // Inheriting from itself means the theme is buggy but we shouldn't crash. if (theme && theme != this) return theme->GetIconPath(icon_name, size, inherits); else return FilePath(); } IconTheme* IconTheme::LoadTheme(const std::string& theme_name) { scoped_ptr<IconTheme> theme; MimeUtilConstants::IconThemeMap* icon_themes = &MimeUtilConstants::GetInstance()->icon_themes_; if (icon_themes->find(theme_name) != icon_themes->end()) { theme.reset((*icon_themes)[theme_name]); } else { theme.reset(new IconTheme(theme_name)); if (!theme->IsValid()) theme.reset(); (*icon_themes)[theme_name] = theme.get(); } return theme.release(); } FilePath IconTheme::GetIconPathUnderSubdir(const std::string& icon_name, const std::string& subdir) { FilePath icon_path; std::list<FilePath>::iterator dir_iter; MimeUtilConstants::IconFormats* icon_formats = &MimeUtilConstants::GetInstance()->icon_formats_; for (dir_iter = dirs_.begin(); dir_iter != dirs_.end(); ++dir_iter) { for (size_t i = 0; i < icon_formats->size(); ++i) { icon_path = dir_iter->Append(subdir); icon_path = icon_path.Append(icon_name + (*icon_formats)[i]); if (PathExists(icon_path)) return icon_path; } } return FilePath(); } bool IconTheme::LoadIndexTheme(const FilePath& file) { FILE* fp = base::OpenFile(file, "r"); SubDirInfo* current_info = NULL; if (!fp) return false; // Read entries. while (!feof(fp) && !ferror(fp)) { std::string buf = ReadLine(fp); if (buf == "") break; std::string entry; TrimWhitespaceASCII(buf, TRIM_ALL, &entry); if (entry.length() == 0 || entry[0] == '#') { // Blank line or Comment. continue; } else if (entry[0] == '[' && info_array_.get()) { current_info = NULL; std::string subdir = entry.substr(1, entry.length() - 2); if (subdirs_.find(subdir) != subdirs_.end()) current_info = &info_array_[subdirs_[subdir]]; } std::string key, value; std::vector<std::string> r; SplitStringDontTrim(entry, '=', &r); if (r.size() < 2) continue; TrimWhitespaceASCII(r[0], TRIM_ALL, &key); for (size_t i = 1; i < r.size(); i++) value.append(r[i]); TrimWhitespaceASCII(value, TRIM_ALL, &value); if (current_info) { if (key == "Size") { current_info->size = atoi(value.c_str()); } else if (key == "Type") { if (value == "Fixed") current_info->type = SubDirInfo::Fixed; else if (value == "Scalable") current_info->type = SubDirInfo::Scalable; else if (value == "Threshold") current_info->type = SubDirInfo::Threshold; } else if (key == "MaxSize") { current_info->max_size = atoi(value.c_str()); } else if (key == "MinSize") { current_info->min_size = atoi(value.c_str()); } else if (key == "Threshold") { current_info->threshold = atoi(value.c_str()); } } else { if (key.compare("Directories") == 0 && !info_array_.get()) { if (!SetDirectories(value)) break; } else if (key.compare("Inherits") == 0) { if (value != "hicolor") inherits_ = value; } } } base::CloseFile(fp); return info_array_.get() != NULL; } size_t IconTheme::MatchesSize(SubDirInfo* info, size_t size) { if (info->type == SubDirInfo::Fixed) { if (size > info->size) return size - info->size; else return info->size - size; } else if (info->type == SubDirInfo::Scalable) { if (size < info->min_size) return info->min_size - size; if (size > info->max_size) return size - info->max_size; return 0; } else { if (size + info->threshold < info->size) return info->size - size - info->threshold; if (size > info->size + info->threshold) return size - info->size - info->threshold; return 0; } } std::string IconTheme::ReadLine(FILE* fp) { if (!fp) return std::string(); std::string result; const size_t kBufferSize = 100; char buffer[kBufferSize]; while ((fgets(buffer, kBufferSize - 1, fp)) != NULL) { result += buffer; size_t len = result.length(); if (len == 0) break; char end = result[len - 1]; if (end == '\n' || end == '\0') break; } return result; } bool IconTheme::SetDirectories(const std::string& dirs) { int num = 0; std::string::size_type pos = 0, epos; std::string dir; while ((epos = dirs.find(',', pos)) != std::string::npos) { TrimWhitespaceASCII(dirs.substr(pos, epos - pos), TRIM_ALL, &dir); if (dir.length() == 0) { DLOG(WARNING) << "Invalid index.theme: blank subdir"; return false; } subdirs_[dir] = num++; pos = epos + 1; } TrimWhitespaceASCII(dirs.substr(pos), TRIM_ALL, &dir); if (dir.length() == 0) { DLOG(WARNING) << "Invalid index.theme: blank subdir"; return false; } subdirs_[dir] = num++; info_array_.reset(new SubDirInfo[num]); return true; } bool CheckDirExistsAndGetMtime(const FilePath& dir, Time* last_modified) { if (!DirectoryExists(dir)) return false; File::Info file_info; if (!GetFileInfo(dir, &file_info)) return false; *last_modified = file_info.last_modified; return true; } // Make sure |dir| exists and add it to the list of icon directories. void TryAddIconDir(const FilePath& dir) { Time last_modified; if (!CheckDirExistsAndGetMtime(dir, &last_modified)) return; MimeUtilConstants::GetInstance()->icon_dirs_[dir] = last_modified; } // For a xdg directory |dir|, add the appropriate icon sub-directories. void AddXDGDataDir(const FilePath& dir) { if (!DirectoryExists(dir)) return; TryAddIconDir(dir.Append("icons")); TryAddIconDir(dir.Append("pixmaps")); } // Add all the xdg icon directories. void InitIconDir() { FilePath home = GetHomeDir(); if (!home.empty()) { FilePath legacy_data_dir(home); legacy_data_dir = legacy_data_dir.AppendASCII(".icons"); if (DirectoryExists(legacy_data_dir)) TryAddIconDir(legacy_data_dir); } const char* env = getenv("XDG_DATA_HOME"); if (env) { AddXDGDataDir(FilePath(env)); } else if (!home.empty()) { FilePath local_data_dir(home); local_data_dir = local_data_dir.AppendASCII(".local"); local_data_dir = local_data_dir.AppendASCII("share"); AddXDGDataDir(local_data_dir); } env = getenv("XDG_DATA_DIRS"); if (!env) { AddXDGDataDir(FilePath("/usr/local/share")); AddXDGDataDir(FilePath("/usr/share")); } else { std::string xdg_data_dirs = env; std::string::size_type pos = 0, epos; while ((epos = xdg_data_dirs.find(':', pos)) != std::string::npos) { AddXDGDataDir(FilePath(xdg_data_dirs.substr(pos, epos - pos))); pos = epos + 1; } AddXDGDataDir(FilePath(xdg_data_dirs.substr(pos))); } } void EnsureUpdated() { MimeUtilConstants* constants = MimeUtilConstants::GetInstance(); if (constants->last_check_time_.is_null()) { constants->last_check_time_ = TimeTicks::Now(); InitIconDir(); return; } // Per xdg theme spec, we should check the icon directories every so often // for newly added icons. TimeDelta time_since_last_check = TimeTicks::Now() - constants->last_check_time_; if (time_since_last_check.InSeconds() > constants->kUpdateIntervalInSeconds) { constants->last_check_time_ += time_since_last_check; bool rescan_icon_dirs = false; MimeUtilConstants::IconDirMtimeMap* icon_dirs = &constants->icon_dirs_; MimeUtilConstants::IconDirMtimeMap::iterator iter; for (iter = icon_dirs->begin(); iter != icon_dirs->end(); ++iter) { Time last_modified; if (!CheckDirExistsAndGetMtime(iter->first, &last_modified) || last_modified != iter->second) { rescan_icon_dirs = true; break; } } if (rescan_icon_dirs) { constants->icon_dirs_.clear(); constants->icon_themes_.clear(); InitIconDir(); } } } // Find a fallback icon if we cannot find it in the default theme. FilePath LookupFallbackIcon(const std::string& icon_name) { MimeUtilConstants* constants = MimeUtilConstants::GetInstance(); MimeUtilConstants::IconDirMtimeMap::iterator iter; MimeUtilConstants::IconDirMtimeMap* icon_dirs = &constants->icon_dirs_; MimeUtilConstants::IconFormats* icon_formats = &constants->icon_formats_; for (iter = icon_dirs->begin(); iter != icon_dirs->end(); ++iter) { for (size_t i = 0; i < icon_formats->size(); ++i) { FilePath icon = iter->first.Append(icon_name + (*icon_formats)[i]); if (PathExists(icon)) return icon; } } return FilePath(); } // Initialize the list of default themes. void InitDefaultThemes() { IconTheme** default_themes = MimeUtilConstants::GetInstance()->default_themes_; scoped_ptr<Environment> env(Environment::Create()); base::nix::DesktopEnvironment desktop_env = base::nix::GetDesktopEnvironment(env.get()); if (desktop_env == base::nix::DESKTOP_ENVIRONMENT_KDE3 || desktop_env == base::nix::DESKTOP_ENVIRONMENT_KDE4) { // KDE std::string kde_default_theme; std::string kde_fallback_theme; // TODO(thestig): Figure out how to get the current icon theme on KDE. // Setting stored in ~/.kde/share/config/kdeglobals under Icons -> Theme. default_themes[0] = NULL; // Try some reasonable defaults for KDE. if (desktop_env == base::nix::DESKTOP_ENVIRONMENT_KDE3) { // KDE 3 kde_default_theme = "default.kde"; kde_fallback_theme = "crystalsvg"; } else { // KDE 4 kde_default_theme = "default.kde4"; kde_fallback_theme = "oxygen"; } default_themes[1] = IconTheme::LoadTheme(kde_default_theme); default_themes[2] = IconTheme::LoadTheme(kde_fallback_theme); } else { // Assume it's Gnome and use GTK to figure out the theme. default_themes[1] = IconTheme::LoadTheme( MimeUtilConstants::GetInstance()->icon_theme_name_); default_themes[2] = IconTheme::LoadTheme("gnome"); } // hicolor needs to be last per icon theme spec. default_themes[3] = IconTheme::LoadTheme("hicolor"); for (size_t i = 0; i < MimeUtilConstants::kDefaultThemeNum; i++) { if (default_themes[i] == NULL) continue; // NULL out duplicate pointers. for (size_t j = i + 1; j < MimeUtilConstants::kDefaultThemeNum; j++) { if (default_themes[j] == default_themes[i]) default_themes[j] = NULL; } } } // Try to find an icon with the name |icon_name| that's |size| pixels. FilePath LookupIconInDefaultTheme(const std::string& icon_name, int size) { EnsureUpdated(); MimeUtilConstants* constants = MimeUtilConstants::GetInstance(); MimeUtilConstants::IconThemeMap* icon_themes = &constants->icon_themes_; if (icon_themes->empty()) InitDefaultThemes(); FilePath icon_path; IconTheme** default_themes = constants->default_themes_; for (size_t i = 0; i < MimeUtilConstants::kDefaultThemeNum; i++) { if (default_themes[i]) { icon_path = default_themes[i]->GetIconPath(icon_name, size, true); if (!icon_path.empty()) return icon_path; } } return LookupFallbackIcon(icon_name); } MimeUtilConstants::~MimeUtilConstants() { for (size_t i = 0; i < kDefaultThemeNum; i++) delete default_themes_[i]; } } // namespace std::string GetFileMimeType(const FilePath& filepath) { if (filepath.empty()) return std::string(); ThreadRestrictions::AssertIOAllowed(); AutoLock scoped_lock(g_mime_util_xdg_lock.Get()); return xdg_mime_get_mime_type_from_file_name(filepath.value().c_str()); } std::string GetDataMimeType(const std::string& data) { ThreadRestrictions::AssertIOAllowed(); AutoLock scoped_lock(g_mime_util_xdg_lock.Get()); return xdg_mime_get_mime_type_for_data(data.data(), data.length(), NULL); } void SetIconThemeName(const std::string& name) { // If the theme name is already loaded, do nothing. Chrome doesn't respond // to changes in the system theme, so we never need to set this more than // once. if (!MimeUtilConstants::GetInstance()->icon_theme_name_.empty()) return; MimeUtilConstants::GetInstance()->icon_theme_name_ = name; } FilePath GetMimeIcon(const std::string& mime_type, size_t size) { ThreadRestrictions::AssertIOAllowed(); std::vector<std::string> icon_names; std::string icon_name; FilePath icon_file; if (!mime_type.empty()) { AutoLock scoped_lock(g_mime_util_xdg_lock.Get()); const char *icon = xdg_mime_get_icon(mime_type.c_str()); icon_name = std::string(icon ? icon : ""); } if (icon_name.length()) icon_names.push_back(icon_name); // For text/plain, try text-plain. icon_name = mime_type; for (size_t i = icon_name.find('/', 0); i != std::string::npos; i = icon_name.find('/', i + 1)) { icon_name[i] = '-'; } icon_names.push_back(icon_name); // Also try gnome-mime-text-plain. icon_names.push_back("gnome-mime-" + icon_name); // Try "deb" for "application/x-deb" in KDE 3. size_t x_substr_pos = mime_type.find("/x-"); if (x_substr_pos != std::string::npos) { icon_name = mime_type.substr(x_substr_pos + 3); icon_names.push_back(icon_name); } // Try generic name like text-x-generic. icon_name = mime_type.substr(0, mime_type.find('/')) + "-x-generic"; icon_names.push_back(icon_name); // Last resort icon_names.push_back("unknown"); for (size_t i = 0; i < icon_names.size(); i++) { if (icon_names[i][0] == '/') { icon_file = FilePath(icon_names[i]); if (PathExists(icon_file)) return icon_file; } else { icon_file = LookupIconInDefaultTheme(icon_names[i], size); if (!icon_file.empty()) return icon_file; } } return FilePath(); } } // namespace nix } // namespace base
elvestar/chromium-base-library
base/nix/mime_util_xdg.cc
C++
apache-2.0
20,684
package ca.uhn.fhir.cql.dstu3.builder; /*- * #%L * HAPI FHIR JPA Server - Clinical Quality Language * %% * Copyright (C) 2014 - 2022 Smile CDR, Inc. * %% * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * #L% */ import ca.uhn.fhir.cql.common.builder.BaseBuilder; import org.hl7.fhir.dstu3.model.MeasureReport; import org.hl7.fhir.dstu3.model.Period; import org.hl7.fhir.dstu3.model.Reference; import org.hl7.fhir.exceptions.FHIRException; import org.opencds.cqf.cql.engine.runtime.Interval; import java.util.Date; public class MeasureReportBuilder extends BaseBuilder<MeasureReport> { private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(MeasureReportBuilder.class); public MeasureReportBuilder() { super(new MeasureReport()); } public MeasureReportBuilder buildStatus(String status) { try { this.complexProperty.setStatus(MeasureReport.MeasureReportStatus.fromCode(status)); } catch (FHIRException e) { ourLog.warn("Exception caught while attempting to set Status to '" + status + "', assuming status COMPLETE!" + System.lineSeparator() + e.getMessage()); this.complexProperty.setStatus(MeasureReport.MeasureReportStatus.COMPLETE); } return this; } public MeasureReportBuilder buildType(MeasureReport.MeasureReportType type) { this.complexProperty.setType(type); return this; } public MeasureReportBuilder buildMeasureReference(String measureRef) { this.complexProperty.setMeasure(new Reference(measureRef)); return this; } public MeasureReportBuilder buildPatientReference(String patientRef) { this.complexProperty.setPatient(new Reference(patientRef)); return this; } public MeasureReportBuilder buildPeriod(Interval period) { this.complexProperty.setPeriod(new Period().setStart((Date) period.getStart()).setEnd((Date) period.getEnd())); return this; } }
jamesagnew/hapi-fhir
hapi-fhir-jpaserver-cql/src/main/java/ca/uhn/fhir/cql/dstu3/builder/MeasureReportBuilder.java
Java
apache-2.0
2,503
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!-- NewPage --> <html lang="en"> <head> <!-- Generated by javadoc (1.8.0_102) on Thu Sep 29 16:37:39 CEST 2016 --> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Uses of Class energy.usef.agr.model.SynchronisationConnection (usef-root-pom 1.3.6 API)</title> <meta name="date" content="2016-09-29"> <link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style"> <script type="text/javascript" src="../../../../../script.js"></script> </head> <body> <script type="text/javascript"><!-- try { if (location.href.indexOf('is-external=true') == -1) { parent.document.title="Uses of Class energy.usef.agr.model.SynchronisationConnection (usef-root-pom 1.3.6 API)"; } } catch(err) { } //--> </script> <noscript> <div>JavaScript is disabled on your browser.</div> </noscript> <!-- ========= START OF TOP NAVBAR ======= --> <div class="topNav"><a name="navbar.top"> <!-- --> </a> <div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div> <a name="navbar.top.firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../../../overview-summary.html">Overview</a></li> <li><a href="../package-summary.html">Package</a></li> <li><a href="../../../../../energy/usef/agr/model/SynchronisationConnection.html" title="class in energy.usef.agr.model">Class</a></li> <li class="navBarCell1Rev">Use</li> <li><a href="../package-tree.html">Tree</a></li> <li><a href="../../../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../../../index-all.html">Index</a></li> <li><a href="../../../../../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li>Prev</li> <li>Next</li> </ul> <ul class="navList"> <li><a href="../../../../../index.html?energy/usef/agr/model/class-use/SynchronisationConnection.html" target="_top">Frames</a></li> <li><a href="SynchronisationConnection.html" target="_top">No&nbsp;Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_top"> <li><a href="../../../../../allclasses-noframe.html">All&nbsp;Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_top"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <a name="skip.navbar.top"> <!-- --> </a></div> <!-- ========= END OF TOP NAVBAR ========= --> <div class="header"> <h2 title="Uses of Class energy.usef.agr.model.SynchronisationConnection" class="title">Uses of Class<br>energy.usef.agr.model.SynchronisationConnection</h2> </div> <div class="classUseContainer"> <ul class="blockList"> <li class="blockList"> <table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing packages, and an explanation"> <caption><span>Packages that use <a href="../../../../../energy/usef/agr/model/SynchronisationConnection.html" title="class in energy.usef.agr.model">SynchronisationConnection</a></span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Package</th> <th class="colLast" scope="col">Description</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><a href="#energy.usef.agr.model">energy.usef.agr.model</a></td> <td class="colLast"> <div class="block">Model classes of the Aggregator.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><a href="#energy.usef.agr.repository">energy.usef.agr.repository</a></td> <td class="colLast"> <div class="block">Repository classes of the Aggregator.</div> </td> </tr> <tr class="altColor"> <td class="colFirst"><a href="#energy.usef.agr.service.business">energy.usef.agr.service.business</a></td> <td class="colLast"> <div class="block">Business classes of the Aggregator.</div> </td> </tr> </tbody> </table> </li> <li class="blockList"> <ul class="blockList"> <li class="blockList"><a name="energy.usef.agr.model"> <!-- --> </a> <h3>Uses of <a href="../../../../../energy/usef/agr/model/SynchronisationConnection.html" title="class in energy.usef.agr.model">SynchronisationConnection</a> in <a href="../../../../../energy/usef/agr/model/package-summary.html">energy.usef.agr.model</a></h3> <table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing methods, and an explanation"> <caption><span>Methods in <a href="../../../../../energy/usef/agr/model/package-summary.html">energy.usef.agr.model</a> that return <a href="../../../../../energy/usef/agr/model/SynchronisationConnection.html" title="class in energy.usef.agr.model">SynchronisationConnection</a></span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colLast" scope="col">Method and Description</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><code><a href="../../../../../energy/usef/agr/model/SynchronisationConnection.html" title="class in energy.usef.agr.model">SynchronisationConnection</a></code></td> <td class="colLast"><span class="typeNameLabel">SynchronisationConnectionStatus.</span><code><span class="memberNameLink"><a href="../../../../../energy/usef/agr/model/SynchronisationConnectionStatus.html#getSynchronisationConnection--">getSynchronisationConnection</a></span>()</code>&nbsp;</td> </tr> </tbody> </table> <table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing methods, and an explanation"> <caption><span>Methods in <a href="../../../../../energy/usef/agr/model/package-summary.html">energy.usef.agr.model</a> with parameters of type <a href="../../../../../energy/usef/agr/model/SynchronisationConnection.html" title="class in energy.usef.agr.model">SynchronisationConnection</a></span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colLast" scope="col">Method and Description</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><code>void</code></td> <td class="colLast"><span class="typeNameLabel">SynchronisationConnectionStatus.</span><code><span class="memberNameLink"><a href="../../../../../energy/usef/agr/model/SynchronisationConnectionStatus.html#setSynchronisationConnection-energy.usef.agr.model.SynchronisationConnection-">setSynchronisationConnection</a></span>(<a href="../../../../../energy/usef/agr/model/SynchronisationConnection.html" title="class in energy.usef.agr.model">SynchronisationConnection</a>&nbsp;synchronisationConnection)</code>&nbsp;</td> </tr> </tbody> </table> </li> <li class="blockList"><a name="energy.usef.agr.repository"> <!-- --> </a> <h3>Uses of <a href="../../../../../energy/usef/agr/model/SynchronisationConnection.html" title="class in energy.usef.agr.model">SynchronisationConnection</a> in <a href="../../../../../energy/usef/agr/repository/package-summary.html">energy.usef.agr.repository</a></h3> <table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing methods, and an explanation"> <caption><span>Methods in <a href="../../../../../energy/usef/agr/repository/package-summary.html">energy.usef.agr.repository</a> that return <a href="../../../../../energy/usef/agr/model/SynchronisationConnection.html" title="class in energy.usef.agr.model">SynchronisationConnection</a></span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colLast" scope="col">Method and Description</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><code><a href="../../../../../energy/usef/agr/model/SynchronisationConnection.html" title="class in energy.usef.agr.model">SynchronisationConnection</a></code></td> <td class="colLast"><span class="typeNameLabel">SynchronisationConnectionRepository.</span><code><span class="memberNameLink"><a href="../../../../../energy/usef/agr/repository/SynchronisationConnectionRepository.html#findByEntityAddress-java.lang.String-">findByEntityAddress</a></span>(<a href="http://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;entityAddress)</code> <div class="block">Gets Synchronisation Connection entity by its entity address.</div> </td> </tr> </tbody> </table> <table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing methods, and an explanation"> <caption><span>Methods in <a href="../../../../../energy/usef/agr/repository/package-summary.html">energy.usef.agr.repository</a> that return types with arguments of type <a href="../../../../../energy/usef/agr/model/SynchronisationConnection.html" title="class in energy.usef.agr.model">SynchronisationConnection</a></span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colLast" scope="col">Method and Description</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><code><a href="http://docs.oracle.com/javase/8/docs/api/java/util/List.html?is-external=true" title="class or interface in java.util">List</a>&lt;<a href="../../../../../energy/usef/agr/model/SynchronisationConnection.html" title="class in energy.usef.agr.model">SynchronisationConnection</a>&gt;</code></td> <td class="colLast"><span class="typeNameLabel">SynchronisationConnectionRepository.</span><code><span class="memberNameLink"><a href="../../../../../energy/usef/agr/repository/SynchronisationConnectionRepository.html#findAll--">findAll</a></span>()</code> <div class="block">Gets all the connections.</div> </td> </tr> </tbody> </table> <table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing methods, and an explanation"> <caption><span>Methods in <a href="../../../../../energy/usef/agr/repository/package-summary.html">energy.usef.agr.repository</a> with parameters of type <a href="../../../../../energy/usef/agr/model/SynchronisationConnection.html" title="class in energy.usef.agr.model">SynchronisationConnection</a></span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colLast" scope="col">Method and Description</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><code>void</code></td> <td class="colLast"><span class="typeNameLabel">SynchronisationConnectionStatusRepository.</span><code><span class="memberNameLink"><a href="../../../../../energy/usef/agr/repository/SynchronisationConnectionStatusRepository.html#deleteFor-energy.usef.agr.model.SynchronisationConnection-">deleteFor</a></span>(<a href="../../../../../energy/usef/agr/model/SynchronisationConnection.html" title="class in energy.usef.agr.model">SynchronisationConnection</a>&nbsp;synchronisationConnection)</code> <div class="block">Deletes all the <a href="../../../../../energy/usef/agr/model/SynchronisationConnectionStatus.html" title="class in energy.usef.agr.model"><code>SynchronisationConnectionStatus</code></a> object for a .</div> </td> </tr> </tbody> </table> </li> <li class="blockList"><a name="energy.usef.agr.service.business"> <!-- --> </a> <h3>Uses of <a href="../../../../../energy/usef/agr/model/SynchronisationConnection.html" title="class in energy.usef.agr.model">SynchronisationConnection</a> in <a href="../../../../../energy/usef/agr/service/business/package-summary.html">energy.usef.agr.service.business</a></h3> <table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing methods, and an explanation"> <caption><span>Methods in <a href="../../../../../energy/usef/agr/service/business/package-summary.html">energy.usef.agr.service.business</a> that return types with arguments of type <a href="../../../../../energy/usef/agr/model/SynchronisationConnection.html" title="class in energy.usef.agr.model">SynchronisationConnection</a></span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colLast" scope="col">Method and Description</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><code><a href="http://docs.oracle.com/javase/8/docs/api/java/util/Map.html?is-external=true" title="class or interface in java.util">Map</a>&lt;<a href="http://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>,<a href="http://docs.oracle.com/javase/8/docs/api/java/util/List.html?is-external=true" title="class or interface in java.util">List</a>&lt;<a href="../../../../../energy/usef/agr/model/SynchronisationConnection.html" title="class in energy.usef.agr.model">SynchronisationConnection</a>&gt;&gt;</code></td> <td class="colLast"><span class="typeNameLabel">AgrPlanboardBusinessService.</span><code><span class="memberNameLink"><a href="../../../../../energy/usef/agr/service/business/AgrPlanboardBusinessService.html#findConnectionsPerCRO--">findConnectionsPerCRO</a></span>()</code> <div class="block">Finds all <a href="../../../../../energy/usef/agr/model/CommonReferenceOperator.html" title="class in energy.usef.agr.model"><code>CommonReferenceOperator</code></a>s and <a href="../../../../../energy/usef/agr/model/SynchronisationConnection.html" title="class in energy.usef.agr.model"><code>SynchronisationConnection</code></a>s and put them in a Map, all <a href="../../../../../energy/usef/agr/model/SynchronisationConnection.html" title="class in energy.usef.agr.model"><code>SynchronisationConnection</code></a>s are send to all <a href="../../../../../energy/usef/agr/model/CommonReferenceOperator.html" title="class in energy.usef.agr.model"><code>CommonReferenceOperator</code></a>s.</div> </td> </tr> </tbody> </table> </li> </ul> </li> </ul> </div> <!-- ======= START OF BOTTOM NAVBAR ====== --> <div class="bottomNav"><a name="navbar.bottom"> <!-- --> </a> <div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div> <a name="navbar.bottom.firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../../../overview-summary.html">Overview</a></li> <li><a href="../package-summary.html">Package</a></li> <li><a href="../../../../../energy/usef/agr/model/SynchronisationConnection.html" title="class in energy.usef.agr.model">Class</a></li> <li class="navBarCell1Rev">Use</li> <li><a href="../package-tree.html">Tree</a></li> <li><a href="../../../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../../../index-all.html">Index</a></li> <li><a href="../../../../../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li>Prev</li> <li>Next</li> </ul> <ul class="navList"> <li><a href="../../../../../index.html?energy/usef/agr/model/class-use/SynchronisationConnection.html" target="_top">Frames</a></li> <li><a href="SynchronisationConnection.html" target="_top">No&nbsp;Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_bottom"> <li><a href="../../../../../allclasses-noframe.html">All&nbsp;Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_bottom"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <a name="skip.navbar.bottom"> <!-- --> </a></div> <!-- ======== END OF BOTTOM NAVBAR ======= --> <p class="legalCopy"><small>Copyright &#169; 2016. All rights reserved.</small></p> </body> </html>
USEF-Foundation/ri.usef.energy
usef-javadoc/energy/usef/agr/model/class-use/SynchronisationConnection.html
HTML
apache-2.0
15,970
/* * Copyright (c) 2005 - 2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy * of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR * CONDITIONS OF ANY KIND, either express or implied. See the License for the * specific language governing permissions and limitations under the License. */ package org.wso2.carbon.event.output.adapter.wso2event; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.wso2.carbon.databridge.agent.AgentHolder; import org.wso2.carbon.databridge.agent.DataPublisher; import org.wso2.carbon.databridge.agent.exception.DataEndpointAgentConfigurationException; import org.wso2.carbon.databridge.agent.exception.DataEndpointAuthenticationException; import org.wso2.carbon.databridge.agent.exception.DataEndpointConfigurationException; import org.wso2.carbon.databridge.agent.exception.DataEndpointException; import org.wso2.carbon.databridge.commons.Event; import org.wso2.carbon.databridge.commons.exception.TransportException; import org.wso2.carbon.event.output.adapter.core.OutputEventAdapter; import org.wso2.carbon.event.output.adapter.core.OutputEventAdapterConfiguration; import org.wso2.carbon.event.output.adapter.core.exception.ConnectionUnavailableException; import org.wso2.carbon.event.output.adapter.core.exception.OutputEventAdapterRuntimeException; import org.wso2.carbon.event.output.adapter.core.exception.TestConnectionNotSupportedException; import org.wso2.carbon.event.output.adapter.wso2event.internal.util.WSO2EventAdapterConstants; import java.util.Map; import static org.wso2.carbon.event.output.adapter.wso2event.internal.util.WSO2EventAdapterConstants.*; public final class WSO2EventAdapter implements OutputEventAdapter { private static final Log log = LogFactory.getLog(WSO2EventAdapter.class); private final OutputEventAdapterConfiguration eventAdapterConfiguration; private final Map<String, String> globalProperties; private DataPublisher dataPublisher = null; private boolean isBlockingMode = false; private long timeout = 0; private String streamId; public WSO2EventAdapter(OutputEventAdapterConfiguration eventAdapterConfiguration, Map<String, String> globalProperties) { this.eventAdapterConfiguration = eventAdapterConfiguration; this.globalProperties = globalProperties; } /** * Initialises the resource bundle */ @Override public void init() { streamId = eventAdapterConfiguration.getStaticProperties().get( WSO2EventAdapterConstants.ADAPTER_STATIC_CONFIG_STREAM_NAME) + ":" + eventAdapterConfiguration.getStaticProperties().get(WSO2EventAdapterConstants .ADAPTER_STATIC_CONFIG_STREAM_VERSION); String configPath = globalProperties.get(ADAPTOR_CONF_PATH); if (configPath != null) { AgentHolder.setConfigPath(configPath); } } @Override public void testConnect() throws TestConnectionNotSupportedException { connect(); } @Override public synchronized void connect() { String userName = eventAdapterConfiguration.getStaticProperties().get(ADAPTER_CONF_WSO2EVENT_PROP_USER_NAME); String password = eventAdapterConfiguration.getStaticProperties().get(ADAPTER_CONF_WSO2EVENT_PROP_PASSWORD); String authUrl = eventAdapterConfiguration.getStaticProperties() .get(ADAPTER_CONF_WSO2EVENT_PROP_AUTHENTICATOR_URL); String receiverUrl = eventAdapterConfiguration.getStaticProperties() .get(ADAPTER_CONF_WSO2EVENT_PROP_RECEIVER_URL); String protocol = eventAdapterConfiguration.getStaticProperties().get(ADAPTER_CONF_WSO2EVENT_PROP_PROTOCOL); String publishingMode = eventAdapterConfiguration.getStaticProperties() .get(ADAPTER_CONF_WSO2EVENT_PROP_PUBLISHING_MODE); String timeoutString = eventAdapterConfiguration.getStaticProperties() .get(ADAPTER_CONF_WSO2EVENT_PROP_PUBLISH_TIMEOUT_MS); if (publishingMode.equalsIgnoreCase(ADAPTER_PUBLISHING_MODE_BLOCKING)) { isBlockingMode = true; } else { try { timeout = Long.parseLong(timeoutString); } catch (RuntimeException e) { throwRuntimeException(receiverUrl, authUrl, protocol, userName, e); } } try { if (authUrl != null && authUrl.length() > 0) { dataPublisher = new DataPublisher(protocol, receiverUrl, authUrl, userName, password); } else { dataPublisher = new DataPublisher(protocol, receiverUrl, null, userName, password); } } catch (DataEndpointAgentConfigurationException e) { throwRuntimeException(receiverUrl, authUrl, protocol, userName, e); } catch (DataEndpointException e) { throwConnectionException(receiverUrl, authUrl, protocol, userName, e); } catch (DataEndpointConfigurationException e) { throwRuntimeException(receiverUrl, authUrl, protocol, userName, e); } catch (DataEndpointAuthenticationException e) { throwConnectionException(receiverUrl, authUrl, protocol, userName, e); } catch (TransportException e) { throwConnectionException(receiverUrl, authUrl, protocol, userName, e); } } @Override public void publish(Object message, Map<String, String> dynamicProperties) { Event event = (Event) (message); //StreamDefinition streamDefinition = (StreamDefinition) ((Object[]) message)[1]; event.setStreamId(streamId); if (isBlockingMode) { dataPublisher.publish(event); } else { dataPublisher.tryPublish(event, timeout); } } @Override public void disconnect() { if (dataPublisher != null) { try { dataPublisher.shutdown(); } catch (DataEndpointException e) { String userName = eventAdapterConfiguration.getStaticProperties() .get(ADAPTER_CONF_WSO2EVENT_PROP_USER_NAME); String authUrl = eventAdapterConfiguration.getStaticProperties() .get(ADAPTER_CONF_WSO2EVENT_PROP_AUTHENTICATOR_URL); String receiverUrl = eventAdapterConfiguration.getStaticProperties() .get(ADAPTER_CONF_WSO2EVENT_PROP_RECEIVER_URL); String protocol = eventAdapterConfiguration.getStaticProperties() .get(ADAPTER_CONF_WSO2EVENT_PROP_PROTOCOL); logException("Error in shutting down the data publisher", receiverUrl, authUrl, protocol, userName, e); } } } @Override public void destroy() { } private void throwRuntimeException(String receiverUrl, String authUrl, String protocol, String userName, Exception e) { throw new OutputEventAdapterRuntimeException( "Error in data-bridge config for adaptor " + eventAdapterConfiguration.getName() + " with the receiverUrl:" + receiverUrl + " authUrl:" + authUrl + " protocol:" + protocol + " and userName:" + userName + "," + e.getMessage(), e); } private void logException(String message, String receiverUrl, String authUrl, String protocol, String userName, Exception e) { log.error(message + " for adaptor " + eventAdapterConfiguration.getName() + " with the receiverUrl:" + receiverUrl + " authUrl:" + authUrl + " protocol:" + protocol + " and userName:" + userName + "," + e.getMessage(), e); } private void throwConnectionException(String receiverUrl, String authUrl, String protocol, String userName, Exception e) { throw new ConnectionUnavailableException( "Connection not available for adaptor " + eventAdapterConfiguration.getName() + " with the receiverUrl:" + receiverUrl + " authUrl:" + authUrl + " protocol:" + protocol + " and userName:" + userName + "," + e.getMessage(), e); } }
kasungayan/carbon-analytics-common
components/event-publisher/event-output-adapters/org.wso2.carbon.event.output.adapter.wso2event/src/main/java/org/wso2/carbon/event/output/adapter/wso2event/WSO2EventAdapter.java
Java
apache-2.0
8,571
""" websocket - WebSocket client library for Python Copyright (C) 2010 Hiroki Ohtani(liris) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA """ import logging _logger = logging.getLogger('websocket') try: from logging import NullHandler except ImportError: class NullHandler(logging.Handler): def emit(self, record): pass _logger.addHandler(NullHandler()) _traceEnabled = False __all__ = ["enableTrace", "dump", "error", "warning", "debug", "trace", "isEnabledForError", "isEnabledForDebug", "isEnabledForTrace"] def enableTrace(traceable, handler = logging.StreamHandler()): """ turn on/off the traceability. traceable: boolean value. if set True, traceability is enabled. """ global _traceEnabled _traceEnabled = traceable if traceable: _logger.addHandler(handler) _logger.setLevel(logging.DEBUG) def dump(title, message): if _traceEnabled: _logger.debug("--- " + title + " ---") _logger.debug(message) _logger.debug("-----------------------") def error(msg): _logger.error(msg) def warning(msg): _logger.warning(msg) def debug(msg): _logger.debug(msg) def trace(msg): if _traceEnabled: _logger.debug(msg) def isEnabledForError(): return _logger.isEnabledFor(logging.ERROR) def isEnabledForDebug(): return _logger.isEnabledFor(logging.DEBUG) def isEnabledForTrace(): return _traceEnabled
vert-x3/vertx-web
vertx-web/src/test/sockjs-protocol/websocket/_logging.py
Python
apache-2.0
2,165
# -*- coding: utf-8 -*- # Copyright (c) 2015 Ericsson AB # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import pytest from mock import Mock from calvin.tests import DummyNode from calvin.runtime.north.actormanager import ActorManager from calvin.runtime.south.endpoint import LocalOutEndpoint, LocalInEndpoint from calvin.actor.actor import Actor pytestmark = pytest.mark.unittest def create_actor(node): actor_manager = ActorManager(node) actor_id = actor_manager.new('std.Identity', {}) actor = actor_manager.actors[actor_id] actor._calvinsys = Mock() return actor @pytest.fixture def actor(): return create_actor(DummyNode()) @pytest.mark.parametrize("port_type,port_name,port_property,value,expected", [ ("invalid", "", "", "", False), ("in", "missing", "", "", False), ("out", "missing", "", "", False), ("out", "token", "missing", "", False), ("in", "token", "missing", "", False), ("out", "token", "name", "new_name", True), ("out", "token", "name", "new_name", True), ]) def test_set_port_property(port_type, port_name, port_property, value, expected): assert actor().set_port_property(port_type, port_name, port_property, value) is expected @pytest.mark.parametrize("inport_ret_val,outport_ret_val,expected", [ (False, False, False), (False, True, False), (True, False, False), (True, True, True), ]) def test_did_connect(actor, inport_ret_val, outport_ret_val, expected): for port in actor.inports.values(): port.is_connected = Mock(return_value=inport_ret_val) for port in actor.outports.values(): port.is_connected = Mock(return_value=outport_ret_val) actor.fsm = Mock() actor.did_connect(None) if expected: actor.fsm.transition_to.assert_called_with(Actor.STATUS.ENABLED) assert actor._calvinsys.scheduler_wakeup.called else: assert not actor.fsm.transition_to.called assert not actor._calvinsys.scheduler_wakeup.called @pytest.mark.parametrize("inport_ret_val,outport_ret_val,expected", [ (True, True, False), (True, False, False), (False, True, False), (False, False, True), ]) def test_did_disconnect(actor, inport_ret_val, outport_ret_val, expected): for port in actor.inports.values(): port.is_connected = Mock(return_value=inport_ret_val) for port in actor.outports.values(): port.is_connected = Mock(return_value=outport_ret_val) actor.fsm = Mock() actor.did_disconnect(None) if expected: actor.fsm.transition_to.assert_called_with(Actor.STATUS.READY) else: assert not actor.fsm.transition_to.called def test_enabled(actor): actor.enable() assert actor.enabled() actor.disable() assert not actor.enabled() def test_connections(): node = DummyNode() node.id = "node_id" actor = create_actor(node) inport = actor.inports['token'] outport = actor.outports['token'] port = Mock() port.id = "x" peer_port = Mock() peer_port.id = "y" inport.attach_endpoint(LocalInEndpoint(port, peer_port)) outport.attach_endpoint(LocalOutEndpoint(port, peer_port)) assert actor.connections(node) == { 'actor_id': actor.id, 'actor_name': actor.name, 'inports': {inport.id: (node, "y")}, 'outports': {outport.id: [(node, "y")]} } def test_state(actor): inport = actor.inports['token'] outport = actor.outports['token'] correct_state = { '_component_members': set([actor.id]), '_deployment_requirements': [], '_managed': set(['dump', '_signature', 'id', '_deployment_requirements', 'name', 'credentials']), '_signature': None, 'dump': False, 'id': actor.id, 'inports': {'token': {'fifo': {'N': 5, 'fifo': [{'data': 0, 'type': 'Token'}, {'data': 0, 'type': 'Token'}, {'data': 0, 'type': 'Token'}, {'data': 0, 'type': 'Token'}, {'data': 0, 'type': 'Token'}], 'read_pos': {inport.id: 0}, 'readers': [inport.id], 'tentative_read_pos': {inport.id: 0}, 'write_pos': 0}, 'id': inport.id, 'name': 'token'}}, 'name': '', 'outports': {'token': {'fanout': 1, 'fifo': {'N': 5, 'fifo': [{'data': 0, 'type': 'Token'}, {'data': 0, 'type': 'Token'}, {'data': 0, 'type': 'Token'}, {'data': 0, 'type': 'Token'}, {'data': 0, 'type': 'Token'}], 'read_pos': {}, 'readers': [], 'tentative_read_pos': {}, 'write_pos': 0}, 'id': outport.id, 'name': 'token'}}} test_state = actor.state() for k, v in correct_state.iteritems(): # Read state use list to support JSON serialization if isinstance(v, set): assert set(test_state[k]) == v else: assert test_state[k] == v @pytest.mark.parametrize("prev_signature,new_signature,expected", [ (None, "new_val", "new_val"), ("old_val", "new_val", "old_val") ]) def test_set_signature(actor, prev_signature, new_signature, expected): actor.signature_set(prev_signature) actor.signature_set(new_signature) assert actor._signature == expected def test_component(actor): actor.component_add(1) assert 1 in actor.component_members() actor.component_add([2, 3]) assert 2 in actor.component_members() assert 3 in actor.component_members() actor.component_remove(1) assert 1 not in actor.component_members() actor.component_remove([2, 3]) assert 2 not in actor.component_members() assert 3 not in actor.component_members() def test_requirements(actor): assert actor.requirements_get() == [] actor.requirements_add([1, 2, 3]) assert actor.requirements_get() == [1, 2, 3] actor.requirements_add([4, 5]) assert actor.requirements_get() == [4, 5] actor.requirements_add([6, 7], extend=True) assert actor.requirements_get() == [4, 5, 6, 7]
les69/calvin-base
calvin/tests/test_actor.py
Python
apache-2.0
7,248
#!/var/www/horizon/.venv/bin/python # $Id: rst2xml.py 4564 2006-05-21 20:44:42Z wiemann $ # Author: David Goodger <goodger@python.org> # Copyright: This module has been placed in the public domain. """ A minimal front end to the Docutils Publisher, producing Docutils XML. """ try: import locale locale.setlocale(locale.LC_ALL, '') except: pass from docutils.core import publish_cmdline, default_description description = ('Generates Docutils-native XML from standalone ' 'reStructuredText sources. ' + default_description) publish_cmdline(writer_name='xml', description=description)
neumerance/deploy
.venv/bin/rst2xml.py
Python
apache-2.0
619
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Search &mdash; Paramiko documentation</title> <link rel="stylesheet" href="_static/alabaster.css" type="text/css" /> <link rel="stylesheet" href="_static/pygments.css" type="text/css" /> <script type="text/javascript"> var DOCUMENTATION_OPTIONS = { URL_ROOT: './', VERSION: '', COLLAPSE_INDEX: false, FILE_SUFFIX: '.html', HAS_SOURCE: true }; </script> <script type="text/javascript" src="_static/jquery.js"></script> <script type="text/javascript" src="_static/underscore.js"></script> <script type="text/javascript" src="_static/doctools.js"></script> <script type="text/javascript" src="_static/searchtools.js"></script> <link rel="top" title="Paramiko documentation" href="index.html" /> <script type="text/javascript"> jQuery(function() { Search.loadIndex("searchindex.js"); }); </script> <script type="text/javascript" id="searchindexloader"></script> <meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9"> </head> <body> <div class="related"> <h3>Navigation</h3> <ul> <li class="right" style="margin-right: 10px"> <a href="genindex.html" title="General Index" accesskey="I">index</a></li> <li class="right" > <a href="py-modindex.html" title="Python Module Index" >modules</a> |</li> <li><a href="index.html">Paramiko documentation</a> &raquo;</li> </ul> </div> <div class="document"> <div class="documentwrapper"> <div class="bodywrapper"> <div class="body"> <h1 id="search-documentation">Search</h1> <div id="fallback" class="admonition warning"> <script type="text/javascript">$('#fallback').hide();</script> <p> Please activate JavaScript to enable the search functionality. </p> </div> <p> From here you can search these documents. Enter your search words into the box below and click "search". Note that the search function will automatically search for all of the words. Pages containing fewer words won't appear in the result list. </p> <form action="" method="get"> <input type="text" name="q" value="" /> <input type="submit" value="search" /> <span id="search-progress" style="padding-left: 10px"></span> </form> <div id="search-results"> </div> </div> </div> </div> <div class="sphinxsidebar"> <div class="sphinxsidebarwrapper"> <h1 class="logo"><a href="index.html">Paramiko</a></h1> <p class="blurb">A Python implementation of SSHv2.</p> <p> <iframe src="http://ghbtns.com/github-btn.html?user=paramiko&repo=paramiko&type=watch&count=true&size=large" allowtransparency="true" frameborder="0" scrolling="0" width="200px" height="35px"></iframe> </p> <p> <a href="https://travis-ci.org/paramiko/paramiko"> <img alt="https://secure.travis-ci.org/paramiko/paramiko.png?branch=master" src="https://secure.travis-ci.org/paramiko/paramiko.png?branch=master" > </a> </p> <h3>Navigation</h3> <ul> <li class="toctree-l1"><a class="reference internal" href="api/channel.html">Channel</a></li> <li class="toctree-l1"><a class="reference internal" href="api/client.html">Client</a></li> <li class="toctree-l1"><a class="reference internal" href="api/message.html">Message</a></li> <li class="toctree-l1"><a class="reference internal" href="api/packet.html">Packetizer</a></li> <li class="toctree-l1"><a class="reference internal" href="api/transport.html">Transport</a></li> </ul> <ul> <li class="toctree-l1"><a class="reference internal" href="api/agent.html">SSH Agents</a></li> <li class="toctree-l1"><a class="reference internal" href="api/hostkeys.html">Host keys / <tt class="docutils literal"><span class="pre">known_hosts</span></tt> files</a></li> <li class="toctree-l1"><a class="reference internal" href="api/keys.html">Key handling</a></li> </ul> <ul> <li class="toctree-l1"><a class="reference internal" href="api/config.html">Configuration</a></li> <li class="toctree-l1"><a class="reference internal" href="api/proxy.html"><tt class="docutils literal"><span class="pre">ProxyCommand</span></tt> support</a></li> <li class="toctree-l1"><a class="reference internal" href="api/server.html">Server implementation</a></li> <li class="toctree-l1"><a class="reference internal" href="api/sftp.html">SFTP</a></li> </ul> <ul> <li class="toctree-l1"><a class="reference internal" href="api/buffered_pipe.html">Buffered pipes</a></li> <li class="toctree-l1"><a class="reference internal" href="api/file.html">Buffered files</a></li> <li class="toctree-l1"><a class="reference internal" href="api/pipe.html">Cross-platform pipe implementations</a></li> <li class="toctree-l1"><a class="reference internal" href="api/ssh_exception.html">Exceptions</a></li> </ul> <hr /> <ul> <li class="toctree-l1"><a href="http://www.paramiko.org">Main website</a></li> </ul> <h3>Donate</h3> <p> Consider supporting the authors on <a href="https://www.gittip.com/">Gittip</a>: <iframe style="border: 0; margin: 5px 0 -5px 0; padding: 0;" src="https://www.gittip.com/bitprophet/widget.html" width="48pt" height="20pt"></iframe> </p> </div> </div> <div class="clearer"></div> </div> <div class="footer"> &copy;2014 Jeff Forcier. | Powered by <a href="http://sphinx-doc.org/">Sphinx 1.2.2</a> &amp; <a href="https://github.com/bitprophet/alabaster">Alabaster 0.6.0</a> </div> <script type="text/javascript"> var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-18486793-2']); _gaq.push(['_setDomainName', 'none']); _gaq.push(['_setAllowLinker', true]); _gaq.push(['_trackPageview']); (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); </script> </body> </html>
mytliulei/DCNRobotInstallPackages
windows/win32/paramiko-1.14.0/docs/search.html
HTML
apache-2.0
6,532
<?xml version="1.0" encoding="UTF-8"?> <html xmlns:extrep="http://www.sun.com/japex/extendedTestSuiteReport" xmlns:rep="http://www.sun.com/japex/testSuiteReport" xmlns="http://www.w3.org/1999/xhtml"> <link href="report.css" type="text/css" rel="stylesheet"/> <body> <table border="0" cellpadding="2"> <tr> <td valign="middle" width="90"> <p> <a href="https://japex.dev.java.net"> <img src="small_japex.gif" align="middle" border="0"/> </a> </p> </td> <td valign="middle"> <h1>Japex Report: FI-serialize</h1> </td> </tr> </table> <h2>Global Parameters</h2> <ul> <li>chartType: barchart</li> <li>classPath: <table width=750><tr><td>japex/dist/jdsl/FastInfoset.jar; japex/dist/jdsl/activation.jar; japex/dist/jdsl/jaxb-api.jar; japex/dist/jdsl/jaxb-impl.jar; japex/dist/jdsl/jaxb-xjc.jar; japex/dist/jdsl/jaxb1-impl.jar; japex/dist/jdsl/jdsl.jar; japex/dist/jdsl/jsr173_api.jar; japex/dist/jdsl/resolver.jar; japex/dist/jdsl/sjsxp.jar; japex/dist/jdsl/xercesImpl.jar; japex/dist/jdsl/xml-apis.jar</td></tr></table></li> <li>configFile: serialize.xml</li> <li>dateTime: 23 Jan 2006/13:44:19 EST</li> <li>includeWarmupRun: false</li> <li>numberOfThreads: 1</li> <li>osArchitecture: x86</li> <li>osName: SunOS</li> <li>reportsDirectory: reports</li> <li>resultAxis: normal</li> <li>resultAxisX: normal</li> <li>resultUnit: ms</li> <li>resultUnitX: kbs</li> <li>runsPerDriver: 1</li> <li>runTime: 5</li> <li>version: 1.000</li> <li>vmInfo: Sun Microsystems Inc. 1.5.0_04-b05</li> <li>warmupTime: 5</li> </ul> <h2>Result Summary (ms)</h2> <table width="80%" border="1"> <thead> <tr> <th width="15%"> <b>driver</b> </th> <th> <b>resultAritMean</b> </th> <th> <b>resultHarmMean</b> </th> <th> <b>resultGeomMean</b> </th> <th> <b>driverClass</b> </th> </tr> </thead> <tbody> <tr> <td align="right">FastInfosetDOMDriver</td> <td align="right"> <nobr>10.702</nobr> </td> <td align="right"> <nobr>0.121</nobr> </td> <td align="right"> <nobr>0.963</nobr> </td> <td align="right"> <nobr>com.sun.japex.jdsl.xml.serialize.dom.FastInfosetDOMDriver</nobr> </td> </tr> <tr> <td align="right">FastInfosetDOM24IndexedContentDriver</td> <td align="right"> <nobr>10.978</nobr> </td> <td align="right"> <nobr>0.123</nobr> </td> <td align="right"> <nobr>0.979</nobr> </td> <td align="right"> <nobr>com.sun.japex.jdsl.xml.serialize.dom.FastInfosetDOMDriver</nobr> </td> </tr> <tr> <td align="right">FastInfosetDOMExtVocab24IndexedContentDriver</td> <td align="right"> <nobr>10.981</nobr> </td> <td align="right"> <nobr>0.064</nobr> </td> <td align="right"> <nobr>0.794</nobr> </td> <td align="right"> <nobr>com.sun.japex.jdsl.xml.serialize.dom.FastInfosetDOMDriver</nobr> </td> </tr> <tr> <td align="right">XercesDOMXercesXMLSerializerDriver</td> <td align="right"> <nobr>20.996</nobr> </td> <td align="right"> <nobr>0.178</nobr> </td> <td align="right"> <nobr>1.550</nobr> </td> <td align="right"> <nobr>com.sun.japex.jdsl.xml.serialize.dom.XercesDOMXercesXMLSerializerDriver</nobr> </td> </tr> </tbody> </table> <br/> <br/> <center> <img src="result.jpg"/> </center> <br/> <br/> <h2>Driver: FastInfosetDOMDriver</h2> <p> <ul> <li>jdsl.attributeValueSizeLimit: n/a</li> <li>jdsl.characterContentChunkSizeLimit: n/a</li> <li>jdsl.externalVocabulary: n/a</li> </ul> </p> <table width="80%" border="1"> <thead> <tr> <th> <b>testCase</b> </th> <th> <b>resultValue</b> </th> <th> <b>xmlfile</b> </th> </tr> </thead> <tbody> <tr> <td align="right">inv1.xml</td> <td align="right"> <nobr>0.119</nobr> </td> <td align="left"> <nobr>data/inv1.xml</nobr> </td> </tr> <tr> <td align="right">inv10.xml</td> <td align="right"> <nobr>0.246</nobr> </td> <td align="left"> <nobr>data/inv10.xml</nobr> </td> </tr> <tr> <td align="right">inv50.xml</td> <td align="right"> <nobr>0.828</nobr> </td> <td align="left"> <nobr>data/inv50.xml</nobr> </td> </tr> <tr> <td align="right">inv100.xml</td> <td align="right"> <nobr>1.556</nobr> </td> <td align="left"> <nobr>data/inv100.xml</nobr> </td> </tr> <tr> <td align="right">inv500.xml</td> <td align="right"> <nobr>10.087</nobr> </td> <td align="left"> <nobr>data/inv500.xml</nobr> </td> </tr> <tr> <td align="right">inv1000.xml</td> <td align="right"> <nobr>20.269</nobr> </td> <td align="left"> <nobr>data/inv1000.xml</nobr> </td> </tr> <tr> <td align="right">soap1.xml</td> <td align="right"> <nobr>0.025</nobr> </td> <td align="left"> <nobr>data/soap1.xml</nobr> </td> </tr> <tr> <td align="right">soap2.xml</td> <td align="right"> <nobr>0.027</nobr> </td> <td align="left"> <nobr>data/soap2.xml</nobr> </td> </tr> <tr> <td align="right">soap3.xml</td> <td align="right"> <nobr>0.028</nobr> </td> <td align="left"> <nobr>data/soap3.xml</nobr> </td> </tr> <tr> <td align="right">soap4.xml</td> <td align="right"> <nobr>3.133</nobr> </td> <td align="left"> <nobr>data/soap4.xml</nobr> </td> </tr> <tr> <td align="right">db10.xml</td> <td align="right"> <nobr>0.049</nobr> </td> <td align="left"> <nobr>data/db10.xml</nobr> </td> </tr> <tr> <td align="right">db50.xml</td> <td align="right"> <nobr>0.207</nobr> </td> <td align="left"> <nobr>data/db50.xml</nobr> </td> </tr> <tr> <td align="right">db100.xml</td> <td align="right"> <nobr>0.410</nobr> </td> <td align="left"> <nobr>data/db100.xml</nobr> </td> </tr> <tr> <td align="right">db500.xml</td> <td align="right"> <nobr>2.034</nobr> </td> <td align="left"> <nobr>data/db500.xml</nobr> </td> </tr> <tr> <td align="right">db1000.xml</td> <td align="right"> <nobr>5.473</nobr> </td> <td align="left"> <nobr>data/db1000.xml</nobr> </td> </tr> <tr> <td align="right">db10000.xml</td> <td align="right"> <nobr>60.034</nobr> </td> <td align="left"> <nobr>data/db10000.xml</nobr> </td> </tr> <tr> <td align="right">xsl1.xml</td> <td align="right"> <nobr>0.037</nobr> </td> <td align="left"> <nobr>data/xsl1.xml</nobr> </td> </tr> <tr> <td align="right">xsl2.xml</td> <td align="right"> <nobr>0.175</nobr> </td> <td align="left"> <nobr>data/xsl2.xml</nobr> </td> </tr> <tr> <td align="right">xsl3.xml</td> <td align="right"> <nobr>0.567</nobr> </td> <td align="left"> <nobr>data/xsl3.xml</nobr> </td> </tr> <tr> <td align="right">xsl4.xml</td> <td align="right"> <nobr>11.067</nobr> </td> <td align="left"> <nobr>data/xsl4.xml</nobr> </td> </tr> <tr> <td align="right">periodic.xml</td> <td align="right"> <nobr>1.925</nobr> </td> <td align="left"> <nobr>data/periodic.xml</nobr> </td> </tr> <tr> <td align="right">weblog.xml</td> <td align="right"> <nobr>68.896</nobr> </td> <td align="left"> <nobr>data/weblog.xml</nobr> </td> </tr> <tr> <td align="right">factbook.xml</td> <td align="right"> <nobr>58.955</nobr> </td> <td align="left"> <nobr>data/factbook.xml</nobr> </td> </tr> </tbody> </table> <br/> <h2>Driver: FastInfosetDOM24IndexedContentDriver</h2> <p> <ul> <li>jdsl.attributeValueSizeLimit: 24</li> <li>jdsl.characterContentChunkSizeLimit: 24</li> <li>jdsl.externalVocabulary: n/a</li> </ul> </p> <table width="80%" border="1"> <thead> <tr> <th> <b>testCase</b> </th> <th> <b>resultValue</b> </th> <th> <b>xmlfile</b> </th> </tr> </thead> <tbody> <tr> <td align="right">inv1.xml</td> <td align="right"> <nobr>0.123</nobr> </td> <td align="left"> <nobr>data/inv1.xml</nobr> </td> </tr> <tr> <td align="right">inv10.xml</td> <td align="right"> <nobr>0.247</nobr> </td> <td align="left"> <nobr>data/inv10.xml</nobr> </td> </tr> <tr> <td align="right">inv50.xml</td> <td align="right"> <nobr>0.801</nobr> </td> <td align="left"> <nobr>data/inv50.xml</nobr> </td> </tr> <tr> <td align="right">inv100.xml</td> <td align="right"> <nobr>1.511</nobr> </td> <td align="left"> <nobr>data/inv100.xml</nobr> </td> </tr> <tr> <td align="right">inv500.xml</td> <td align="right"> <nobr>9.842</nobr> </td> <td align="left"> <nobr>data/inv500.xml</nobr> </td> </tr> <tr> <td align="right">inv1000.xml</td> <td align="right"> <nobr>19.648</nobr> </td> <td align="left"> <nobr>data/inv1000.xml</nobr> </td> </tr> <tr> <td align="right">soap1.xml</td> <td align="right"> <nobr>0.024</nobr> </td> <td align="left"> <nobr>data/soap1.xml</nobr> </td> </tr> <tr> <td align="right">soap2.xml</td> <td align="right"> <nobr>0.028</nobr> </td> <td align="left"> <nobr>data/soap2.xml</nobr> </td> </tr> <tr> <td align="right">soap3.xml</td> <td align="right"> <nobr>0.029</nobr> </td> <td align="left"> <nobr>data/soap3.xml</nobr> </td> </tr> <tr> <td align="right">soap4.xml</td> <td align="right"> <nobr>3.164</nobr> </td> <td align="left"> <nobr>data/soap4.xml</nobr> </td> </tr> <tr> <td align="right">db10.xml</td> <td align="right"> <nobr>0.051</nobr> </td> <td align="left"> <nobr>data/db10.xml</nobr> </td> </tr> <tr> <td align="right">db50.xml</td> <td align="right"> <nobr>0.222</nobr> </td> <td align="left"> <nobr>data/db50.xml</nobr> </td> </tr> <tr> <td align="right">db100.xml</td> <td align="right"> <nobr>0.434</nobr> </td> <td align="left"> <nobr>data/db100.xml</nobr> </td> </tr> <tr> <td align="right">db500.xml</td> <td align="right"> <nobr>2.081</nobr> </td> <td align="left"> <nobr>data/db500.xml</nobr> </td> </tr> <tr> <td align="right">db1000.xml</td> <td align="right"> <nobr>5.551</nobr> </td> <td align="left"> <nobr>data/db1000.xml</nobr> </td> </tr> <tr> <td align="right">db10000.xml</td> <td align="right"> <nobr>57.967</nobr> </td> <td align="left"> <nobr>data/db10000.xml</nobr> </td> </tr> <tr> <td align="right">xsl1.xml</td> <td align="right"> <nobr>0.040</nobr> </td> <td align="left"> <nobr>data/xsl1.xml</nobr> </td> </tr> <tr> <td align="right">xsl2.xml</td> <td align="right"> <nobr>0.176</nobr> </td> <td align="left"> <nobr>data/xsl2.xml</nobr> </td> </tr> <tr> <td align="right">xsl3.xml</td> <td align="right"> <nobr>0.560</nobr> </td> <td align="left"> <nobr>data/xsl3.xml</nobr> </td> </tr> <tr> <td align="right">xsl4.xml</td> <td align="right"> <nobr>11.448</nobr> </td> <td align="left"> <nobr>data/xsl4.xml</nobr> </td> </tr> <tr> <td align="right">periodic.xml</td> <td align="right"> <nobr>2.043</nobr> </td> <td align="left"> <nobr>data/periodic.xml</nobr> </td> </tr> <tr> <td align="right">weblog.xml</td> <td align="right"> <nobr>71.351</nobr> </td> <td align="left"> <nobr>data/weblog.xml</nobr> </td> </tr> <tr> <td align="right">factbook.xml</td> <td align="right"> <nobr>65.148</nobr> </td> <td align="left"> <nobr>data/factbook.xml</nobr> </td> </tr> </tbody> </table> <br/> <h2>Driver: FastInfosetDOMExtVocab24IndexedContentDriver</h2> <p> <ul> <li>jdsl.attributeValueSizeLimit: 24</li> <li>jdsl.characterContentChunkSizeLimit: 24</li> <li>jdsl.externalVocabulary: true</li> </ul> </p> <table width="80%" border="1"> <thead> <tr> <th> <b>testCase</b> </th> <th> <b>resultValue</b> </th> <th> <b>xmlfile</b> </th> </tr> </thead> <tbody> <tr> <td align="right">inv1.xml</td> <td align="right"> <nobr>0.090</nobr> </td> <td align="left"> <nobr>data/inv1.xml</nobr> </td> </tr> <tr> <td align="right">inv10.xml</td> <td align="right"> <nobr>0.209</nobr> </td> <td align="left"> <nobr>data/inv10.xml</nobr> </td> </tr> <tr> <td align="right">inv50.xml</td> <td align="right"> <nobr>0.742</nobr> </td> <td align="left"> <nobr>data/inv50.xml</nobr> </td> </tr> <tr> <td align="right">inv100.xml</td> <td align="right"> <nobr>1.408</nobr> </td> <td align="left"> <nobr>data/inv100.xml</nobr> </td> </tr> <tr> <td align="right">inv500.xml</td> <td align="right"> <nobr>9.339</nobr> </td> <td align="left"> <nobr>data/inv500.xml</nobr> </td> </tr> <tr> <td align="right">inv1000.xml</td> <td align="right"> <nobr>19.285</nobr> </td> <td align="left"> <nobr>data/inv1000.xml</nobr> </td> </tr> <tr> <td align="right">soap1.xml</td> <td align="right"> <nobr>0.014</nobr> </td> <td align="left"> <nobr>data/soap1.xml</nobr> </td> </tr> <tr> <td align="right">soap2.xml</td> <td align="right"> <nobr>0.012</nobr> </td> <td align="left"> <nobr>data/soap2.xml</nobr> </td> </tr> <tr> <td align="right">soap3.xml</td> <td align="right"> <nobr>0.014</nobr> </td> <td align="left"> <nobr>data/soap3.xml</nobr> </td> </tr> <tr> <td align="right">soap4.xml</td> <td align="right"> <nobr>2.887</nobr> </td> <td align="left"> <nobr>data/soap4.xml</nobr> </td> </tr> <tr> <td align="right">db10.xml</td> <td align="right"> <nobr>0.043</nobr> </td> <td align="left"> <nobr>data/db10.xml</nobr> </td> </tr> <tr> <td align="right">db50.xml</td> <td align="right"> <nobr>0.201</nobr> </td> <td align="left"> <nobr>data/db50.xml</nobr> </td> </tr> <tr> <td align="right">db100.xml</td> <td align="right"> <nobr>0.401</nobr> </td> <td align="left"> <nobr>data/db100.xml</nobr> </td> </tr> <tr> <td align="right">db500.xml</td> <td align="right"> <nobr>1.952</nobr> </td> <td align="left"> <nobr>data/db500.xml</nobr> </td> </tr> <tr> <td align="right">db1000.xml</td> <td align="right"> <nobr>5.246</nobr> </td> <td align="left"> <nobr>data/db1000.xml</nobr> </td> </tr> <tr> <td align="right">db10000.xml</td> <td align="right"> <nobr>62.476</nobr> </td> <td align="left"> <nobr>data/db10000.xml</nobr> </td> </tr> <tr> <td align="right">xsl1.xml</td> <td align="right"> <nobr>0.014</nobr> </td> <td align="left"> <nobr>data/xsl1.xml</nobr> </td> </tr> <tr> <td align="right">xsl2.xml</td> <td align="right"> <nobr>0.139</nobr> </td> <td align="left"> <nobr>data/xsl2.xml</nobr> </td> </tr> <tr> <td align="right">xsl3.xml</td> <td align="right"> <nobr>0.513</nobr> </td> <td align="left"> <nobr>data/xsl3.xml</nobr> </td> </tr> <tr> <td align="right">xsl4.xml</td> <td align="right"> <nobr>11.289</nobr> </td> <td align="left"> <nobr>data/xsl4.xml</nobr> </td> </tr> <tr> <td align="right">periodic.xml</td> <td align="right"> <nobr>1.952</nobr> </td> <td align="left"> <nobr>data/periodic.xml</nobr> </td> </tr> <tr> <td align="right">weblog.xml</td> <td align="right"> <nobr>72.356</nobr> </td> <td align="left"> <nobr>data/weblog.xml</nobr> </td> </tr> <tr> <td align="right">factbook.xml</td> <td align="right"> <nobr>61.988</nobr> </td> <td align="left"> <nobr>data/factbook.xml</nobr> </td> </tr> </tbody> </table> <br/> <h2>Driver: XercesDOMXercesXMLSerializerDriver</h2> <p> <ul> <li>jdsl.attributeValueSizeLimit: n/a</li> <li>jdsl.characterContentChunkSizeLimit: n/a</li> <li>jdsl.externalVocabulary: n/a</li> </ul> </p> <table width="80%" border="1"> <thead> <tr> <th> <b>testCase</b> </th> <th> <b>resultValue</b> </th> <th> <b>xmlfile</b> </th> </tr> </thead> <tbody> <tr> <td align="right">inv1.xml</td> <td align="right"> <nobr>0.158</nobr> </td> <td align="left"> <nobr>data/inv1.xml</nobr> </td> </tr> <tr> <td align="right">inv10.xml</td> <td align="right"> <nobr>0.377</nobr> </td> <td align="left"> <nobr>data/inv10.xml</nobr> </td> </tr> <tr> <td align="right">inv50.xml</td> <td align="right"> <nobr>1.358</nobr> </td> <td align="left"> <nobr>data/inv50.xml</nobr> </td> </tr> <tr> <td align="right">inv100.xml</td> <td align="right"> <nobr>2.592</nobr> </td> <td align="left"> <nobr>data/inv100.xml</nobr> </td> </tr> <tr> <td align="right">inv500.xml</td> <td align="right"> <nobr>15.100</nobr> </td> <td align="left"> <nobr>data/inv500.xml</nobr> </td> </tr> <tr> <td align="right">inv1000.xml</td> <td align="right"> <nobr>30.568</nobr> </td> <td align="left"> <nobr>data/inv1000.xml</nobr> </td> </tr> <tr> <td align="right">soap1.xml</td> <td align="right"> <nobr>0.040</nobr> </td> <td align="left"> <nobr>data/soap1.xml</nobr> </td> </tr> <tr> <td align="right">soap2.xml</td> <td align="right"> <nobr>0.042</nobr> </td> <td align="left"> <nobr>data/soap2.xml</nobr> </td> </tr> <tr> <td align="right">soap3.xml</td> <td align="right"> <nobr>0.046</nobr> </td> <td align="left"> <nobr>data/soap3.xml</nobr> </td> </tr> <tr> <td align="right">soap4.xml</td> <td align="right"> <nobr>4.801</nobr> </td> <td align="left"> <nobr>data/soap4.xml</nobr> </td> </tr> <tr> <td align="right">db10.xml</td> <td align="right"> <nobr>0.078</nobr> </td> <td align="left"> <nobr>data/db10.xml</nobr> </td> </tr> <tr> <td align="right">db50.xml</td> <td align="right"> <nobr>0.329</nobr> </td> <td align="left"> <nobr>data/db50.xml</nobr> </td> </tr> <tr> <td align="right">db100.xml</td> <td align="right"> <nobr>0.647</nobr> </td> <td align="left"> <nobr>data/db100.xml</nobr> </td> </tr> <tr> <td align="right">db500.xml</td> <td align="right"> <nobr>3.180</nobr> </td> <td align="left"> <nobr>data/db500.xml</nobr> </td> </tr> <tr> <td align="right">db1000.xml</td> <td align="right"> <nobr>7.617</nobr> </td> <td align="left"> <nobr>data/db1000.xml</nobr> </td> </tr> <tr> <td align="right">db10000.xml</td> <td align="right"> <nobr>76.696</nobr> </td> <td align="left"> <nobr>data/db10000.xml</nobr> </td> </tr> <tr> <td align="right">xsl1.xml</td> <td align="right"> <nobr>0.038</nobr> </td> <td align="left"> <nobr>data/xsl1.xml</nobr> </td> </tr> <tr> <td align="right">xsl2.xml</td> <td align="right"> <nobr>0.285</nobr> </td> <td align="left"> <nobr>data/xsl2.xml</nobr> </td> </tr> <tr> <td align="right">xsl3.xml</td> <td align="right"> <nobr>0.988</nobr> </td> <td align="left"> <nobr>data/xsl3.xml</nobr> </td> </tr> <tr> <td align="right">xsl4.xml</td> <td align="right"> <nobr>19.432</nobr> </td> <td align="left"> <nobr>data/xsl4.xml</nobr> </td> </tr> <tr> <td align="right">periodic.xml</td> <td align="right"> <nobr>4.164</nobr> </td> <td align="left"> <nobr>data/periodic.xml</nobr> </td> </tr> <tr> <td align="right">weblog.xml</td> <td align="right"> <nobr>136.872</nobr> </td> <td align="left"> <nobr>data/weblog.xml</nobr> </td> </tr> <tr> <td align="right">factbook.xml</td> <td align="right"> <nobr>177.500</nobr> </td> <td align="left"> <nobr>data/factbook.xml</nobr> </td> </tr> </tbody> </table> <br/> <h2>Results Per Test</h2> <br/> <center> <img src="testcase0.jpg"/> </center> <br/> <br/> <center> <img src="testcase1.jpg"/> </center> <br/> <br/> <center> <img src="testcase2.jpg"/> </center> <br/> <br/> <center> <img src="testcase3.jpg"/> </center> <br/> <br/> <center> <img src="testcase4.jpg"/> </center> <br/> <br/> <br/> <small> <hr/> <font size="-2"> Generated using <a href="https://japex.dev.java.net">Japex</a> version 1.00</font> </small> </body> </html>
aadamowski/fi.java.net
www/performance-reports/General/serialize/report.html
HTML
apache-2.0
18,005
/** * @author caspar - chengzhihang * @contact 279397942@qq.com * @date 2016/12/29 * @file admin/view-partial/main/order/widget/form/value-widget/TpNameText */ define([ 'zh/widget/text/ValidationTextBox', 'admin/services/enums/OrderPropertyEnum', "dojo/_base/declare" ], function (TextBox, OrderPropertyEnum, declare) { return declare('admin/view-partial/main/order/widget/form/value-widget/TpNameText', [TextBox], { label: OrderPropertyEnum.TpName.text, name: OrderPropertyEnum.TpName.id, placeHolder: OrderPropertyEnum.TpName.text, }); });
Caspar12/zh.sw
zh-site-manager-web-ui-admin/target/classes/static/app/admin/view-partial/main/order/widget/form/value-widget/TpNameText.js
JavaScript
apache-2.0
590
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache license, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the license for the specific language governing permissions and * limitations under the license. */ package org.apache.logging.log4j.core.pattern; import java.util.Calendar; import java.util.HashMap; import java.util.List; import java.util.Map; import org.apache.logging.log4j.Level; import org.apache.logging.log4j.MarkerManager; import org.apache.logging.log4j.core.LogEvent; import org.apache.logging.log4j.core.Logger; import org.apache.logging.log4j.core.LoggerContext; import org.apache.logging.log4j.core.config.Configuration; import org.apache.logging.log4j.core.config.NullConfiguration; import org.apache.logging.log4j.core.impl.Log4jLogEvent; import org.apache.logging.log4j.core.util.DummyNanoClock; import org.apache.logging.log4j.core.util.SystemNanoClock; import org.apache.logging.log4j.message.SimpleMessage; import org.apache.logging.log4j.util.Strings; import org.junit.Before; import org.junit.Test; import static org.junit.Assert.*; /** * */ public class PatternParserTest { static String OUTPUT_FILE = "output/PatternParser"; static String WITNESS_FILE = "witness/PatternParser"; LoggerContext ctx = LoggerContext.getContext(); Logger root = ctx.getRootLogger(); private static String msgPattern = "%m%n"; private final String mdcMsgPattern1 = "%m : %X%n"; private final String mdcMsgPattern2 = "%m : %X{key1}%n"; private final String mdcMsgPattern3 = "%m : %X{key2}%n"; private final String mdcMsgPattern4 = "%m : %X{key3}%n"; private final String mdcMsgPattern5 = "%m : %X{key1},%X{key2},%X{key3}%n"; private static String badPattern = "[%d{yyyyMMdd HH:mm:ss,SSS] %-5p [%c{10}] - %m%n"; private static String customPattern = "[%d{yyyyMMdd HH:mm:ss,SSS}] %-5p [%-25.25c{1}:%-4L] - %m%n"; private static String patternTruncateFromEnd = "%d; %-5p %5.-5c %m%n"; private static String patternTruncateFromBeginning = "%d; %-5p %5.5c %m%n"; private static String nestedPatternHighlight = "%highlight{%d{dd MMM yyyy HH:mm:ss,SSS}{GMT+0} [%t] %-5level: %msg%n%throwable}"; private static final String KEY = "Converter"; private PatternParser parser; @Before public void setup() { parser = new PatternParser(KEY); } private void validateConverter(final List<PatternFormatter> formatter, final int index, final String name) { final PatternConverter pc = formatter.get(index).getConverter(); assertEquals("Incorrect converter " + pc.getName() + " at index " + index + " expected " + name, pc.getName(), name); } /** * Test the default pattern */ @Test public void defaultPattern() { final List<PatternFormatter> formatters = parser.parse(msgPattern); assertNotNull(formatters); assertTrue(formatters.size() == 2); validateConverter(formatters, 0, "Message"); validateConverter(formatters, 1, "Line Sep"); } /** * Test the custom pattern */ @Test public void testCustomPattern() { final List<PatternFormatter> formatters = parser.parse(customPattern); assertNotNull(formatters); final Map<String, String> mdc = new HashMap<>(); mdc.put("loginId", "Fred"); final Throwable t = new Throwable(); final StackTraceElement[] elements = t.getStackTrace(); final Log4jLogEvent event = Log4jLogEvent.newBuilder() // .setLoggerName("org.apache.logging.log4j.PatternParserTest") // .setMarker(MarkerManager.getMarker("TEST")) // .setLoggerFqcn(Logger.class.getName()) // .setLevel(Level.INFO) // .setMessage(new SimpleMessage("Hello, world")) // .setContextMap(mdc) // .setThreadName("Thread1") // .setSource(elements[0]) .setTimeMillis(System.currentTimeMillis()).build(); final StringBuilder buf = new StringBuilder(); for (final PatternFormatter formatter : formatters) { formatter.format(event, buf); } final String str = buf.toString(); final String expected = "INFO [PatternParserTest :100 ] - Hello, world" + Strings.LINE_SEPARATOR; assertTrue("Expected to end with: " + expected + ". Actual: " + str, str.endsWith(expected)); } @Test public void testPatternTruncateFromBeginning() { final List<PatternFormatter> formatters = parser.parse(patternTruncateFromBeginning); assertNotNull(formatters); final LogEvent event = Log4jLogEvent.newBuilder() // .setLoggerName("org.apache.logging.log4j.PatternParserTest") // .setLoggerFqcn(Logger.class.getName()) // .setLevel(Level.INFO) // .setMessage(new SimpleMessage("Hello, world")) // .setThreadName("Thread1") // .setTimeMillis(System.currentTimeMillis()) // .build(); final StringBuilder buf = new StringBuilder(); for (final PatternFormatter formatter : formatters) { formatter.format(event, buf); } final String str = buf.toString(); final String expected = "INFO rTest Hello, world" + Strings.LINE_SEPARATOR; assertTrue("Expected to end with: " + expected + ". Actual: " + str, str.endsWith(expected)); } @Test public void testPatternTruncateFromEnd() { final List<PatternFormatter> formatters = parser.parse(patternTruncateFromEnd); assertNotNull(formatters); final LogEvent event = Log4jLogEvent.newBuilder() // .setLoggerName("org.apache.logging.log4j.PatternParserTest") // .setLoggerFqcn(Logger.class.getName()) // .setLevel(Level.INFO) // .setMessage(new SimpleMessage("Hello, world")) // .setThreadName("Thread1") // .setTimeMillis(System.currentTimeMillis()) // .build(); final StringBuilder buf = new StringBuilder(); for (final PatternFormatter formatter : formatters) { formatter.format(event, buf); } final String str = buf.toString(); final String expected = "INFO org.a Hello, world" + Strings.LINE_SEPARATOR; assertTrue("Expected to end with: " + expected + ". Actual: " + str, str.endsWith(expected)); } @Test public void testBadPattern() { final Calendar cal = Calendar.getInstance(); cal.set(2001, Calendar.FEBRUARY, 3, 4, 5, 6); cal.set(Calendar.MILLISECOND, 789); final long timestamp = cal.getTimeInMillis(); final List<PatternFormatter> formatters = parser.parse(badPattern); assertNotNull(formatters); final Throwable t = new Throwable(); final StackTraceElement[] elements = t.getStackTrace(); final LogEvent event = Log4jLogEvent.newBuilder() // .setLoggerName("a.b.c") // .setLoggerFqcn(Logger.class.getName()) // .setLevel(Level.INFO) // .setMessage(new SimpleMessage("Hello, world")) // .setThreadName("Thread1") // .setSource(elements[0]) // .setTimeMillis(timestamp) // .build(); final StringBuilder buf = new StringBuilder(); for (final PatternFormatter formatter : formatters) { formatter.format(event, buf); } final String str = buf.toString(); // eats all characters until the closing '}' character final String expected = "[2001-02-03 04:05:06,789] - Hello, world"; assertTrue("Expected to start with: " + expected + ". Actual: " + str, str.startsWith(expected)); } @Test public void testNestedPatternHighlight() { testNestedPatternHighlight(Level.TRACE, "\u001B[30m"); testNestedPatternHighlight(Level.DEBUG, "\u001B[36m"); testNestedPatternHighlight(Level.INFO, "\u001B[32m"); testNestedPatternHighlight(Level.WARN, "\u001B[33m"); testNestedPatternHighlight(Level.ERROR, "\u001B[1;31m"); testNestedPatternHighlight(Level.FATAL, "\u001B[1;31m"); } private void testNestedPatternHighlight(final Level level, final String expectedStart) { final List<PatternFormatter> formatters = parser.parse(nestedPatternHighlight); assertNotNull(formatters); final Throwable t = new Throwable(); t.getStackTrace(); final LogEvent event = Log4jLogEvent.newBuilder() // .setLoggerName("org.apache.logging.log4j.PatternParserTest") // .setMarker(MarkerManager.getMarker("TEST")) // .setLoggerFqcn(Logger.class.getName()) // .setLevel(level) // .setMessage(new SimpleMessage("Hello, world")) // .setThreadName("Thread1") // .setSource(/*stackTraceElement[0]*/ null) // .setTimeMillis(System.currentTimeMillis()) // .build(); final StringBuilder buf = new StringBuilder(); for (final PatternFormatter formatter : formatters) { formatter.format(event, buf); } final String str = buf.toString(); final String expectedEnd = String.format("] %-5s: Hello, world%s\u001B[m", level, Strings.LINE_SEPARATOR); assertTrue("Expected to start with: " + expectedStart + ". Actual: " + str, str.startsWith(expectedStart)); assertTrue("Expected to end with: \"" + expectedEnd + "\". Actual: \"" + str, str.endsWith(expectedEnd)); } @Test public void testNanoPatternShort() { final List<PatternFormatter> formatters = parser.parse("%N"); assertNotNull(formatters); assertEquals(1, formatters.size()); assertTrue(formatters.get(0).getConverter() instanceof NanoTimePatternConverter); } @Test public void testNanoPatternLong() { final List<PatternFormatter> formatters = parser.parse("%nano"); assertNotNull(formatters); assertEquals(1, formatters.size()); assertTrue(formatters.get(0).getConverter() instanceof NanoTimePatternConverter); } @Test public void testThreadNamePattern() { testThreadNamePattern("%thread"); } @Test public void testThreadNameFullPattern() { testThreadNamePattern("%threadName"); } @Test public void testThreadIdFullPattern() { testThreadIdPattern("%threadId"); } @Test public void testThreadIdShortPattern1() { testThreadIdPattern("%tid"); } @Test public void testThreadIdShortPattern2() { testThreadIdPattern("%T"); } @Test public void testThreadPriorityShortPattern() { testThreadPriorityPattern("%tp"); } @Test public void testThreadPriorityFullPattern() { testThreadPriorityPattern("%threadPriority"); } private void testThreadIdPattern(final String pattern) { testFirstConverter(pattern, ThreadIdPatternConverter.class); } private void testThreadNamePattern(final String pattern) { testFirstConverter(pattern, ThreadNamePatternConverter.class); } private void testThreadPriorityPattern(final String pattern) { testFirstConverter(pattern, ThreadPriorityPatternConverter.class); } private void testFirstConverter(final String pattern, final Class<?> checkClass) { final List<PatternFormatter> formatters = parser.parse(pattern); assertNotNull(formatters); final String msg = formatters.toString(); assertEquals(msg, 1, formatters.size()); assertTrue(msg, checkClass.isInstance(formatters.get(0).getConverter())); } @Test public void testThreadNameShortPattern() { testThreadNamePattern("%t"); } @Test public void testNanoPatternShortChangesConfigurationNanoClock() { final Configuration config = new NullConfiguration(); assertTrue(config.getNanoClock() instanceof DummyNanoClock); final PatternParser pp = new PatternParser(config, KEY, null); assertTrue(config.getNanoClock() instanceof DummyNanoClock); pp.parse("%m"); assertTrue(config.getNanoClock() instanceof DummyNanoClock); pp.parse("%nano"); // this changes the config clock assertTrue(config.getNanoClock() instanceof SystemNanoClock); } @Test public void testNanoPatternLongChangesNanoClockFactoryMode() { final Configuration config = new NullConfiguration(); assertTrue(config.getNanoClock() instanceof DummyNanoClock); final PatternParser pp = new PatternParser(config, KEY, null); assertTrue(config.getNanoClock() instanceof DummyNanoClock); pp.parse("%m"); assertTrue(config.getNanoClock() instanceof DummyNanoClock); pp.parse("%N"); assertTrue(config.getNanoClock() instanceof SystemNanoClock); } }
codescale/logging-log4j2
log4j-core/src/test/java/org/apache/logging/log4j/core/pattern/PatternParserTest.java
Java
apache-2.0
13,711
import logging import threading import time from ballast.discovery import ServerList from ballast.rule import Rule, RoundRobinRule from ballast.ping import ( Ping, SocketPing, PingStrategy, SerialPingStrategy ) class LoadBalancer(object): DEFAULT_PING_INTERVAL = 30 MAX_PING_TIME = 3 def __init__(self, server_list, rule=None, ping_strategy=None, ping=None, ping_on_start=True): assert isinstance(server_list, ServerList) assert rule is None or isinstance(rule, Rule) assert ping_strategy is None or isinstance(ping_strategy, PingStrategy) assert ping is None or isinstance(ping, Ping) # some locks for thread-safety self._lock = threading.Lock() self._server_lock = threading.Lock() self._rule = rule \ if rule is not None \ else RoundRobinRule() self._ping_strategy = ping_strategy \ if ping_strategy is not None \ else SerialPingStrategy() self._ping = ping \ if ping is not None \ else SocketPing() self.max_ping_time = self.MAX_PING_TIME self._ping_interval = self.DEFAULT_PING_INTERVAL self._server_list = server_list self._servers = set() self._stats = LoadBalancerStats() self._rule.load_balancer = self self._logger = logging.getLogger(self.__module__) # start our background worker # to periodically ping our servers self._ping_timer_running = False self._ping_timer = None if ping_on_start: self._start_ping_timer() @property def ping_interval(self): return self._ping_interval @ping_interval.setter def ping_interval(self, value): self._ping_interval = value if self._ping_timer_running: self._stop_ping_timer() self._start_ping_timer() @property def max_ping_time(self): if self._ping is None: return 0 return self._ping.max_ping_time @max_ping_time.setter def max_ping_time(self, value): if self._ping is not None: self._ping.max_ping_time = value @property def stats(self): return self._stats @property def servers(self): with self._server_lock: return set(self._servers) @property def reachable_servers(self): with self._server_lock: servers = set() for s in self._servers: if s.is_alive: servers.add(s) return servers def choose_server(self): # choose a server, will # throw if there are none server = self._rule.choose() return server def mark_server_down(self, server): self._logger.debug("Marking server down: %s", server) server._is_alive = False def ping(self, server=None): if server is None: self._ping_all_servers() else: is_alive = self._ping.is_alive(server) server._is_alive = is_alive def ping_async(self, server=None): if server is None: # self._ping_all_servers() t = threading.Thread(name='ballast-worker', target=self._ping_all_servers) t.daemon = True t.start() else: is_alive = self._ping.is_alive(server) server._is_alive = is_alive def _ping_all_servers(self): with self._server_lock: results = self._ping_strategy.ping( self._ping, self._server_list ) self._servers = set(results) def _start_ping_timer(self): with self._lock: if self._ping_timer_running: self._logger.debug("Background pinger already running") return self._ping_timer_running = True self._ping_timer = threading.Thread(name='ballast-worker', target=self._ping_loop) self._ping_timer.daemon = True self._ping_timer.start() def _stop_ping_timer(self): with self._lock: self._ping_timer_running = False self._ping_timer = None def _ping_loop(self): while self._ping_timer_running: try: self._ping_all_servers() except BaseException as e: self._logger.error("There was an error pinging servers: %s", e) time.sleep(self._ping_interval) class LoadBalancerStats(object): def get_server_stats(self, server): pass
thomasstreet/ballast
ballast/core.py
Python
apache-2.0
4,607
import os, re, csv # regular expressions for capturing the interesting quantities noise_pattern = 'noise: \[(.+)\]' res_pattern = '^([0-9.]+$)' search_dir = "output" results_file = '../results.csv' os.chdir( search_dir ) files = filter( os.path.isfile, os.listdir( '.' )) #files = [ os.path.join( search_dir, f ) for f in files ] # add path to each file files.sort( key=lambda x: os.path.getmtime( x )) results = [] for file in files: f = open( file ) contents = f.read() # noise matches = re.search( noise_pattern, contents, re.DOTALL ) try: noise = matches.group( 1 ) noise = noise.strip() noise = noise.split() except AttributeError: print "noise error 1: %s" % ( contents ) continue # rmse matches = re.search( res_pattern, contents, re.M ) try: res = matches.group( 1 ) except AttributeError: print "matches error 2: %s" % ( contents ) continue results.append( [ res ] + noise ) writer = csv.writer( open( results_file, 'wb' )) for result in results: writer.writerow( result )
jiminliang/msda-denoising
spearmint_variable_noise/output2csv.py
Python
apache-2.0
1,028
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.ignite.internal.visor.verify; import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; import java.util.Collection; import java.util.Collections; import java.util.Map; import org.apache.ignite.internal.processors.cache.verify.PartitionKey; import org.apache.ignite.internal.util.typedef.internal.S; import org.apache.ignite.internal.util.typedef.internal.U; import org.apache.ignite.internal.visor.VisorDataTransferObject; import org.jetbrains.annotations.NotNull; /** * */ public class VisorValidateIndexesJobResult extends VisorDataTransferObject { /** */ private static final long serialVersionUID = 0L; /** Results of indexes validation from node. */ private Map<PartitionKey, ValidateIndexesPartitionResult> partRes; /** Results of reverse indexes validation from node. */ private Map<String, ValidateIndexesPartitionResult> idxRes; /** Integrity check issues. */ private Collection<IndexIntegrityCheckIssue> integrityCheckFailures; /** * @param partRes Results of indexes validation from node. * @param idxRes Results of reverse indexes validation from node. * @param integrityCheckFailures Collection of indexes integrity check failures. */ public VisorValidateIndexesJobResult( @NotNull Map<PartitionKey, ValidateIndexesPartitionResult> partRes, @NotNull Map<String, ValidateIndexesPartitionResult> idxRes, @NotNull Collection<IndexIntegrityCheckIssue> integrityCheckFailures ) { this.partRes = partRes; this.idxRes = idxRes; this.integrityCheckFailures = integrityCheckFailures; } /** * For externalization only. */ public VisorValidateIndexesJobResult() { } /** {@inheritDoc} */ @Override public byte getProtocolVersion() { return V3; } /** * @return Results of indexes validation from node. */ public Map<PartitionKey, ValidateIndexesPartitionResult> partitionResult() { return partRes; } /** * @return Results of reverse indexes validation from node. */ public Map<String, ValidateIndexesPartitionResult> indexResult() { return idxRes == null ? Collections.emptyMap() : idxRes; } /** * @return Collection of failed integrity checks. */ public Collection<IndexIntegrityCheckIssue> integrityCheckFailures() { return integrityCheckFailures == null ? Collections.emptyList() : integrityCheckFailures; } /** * @return {@code true} If any indexes issues found on node, otherwise returns {@code false}. */ public boolean hasIssues() { return (integrityCheckFailures != null && !integrityCheckFailures.isEmpty()) || (partRes != null && partRes.entrySet().stream().anyMatch(e -> !e.getValue().issues().isEmpty())) || (idxRes != null && idxRes.entrySet().stream().anyMatch(e -> !e.getValue().issues().isEmpty())); } /** {@inheritDoc} */ @Override protected void writeExternalData(ObjectOutput out) throws IOException { U.writeMap(out, partRes); U.writeMap(out, idxRes); U.writeCollection(out, integrityCheckFailures); } /** {@inheritDoc} */ @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException { partRes = U.readMap(in); if (protoVer >= V2) idxRes = U.readMap(in); if (protoVer >= V3) integrityCheckFailures = U.readCollection(in); } /** {@inheritDoc} */ @Override public String toString() { return S.toString(VisorValidateIndexesJobResult.class, this); } }
ptupitsyn/ignite
modules/core/src/main/java/org/apache/ignite/internal/visor/verify/VisorValidateIndexesJobResult.java
Java
apache-2.0
4,517
/* * (c) Copyright 2021 Micro Focus * All rights reserved. This program and the accompanying materials * are made available under the terms of the Apache License v2.0 which accompany this distribution. * * The Apache License is available at * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package io.cloudslang.content.active_directory.entities; import java.util.List; public interface CreateUserInputInterface { String getHost(); String getDistinguishedName(); String getUserCommonName(); String getUserPassword(); String getSAMAccountName(); String getUsername(); String getPassword(); String getProtocol(); Boolean getTrustAllRoots(); String getTrustKeystore(); String getTrustPassword(); Boolean getEscapeChars(); String getTimeout(); String getProxyHost(); int getProxyPort(); String getProxyUsername(); String getProxyPassword(); String getX509HostnameVerifier(); String getTlsVersion(); List<String> getAllowedCiphers(); }
CloudSlang/cs-actions
cs-active-directory/src/main/java/io/cloudslang/content/active_directory/entities/CreateUserInputInterface.java
Java
apache-2.0
1,364
/* Copyright 2019 The Vitess Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ /* This test makes sure encrypted transport over gRPC works. The security chains are setup the following way: * root CA * vttablet server CA * vttablet server instance cert/key * vttablet client CA * vttablet client 1 cert/key * vtgate server CA * vtgate server instance cert/key (common name is 'localhost') * vtgate client CA * vtgate client 1 cert/key * vtgate client 2 cert/key The following table shows all the checks we perform: process: will check its peer is signed by: for link: vttablet vttablet client CA vtgate -> vttablet vtgate vttablet server CA vtgate -> vttablet vtgate vtgate client CA client -> vtgate client vtgate server CA client -> vtgate Additionally, we have the following constraints: - the client certificate common name is used as immediate caller ID by vtgate, and forwarded to vttablet. This allows us to use table ACLs on the vttablet side. - the vtgate server certificate common name is set to 'localhost' so it matches the hostname dialed by the vtgate clients. This is not a requirement for the go client, that can set its expected server name. However, the python gRPC client doesn't have the ability to set the server name, so they must match. - the python client needs to have the full chain for the server validation (that is 'vtgate server CA' + 'root CA'). A go client doesn't. So we read both below when using the python client, but we only pass the intermediate cert to the go clients (for vtgate -> vttablet link). */ package encryptedtransport import ( "flag" "fmt" "io/ioutil" "os" "os/exec" "path" "testing" "vitess.io/vitess/go/test/endtoend/encryption" "vitess.io/vitess/go/vt/proto/vtrpc" "vitess.io/vitess/go/vt/vterrors" "context" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "vitess.io/vitess/go/test/endtoend/cluster" "vitess.io/vitess/go/vt/grpcclient" "vitess.io/vitess/go/vt/log" querypb "vitess.io/vitess/go/vt/proto/query" vtgatepb "vitess.io/vitess/go/vt/proto/vtgate" vtgateservicepb "vitess.io/vitess/go/vt/proto/vtgateservice" ) var ( clusterInstance *cluster.LocalProcessCluster createVtInsertTest = `create table vt_insert_test ( id bigint auto_increment, msg varchar(64), keyspace_id bigint(20) unsigned NOT NULL, primary key (id) ) Engine = InnoDB` keyspace = "test_keyspace" hostname = "localhost" shardName = "0" cell = "zone1" certDirectory string grpcCert = "" grpcKey = "" grpcCa = "" grpcName = "" ) func TestSecureTransport(t *testing.T) { defer cluster.PanicHandler(t) flag.Parse() // initialize cluster _, err := clusterSetUp(t) require.Nil(t, err, "setup failed") masterTablet := *clusterInstance.Keyspaces[0].Shards[0].Vttablets[0] replicaTablet := *clusterInstance.Keyspaces[0].Shards[0].Vttablets[1] // creating table_acl_config.json file tableACLConfigJSON := path.Join(certDirectory, "table_acl_config.json") f, err := os.Create(tableACLConfigJSON) require.NoError(t, err) _, err = f.WriteString(`{ "table_groups": [ { "table_names_or_prefixes": ["vt_insert_test"], "readers": ["vtgate client 1"], "writers": ["vtgate client 1"], "admins": ["vtgate client 1"] } ] }`) require.NoError(t, err) err = f.Close() require.NoError(t, err) // start the tablets for _, tablet := range []cluster.Vttablet{masterTablet, replicaTablet} { tablet.VttabletProcess.ExtraArgs = append(tablet.VttabletProcess.ExtraArgs, "-table-acl-config", tableACLConfigJSON, "-queryserver-config-strict-table-acl") tablet.VttabletProcess.ExtraArgs = append(tablet.VttabletProcess.ExtraArgs, serverExtraArguments("vttablet-server-instance", "vttablet-client")...) err = tablet.VttabletProcess.Setup() require.NoError(t, err) } // setup replication var vtctlClientArgs []string vtctlClientTmArgs := append(vtctlClientArgs, tmclientExtraArgs("vttablet-client-1")...) // Reparenting vtctlClientArgs = append(vtctlClientTmArgs, "InitShardMaster", "-force", "test_keyspace/0", masterTablet.Alias) err = clusterInstance.VtctlProcess.ExecuteCommand(vtctlClientArgs...) require.NoError(t, err) // Apply schema var vtctlApplySchemaArgs = append(vtctlClientTmArgs, "ApplySchema", "-sql", createVtInsertTest, "test_keyspace") err = clusterInstance.VtctlProcess.ExecuteCommand(vtctlApplySchemaArgs...) require.NoError(t, err) for _, tablet := range []cluster.Vttablet{masterTablet, replicaTablet} { var vtctlTabletArgs []string vtctlTabletArgs = append(vtctlTabletArgs, tmclientExtraArgs("vttablet-client-1")...) vtctlTabletArgs = append(vtctlTabletArgs, "RunHealthCheck", tablet.Alias) _, err = clusterInstance.VtctlProcess.ExecuteCommandWithOutput(vtctlTabletArgs...) require.NoError(t, err) } // start vtgate clusterInstance.VtGateExtraArgs = append(clusterInstance.VtGateExtraArgs, tabletConnExtraArgs("vttablet-client-1")...) clusterInstance.VtGateExtraArgs = append(clusterInstance.VtGateExtraArgs, serverExtraArguments("vtgate-server-instance", "vtgate-client")...) err = clusterInstance.StartVtgate() require.NoError(t, err) grpcAddress := fmt.Sprintf("%s:%d", "localhost", clusterInstance.VtgateProcess.GrpcPort) // 'vtgate client 1' is authorized to access vt_insert_test setCreds(t, "vtgate-client-1", "vtgate-server") ctx := context.Background() request := getRequest("select * from vt_insert_test") vc, err := getVitessClient(grpcAddress) require.NoError(t, err) qr, err := vc.Execute(ctx, request) require.NoError(t, err) err = vterrors.FromVTRPC(qr.Error) require.NoError(t, err) // 'vtgate client 2' is not authorized to access vt_insert_test setCreds(t, "vtgate-client-2", "vtgate-server") request = getRequest("select * from vt_insert_test") vc, err = getVitessClient(grpcAddress) require.NoError(t, err) qr, err = vc.Execute(ctx, request) require.NoError(t, err) err = vterrors.FromVTRPC(qr.Error) require.Error(t, err) assert.Contains(t, err.Error(), "table acl error") assert.Contains(t, err.Error(), "cannot run Select on table") // now restart vtgate in the mode where we don't use SSL // for client connections, but we copy effective caller id // into immediate caller id. clusterInstance.VtGateExtraArgs = []string{"-grpc_use_effective_callerid"} clusterInstance.VtGateExtraArgs = append(clusterInstance.VtGateExtraArgs, tabletConnExtraArgs("vttablet-client-1")...) err = clusterInstance.RestartVtgate() require.NoError(t, err) grpcAddress = fmt.Sprintf("%s:%d", "localhost", clusterInstance.VtgateProcess.GrpcPort) setSSLInfoEmpty() // get vitess client vc, err = getVitessClient(grpcAddress) require.NoError(t, err) // test with empty effective caller Id request = getRequest("select * from vt_insert_test") qr, err = vc.Execute(ctx, request) require.NoError(t, err) err = vterrors.FromVTRPC(qr.Error) require.Error(t, err) assert.Contains(t, err.Error(), "table acl error") assert.Contains(t, err.Error(), "cannot run Select on table") // 'vtgate client 1' is authorized to access vt_insert_test callerID := &vtrpc.CallerID{ Principal: "vtgate client 1", } request = getRequestWithCallerID(callerID, "select * from vt_insert_test") qr, err = vc.Execute(ctx, request) require.NoError(t, err) err = vterrors.FromVTRPC(qr.Error) require.NoError(t, err) // 'vtgate client 2' is not authorized to access vt_insert_test callerID = &vtrpc.CallerID{ Principal: "vtgate client 2", } request = getRequestWithCallerID(callerID, "select * from vt_insert_test") qr, err = vc.Execute(ctx, request) require.NoError(t, err) err = vterrors.FromVTRPC(qr.Error) require.Error(t, err) assert.Contains(t, err.Error(), "table acl error") assert.Contains(t, err.Error(), "cannot run Select on table") clusterInstance.Teardown() } func clusterSetUp(t *testing.T) (int, error) { var mysqlProcesses []*exec.Cmd clusterInstance = cluster.NewCluster(cell, hostname) // Start topo server if err := clusterInstance.StartTopo(); err != nil { return 1, err } // create all certs log.Info("Creating certificates") certDirectory = path.Join(clusterInstance.TmpDirectory, "certs") _ = encryption.CreateDirectory(certDirectory, 0700) err := encryption.ExecuteVttlstestCommand("-root", certDirectory, "CreateCA") require.NoError(t, err) err = createSignedCert("ca", "01", "vttablet-server", "vttablet server CA") require.NoError(t, err) err = createSignedCert("ca", "02", "vttablet-client", "vttablet client CA") require.NoError(t, err) err = createSignedCert("ca", "03", "vtgate-server", "vtgate server CA") require.NoError(t, err) err = createSignedCert("ca", "04", "vtgate-client", "vtgate client CA") require.NoError(t, err) err = createSignedCert("vttablet-server", "01", "vttablet-server-instance", "vttablet server instance") require.NoError(t, err) err = createSignedCert("vttablet-client", "01", "vttablet-client-1", "vttablet client 1") require.NoError(t, err) err = createSignedCert("vtgate-server", "01", "vtgate-server-instance", "localhost") require.NoError(t, err) err = createSignedCert("vtgate-client", "01", "vtgate-client-1", "vtgate client 1") require.NoError(t, err) err = createSignedCert("vtgate-client", "02", "vtgate-client-2", "vtgate client 2") require.NoError(t, err) for _, keyspaceStr := range []string{keyspace} { KeyspacePtr := &cluster.Keyspace{Name: keyspaceStr} keyspace := *KeyspacePtr if err := clusterInstance.VtctlProcess.CreateKeyspace(keyspace.Name); err != nil { return 1, err } shard := &cluster.Shard{ Name: shardName, } for i := 0; i < 2; i++ { // instantiate vttablet object with reserved ports tablet := clusterInstance.NewVttabletInstance("replica", 0, cell) // Start Mysqlctl process tablet.MysqlctlProcess = *cluster.MysqlCtlProcessInstance(tablet.TabletUID, tablet.MySQLPort, clusterInstance.TmpDirectory) proc, err := tablet.MysqlctlProcess.StartProcess() if err != nil { return 1, err } mysqlProcesses = append(mysqlProcesses, proc) // start vttablet process tablet.VttabletProcess = cluster.VttabletProcessInstance(tablet.HTTPPort, tablet.GrpcPort, tablet.TabletUID, clusterInstance.Cell, shardName, keyspace.Name, clusterInstance.VtctldProcess.Port, tablet.Type, clusterInstance.TopoProcess.Port, clusterInstance.Hostname, clusterInstance.TmpDirectory, clusterInstance.VtTabletExtraArgs, clusterInstance.EnableSemiSync) tablet.Alias = tablet.VttabletProcess.TabletPath shard.Vttablets = append(shard.Vttablets, tablet) } keyspace.Shards = append(keyspace.Shards, *shard) clusterInstance.Keyspaces = append(clusterInstance.Keyspaces, keyspace) } for _, proc := range mysqlProcesses { err := proc.Wait() if err != nil { return 1, err } } return 0, nil } func createSignedCert(ca string, serial string, name string, commonName string) error { log.Infof("Creating signed cert and key %s", commonName) tmpProcess := exec.Command( "vttlstest", "-root", certDirectory, "CreateSignedCert", "-parent", ca, "-serial", serial, "-common_name", commonName, name) return tmpProcess.Run() } func serverExtraArguments(name string, ca string) []string { args := []string{"-grpc_cert", certDirectory + "/" + name + "-cert.pem", "-grpc_key", certDirectory + "/" + name + "-key.pem", "-grpc_ca", certDirectory + "/" + ca + "-cert.pem"} return args } func tmclientExtraArgs(name string) []string { ca := "vttablet-server" var args = []string{"-tablet_manager_grpc_cert", certDirectory + "/" + name + "-cert.pem", "-tablet_manager_grpc_key", certDirectory + "/" + name + "-key.pem", "-tablet_manager_grpc_ca", certDirectory + "/" + ca + "-cert.pem", "-tablet_manager_grpc_server_name", "vttablet server instance"} return args } func tabletConnExtraArgs(name string) []string { ca := "vttablet-server" args := []string{"-tablet_grpc_cert", certDirectory + "/" + name + "-cert.pem", "-tablet_grpc_key", certDirectory + "/" + name + "-key.pem", "-tablet_grpc_ca", certDirectory + "/" + ca + "-cert.pem", "-tablet_grpc_server_name", "vttablet server instance"} return args } func getVitessClient(addr string) (vtgateservicepb.VitessClient, error) { opt, err := grpcclient.SecureDialOption(grpcCert, grpcKey, grpcCa, grpcName) if err != nil { return nil, err } cc, err := grpcclient.Dial(addr, grpcclient.FailFast(false), opt) if err != nil { return nil, err } c := vtgateservicepb.NewVitessClient(cc) return c, nil } func setCreds(t *testing.T, name string, ca string) { f1, err := os.Open(path.Join(certDirectory, "ca-cert.pem")) require.NoError(t, err) b1, err := ioutil.ReadAll(f1) require.NoError(t, err) f2, err := os.Open(path.Join(certDirectory, ca+"-cert.pem")) require.NoError(t, err) b2, err := ioutil.ReadAll(f2) require.NoError(t, err) caContent := append(b1, b2...) fileName := "ca-" + name + ".pem" caVtgateClient := path.Join(certDirectory, fileName) f, err := os.Create(caVtgateClient) require.NoError(t, err) _, err = f.Write(caContent) require.NoError(t, err) grpcCa = caVtgateClient grpcKey = path.Join(certDirectory, name+"-key.pem") grpcCert = path.Join(certDirectory, name+"-cert.pem") err = f.Close() require.NoError(t, err) err = f2.Close() require.NoError(t, err) err = f1.Close() require.NoError(t, err) } func setSSLInfoEmpty() { grpcCa = "" grpcCert = "" grpcKey = "" grpcName = "" } func getSession() *vtgatepb.Session { return &vtgatepb.Session{ TargetString: "test_keyspace:0@master", } } func getRequestWithCallerID(callerID *vtrpc.CallerID, sql string) *vtgatepb.ExecuteRequest { session := getSession() return &vtgatepb.ExecuteRequest{ CallerId: callerID, Session: session, Query: &querypb.BoundQuery{ Sql: sql, }, } } func getRequest(sql string) *vtgatepb.ExecuteRequest { session := getSession() return &vtgatepb.ExecuteRequest{ Session: session, Query: &querypb.BoundQuery{ Sql: sql, }, } }
mahak/vitess
go/test/endtoend/encryption/encryptedtransport/encrypted_transport_test.go
GO
apache-2.0
14,700
--- title: "DEFINED" layout: "function" isPage: "true" link: "/warpscript/functions" desc: "Check whether or not a symbol is defined" categoryTree: ["reference","functions"] oldPath: ["30-functions","30-logic-structures","15-function_DEFINED.html.md"] category: "reference" --- The `DEFINED` function checks whether or not a symbol is defined. WarpScript commands: 42 'foo' STORE // STORE value 42 under symbol 'foo' 'foo' DEFINED 'bar' DEFINED Stack: TOP: false 1: true {% raw %} <warp10-warpscript-widget backend="{{backend}}" exec-endpoint="{{execEndpoint}}">42 'foo' STORE 'foo' DEFINED 'bar' DEFINED </warp10-warpscript-widget> {% endraw %} ## Unit test ## {% raw %} <warp10-warpscript-widget backend="{{backend}}" exec-endpoint="{{execEndpoint}}">42 'foo' STORE 'foo' DEFINED 'bar' DEFINED false == ASSERT true == ASSERT 'unit test successful' </warp10-warpscript-widget> {% endraw %}
slambour/www.warp10.io
reference/functions/function_DEFINED.md
Markdown
apache-2.0
947
import os import logging from mongodb_consistent_backup.Common import LocalCommand from mongodb_consistent_backup.Pipeline import PoolThread class TarThread(PoolThread): def __init__(self, backup_dir, output_file, compression='none', verbose=False, binary="tar"): super(TarThread, self).__init__(self.__class__.__name__, compression) self.compression_method = compression self.backup_dir = backup_dir self.output_file = output_file self.verbose = verbose self.binary = binary self._command = None def close(self, exit_code=None, frame=None): if self._command and not self.stopped: logging.debug("Stopping running tar command: %s" % self._command.command) del exit_code del frame self._command.close() self.stopped = True def run(self): if os.path.isdir(self.backup_dir): if not os.path.isfile(self.output_file): try: backup_base_dir = os.path.dirname(self.backup_dir) backup_base_name = os.path.basename(self.backup_dir) log_msg = "Archiving directory: %s" % self.backup_dir cmd_flags = ["-C", backup_base_dir, "-c", "-f", self.output_file, "--remove-files"] if self.do_gzip(): log_msg = "Archiving and compressing directory: %s" % self.backup_dir cmd_flags.append("-z") cmd_flags.append(backup_base_name) logging.info(log_msg) self.running = True self._command = LocalCommand(self.binary, cmd_flags, self.verbose) self.exit_code = self._command.run() except Exception, e: return self.result(False, "Failed archiving file: %s!" % self.output_file, e) finally: self.running = False self.stopped = True self.completed = True else: return self.result(False, "Output file: %s already exists!" % self.output_file, None) return self.result(True, "Archiving successful.", None) def result(self, success, message, error): return { "success": success, "message": message, "error": error, "directory": self.backup_dir, "exit_code": self.exit_code }
Percona-Lab/mongodb_consistent_backup
mongodb_consistent_backup/Archive/Tar/TarThread.py
Python
apache-2.0
2,555
/** * OLAT - Online Learning and Training<br> * http://www.olat.org * <p> * Licensed under the Apache License, Version 2.0 (the "License"); <br> * you may not use this file except in compliance with the License.<br> * You may obtain a copy of the License at * <p> * http://www.apache.org/licenses/LICENSE-2.0 * <p> * Unless required by applicable law or agreed to in writing,<br> * software distributed under the License is distributed on an "AS IS" BASIS, <br> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <br> * See the License for the specific language governing permissions and <br> * limitations under the License. * <p> * Copyright (c) since 2004 at Multimedia- & E-Learning Services (MELS),<br> * University of Zurich, Switzerland. * <p> */ package org.olat.presentation.group.area; import java.util.Iterator; import java.util.List; import org.apache.commons.lang.StringEscapeUtils; import org.olat.data.group.BusinessGroup; import org.olat.data.group.area.BGArea; import org.olat.data.group.area.BGAreaDao; import org.olat.data.group.area.BGAreaDaoImpl; import org.olat.data.group.context.BGContext; import org.olat.data.group.context.BGContextDao; import org.olat.data.group.context.BGContextDaoImpl; import org.olat.lms.activitylogging.LoggingResourceable; import org.olat.lms.activitylogging.ThreadLocalUserActivityLogger; import org.olat.lms.group.BusinessGroupService; import org.olat.lms.group.GroupLoggingAction; import org.olat.presentation.framework.core.UserRequest; import org.olat.presentation.framework.core.components.Component; import org.olat.presentation.framework.core.components.choice.Choice; import org.olat.presentation.framework.core.components.tabbedpane.TabbedPane; import org.olat.presentation.framework.core.components.velocity.VelocityContainer; import org.olat.presentation.framework.core.control.Controller; import org.olat.presentation.framework.core.control.WindowControl; import org.olat.presentation.framework.core.control.controller.BasicController; import org.olat.presentation.framework.core.translator.PackageTranslator; import org.olat.presentation.framework.core.translator.PackageUtil; import org.olat.presentation.framework.core.translator.Translator; import org.olat.system.event.Event; import org.olat.system.spring.CoreSpringFactory; /** * Description:<BR> * This controller can be used to edit the business grou area metadata and associate business groups to the business group area. * <P> * Initial Date: Aug 30, 2004 * * @author gnaegi */ public class BGAreaEditController extends BasicController { private static final String PACKAGE = PackageUtil.getPackageName(BGAreaEditController.class); private static final String VELOCITY_ROOT = PackageUtil.getPackageVelocityRoot(PACKAGE); // helpers private final Translator trans; // GUI components private final TabbedPane tabbedPane; private VelocityContainer editVC, detailsTabVC, groupsTabVC; private BGAreaFormController areaController; private GroupsToAreaDataModel groupsDataModel; private Choice groupsChoice; // area, context and group references private BGArea area; private final BGContext bgContext; private List allGroups, inAreaGroups; // managers private final BGAreaDao areaManager; private final BGContextDao contextManager; /** * Constructor for the business group area edit controller * * @param ureq * The user request * @param wControl * The window control * @param area * The business group area */ public BGAreaEditController(final UserRequest ureq, final WindowControl wControl, final BGArea area) { super(ureq, wControl); this.trans = new PackageTranslator(PACKAGE, ureq.getLocale()); this.area = area; this.areaManager = BGAreaDaoImpl.getInstance(); this.bgContext = area.getGroupContext(); this.contextManager = BGContextDaoImpl.getInstance(); // tabbed pane tabbedPane = new TabbedPane("tabbedPane", ureq.getLocale()); tabbedPane.addListener(this); // details tab initAndAddDetailsTab(ureq, wControl); // groups tab initAndAddGroupsTab(); // initialize main view initEditVC(); putInitialPanel(this.editVC); } /** * initialize the main velocity wrapper container */ private void initEditVC() { editVC = new VelocityContainer("edit", VELOCITY_ROOT + "/edit.html", trans, this); editVC.put("tabbedpane", tabbedPane); editVC.contextPut("title", trans.translate("area.edit.title", new String[] { StringEscapeUtils.escapeHtml(this.area.getName()).toString() })); } /** * initialize the area details tab */ private void initAndAddDetailsTab(final UserRequest ureq, final WindowControl wControl) { this.detailsTabVC = new VelocityContainer("detailstab", VELOCITY_ROOT + "/detailstab.html", this.trans, this); // TODO:pb: refactor BGControllerFactory.create..AreaController to be // usefull here if (this.areaController != null) { removeAsListenerAndDispose(this.areaController); } this.areaController = new BGAreaFormController(ureq, wControl, this.area, false); listenTo(this.areaController); this.detailsTabVC.put("areaForm", this.areaController.getInitialComponent()); this.tabbedPane.addTab(this.trans.translate("tab.details"), this.detailsTabVC); } /** * initalize the group to area association tab */ private void initAndAddGroupsTab() { groupsTabVC = new VelocityContainer("groupstab", VELOCITY_ROOT + "/groupstab.html", trans, this); tabbedPane.addTab(trans.translate("tab.groups"), groupsTabVC); this.allGroups = contextManager.getGroupsOfBGContext(this.bgContext); this.inAreaGroups = areaManager.findBusinessGroupsOfArea(this.area); this.groupsDataModel = new GroupsToAreaDataModel(this.allGroups, this.inAreaGroups); groupsChoice = new Choice("groupsChoice", trans); groupsChoice.setSubmitKey("submit"); groupsChoice.setCancelKey("cancel"); groupsChoice.setTableDataModel(groupsDataModel); groupsChoice.addListener(this); groupsTabVC.put(groupsChoice); groupsTabVC.contextPut("noGroupsFound", (allGroups.size() > 0 ? Boolean.FALSE : Boolean.TRUE)); } /** */ @Override protected void event(final UserRequest ureq, final Component source, final Event event) { if (source == this.groupsChoice) { if (event == Choice.EVNT_VALIDATION_OK) { doUpdateGroupAreaRelations(); // do logging if (this.inAreaGroups.size() == 0) { ThreadLocalUserActivityLogger.log(GroupLoggingAction.BGAREA_UPDATED_NOW_EMPTY, getClass()); } else { for (final Iterator it = inAreaGroups.iterator(); it.hasNext();) { final BusinessGroup aGroup = (BusinessGroup) it.next(); ThreadLocalUserActivityLogger.log(GroupLoggingAction.BGAREA_UPDATED_MEMBER_GROUP, getClass(), LoggingResourceable.wrap(aGroup)); } } } } } @Override protected void event(final UserRequest ureq, final Controller source, final Event event) { if (source == this.areaController) { if (event == Event.DONE_EVENT) { final BGArea updatedArea = doAreaUpdate(); if (updatedArea == null) { this.areaController.resetAreaName(); getWindowControl().setWarning(this.trans.translate("error.area.name.exists")); } else { this.area = updatedArea; this.editVC.contextPut("title", this.trans.translate("area.edit.title", new String[] { StringEscapeUtils.escapeHtml(this.area.getName()).toString() })); } } else if (event == Event.CANCELLED_EVENT) { // area might have been changed, reload from db this.area = this.areaManager.reloadArea(this.area); // TODO:pb: refactor BGControllerFactory.create..AreaController to be // usefull here if (this.areaController != null) { removeAsListenerAndDispose(this.areaController); } this.areaController = new BGAreaFormController(ureq, getWindowControl(), this.area, false); listenTo(this.areaController); this.detailsTabVC.put("areaForm", this.areaController.getInitialComponent()); } } } /** * Update a group area * * @return the updated area */ public BGArea doAreaUpdate() { this.area.setName(this.areaController.getAreaName()); this.area.setDescription(this.areaController.getAreaDescription()); return this.areaManager.updateBGArea(this.area); } /** * Update the groups associated to this area: remove and add groups */ private void doUpdateGroupAreaRelations() { BusinessGroupService businessGroupService = (BusinessGroupService) CoreSpringFactory.getBean(BusinessGroupService.class); // 1) add groups to area final List addedGroups = groupsChoice.getAddedRows(); Iterator iterator = addedGroups.iterator(); while (iterator.hasNext()) { final Integer position = (Integer) iterator.next(); BusinessGroup group = groupsDataModel.getGroup(position.intValue()); // refresh group to prevent stale object exception and context proxy // issues group = businessGroupService.loadBusinessGroup(group); // refresh group also in table model this.allGroups.set(position.intValue(), group); // add group now to area and update in area group list areaManager.addBGToBGArea(group, area); this.inAreaGroups.add(group); } // 2) remove groups from area final List removedGroups = groupsChoice.getRemovedRows(); iterator = removedGroups.iterator(); while (iterator.hasNext()) { final Integer position = (Integer) iterator.next(); final BusinessGroup group = groupsDataModel.getGroup(position.intValue()); areaManager.removeBGFromArea(group, area); this.inAreaGroups.remove(group); } } /** */ @Override protected void doDispose() { // don't dispose anything } }
huihoo/olat
olat7.8/src/main/java/org/olat/presentation/group/area/BGAreaEditController.java
Java
apache-2.0
10,780
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.river.test.spec.javaspace.conformance; import java.util.logging.Level; // net.jini import net.jini.core.transaction.Transaction; // org.apache.river import org.apache.river.qa.harness.TestException; import org.apache.river.qa.harness.QAConfig; /** * TransactionWriteTakeIfExistsTest asserts that if the entry is written and * after that is taken by takeIfExists method within the non null * transaction, the entry will never be visible outside the transaction and * will not be added to the space when the transaction commits. * * @author Mikhail A. Markov */ public class TransactionWriteTakeIfExistsTest extends TransactionTest { /** * This method asserts that if the entry is written and * after that is taken by takeIfExists method within the non null * transaction, the entry will never be visible outside the transaction and * will not be added to the space when the transaction commits. * * <P>Notes:<BR>For more information see the JavaSpaces specification * section 3.1</P> */ public void run() throws Exception { SimpleEntry sampleEntry1 = new SimpleEntry("TestEntry #1", 1); SimpleEntry sampleEntry2 = new SimpleEntry("TestEntry #2", 2); SimpleEntry result; Transaction txn; // first check that space is empty if (!checkSpace(space)) { throw new TestException( "Space is not empty in the beginning."); } // create the non null transaction txn = getTransaction(); /* * write 1-st sample and 2-nd sample entries twice * to the space within the transaction */ space.write(sampleEntry1, txn, leaseForeverTime); space.write(sampleEntry1, txn, leaseForeverTime); space.write(sampleEntry2, txn, leaseForeverTime); space.write(sampleEntry2, txn, leaseForeverTime); /* * takeIfExists all written entries from the space * within the transaction */ space.takeIfExists(sampleEntry1, txn, checkTime); space.takeIfExists(sampleEntry1, txn, checkTime); space.takeIfExists(sampleEntry2, txn, checkTime); space.takeIfExists(sampleEntry2, txn, checkTime); // commit the transaction txnCommit(txn); // check that there are no entries in the space result = (SimpleEntry) space.read(null, null, checkTime); if (result != null) { throw new TestException( "there is " + result + " still available in the" + " space after transaction's committing" + " but null is expected."); } logDebugText("There are no entries in the space after" + " transaction's committing, as expected."); } }
pfirmstone/JGDMS
qa/src/org/apache/river/test/spec/javaspace/conformance/TransactionWriteTakeIfExistsTest.java
Java
apache-2.0
3,650