text
stringlengths
2
99.9k
meta
dict
(* This interface is deliberately empty. *)
{ "pile_set_name": "Github" }
The UK government meets docs as code ===================================== .. datatemplate-video:: :source: /_data/2019.prague.speakers.yaml :template: videos/video-detail.html :key: 5
{ "pile_set_name": "Github" }
{ "status_code": 200, "data": { "DBCluster": { "MasterUsername": "custodian", "ReaderEndpoint": "test-sg-fail-cluster.cluster-ro-ci3evidtom6k.ca-central-1.rds.amazonaws.com", "ReadReplicaIdentifiers": [], "VpcSecurityGroups": [ { "Status": "active", "VpcSecurityGroupId": "sg-7a3fcb13" } ], "HostedZoneId": "Z1JG78A3UK1DU3", "Status": "available", "MultiAZ": false, "LatestRestorableTime": { "hour": 21, "__class__": "datetime", "month": 12, "second": 37, "microsecond": 146000, "year": 2016, "day": 21, "minute": 58 }, "PreferredBackupWindow": "12:22-12:52", "DBSubnetGroup": "default", "AllocatedStorage": 1, "BackupRetentionPeriod": 1, "PreferredMaintenanceWindow": "thu:06:44-thu:07:14", "Engine": "aurora", "Endpoint": "test-sg-fail-cluster.cluster-ci3evidtom6k.ca-central-1.rds.amazonaws.com", "AssociatedRoles": [], "EarliestRestorableTime": { "hour": 17, "__class__": "datetime", "month": 12, "second": 38, "microsecond": 244000, "year": 2016, "day": 21, "minute": 58 }, "ClusterCreateTime": { "hour": 17, "__class__": "datetime", "month": 12, "second": 47, "microsecond": 929000, "year": 2016, "day": 21, "minute": 57 }, "EngineVersion": "5.6.10a", "DBClusterIdentifier": "test-sg-fail-cluster", "DbClusterResourceId": "cluster-J6N4HKCO4ZDHQO7JVWE3IMROOY", "DBClusterMembers": [ { "IsClusterWriter": false, "DBClusterParameterGroupStatus": "in-sync", "PromotionTier": 15, "DBInstanceIdentifier": "test-sg-fail-ca-central-1a" }, { "IsClusterWriter": true, "DBClusterParameterGroupStatus": "in-sync", "PromotionTier": 15, "DBInstanceIdentifier": "test-sg-fail" } ], "DBClusterArn": "arn:aws:rds:ca-central-1:644160558196:cluster:test-sg-fail-cluster", "StorageEncrypted": false, "DatabaseName": "test_sg_db_fail", "DBClusterParameterGroup": "default.aurora5.6", "AvailabilityZones": [ "ca-central-1a", "ca-central-1b" ], "Port": 3306 }, "ResponseMetadata": { "RetryAttempts": 0, "HTTPStatusCode": 200, "RequestId": "f20acfaf-c7c8-11e6-9e36-15419dd28d7d", "HTTPHeaders": { "x-amzn-requestid": "f20acfaf-c7c8-11e6-9e36-15419dd28d7d", "vary": "Accept-Encoding", "content-length": "2914", "content-type": "text/xml", "date": "Wed, 21 Dec 2016 22:00:54 GMT" } } } }
{ "pile_set_name": "Github" }
#!/usr/bin/perl use Modern::Perl; use Test::More tests => 15; use utf8; use File::Basename; use File::Temp qw/tempfile/; use t::lib::Mocks; use t::lib::TestBuilder; use Koha::Database; use Koha::Plugins; BEGIN { # Mock pluginsdir before loading Plugins module my $path = dirname(__FILE__) . '/../lib'; t::lib::Mocks::mock_config( 'pluginsdir', $path ); use_ok('C4::ImportBatch'); } # Start transaction my $schema = Koha::Database->new->schema; $schema->storage->txn_begin; my $builder = t::lib::TestBuilder->new; my $dbh = C4::Context->dbh; # clear $dbh->do('DELETE FROM import_batches'); my $sample_import_batch1 = { matcher_id => 1, template_id => 1, branchcode => 'QRT', overlay_action => 'create_new', nomatch_action => 'create_new', item_action => 'always_add', import_status => 'staged', batch_type => 'z3950', file_name => 'test.mrc', comments => 'test', record_type => 'auth', }; my $sample_import_batch2 = { matcher_id => 2, template_id => 2, branchcode => 'QRZ', overlay_action => 'create_new', nomatch_action => 'create_new', item_action => 'always_add', import_status => 'staged', batch_type => 'z3950', file_name => 'test.mrc', comments => 'test', record_type => 'auth', }; my $id_import_batch1 = C4::ImportBatch::AddImportBatch($sample_import_batch1); my $id_import_batch2 = C4::ImportBatch::AddImportBatch($sample_import_batch2); like( $id_import_batch1, '/^\d+$/', "AddImportBatch for sample_import_batch1 return an id" ); like( $id_import_batch2, '/^\d+$/', "AddImportBatch for sample_import_batch2 return an id" ); #Test GetImportBatch my $importbatch2 = C4::ImportBatch::GetImportBatch( $id_import_batch2 ); delete $importbatch2->{upload_timestamp}; delete $importbatch2->{import_batch_id}; delete $importbatch2->{num_records}; delete $importbatch2->{num_items}; is_deeply( $importbatch2, $sample_import_batch2, "GetImportBatch returns the right informations about $sample_import_batch2" ); my $importbatch1 = C4::ImportBatch::GetImportBatch( $id_import_batch1 ); delete $importbatch1->{upload_timestamp}; delete $importbatch1->{import_batch_id}; delete $importbatch1->{num_records}; delete $importbatch1->{num_items}; is_deeply( $importbatch1, $sample_import_batch1, "GetImportBatch returns the right informations about $sample_import_batch1" ); my $record = MARC::Record->new; # FIXME Create another MARC::Record which won't be modified # AddItemsToImportBiblio will remove the items field from the record passed in parameter. my $original_record = MARC::Record->new; $record->leader('03174nam a2200445 a 4500'); $original_record->leader('03174nam a2200445 a 4500'); my ($item_tag, $item_subfield) = C4::Biblio::GetMarcFromKohaField( 'items.itemnumber' ); my @fields = ( MARC::Field->new( 100, '1', ' ', a => 'Knuth, Donald Ervin', d => '1938', ), MARC::Field->new( 245, '1', '4', a => 'The art of computer programming', c => 'Donald E. Knuth.', ), MARC::Field->new( 650, ' ', '0', a => 'Computer programming.', 9 => '462', ), MARC::Field->new( $item_tag, ' ', ' ', e => 'my edition ❤', i => 'my item part', ), MARC::Field->new( $item_tag, ' ', ' ', e => 'my edition 2', i => 'my item part 2', ), ); $record->append_fields(@fields); $original_record->append_fields(@fields); my $import_record_id = AddBiblioToBatch( $id_import_batch1, 0, $record, 'utf8', int(rand(99999)), 0 ); AddItemsToImportBiblio( $id_import_batch1, $import_record_id, $record, 0 ); my $record_from_import_biblio_with_items = C4::ImportBatch::GetRecordFromImportBiblio( $import_record_id, 'embed_items' ); $original_record->leader($record_from_import_biblio_with_items->leader()); is_deeply( $record_from_import_biblio_with_items, $original_record, 'GetRecordFromImportBiblio should return the record with items if specified' ); my $utf8_field = $record_from_import_biblio_with_items->subfield($item_tag, 'e'); is($utf8_field, 'my edition ❤'); $original_record->delete_fields($original_record->field($item_tag)); #Remove items fields my $record_from_import_biblio_without_items = C4::ImportBatch::GetRecordFromImportBiblio( $import_record_id ); $original_record->leader($record_from_import_biblio_without_items->leader()); is_deeply( $record_from_import_biblio_without_items, $original_record, 'GetRecordFromImportBiblio should return the record without items by default' ); # Add a few tests for GetItemNumbersFromImportBatch my @a = GetItemNumbersFromImportBatch( $id_import_batch1 ); is( @a, 0, 'No item numbers expected since we did not commit' ); my $itemno = $builder->build_sample_item->itemnumber; # Link this item to the import item to fool GetItemNumbersFromImportBatch my $sql = "UPDATE import_items SET itemnumber=? WHERE import_record_id=?"; $dbh->do( $sql, undef, $itemno, $import_record_id ); @a = GetItemNumbersFromImportBatch( $id_import_batch1 ); is( @a, 2, 'Expecting two items now' ); is( $a[0], $itemno, 'Check the first returned itemnumber' ); # Now delete the item and check again $dbh->do( "DELETE FROM items WHERE itemnumber=?", undef, $itemno ); @a = GetItemNumbersFromImportBatch( $id_import_batch1 ); is( @a, 0, 'No item numbers expected since we deleted the item' ); $dbh->do( $sql, undef, undef, $import_record_id ); # remove link again # fresh data my $sample_import_batch3 = { matcher_id => 3, template_id => 3, branchcode => 'QRT', overlay_action => 'create_new', nomatch_action => 'create_new', item_action => 'always_add', import_status => 'staged', batch_type => 'z3950', file_name => 'test.mrc', comments => 'test', record_type => 'auth', }; my $id_import_batch3 = C4::ImportBatch::AddImportBatch($sample_import_batch3); # Test CleanBatch C4::ImportBatch::CleanBatch( $id_import_batch3 ); my $batch3_clean = $dbh->do('SELECT * FROM import_records WHERE import_batch_id = "$id_import_batch3"'); is( $batch3_clean, "0E0", "Batch 3 has been cleaned" ); # Test DeleteBatch C4::ImportBatch::DeleteBatch( $id_import_batch3 ); my $batch3_results = $dbh->do('SELECT * FROM import_batches WHERE import_batch_id = "$id_import_batch3"'); is( $batch3_results, "0E0", "Batch 3 has been deleted"); subtest "RecordsFromMarcPlugin" => sub { plan tests => 5; # Create a test file my ( $fh, $name ) = tempfile(); print $fh q| 003 = NLAmRIJ 100,a = Author 245,ind2 = 0 245,a = Silence in the library 500 , a= Some note 100,a = Another 245,a = Noise in the library|; close $fh; t::lib::Mocks::mock_config( 'enable_plugins', 1 ); my $plugins = Koha::Plugins->new; $plugins->InstallPlugins; my ($plugin) = $plugins->GetPlugins({ all => 1, metadata => { name => 'MarcFieldValues' } }); isnt( $plugin, undef, "Plugin found" ); my $records = C4::ImportBatch::RecordsFromMarcPlugin( $name, ref $plugin, 'UTF-8' ); is( @$records, 2, 'Two results returned' ); is( ref $records->[0], 'MARC::Record', 'Returned MARC::Record object' ); is( $records->[0]->subfield('245', 'a'), 'Silence in the library', 'Checked one field in first record' ); is( $records->[1]->subfield('100', 'a'), 'Another', 'Checked one field in second record' ); }; $schema->storage->txn_rollback;
{ "pile_set_name": "Github" }
/** * */ package de.metas.letter.interceptor; import org.adempiere.ad.modelvalidator.annotations.Interceptor; import org.adempiere.ad.modelvalidator.annotations.ModelChange; import org.compiere.Adempiere; import org.compiere.model.ModelValidator; import org.springframework.stereotype.Component; import de.metas.async.model.I_C_Async_Batch; import de.metas.letter.LetterConstants; import de.metas.letter.service.SerialLetterService; /* * #%L * marketing-serialleter * %% * Copyright (C) 2018 metas GmbH * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as * published by the Free Software Foundation, either version 2 of the * License, or (at your option) any later version. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public * License along with this program. If not, see * <http://www.gnu.org/licenses/gpl-2.0.html>. * #L% */ @Interceptor(I_C_Async_Batch.class) @Component public class C_Async_Batch { @ModelChange(timings = ModelValidator.TYPE_AFTER_CHANGE, ifColumnsChanged = I_C_Async_Batch.COLUMNNAME_Processed) public void print(final I_C_Async_Batch asyncBatch) { if (asyncBatch.isProcessed() && LetterConstants.C_Async_Batch_InternalName_CreateLettersAsync.equals(asyncBatch.getC_Async_Batch_Type().getInternalName())) { runPrintingProcess(asyncBatch); } } private void runPrintingProcess(final I_C_Async_Batch asyncBatch) { final SerialLetterService serialLetterService = Adempiere.getBean(SerialLetterService.class); serialLetterService.printAutomaticallyLetters(asyncBatch); } }
{ "pile_set_name": "Github" }
# -*- coding: utf-8 -*- # # 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 __future__ import print_function import airflow from datetime import datetime, timedelta from airflow.operators.hive_operator import HiveOperator from airflow.operators.dummy_operator import DummyOperator from airflow.models import Variable args = { 'owner': 'airflow', 'start_date': airflow.utils.dates.days_ago(1), 'provide_context': True, 'depends_on_past': True } dag = airflow.DAG( 'starschema', schedule_interval="@daily", dagrun_timeout=timedelta(minutes=60), template_searchpath='/usr/local/airflow/sql', default_args=args, max_active_runs=1) dimensions_done = DummyOperator( task_id='dimensions_done', dag=dag) starschema_done = DummyOperator( task_id='starschema_done', dag=dag) dimensions_done >> starschema_done def create_operator(hql, hive_table, prev_id, next_id): t = HiveOperator( hql=hql, hive_cli_conn_id='hive_datavault_raw', schema='dv_raw', task_id='star_{0}'.format(hive_table), dag=dag) t >> next_id if prev_id is not None: prev_id >> t create_operator('starschema/dim_address.hql', 'dim_address', None, dimensions_done) create_operator('starschema/dim_currency.hql', 'dim_currency', None, dimensions_done) create_operator('starschema/dim_product.hql', 'dim_product', None, dimensions_done) create_operator('starschema/dim_salesterritory.hql', 'dim_salesterritory', None, dimensions_done) create_operator('starschema/dim_salesorder.hql', 'dim_salesorder', None, dimensions_done) create_operator('starschema/fact_orderdetail.hql', 'fact_orderdetail', dimensions_done, starschema_done) if __name__ == "__main__": dag.cli()
{ "pile_set_name": "Github" }
commandlinefu_id: 11595 translator: weibo: tgic command: |- find . -size 0c -print -exec rm -f {} \; summary: |- 删除空文件
{ "pile_set_name": "Github" }
--- layout: text/textblock --- [Measuring service performance](https://www.dta.gov.au/standard/measuring-performance/)
{ "pile_set_name": "Github" }
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!--NewPage--> <HTML> <HEAD> <!-- Generated by javadoc (build 1.6.0_31) on Tue Jun 12 18:19:51 EDT 2012 --> <META http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <TITLE> Uses of Class org.apache.commons.io.output.ThresholdingOutputStream (Commons IO 2.4 API) </TITLE> <META NAME="date" CONTENT="2012-06-12"> <LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../../stylesheet.css" TITLE="Style"> <SCRIPT type="text/javascript"> function windowTitle() { if (location.href.indexOf('is-external=true') == -1) { parent.document.title="Uses of Class org.apache.commons.io.output.ThresholdingOutputStream (Commons IO 2.4 API)"; } } </SCRIPT> <NOSCRIPT> </NOSCRIPT> </HEAD> <BODY BGCOLOR="white" onload="windowTitle();"> <HR> <!-- ========= START OF TOP NAVBAR ======= --> <A NAME="navbar_top"><!-- --></A> <A HREF="#skip-navbar_top" title="Skip navigation links"></A> <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> <TR> <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A NAME="navbar_top_firstrow"><!-- --></A> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../org/apache/commons/io/output/ThresholdingOutputStream.html" title="class in org.apache.commons.io.output"><FONT CLASS="NavBarFont1"><B>Class</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Use</B></FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> </EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> &nbsp;PREV&nbsp; &nbsp;NEXT</FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../../../index.html?org/apache/commons/io/output/\class-useThresholdingOutputStream.html" target="_top"><B>FRAMES</B></A> &nbsp; &nbsp;<A HREF="ThresholdingOutputStream.html" target="_top"><B>NO FRAMES</B></A> &nbsp; &nbsp;<SCRIPT type="text/javascript"> <!-- if(window==top) { document.writeln('<A HREF="../../../../../../allclasses-noframe.html"><B>All Classes</B></A>'); } //--> </SCRIPT> <NOSCRIPT> <A HREF="../../../../../../allclasses-noframe.html"><B>All Classes</B></A> </NOSCRIPT> </FONT></TD> </TR> </TABLE> <A NAME="skip-navbar_top"></A> <!-- ========= END OF TOP NAVBAR ========= --> <HR> <CENTER> <H2> <B>Uses of Class<br>org.apache.commons.io.output.ThresholdingOutputStream</B></H2> </CENTER> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> Packages that use <A HREF="../../../../../../org/apache/commons/io/output/ThresholdingOutputStream.html" title="class in org.apache.commons.io.output">ThresholdingOutputStream</A></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><A HREF="#org.apache.commons.io.output"><B>org.apache.commons.io.output</B></A></TD> <TD> This package provides implementations of output classes, such as <code>OutputStream</code> and <code>Writer</code>.&nbsp;</TD> </TR> </TABLE> &nbsp; <P> <A NAME="org.apache.commons.io.output"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> Uses of <A HREF="../../../../../../org/apache/commons/io/output/ThresholdingOutputStream.html" title="class in org.apache.commons.io.output">ThresholdingOutputStream</A> in <A HREF="../../../../../../org/apache/commons/io/output/package-summary.html">org.apache.commons.io.output</A></FONT></TH> </TR> </TABLE> &nbsp; <P> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableSubHeadingColor"> <TH ALIGN="left" COLSPAN="2">Subclasses of <A HREF="../../../../../../org/apache/commons/io/output/ThresholdingOutputStream.html" title="class in org.apache.commons.io.output">ThresholdingOutputStream</A> in <A HREF="../../../../../../org/apache/commons/io/output/package-summary.html">org.apache.commons.io.output</A></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;class</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../../../org/apache/commons/io/output/DeferredFileOutputStream.html" title="class in org.apache.commons.io.output">DeferredFileOutputStream</A></B></CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;An output stream which will retain data in memory until a specified threshold is reached, and only then commit it to disk.</TD> </TR> </TABLE> &nbsp; <P> <HR> <!-- ======= START OF BOTTOM NAVBAR ====== --> <A NAME="navbar_bottom"><!-- --></A> <A HREF="#skip-navbar_bottom" title="Skip navigation links"></A> <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> <TR> <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A NAME="navbar_bottom_firstrow"><!-- --></A> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../org/apache/commons/io/output/ThresholdingOutputStream.html" title="class in org.apache.commons.io.output"><FONT CLASS="NavBarFont1"><B>Class</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Use</B></FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> </EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> &nbsp;PREV&nbsp; &nbsp;NEXT</FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../../../index.html?org/apache/commons/io/output/\class-useThresholdingOutputStream.html" target="_top"><B>FRAMES</B></A> &nbsp; &nbsp;<A HREF="ThresholdingOutputStream.html" target="_top"><B>NO FRAMES</B></A> &nbsp; &nbsp;<SCRIPT type="text/javascript"> <!-- if(window==top) { document.writeln('<A HREF="../../../../../../allclasses-noframe.html"><B>All Classes</B></A>'); } //--> </SCRIPT> <NOSCRIPT> <A HREF="../../../../../../allclasses-noframe.html"><B>All Classes</B></A> </NOSCRIPT> </FONT></TD> </TR> </TABLE> <A NAME="skip-navbar_bottom"></A> <!-- ======== END OF BOTTOM NAVBAR ======= --> <HR> Copyright &#169; 2002-2012 <a href="http://www.apache.org/">The Apache Software Foundation</a>. All Rights Reserved. </BODY> </HTML>
{ "pile_set_name": "Github" }
<component name="libraryTable"> <library name="Maven: org.apache.spark:spark-core_2.11:2.0.1"> <CLASSES> <root url="jar://$MAVEN_REPOSITORY$/org/apache/spark/spark-core_2.11/2.0.1/spark-core_2.11-2.0.1.jar!/" /> </CLASSES> <JAVADOC> <root url="jar://$MAVEN_REPOSITORY$/org/apache/spark/spark-core_2.11/2.0.1/spark-core_2.11-2.0.1-javadoc.jar!/" /> </JAVADOC> <SOURCES> <root url="jar://$MAVEN_REPOSITORY$/org/apache/spark/spark-core_2.11/2.0.1/spark-core_2.11-2.0.1-sources.jar!/" /> </SOURCES> </library> </component>
{ "pile_set_name": "Github" }
/* =========================================================================== Copyright (C) 1999-2005 Id Software, Inc. This file is part of Quake III Arena source code. Quake III Arena source code is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. Quake III Arena source code 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 General Public License for more details. You should have received a copy of the GNU General Public License along with Quake III Arena source code; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA =========================================================================== */ #ifndef __Q_PLATFORM_H #define __Q_PLATFORM_H // this is for determining if we have an asm version of a C function #define idx64 0 #ifdef Q3_VM #define id386 0 #define idppc 0 #define idppc_altivec 0 #define idsparc 0 #else #if (defined _M_IX86 || defined __i386__) && !defined(C_ONLY) #define id386 1 #else #define id386 0 #endif #if (defined(powerc) || defined(powerpc) || defined(ppc) || \ defined(__ppc) || defined(__ppc__)) && !defined(C_ONLY) #define idppc 1 #if defined(__VEC__) #define idppc_altivec 1 #ifdef __APPLE__ // Apple's GCC does this differently than the FSF. #define VECCONST_UINT8(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p) \ (vector unsigned char) (a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p) #else #define VECCONST_UINT8(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p) \ (vector unsigned char) {a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p} #endif #else #define idppc_altivec 0 #endif #else #define idppc 0 #define idppc_altivec 0 #endif #if defined(__sparc__) && !defined(C_ONLY) #define idsparc 1 #else #define idsparc 0 #endif #endif #ifndef __ASM_I386__ // don't include the C bits if included from qasm.h // for windows fastcall option #define QDECL #define QCALL //================================================================= WIN64/32 === #if defined(_WIN64) || defined(__WIN64__) #undef idx64 #define idx64 1 #undef QDECL #define QDECL __cdecl #undef QCALL #define QCALL __stdcall #if defined( _MSC_VER ) #define OS_STRING "win_msvc64" #elif defined __MINGW64__ #define OS_STRING "win_mingw64" #endif #define ID_INLINE __inline #define PATH_SEP '\\' #if defined( __WIN64__ ) #define ARCH_STRING "x64" #elif defined _M_ALPHA #define ARCH_STRING "AXP" #endif #define Q3_LITTLE_ENDIAN #define DLL_EXT ".dll" #elif defined(_WIN32) || defined(__WIN32__) #undef QDECL #define QDECL __cdecl #undef QCALL #define QCALL __stdcall #if defined( _MSC_VER ) #define OS_STRING "win_msvc" #elif defined __MINGW32__ #define OS_STRING "win_mingw" #endif #define ID_INLINE __inline #define PATH_SEP '\\' #if defined( _M_IX86 ) || defined( __i386__ ) #define ARCH_STRING "x86" #elif defined _M_ALPHA #define ARCH_STRING "AXP" #endif #define Q3_LITTLE_ENDIAN #define DLL_EXT ".dll" #endif //============================================================== MAC OS X === #if defined(__APPLE__) || defined(__APPLE_CC__) #define OS_STRING "macosx" #define ID_INLINE inline #define PATH_SEP '/' #ifdef __ppc__ #define ARCH_STRING "ppc" #define Q3_BIG_ENDIAN #elif defined __i386__ #define ARCH_STRING "i386" #define Q3_LITTLE_ENDIAN #elif defined __x86_64__ #undef idx64 #define idx64 1 #define ARCH_STRING "x86_64" #define Q3_LITTLE_ENDIAN #endif #define DLL_EXT ".dylib" #endif //================================================================= LINUX === #if defined(__linux__) || defined(__FreeBSD_kernel__) || defined(__GNU__) #include <endian.h> #if defined(__linux__) #define OS_STRING "linux" #elif defined(__FreeBSD_kernel__) #define OS_STRING "kFreeBSD" #else #define OS_STRING "GNU" #endif #define ID_INLINE inline #define PATH_SEP '/' #if !defined(ARCH_STRING) # error ARCH_STRING should be defined by the Makefile #endif #if defined __x86_64__ #undef idx64 #define idx64 1 #endif #if __FLOAT_WORD_ORDER == __BIG_ENDIAN #define Q3_BIG_ENDIAN #else #define Q3_LITTLE_ENDIAN #endif #define DLL_EXT ".so" #endif //=================================================================== BSD === #if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) #include <sys/types.h> #include <machine/endian.h> #ifndef __BSD__ #define __BSD__ #endif #if defined(__FreeBSD__) #define OS_STRING "freebsd" #elif defined(__OpenBSD__) #define OS_STRING "openbsd" #elif defined(__NetBSD__) #define OS_STRING "netbsd" #endif #define ID_INLINE inline #define PATH_SEP '/' #ifdef __i386__ #define ARCH_STRING "i386" #elif defined __amd64__ #undef idx64 #define idx64 1 #define ARCH_STRING "amd64" #elif defined __axp__ #define ARCH_STRING "alpha" #elif defined __powerpc64__ #define ARCH_STRING "powerpc64" #elif defined __powerpc__ #define ARCH_STRING "powerpc" #endif #if BYTE_ORDER == BIG_ENDIAN #define Q3_BIG_ENDIAN #else #define Q3_LITTLE_ENDIAN #endif #define DLL_EXT ".so" #endif //================================================================= SUNOS === #ifdef __sun #include <stdint.h> #include <sys/byteorder.h> #define OS_STRING "solaris" #define ID_INLINE inline #define PATH_SEP '/' #ifdef __i386__ #define ARCH_STRING "i386" #elif defined __sparc #define ARCH_STRING "sparc" #endif #if defined( _BIG_ENDIAN ) #define Q3_BIG_ENDIAN #elif defined( _LITTLE_ENDIAN ) #define Q3_LITTLE_ENDIAN #endif #define DLL_EXT ".so" #endif //================================================================== IRIX === #ifdef __sgi #define OS_STRING "irix" #define ID_INLINE __inline #define PATH_SEP '/' #define ARCH_STRING "mips" #define Q3_BIG_ENDIAN // SGI's MIPS are always big endian #define DLL_EXT ".so" #endif //================================================================== Q3VM === #ifdef Q3_VM #define OS_STRING "q3vm" #define ID_INLINE #define PATH_SEP '/' #define ARCH_STRING "bytecode" #define DLL_EXT ".qvm" #endif //=========================================================================== //catch missing defines in above blocks #if !defined( OS_STRING ) #error "Operating system not supported" #endif #if !defined( ARCH_STRING ) #error "Architecture not supported" #endif #ifndef ID_INLINE #error "ID_INLINE not defined" #endif #ifndef PATH_SEP #error "PATH_SEP not defined" #endif #ifndef DLL_EXT #error "DLL_EXT not defined" #endif //endianness void CopyShortSwap (void *dest, void *src); void CopyLongSwap (void *dest, void *src); short ShortSwap (short l); int LongSwap (int l); float FloatSwap (const float *f); #if defined( Q3_BIG_ENDIAN ) && defined( Q3_LITTLE_ENDIAN ) #error "Endianness defined as both big and little" #elif defined( Q3_BIG_ENDIAN ) #define CopyLittleShort(dest, src) CopyShortSwap(dest, src) #define CopyLittleLong(dest, src) CopyLongSwap(dest, src) #define LittleShort(x) ShortSwap(x) #define LittleLong(x) LongSwap(x) #define LittleFloat(x) FloatSwap(&x) #define BigShort #define BigLong #define BigFloat #elif defined( Q3_LITTLE_ENDIAN ) #define CopyLittleShort(dest, src) Com_Memcpy(dest, src, 2) #define CopyLittleLong(dest, src) Com_Memcpy(dest, src, 4) #define LittleShort #define LittleLong #define LittleFloat #define BigShort(x) ShortSwap(x) #define BigLong(x) LongSwap(x) #define BigFloat(x) FloatSwap(&x) #elif defined( Q3_VM ) #define LittleShort #define LittleLong #define LittleFloat #define BigShort #define BigLong #define BigFloat #else #error "Endianness not defined" #endif //platform string #ifdef NDEBUG #define PLATFORM_STRING OS_STRING "-" ARCH_STRING #else #define PLATFORM_STRING OS_STRING "-" ARCH_STRING "-debug" #endif #endif #endif
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="UTF-8"?> <definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:activiti="http://activiti.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC" xmlns:omgdi="http://www.omg.org/spec/DD/20100524/DI" typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://www.activiti.org/test"> <process id="timerProcess"> <startEvent id="start" /> <sequenceFlow id="flow1" sourceRef="start" targetRef="fork" /> <parallelGateway id="fork" /> <sequenceFlow sourceRef="fork" targetRef="task" /> <sequenceFlow sourceRef="fork" targetRef="asyncTask" /> <serviceTask id="asyncTask" activiti:async="true" activiti:expression="${test}" /> <sequenceFlow sourceRef="asyncTask" targetRef="asyncEnd" /> <endEvent id="asyncEnd" /> <userTask id="task" /> <boundaryEvent id="escalationTimer" name="Escalation" cancelActivity="true" attachedToRef="task"> <timerEventDefinition> <timeDuration>PT30M</timeDuration> </timerEventDefinition> </boundaryEvent> <sequenceFlow id="flow3" sourceRef="escalationTimer" targetRef="exclusiveGw" /> <exclusiveGateway id="exclusiveGw" name="Exclusive Gateway" /> <sequenceFlow sourceRef="exclusiveGw" targetRef="error"> <conditionExpression xsi:type="tFormalExpression">${error == true}</conditionExpression> </sequenceFlow> <sequenceFlow sourceRef="exclusiveGw" targetRef="afterTimerTest" /> <scriptTask id="error" scriptFormat="unexistinglanguage"> <script> // Using unexisting language to force error </script> </scriptTask> <userTask id="afterTimerTest" /> <sequenceFlow id="flow4" sourceRef="afterTimerTest" targetRef="end" /> <sequenceFlow id="flow2" sourceRef="task" targetRef="end" /> <endEvent id="end" /> </process> </definitions>
{ "pile_set_name": "Github" }
package ibm import ( "fmt" "strings" "testing" "github.com/IBM/vpc-go-sdk/vpcv1" "github.com/hashicorp/terraform-plugin-sdk/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/terraform" ) func TestAccIBMISInstanceGroupManagerPolicy_basic(t *testing.T) { randInt := acctest.RandIntRange(400, 500) instanceGroupName := fmt.Sprintf("testinstancegroup%d", randInt) publicKey := strings.TrimSpace(` ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQC4zkmPqZ826/DpkkEIvA8VxUvJtSlP9cmAuHeofZiKczbvWbTeHBkBs2K4LKht/T53xKH8YTttmVX1AZqiHOzhi70jA7PvopbtfkcdTVxcJEJXJ6IhlTXGVcor/oreDTCn4o5KD3Y/TSAmIHi5s9+xZGfgPRijkBLCS98n0nNFqVQ2Uam8PrDkzFQox/2XsFCbrMFtjxCMo/c6DG/6Z3w/5mWi9Z4hH0kQqACaBJR6mYgM07LSmpyMu4qsrEjwQ9tKhz3EM0SOB9ueT+SFwvIeoq49j+6kYFAeZxMSUjfJ/jmrsAZS/cXsBYAekwroYr/SH0w+Mj96EnUX6IDW9YT6DqrVH91xbAaXqggwR7K5kM+WaDqxthcWYZseIsS7HNzsJKeyqEHwQy4pWAr5SHbREm+1YZ4fCGTpozNz8OKY+vizWxvbv4HJPZJtvV4X+7+rV+kkkUMh2eycWkqSjViGng0oT6wG5+FHnrRp2t4kMx+sL+/6vs2aSLEvDjTkltc= root@ffd8363b1226 `) vpcName := fmt.Sprintf("testvpc%d", randInt) subnetName := fmt.Sprintf("testsubnet%d", randInt) templateName := fmt.Sprintf("testtemplate%d", randInt) sshKeyName := fmt.Sprintf("testsshkey%d", randInt) instanceGroupManager := fmt.Sprintf("testinstancegroupmanager%d", randInt) instanceGroupManagerPolicy := fmt.Sprintf("testinstancegroupmanagerpolicy%d", randInt) resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, CheckDestroy: testAccCheckIBMISInstanceGroupManagerPolicyDestroy, Steps: []resource.TestStep{ { Config: testAccCheckIBMISInstanceGroupManagerPolicyConfig(vpcName, subnetName, sshKeyName, publicKey, templateName, instanceGroupName, instanceGroupManager, instanceGroupManagerPolicy), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttr( "ibm_is_instance_group_manager_policy.cpuPolicy", "name", instanceGroupManagerPolicy), resource.TestCheckResourceAttr( "ibm_is_instance_group_manager_policy.cpuPolicy", "metric_type", "cpu"), resource.TestCheckResourceAttr( "ibm_is_instance_group_manager_policy.cpuPolicy", "metric_value", "70"), resource.TestCheckResourceAttr( "ibm_is_instance_group_manager_policy.cpuPolicy", "policy_type", "target"), ), }, }, }) } func testAccCheckIBMISInstanceGroupManagerPolicyDestroy(s *terraform.State) error { sess, _ := testAccProvider.Meta().(ClientSession).VpcV1API() for _, rs := range s.RootModule().Resources { if rs.Type != "ibm_is_instance_group_manager_policy" { continue } instanceGroupID := rs.Primary.Attributes["instance_group"] instanceGroupManagerID := rs.Primary.Attributes["instance_group_manager"] getInstanceGroupManagerPolicyOptions := vpcv1.GetInstanceGroupManagerPolicyOptions{ ID: &rs.Primary.ID, InstanceGroupID: &instanceGroupID, InstanceGroupManagerID: &instanceGroupManagerID, } _, _, err := sess.GetInstanceGroupManagerPolicy(&getInstanceGroupManagerPolicyOptions) if err == nil { return fmt.Errorf("instance group manager policy still exists: %s", rs.Primary.ID) } } return nil } func testAccCheckIBMISInstanceGroupManagerPolicyConfig(vpcName, subnetName, sshKeyName, publicKey, templateName, instanceGroupName, instanceGroupManager, instanceGroupManagerPolicy string) string { return fmt.Sprintf(` provider "ibm" { generation = 2 } resource "ibm_is_vpc" "vpc2" { name = "%s" } resource "ibm_is_subnet" "subnet2" { name = "%s" vpc = ibm_is_vpc.vpc2.id zone = "us-south-2" ipv4_cidr_block = "10.240.64.0/28" } resource "ibm_is_ssh_key" "sshkey" { name = "%s" public_key = "%s" } resource "ibm_is_instance_template" "instancetemplate1" { name = "%s" image = "r006-14140f94-fcc4-11e9-96e7-a72723715315" profile = "bx2-8x32" primary_network_interface { subnet = ibm_is_subnet.subnet2.id } vpc = ibm_is_vpc.vpc2.id zone = "us-south-2" keys = [ibm_is_ssh_key.sshkey.id] } resource "ibm_is_instance_group" "instance_group" { name = "%s" instance_template = ibm_is_instance_template.instancetemplate1.id instance_count = 2 subnets = [ibm_is_subnet.subnet2.id] } resource "ibm_is_instance_group_manager" "instance_group_manager" { name = "%s" aggregation_window = 120 instance_group = ibm_is_instance_group.instance_group.id cooldown = 300 manager_type = "autoscale" enable_manager = true max_membership_count = 2 min_membership_count = 1 } resource "ibm_is_instance_group_manager_policy" "cpuPolicy" { instance_group = ibm_is_instance_group.instance_group.id instance_group_manager = ibm_is_instance_group_manager.instance_group_manager.manager_id metric_type = "cpu" metric_value = 70 policy_type = "target" name = "%s" } `, vpcName, subnetName, sshKeyName, publicKey, templateName, instanceGroupName, instanceGroupManager, instanceGroupManagerPolicy) }
{ "pile_set_name": "Github" }
//===- llvm/Support/Host.h - Host machine characteristics --------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // // Methods for querying the nature of the host machine. // //===----------------------------------------------------------------------===// #ifndef LLVM_SUPPORT_HOST_H #define LLVM_SUPPORT_HOST_H #include "llvm/ADT/StringMap.h" #include <string> namespace llvm { namespace sys { /// getDefaultTargetTriple() - Return the default target triple the compiler /// has been configured to produce code for. /// /// The target triple is a string in the format of: /// CPU_TYPE-VENDOR-OPERATING_SYSTEM /// or /// CPU_TYPE-VENDOR-KERNEL-OPERATING_SYSTEM std::string getDefaultTargetTriple(); /// getProcessTriple() - Return an appropriate target triple for generating /// code to be loaded into the current process, e.g. when using the JIT. std::string getProcessTriple(); /// getHostCPUName - Get the LLVM name for the host CPU. The particular format /// of the name is target dependent, and suitable for passing as -mcpu to the /// target which matches the host. /// /// \return - The host CPU name, or empty if the CPU could not be determined. StringRef getHostCPUName(); /// getHostCPUFeatures - Get the LLVM names for the host CPU features. /// The particular format of the names are target dependent, and suitable for /// passing as -mattr to the target which matches the host. /// /// \param Features - A string mapping feature names to either /// true (if enabled) or false (if disabled). This routine makes no guarantees /// about exactly which features may appear in this map, except that they are /// all valid LLVM feature names. /// /// \return - True on success. bool getHostCPUFeatures(StringMap<bool> &Features); /// Get the number of physical cores (as opposed to logical cores returned /// from thread::hardware_concurrency(), which includes hyperthreads). /// Returns -1 if unknown for the current host system. int getHostNumPhysicalCores(); namespace detail { /// Helper functions to extract HostCPUName from /proc/cpuinfo on linux. StringRef getHostCPUNameForPowerPC(StringRef ProcCpuinfoContent); StringRef getHostCPUNameForARM(StringRef ProcCpuinfoContent); StringRef getHostCPUNameForS390x(StringRef ProcCpuinfoContent); StringRef getHostCPUNameForBPF(); } } } #endif
{ "pile_set_name": "Github" }
import Foundation #if canImport(Darwin) && !SWIFT_PACKAGE @objcMembers public class _FilterBase: NSObject {} #else public class _FilterBase: NSObject {} #endif /** A mapping of string keys to booleans that can be used to filter examples or example groups. For example, a "focused" example would have the flags [Focused: true]. */ public typealias FilterFlags = [String: Bool] /** A namespace for filter flag keys, defined primarily to make the keys available in Objective-C. */ final public class Filter: _FilterBase { /** Example and example groups with [Focused: true] are included in test runs, excluding all other examples without this flag. Use this to only run one or two tests that you're currently focusing on. */ public class var focused: String { return "focused" } /** Example and example groups with [Pending: true] are excluded from test runs. Use this to temporarily suspend examples that you know do not pass yet. */ public class var pending: String { return "pending" } }
{ "pile_set_name": "Github" }
var async = require('async'), crypto = require('crypto'), pg = require('pg'), config = require('../config'), INVITATIONS = 'SELECT * FROM invitations ORDER BY id', INVITATION_BY_ID = 'SELECT * FROM invitations WHERE id=$1 LIMIT 1', INVITATION_GUESTS = 'SELECT * FROM guests WHERE invitation_id=$1 ORDER BY id', UPDATE_INVITATION = 'UPDATE invitations SET $UPDATES WHERE id=$1', UPDATE_SCHEMEA = { address: true, rsvpd : true }; exports.encipherId = encipherId; exports.decipherId = decipherId; exports.loadInvitation = loadInvitation; exports.loadInvitations = loadInvitations; exports.updateInvitation = updateInvitation; function encipherId(id) { var cipher = crypto.createCipher('bf', config.invitationSecret); cipher.update(String(id), 'utf8', 'hex'); return cipher.final('hex'); } function decipherId(encipheredId) { var decipher = crypto.createDecipher('bf', config.invitationSecret); // TODO: Remove Buffer once bug is fixed: // https://github.com/joyent/node/pull/5725 decipher.update(new Buffer(encipheredId, 'hex'), 'utf8'); return decipher.final('utf8'); } function loadInvitation(id, callback) { function processResults(results, callback) { var invitation = results.invitation.rows[0]; if (invitation) { invitation.guests = results.guests.rows; } callback(null, invitation); } pg.connect(config.database, function (err, db, done) { if (err) { return callback(err); } async.waterfall([ async.parallel.bind(null, { invitation: db.query.bind(db, INVITATION_BY_ID, [id]), guests : db.query.bind(db, INVITATION_GUESTS, [id]) }), processResults ], function () { done(); callback.apply(null, arguments); }); }); } function loadInvitations(callback) { function processInvitation(db, invitation, callback) { db.query(INVITATION_GUESTS, [invitation.id], function (err, results) { if (err) { return callback(err); } invitation.guests = results.rows; callback(null, invitation); }); } function processInvitations(db, results, callback) { async.map(results.rows, processInvitation.bind(null, db), callback); } pg.connect(config.database, function (err, db, done) { if (err) { return callback(err); } async.waterfall([ db.query.bind(db, INVITATIONS), processInvitations.bind(null, db) ], function () { done(); callback.apply(null, arguments); }); }); } function updateInvitation(id, changes, callback) { var values = [id], updates = [], query; Object.keys(UPDATE_SCHEMEA).forEach(function (col) { if (col in changes) { updates.push(col + '=$' + values.push(changes[col])); } }); query = UPDATE_INVITATION.replace('$UPDATES', updates.join(', ')); pg.connect(config.database, function (err, db, done) { if (err) { return callback(err); } db.query(query, values, function (err, results) { done(); callback(err, results && results.rows[0]); }); }); }
{ "pile_set_name": "Github" }
package io.github.xdiamond.constants; public class Access { public final static int GUEST = 10; public final static int REPORTER = 20; public final static int DEVELOPER = 30; public final static int MASTER = 40; public final static int OWNER = 50; }
{ "pile_set_name": "Github" }
/* Copyright (C) 2014-2019 [email protected] This file is part of dnSpy dnSpy is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. dnSpy 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 General Public License for more details. You should have received a copy of the GNU General Public License along with dnSpy. If not, see <http://www.gnu.org/licenses/>. */ using System; namespace dnSpy.BamlDecompiler { struct RecursionCounter { const int MAX_RECURSION_COUNT = 100; int counter; public bool Increment() { if (counter >= MAX_RECURSION_COUNT) return false; counter++; return true; } public void Decrement() { #if DEBUG if (counter <= 0) throw new InvalidOperationException("recursionCounter <= 0"); #endif counter--; } } }
{ "pile_set_name": "Github" }
=== In Development (git clone git://github.com/dchelimsky/rspec-rails.git) IMPORTANT: use 'script/autospec' (or just 'autospec' if you have the rspec gem installed) instead of 'autotest'. We changed the way autotest discovers rspec so the autotest executable won't automatically load rspec anymore. This allows rspec to live side by side other spec frameworks without always co-opting autotest through autotest's discovery mechanism. * Generated route specs have shorter names, making it less painful to modify their implementation * Add conditional so Rails 2.1.0 doesn't warn about cache_template_extensions (patch from James Herdman) * Fixed stub_model examples to work with Rails 2.1.0 (the code was fine, just the examples needed patching) * use hoe for build/release * reworked generated examples for rspec_scaffold - thanks to Mikel Lindsaar and Dan Manges for their feedback * bye, bye translator * Added proxy to cookies so you can set them in examples the same way you set them in controllers * Added script/autospec so you can run autospec without installing the gem * Support --skip-fixture in the rspec_model generator (patches from Alex Tomlins and Niels Ganser) * Add mock_model#as_new_record (patch from Zach Dennis) === Version 1.1.4 Maintenance release. * Moved mock_model and stub_model to their own module: Spec::Rails::Mocks * Setting mock_model object id with stubs hash - patch from Adam Meehan * Added as_new_record to stub_model e.g. stub_model(Foo).as_new_record * Improved stub_model such that new_record? does "the right thing" * Patch from Pat Maddox to get integrate_views to work in nested example groups. * Patch from Pat Maddox to get controller_name to work in nested example groups. * Patch from Corey Haines to add include_text matcher * Added stub_model method which creates a real model instance with :id stubbed and data access prohibited. * Applied patch from Pat Maddox to handle redirect_to w/ SSL. Closes #320. * Added #helper and #assigns to helper specs. * Applied patch from Bryan Helmkamp to tweak format of generated spec.opts to be more obvious. Closes #162. * Tweaked list of exceptions (ignores) for autotest * Applied patch from Rick Olson to get rspec_on_rails working with rails edge (>= 8862) * Applied patch from Wincent Colaiuta to invert sense of "spec --diff". Closes #281. * Allow any type of render in view specs. Closes #57. * Applied patch from Ian White to get rspec working with edge rails (8804). Closes #271. * Applied patch from Jon Strother to have spec_server reload fixtures. Closes #344.
{ "pile_set_name": "Github" }
{ "images": [ { "filename": "ic_contacts_white.png", "idiom": "universal", "scale": "1x" }, { "filename": "ic_contacts_white_2x.png", "idiom": "universal", "scale": "2x" }, { "filename": "ic_contacts_white_3x.png", "idiom": "universal", "scale": "3x" } ], "info": { "author": "xcode", "version": 1 } }
{ "pile_set_name": "Github" }
/* * wm8994.h -- WM8994 MFD internals * * Copyright 2011 Wolfson Microelectronics PLC. * * Author: Mark Brown <[email protected]> * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation; either version 2 of the License, or (at your * option) any later version. * */ #ifndef __MFD_WM8994_H__ #define __MFD_WM8994_H__ #include <linux/regmap.h> extern struct regmap_config wm1811_regmap_config; extern struct regmap_config wm8994_regmap_config; extern struct regmap_config wm8958_regmap_config; extern struct regmap_config wm8994_base_regmap_config; #endif
{ "pile_set_name": "Github" }
$! $! OpenVMS configure procedure for libtiff $! (c) Alexey Chupahin 22-NOV-2007 $! [email protected] $! $! Permission to use, copy, modify, distribute, and sell this software and $! its documentation for any purpose is hereby granted without fee, provided $! that (i) the above copyright notices and this permission notice appear in $! all copies of the software and related documentation, and (ii) the names of $! Sam Leffler and Silicon Graphics may not be used in any advertising or $! publicity relating to the software without the specific, prior written $! permission of Sam Leffler and Silicon Graphics. $! $! THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, $! EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY $! WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. $! $! IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR $! ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, $! OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, $! WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF $! LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE $! OF THIS SOFTWARE. $! $! $ SET NOON $WRITE SYS$OUTPUT " " $WRITE SYS$OUTPUT "Configuring libTIFF library" $WRITE SYS$OUTPUT " " $! Checking architecture $DECC = F$SEARCH("SYS$SYSTEM:DECC$COMPILER.EXE") .NES. "" $IF (.NOT. DECC) THEN $WRITE SYS$OUTPUT "BAD compiler" GOTO EXIT $ IF F$GETSYI("ARCH_TYPE").EQ.1 THEN CPU = "VAX" $ IF F$GETSYI("ARCH_TYPE").EQ.2 THEN CPU = "Alpha" $ IF F$GETSYI("ARCH_TYPE").EQ.3 THEN CPU = "I64" $ OS = F$GETSYI("VERSION") $WRITE SYS$OUTPUT "Checking architecture ... ", CPU $WRITE SYS$OUTPUT "Checking OS ... OpenVMS ",OS $SHARED=0 $IF ( (CPU.EQS."Alpha").OR.(CPU.EQS."I64") ) $ THEN $ SHARED=64 $ ELSE $ SHARED=32 $ENDIF $MMS = F$SEARCH("SYS$SYSTEM:MMS.EXE") .NES. "" $MMK = F$TYPE(MMK) $IF (MMS .OR. MMK.NES."") THEN GOTO TEST_LIBRARIES $! I cant find any make tool $GOTO EXIT $! $! $TEST_LIBRARIES: $! Setting as MAKE utility one of MMS or MMK. I prefer MMS. $IF (MMK.NES."") THEN MAKE="MMK" $IF (MMS) THEN MAKE="MMS" $WRITE SYS$OUTPUT "Checking build utility ... ''MAKE'" $WRITE SYS$OUTPUT " " $! $! $IF (P1.EQS."STATIC").OR.(P1.EQS."static") THEN SHARED=0 $! $! $!"Checking for strcasecmp " $ DEFINE SYS$ERROR _NLA0: $ DEFINE SYS$OUTPUT _NLA0: $ CC/OBJECT=TEST.OBJ/INCLUDE=(ZLIB) SYS$INPUT #include <strings.h> #include <stdlib.h> int main() { if (strcasecmp("bla", "Bla")==0) exit(0); else exit(2); } $! $TMP = $STATUS $DEASS SYS$ERROR $DEAS SYS$OUTPUT $IF (TMP .NE. %X10B90001) $ THEN $ HAVE_STRCASECMP=0 $ GOTO NEXT1 $ENDIF $DEFINE SYS$ERROR _NLA0: $DEFINE SYS$OUTPUT _NLA0: $LINK/EXE=TEST TEST $TMP = $STATUS $DEAS SYS$ERROR $DEAS SYS$OUTPUT $!WRITE SYS$OUTPUT TMP $IF (TMP .NE. %X10000001) $ THEN $ HAVE_STRCASECMP=0 $ GOTO NEXT1 $ENDIF $! $DEFINE SYS$ERROR _NLA0: $DEFINE SYS$OUTPUT _NLA0: $RUN TEST $IF ($STATUS .NE. %X00000001) $ THEN $ HAVE_STRCASECMP=0 $ ELSE $ HAVE_STRCASECMP=1 $ENDIF $DEAS SYS$ERROR $DEAS SYS$OUTPUT $NEXT1: $IF (HAVE_STRCASECMP.EQ.1) $ THEN $ WRITE SYS$OUTPUT "Checking for strcasecmp ... Yes" $ ELSE $ WRITE SYS$OUTPUT "Checking for strcasecmp ... No" $ENDIF $! $! $!"Checking for lfind " $ DEFINE SYS$ERROR _NLA0: $ DEFINE SYS$OUTPUT _NLA0: $ CC/OBJECT=TEST.OBJ/INCLUDE=(ZLIB) SYS$INPUT #include <search.h> int main() { lfind((const void *)key, (const void *)NULL, (size_t *)NULL, (size_t) 0, NULL); } $! $TMP = $STATUS $DEASS SYS$ERROR $DEAS SYS$OUTPUT $IF (TMP .NE. %X10B90001) $ THEN $ HAVE_LFIND=0 $ GOTO NEXT2 $ENDIF $DEFINE SYS$ERROR _NLA0: $DEFINE SYS$OUTPUT _NLA0: $LINK/EXE=TEST TEST $TMP = $STATUS $DEAS SYS$ERROR $DEAS SYS$OUTPUT $!WRITE SYS$OUTPUT TMP $IF (TMP .NE. %X10000001) $ THEN $ HAVE_LFIND=0 $ GOTO NEXT2 $ ELSE $ HAVE_LFIND=1 $ENDIF $! $NEXT2: $IF (HAVE_LFIND.EQ.1) $ THEN $ WRITE SYS$OUTPUT "Checking for lfind ... Yes" $ ELSE $ WRITE SYS$OUTPUT "Checking for lfind ... No" $ENDIF $! $! $!"Checking for correct zlib library " $ DEFINE SYS$ERROR _NLA0: $ DEFINE SYS$OUTPUT _NLA0: $ CC/OBJECT=TEST.OBJ/INCLUDE=(ZLIB) SYS$INPUT #include <stdlib.h> #include <stdio.h> #include <zlib.h> int main() { printf("checking version zlib: %s\n",zlibVersion()); } $TMP = $STATUS $DEASS SYS$ERROR $DEAS SYS$OUTPUT $!WRITE SYS$OUTPUT TMP $IF (TMP .NE. %X10B90001) $ THEN $ HAVE_ZLIB=0 $ GOTO EXIT $ENDIF $DEFINE SYS$ERROR _NLA0: $DEFINE SYS$OUTPUT _NLA0: $LINK/EXE=TEST TEST,ZLIB:LIBZ/LIB $TMP = $STATUS $DEAS SYS$ERROR $DEAS SYS$OUTPUT $!WRITE SYS$OUTPUT TMP $IF (TMP .NE. %X10000001) $ THEN $ HAVE_ZLIB=0 $ GOTO EXIT $ ELSE $ HAVE_ZLIB=1 $ENDIF $IF (HAVE_ZLIB.EQ.1) $ THEN $ WRITE SYS$OUTPUT "Checking for correct zlib library ... Yes" $ ELSE $ WRITE SYS$OUTPUT "Checking for correct zlib library ... No" $ WRITE SYS$OUTPUT "This is fatal. Please download and install good library from fafner.dyndns.org/~alexey/libsdl/public.html" $ENDIF $RUN TEST $! $DEL TEST.OBJ;* $! Checking for JPEG ... $ DEFINE SYS$ERROR _NLA0: $ DEFINE SYS$OUTPUT _NLA0: $ CC/OBJECT=TEST.OBJ/INCLUDE=(JPEG) SYS$INPUT #include <stdlib.h> #include <stdio.h> #include <jpeglib.h> #include <jversion.h> int main() { printf("checking version jpeg: %s\n",JVERSION); jpeg_quality_scaling(0); return 0; } $TMP = $STATUS $DEASS SYS$ERROR $DEAS SYS$OUTPUT $!WRITE SYS$OUTPUT TMP $IF (TMP .NE. %X10B90001) $ THEN $ WRITE SYS$OUTPUT "Checking for static jpeg library ... No" $ HAVE_JPEG=0 $ENDIF $DEFINE SYS$ERROR _NLA0: $DEFINE SYS$OUTPUT _NLA0: $LINK/EXE=TEST TEST,JPEG:LIBJPEG/LIB $TMP = $STATUS $DEAS SYS$ERROR $DEAS SYS$OUTPUT $!WRITE SYS$OUTPUT TMP $IF (TMP .NE. %X10000001) $ THEN $ HAVE_JPEG=0 $ ELSE $ HAVE_JPEG=1 $ENDIF $IF (HAVE_JPEG.EQ.1) $ THEN $ WRITE SYS$OUTPUT "Checking for static jpeg library ... Yes" $ JPEG_LIBRARY_PATH="JPEG:LIBJPEG/LIB" $ RUN TEST $ ELSE $ WRITE SYS$OUTPUT "Checking for static jpeg library ... No" $ENDIF $! $!"Checking for SHARED JPEG library " $OPEN/WRITE OUT TEST.OPT $WRITE OUT "SYS$SHARE:LIBJPEG$SHR/SHARE" $WRITE OUT "ZLIB:LIBZ/LIB" $CLOSE OUT $DEFINE SYS$ERROR _NLA0: $DEFINE SYS$OUTPUT _NLA0: $LINK/EXE=TEST TEST,TEST/OPT $TMP = $STATUS $DEAS SYS$ERROR $DEAS SYS$OUTPUT $!WRITE SYS$OUTPUT TMP $IF (TMP .NE. %X10000001) $ THEN $ HAVE_JPEG_SHARED=0 $ ELSE $ HAVE_JPEG_SHARED=1 $ENDIF $IF (HAVE_JPEG_SHARED.EQ.1) $ THEN $ WRITE SYS$OUTPUT "Checking for shared jpeg library ... Yes" $ JPEG_LIBRARY_PATH="SYS$SHARE:LIBJPEG$SHR/SHARE" $ ELSE $ WRITE SYS$OUTPUT "Checking for shared jpeg library ... No" $ENDIF $! $ IF ( (HAVE_JPEG_SHARED.EQ.0).AND.(HAVE_JPEG.EQ.0) ) $ THEN $ WRITE SYS$OUTPUT "No JPEG library installed. This is fatal. Please download and install good library from fafner.dyndns.org/~alexey/libsdl/public.html" $ GOTO EXIT $ ENDIF $! $! $! $! Checking for X11 ... $IF F$TRNLNM("DECW$INCLUDE") .NES. "" $ THEN $ WRITE SYS$OUTPUT "Checking for X11 ... Yes" $ ELSE $ WRITE SYS$OUTPUT "Checking for X11 ... No" $ WRITE SYS$OUTPUT "This is fatal. Please install X11 software" $ GOTO EXIT $ENDIF $! $!WRITING BUILD FILES $OPEN/WRITE OUT BUILD.COM $ WRITE OUT "$set def [.port]" $ WRITE OUT "$",MAKE $ WRITE OUT "$set def [-.libtiff]" $ WRITE OUT "$",MAKE $ WRITE OUT "$set def [-.tools]" $ WRITE OUT "$",MAKE $ WRITE OUT "$set def [-]" $ WRITE OUT "$cop [.PORT]LIBPORT.OLB [.LIBTIFF]LIBPORT.OLB" $ WRITE OUT "$ CURRENT = F$ENVIRONMENT (""DEFAULT"") " $ WRITE OUT "$TIFF=CURRENT" $ WRITE OUT "$OPEN/WRITE OUTT LIBTIFF$STARTUP.COM" $ WRITE OUT "$TIFF[F$LOCATE(""]"",TIFF),9]:="".LIBTIFF]""" $ WRITE OUT "$WRITE OUTT ""DEFINE TIFF ","'","'","TIFF'"" " $ WRITE OUT "$TIFF=CURRENT" $ WRITE OUT "$TIFF[F$LOCATE(""]"",TIFF),7]:="".TOOLS]""" $ WRITE OUT "$WRITE OUTT ""BMP2TIFF:==$", "'","'","TIFF'BMP2TIFF""" $ WRITE OUT "$WRITE OUTT ""FAX2PS:==$", "'","'","TIFF'FAX2PS""" $ WRITE OUT "$WRITE OUTT ""FAX2TIFF:==$", "'","'","TIFF'FAX2TIFF""" $ WRITE OUT "$WRITE OUTT ""GIF2TIFF:==$", "'","'","TIFF'GIF2TIFF""" $ WRITE OUT "$WRITE OUTT ""PAL2RGB:==$", "'","'","TIFF'PAL2RGB""" $ WRITE OUT "$WRITE OUTT ""PPM2TIFF:==$", "'","'","TIFF'PPM2TIFF""" $ WRITE OUT "$WRITE OUTT ""RAS2TIFF:==$", "'","'","TIFF'RAS2TIFF""" $ WRITE OUT "$WRITE OUTT ""RAW2TIFF:==$", "'","'","TIFF'RAW2TIFF""" $ WRITE OUT "$WRITE OUTT ""RGB2YCBCR:==$", "'","'","TIFF'RGB2YCBCR""" $ WRITE OUT "$WRITE OUTT ""THUMBNAIL:==$", "'","'","TIFF'THUMBNAIL""" $ WRITE OUT "$WRITE OUTT ""TIFF2BW:==$", "'","'","TIFF'TIFF2BW""" $ WRITE OUT "$WRITE OUTT ""TIFF2PDF:==$", "'","'","TIFF'TIFF2PDF""" $ WRITE OUT "$WRITE OUTT ""TIFF2PS:==$", "'","'","TIFF'TIFF2PS""" $ WRITE OUT "$WRITE OUTT ""TIFF2RGBA:==$", "'","'","TIFF'TIFF2RGBA""" $ WRITE OUT "$WRITE OUTT ""TIFFCMP:==$", "'","'","TIFF'TIFFCMP""" $ WRITE OUT "$WRITE OUTT ""TIFFCP:==$", "'","'","TIFF'TIFFCP""" $ WRITE OUT "$WRITE OUTT ""TIFFDITHER:==$", "'","'","TIFF'TIFFDITHER""" $ WRITE OUT "$WRITE OUTT ""TIFFDUMP:==$", "'","'","TIFF'TIFFDUMP""" $ WRITE OUT "$WRITE OUTT ""TIFFINFO:==$", "'","'","TIFF'TIFFINFO""" $ WRITE OUT "$WRITE OUTT ""TIFFMEDIAN:==$", "'","'","TIFF'TIFFMEDIAN""" $ WRITE OUT "$WRITE OUTT ""TIFFCROP:==$", "'","'","TIFF'TIFFCROP""" $ WRITE OUT "$WRITE OUTT ""TIFFSET:==$", "'","'","TIFF'TIFFSET""" $ WRITE OUT "$CLOSE OUTT" $ WRITE OUT "$OPEN/WRITE OUTT [.LIBTIFF]LIBTIFF.OPT" $ WRITE OUT "$WRITE OUTT ""TIFF:TIFF/LIB"" $ WRITE OUT "$WRITE OUTT ""TIFF:LIBPORT/LIB"" $ WRITE OUT "$WRITE OUTT ""JPEG:LIBJPEG/LIB"" $ WRITE OUT "$WRITE OUTT ""ZLIB:LIBZ/LIB"" $ WRITE OUT "$CLOSE OUTT" $! $ WRITE OUT "$WRITE SYS$OUTPUT "" "" " $ WRITE OUT "$WRITE SYS$OUTPUT ""***************************************************************************** "" " $ WRITE OUT "$WRITE SYS$OUTPUT ""LIBTIFF$STARTUP.COM has been created. "" " $ WRITE OUT "$WRITE SYS$OUTPUT ""This file setups all logicals needed. It should be execute before using LibTIFF "" " $ WRITE OUT "$WRITE SYS$OUTPUT ""Nice place to call it - LOGIN.COM "" " $ WRITE OUT "$WRITE SYS$OUTPUT """" " $ WRITE OUT "$WRITE SYS$OUTPUT ""Using the library:"" " $ WRITE OUT "$WRITE SYS$OUTPUT ""CC/INC=TIFF ASCII_TAG.C"" " $ WRITE OUT "$WRITE SYS$OUTPUT ""LINK ASCII_TAG,TIFF:LIBTIFF/OPT"" " $ WRITE OUT "$WRITE SYS$OUTPUT ""***************************************************************************** "" " $CLOSE OUT $! $! DESCRIP.MMS in [.PORT] $OBJ="dummy.obj" $IF HAVE_STRCASECMP.NE.1 $ THEN $ OBJ=OBJ+",strcasecmp.obj" $ENDIF $IF HAVE_LFIND.NE.1 $ THEN $ OBJ=OBJ+",lfind.obj" $ENDIF $OPEN/WRITE OUT [.PORT]DESCRIP.MMS $WRITE OUT "OBJ=",OBJ $WRITE OUT "" $WRITE OUT "LIBPORT.OLB : $(OBJ)" $WRITE OUT " LIB/CREA LIBPORT $(OBJ)" $WRITE OUT "" $WRITE OUT "" $WRITE OUT "dummy.obj : dummy.c" $WRITE OUT " $(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET)" $WRITE OUT "" $WRITE OUT "" $WRITE OUT "strcasecmp.obj : strcasecmp.c" $WRITE OUT " $(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET)" $WRITE OUT "" $WRITE OUT "" $WRITE OUT "lfind.obj : lfind.c" $WRITE OUT " $(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET)" $WRITE OUT "" $WRITE OUT "" $CLOSE OUT $! $! $WRITE SYS$OUTPUT "Creating LIBTIFF$DEF.OPT" $IF (SHARED.EQ.64) $ THEN $ COPY SYS$INPUT TIFF$DEF.OPT SYMBOL_VECTOR= (- TIFFOpen=PROCEDURE,- TIFFGetVersion=PROCEDURE,- TIFFCleanup=PROCEDURE,- TIFFClose=PROCEDURE,- TIFFFlush=PROCEDURE,- TIFFFlushData=PROCEDURE,- TIFFGetField=PROCEDURE,- TIFFVGetField=PROCEDURE,- TIFFGetFieldDefaulted=PROCEDURE,- TIFFVGetFieldDefaulted=PROCEDURE,- TIFFGetTagListEntry=PROCEDURE,- TIFFGetTagListCount=PROCEDURE,- TIFFReadDirectory=PROCEDURE,- TIFFScanlineSize=PROCEDURE,- TIFFStripSize=PROCEDURE,- TIFFVStripSize=PROCEDURE,- TIFFRawStripSize=PROCEDURE,- TIFFTileRowSize=PROCEDURE,- TIFFTileSize=PROCEDURE,- TIFFVTileSize=PROCEDURE,- TIFFFileno=PROCEDURE,- TIFFSetFileno=PROCEDURE,- TIFFGetMode=PROCEDURE,- TIFFIsTiled=PROCEDURE,- TIFFIsByteSwapped=PROCEDURE,- TIFFIsBigEndian=PROCEDURE,- TIFFIsMSB2LSB=PROCEDURE,- TIFFIsUpSampled=PROCEDURE,- TIFFCIELabToRGBInit=PROCEDURE,- TIFFCIELabToXYZ=PROCEDURE,- TIFFXYZToRGB=PROCEDURE,- TIFFYCbCrToRGBInit=PROCEDURE,- TIFFYCbCrtoRGB=PROCEDURE,- TIFFCurrentRow=PROCEDURE,- TIFFCurrentDirectory=PROCEDURE,- TIFFCurrentStrip=PROCEDURE,- TIFFCurrentTile=PROCEDURE,- TIFFDataWidth=PROCEDURE,- TIFFReadBufferSetup=PROCEDURE,- TIFFWriteBufferSetup=PROCEDURE,- TIFFSetupStrips=PROCEDURE,- TIFFLastDirectory=PROCEDURE,- TIFFSetDirectory=PROCEDURE,- TIFFSetSubDirectory=PROCEDURE,- TIFFUnlinkDirectory=PROCEDURE,- TIFFSetField=PROCEDURE,- TIFFVSetField=PROCEDURE,- TIFFCheckpointDirectory=PROCEDURE,- TIFFWriteDirectory=PROCEDURE,- TIFFRewriteDirectory=PROCEDURE,- TIFFPrintDirectory=PROCEDURE,- TIFFReadScanline=PROCEDURE,- TIFFWriteScanline=PROCEDURE,- TIFFReadRGBAImage=PROCEDURE,- TIFFReadRGBAImageOriented=PROCEDURE,- TIFFFdOpen=PROCEDURE,- TIFFClientOpen=PROCEDURE,- TIFFFileName=PROCEDURE,- TIFFError=PROCEDURE,- TIFFErrorExt=PROCEDURE,- TIFFWarning=PROCEDURE,- TIFFWarningExt=PROCEDURE,- TIFFSetErrorHandler=PROCEDURE,- TIFFSetErrorHandlerExt=PROCEDURE,- TIFFSetWarningHandler=PROCEDURE,- TIFFSetWarningHandlerExt=PROCEDURE,- TIFFComputeTile=PROCEDURE,- TIFFCheckTile=PROCEDURE,- TIFFNumberOfTiles=PROCEDURE,- TIFFReadTile=PROCEDURE,- TIFFWriteTile=PROCEDURE,- TIFFComputeStrip=PROCEDURE,- TIFFNumberOfStrips=PROCEDURE,- TIFFRGBAImageBegin=PROCEDURE,- TIFFRGBAImageGet=PROCEDURE,- TIFFRGBAImageEnd=PROCEDURE,- TIFFReadEncodedStrip=PROCEDURE,- TIFFReadRawStrip=PROCEDURE,- TIFFReadEncodedTile=PROCEDURE,- TIFFReadRawTile=PROCEDURE,- TIFFReadRGBATile=PROCEDURE,- TIFFReadRGBAStrip=PROCEDURE,- TIFFWriteEncodedStrip=PROCEDURE,- TIFFWriteRawStrip=PROCEDURE,- TIFFWriteEncodedTile=PROCEDURE,- TIFFWriteRawTile=PROCEDURE,- TIFFSetWriteOffset=PROCEDURE,- TIFFSwabDouble=PROCEDURE,- TIFFSwabShort=PROCEDURE,- TIFFSwabLong=PROCEDURE,- TIFFSwabArrayOfShort=PROCEDURE,- TIFFSwabArrayOfLong=PROCEDURE,- TIFFSwabArrayOfDouble=PROCEDURE,- TIFFSwabArrayOfTriples=PROCEDURE,- TIFFReverseBits=PROCEDURE,- TIFFGetBitRevTable=PROCEDURE,- TIFFDefaultStripSize=PROCEDURE,- TIFFDefaultTileSize=PROCEDURE,- TIFFRasterScanlineSize=PROCEDURE,- _TIFFmalloc=PROCEDURE,- _TIFFrealloc=PROCEDURE,- _TIFFfree=PROCEDURE,- _TIFFmemset=PROCEDURE,- _TIFFmemcpy=PROCEDURE,- _TIFFmemcmp=PROCEDURE,- TIFFCreateDirectory=PROCEDURE,- TIFFSetTagExtender=PROCEDURE,- TIFFMergeFieldInfo=PROCEDURE,- TIFFFindFieldInfo=PROCEDURE,- TIFFFindFieldInfoByName=PROCEDURE,- TIFFFieldWithName=PROCEDURE,- TIFFFieldWithTag=PROCEDURE,- TIFFFieldTag=PROCEDURE,- TIFFFieldName=PROCEDURE,- TIFFFieldDataType=PROCEDURE,- TIFFFieldPassCount=PROCEDURE,- TIFFFieldReadCount=PROCEDURE,- TIFFFieldWriteCount=PROCEDURE,- TIFFCurrentDirOffset=PROCEDURE,- TIFFWriteCheck=PROCEDURE,- TIFFRGBAImageOK=PROCEDURE,- TIFFNumberOfDirectories=PROCEDURE,- TIFFSetFileName=PROCEDURE,- TIFFSetClientdata=PROCEDURE,- TIFFSetMode=PROCEDURE,- TIFFClientdata=PROCEDURE,- TIFFGetReadProc=PROCEDURE,- TIFFGetWriteProc=PROCEDURE,- TIFFGetSeekProc=PROCEDURE,- TIFFGetCloseProc=PROCEDURE,- TIFFGetSizeProc=PROCEDURE,- TIFFGetMapFileProc=PROCEDURE,- TIFFGetUnmapFileProc=PROCEDURE,- TIFFIsCODECConfigured=PROCEDURE,- TIFFGetConfiguredCODECs=PROCEDURE,- TIFFFindCODEC=PROCEDURE,- TIFFRegisterCODEC=PROCEDURE,- TIFFUnRegisterCODEC=PROCEDURE,- TIFFFreeDirectory=PROCEDURE,- TIFFReadCustomDirectory=PROCEDURE,- TIFFReadEXIFDirectory=PROCEDURE,- TIFFAccessTagMethods=PROCEDURE,- TIFFGetClientInfo=PROCEDURE,- TIFFSetClientInfo=PROCEDURE,- TIFFReassignTagToIgnore=PROCEDURE- ) $ENDIF $IF (SHARED.EQ.32) $ THEN $ COPY SYS$INPUT TIFF$DEF.OPT UNIVERSAL=TIFFOpen UNIVERSAL=TIFFGetVersion UNIVERSAL=TIFFCleanup UNIVERSAL=TIFFClose UNIVERSAL=TIFFFlush UNIVERSAL=TIFFFlushData UNIVERSAL=TIFFGetField UNIVERSAL=TIFFVGetField UNIVERSAL=TIFFGetFieldDefaulted UNIVERSAL=TIFFVGetFieldDefaulted UNIVERSAL=TIFFGetTagListEntry UNIVERSAL=TIFFGetTagListCount UNIVERSAL=TIFFReadDirectory UNIVERSAL=TIFFScanlineSize UNIVERSAL=TIFFStripSize UNIVERSAL=TIFFVStripSize UNIVERSAL=TIFFRawStripSize UNIVERSAL=TIFFTileRowSize UNIVERSAL=TIFFTileSize UNIVERSAL=TIFFVTileSize UNIVERSAL=TIFFFileno UNIVERSAL=TIFFSetFileno UNIVERSAL=TIFFGetMode UNIVERSAL=TIFFIsTiled UNIVERSAL=TIFFIsByteSwapped UNIVERSAL=TIFFIsBigEndian UNIVERSAL=TIFFIsMSB2LSB UNIVERSAL=TIFFIsUpSampled UNIVERSAL=TIFFCIELabToRGBInit UNIVERSAL=TIFFCIELabToXYZ UNIVERSAL=TIFFXYZToRGB UNIVERSAL=TIFFYCbCrToRGBInit UNIVERSAL=TIFFYCbCrtoRGB UNIVERSAL=TIFFCurrentRow UNIVERSAL=TIFFCurrentDirectory UNIVERSAL=TIFFCurrentStrip UNIVERSAL=TIFFCurrentTile UNIVERSAL=TIFFDataWidth UNIVERSAL=TIFFReadBufferSetup UNIVERSAL=TIFFWriteBufferSetup UNIVERSAL=TIFFSetupStrips UNIVERSAL=TIFFLastDirectory UNIVERSAL=TIFFSetDirectory UNIVERSAL=TIFFSetSubDirectory UNIVERSAL=TIFFUnlinkDirectory UNIVERSAL=TIFFSetField UNIVERSAL=TIFFVSetField UNIVERSAL=TIFFCheckpointDirectory UNIVERSAL=TIFFWriteDirectory UNIVERSAL=TIFFRewriteDirectory UNIVERSAL=TIFFPrintDirectory UNIVERSAL=TIFFReadScanline UNIVERSAL=TIFFWriteScanline UNIVERSAL=TIFFReadRGBAImage UNIVERSAL=TIFFReadRGBAImageOriented UNIVERSAL=TIFFFdOpen UNIVERSAL=TIFFClientOpen UNIVERSAL=TIFFFileName UNIVERSAL=TIFFError UNIVERSAL=TIFFErrorExt UNIVERSAL=TIFFWarning UNIVERSAL=TIFFWarningExt UNIVERSAL=TIFFSetErrorHandler UNIVERSAL=TIFFSetErrorHandlerExt UNIVERSAL=TIFFSetWarningHandler UNIVERSAL=TIFFSetWarningHandlerExt UNIVERSAL=TIFFComputeTile UNIVERSAL=TIFFCheckTile UNIVERSAL=TIFFNumberOfTiles UNIVERSAL=TIFFReadTile UNIVERSAL=TIFFWriteTile UNIVERSAL=TIFFComputeStrip UNIVERSAL=TIFFNumberOfStrips UNIVERSAL=TIFFRGBAImageBegin UNIVERSAL=TIFFRGBAImageGet UNIVERSAL=TIFFRGBAImageEnd UNIVERSAL=TIFFReadEncodedStrip UNIVERSAL=TIFFReadRawStrip UNIVERSAL=TIFFReadEncodedTile UNIVERSAL=TIFFReadRawTile UNIVERSAL=TIFFReadRGBATile UNIVERSAL=TIFFReadRGBAStrip UNIVERSAL=TIFFWriteEncodedStrip UNIVERSAL=TIFFWriteRawStrip UNIVERSAL=TIFFWriteEncodedTile UNIVERSAL=TIFFWriteRawTile UNIVERSAL=TIFFSetWriteOffset UNIVERSAL=TIFFSwabDouble UNIVERSAL=TIFFSwabShort UNIVERSAL=TIFFSwabLong UNIVERSAL=TIFFSwabArrayOfShort UNIVERSAL=TIFFSwabArrayOfLong UNIVERSAL=TIFFSwabArrayOfDouble UNIVERSAL=TIFFSwabArrayOfTriples UNIVERSAL=TIFFReverseBits UNIVERSAL=TIFFGetBitRevTable UNIVERSAL=TIFFDefaultStripSize UNIVERSAL=TIFFDefaultTileSize UNIVERSAL=TIFFRasterScanlineSize UNIVERSAL=_TIFFmalloc UNIVERSAL=_TIFFrealloc UNIVERSAL=_TIFFfree UNIVERSAL=_TIFFmemset UNIVERSAL=_TIFFmemcpy UNIVERSAL=_TIFFmemcmp UNIVERSAL=TIFFCreateDirectory UNIVERSAL=TIFFSetTagExtender UNIVERSAL=TIFFMergeFieldInfo UNIVERSAL=TIFFFindFieldInfo UNIVERSAL=TIFFFindFieldInfoByName UNIVERSAL=TIFFFieldWithName UNIVERSAL=TIFFFieldWithTag UNIVERSAL=TIFFFieldTag UNIVERSAL=TIFFFieldName UNIVERSAL=TIFFFieldDataType UNIVERSAL=TIFFFieldPassCount UNIVERSAL=TIFFFieldReadCount UNIVERSAL=TIFFFieldWriteCount UNIVERSAL=TIFFCurrentDirOffset UNIVERSAL=TIFFWriteCheck UNIVERSAL=TIFFRGBAImageOK UNIVERSAL=TIFFNumberOfDirectories UNIVERSAL=TIFFSetFileName UNIVERSAL=TIFFSetClientdata UNIVERSAL=TIFFSetMode UNIVERSAL=TIFFClientdata UNIVERSAL=TIFFGetReadProc UNIVERSAL=TIFFGetWriteProc UNIVERSAL=TIFFGetSeekProc UNIVERSAL=TIFFGetCloseProc UNIVERSAL=TIFFGetSizeProc UNIVERSAL=TIFFGetMapFileProc UNIVERSAL=TIFFGetUnmapFileProc UNIVERSAL=TIFFIsCODECConfigured UNIVERSAL=TIFFGetConfiguredCODECs UNIVERSAL=TIFFFindCODEC UNIVERSAL=TIFFRegisterCODEC UNIVERSAL=TIFFUnRegisterCODEC UNIVERSAL=TIFFFreeDirectory UNIVERSAL=TIFFReadCustomDirectory UNIVERSAL=TIFFReadEXIFDirectory UNIVERSAL=TIFFAccessTagMethods UNIVERSAL=TIFFGetClientInfo UNIVERSAL=TIFFSetClientInfo UNIVERSAL=TIFFReassignTagToIgnore $ENDIF $! $! $! Writing TIFF$SHR.OPT file to build TOOLS $ IF (SHARED.GT.0) $ THEN $ OPEN/WRITE OUT TIFF$SHR.OPT $ WRITE OUT "[]TIFF/LIB" $ WRITE OUT "[-.PORT]LIBPORT/LIB" $ WRITE OUT JPEG_LIBRARY_PATH $ WRITE OUT "ZLIB:LIBZ/LIB" $ CLOSE OUT $ ENDIF $! $! $! Writing OPT.OPT file to build TOOLS $OPEN/WRITE OUT OPT.OPT $ IF (SHARED.GT.0) $ THEN $ WRITE OUT "[-.LIBTIFF]TIFF$SHR/SHARE" $ WRITE OUT JPEG_LIBRARY_PATH $ ELSE $ WRITE OUT "[-.LIBTIFF]TIFF/LIB" $ WRITE OUT "[-.PORT]LIBPORT/LIB" $ WRITE OUT JPEG_LIBRARY_PATH $ ENDIF $ WRITE OUT "ZLIB:LIBZ/LIB" $CLOSE OUT $! $! $COPY SYS$INPUT [.LIBTIFF]DESCRIP.MMS # (c) Alexey Chupahin 22-NOV-2007 # OpenVMS 7.3-1, DEC 2000 mod.300 # OpenVMS 8.3, HP rx1620 # Makefile for DEC C compilers. # INCL = /INCLUDE=(JPEG,ZLIB,[]) CFLAGS = $(INCL) OBJ_SYSDEP_MODULE = tif_vms.obj OBJ = \ tif_aux.obj,\ tif_close.obj,\ tif_codec.obj,\ tif_color.obj,\ tif_compress.obj,\ tif_dir.obj,\ tif_dirinfo.obj,\ tif_dirread.obj,\ tif_dirwrite.obj,\ tif_dumpmode.obj,\ tif_error.obj,\ tif_extension.obj,\ tif_fax3.obj,\ tif_fax3sm.obj,\ tif_flush.obj,\ tif_getimage.obj,\ tif_jbig.obj,\ tif_jpeg.obj,\ tif_luv.obj,\ tif_lzw.obj,\ tif_next.obj,\ tif_ojpeg.obj,\ tif_open.obj,\ tif_packbits.obj,\ tif_pixarlog.obj,\ tif_predict.obj,\ tif_print.obj,\ tif_read.obj,\ tif_strip.obj,\ tif_swab.obj,\ tif_thunder.obj,\ tif_tile.obj,\ tif_version.obj,\ tif_warning.obj,\ tif_write.obj,\ tif_zip.obj, $(OBJ_SYSDEP_MODULE) $IF (SHARED.GT.0) $ THEN $ APP SYS$INPUT [.LIBTIFF]DESCRIP.MMS ALL : tiff.olb, tiff$shr.exe $WRITE SYS$OUTPUT "Done" tiff$shr.exe : tiff.olb LINK/SHARE=TIFF$SHR.EXE TIF_AUX,[-]TIFF$DEF/OPT, [-]TIFF$SHR/OPT COPY TIFF$SHR.EXE SYS$SHARE PURGE SYS$SHARE:TIFF$SHR.EXE $ ELSE $ APP SYS$INPUT [.LIBTIFF]DESCRIP.MMS ALL : tiff.olb $WRITE SYS$OUTPUT "Done" $ENDIF $! $! $ APP SYS$INPUT [.LIBTIFF]DESCRIP.MMS tiff.olb : $(OBJ) lib/crea tiff.olb $(OBJ) #tif_config.h : tif_config.h-vms # copy tif_config.h-vms tif_config.h # #tiffconf.h : tiffconf.h-vms # copy tiffconf.h-vms tiffconf.h tif_aux.obj : tif_aux.c $(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET) tif_close.obj : tif_close.c $(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET) tif_codec.obj : tif_codec.c $(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET) tif_color.obj : tif_color.c $(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET) tif_compress.obj : tif_compress.c $(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET) tif_dir.obj : tif_dir.c $(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET) tif_dirinfo.obj : tif_dirinfo.c $(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET) tif_dirread.obj : tif_dirread.c $(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET) tif_dirwrite.obj : tif_dirwrite.c $(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET) tif_dumpmode.obj : tif_dumpmode.c $(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET) tif_error.obj : tif_error.c $(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET) tif_extension.obj : tif_extension.c $(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET) tif_fax3.obj : tif_fax3.c $(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET) tif_fax3sm.obj : tif_fax3sm.c $(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET) tif_flush.obj : tif_flush.c $(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET) tif_getimage.obj : tif_getimage.c $(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET) tif_jbig.obj : tif_jbig.c $(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET) tif_jpeg.obj : tif_jpeg.c $(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET) tif_luv.obj : tif_luv.c $(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET) tif_lzw.obj : tif_lzw.c $(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET) tif_next.obj : tif_next.c $(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET) tif_ojpeg.obj : tif_ojpeg.c $(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET) tif_open.obj : tif_open.c $(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET) tif_packbits.obj : tif_packbits.c $(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET) tif_pixarlog.obj : tif_pixarlog.c $(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET) tif_predict.obj : tif_predict.c $(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET) tif_print.obj : tif_print.c $(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET) tif_read.obj : tif_read.c $(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET) tif_strip.obj : tif_strip.c $(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET) tif_swab.obj : tif_swab.c $(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET) tif_thunder.obj : tif_thunder.c $(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET) tif_tile.obj : tif_tile.c $(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET) tif_unix.obj : tif_unix.c $(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET) tif_version.obj : tif_version.c $(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET) tif_warning.obj : tif_warning.c $(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET) tif_write.obj : tif_write.c $(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET) tif_zip.obj : tif_zip.c $(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET) clean : del *.obj;* del *.olb;* $! $! $! $COPY SYS$INPUT [.TOOLS]DESCRIP.MMS # (c) Alexey Chupahin 22-NOV-2007 # OpenVMS 7.3-1, DEC 2000 mod.300 # OpenVMS 8.3, HP rx1620 INCL = /INCL=([],[-.LIBTIFF]) CFLAGS = $(INCL) LIBS = [-]OPT/OPT OBJ=\ bmp2tiff.exe,\ fax2ps.exe,\ fax2tiff.exe,\ gif2tiff.exe,\ pal2rgb.exe,\ ppm2tiff.exe,\ ras2tiff.exe,\ raw2tiff.exe,\ rgb2ycbcr.exe,\ thumbnail.exe,\ tiff2bw.exe,\ tiff2pdf.exe,\ tiff2ps.exe,\ tiff2rgba.exe,\ tiffcmp.exe,\ tiffcp.exe,\ tiffcrop.exe,\ tiffdither.exe,\ tiffdump.exe,\ tiffinfo.exe,\ tiffmedian.exe,\ tiffset.exe,\ tiffsplit.exe,\ ycbcr.exe all : $(OBJ) $! bmp2tiff.obj : bmp2tiff.c $(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET) bmp2tiff.exe : bmp2tiff.obj LINK/EXE=$(MMS$TARGET) $(MMS$SOURCE), $(LIBS) fax2ps.obj : fax2ps.c $(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET) fax2ps.exe : fax2ps.obj LINK/EXE=$(MMS$TARGET) $(MMS$SOURCE), $(LIBS) fax2tiff.obj : fax2tiff.c $(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET) fax2tiff.exe : fax2tiff.obj LINK/EXE=$(MMS$TARGET) $(MMS$SOURCE), $(LIBS) gif2tiff.obj : gif2tiff.c $(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET) gif2tiff.exe : gif2tiff.obj LINK/EXE=$(MMS$TARGET) $(MMS$SOURCE), $(LIBS) pal2rgb.obj : pal2rgb.c $(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET) pal2rgb.exe : pal2rgb.obj LINK/EXE=$(MMS$TARGET) $(MMS$SOURCE), $(LIBS) ppm2tiff.obj : ppm2tiff.c $(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET) ppm2tiff.exe : ppm2tiff.obj LINK/EXE=$(MMS$TARGET) $(MMS$SOURCE), $(LIBS) ras2tiff.obj : ras2tiff.c $(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET) ras2tiff.exe : ras2tiff.obj LINK/EXE=$(MMS$TARGET) $(MMS$SOURCE), $(LIBS) raw2tiff.obj : raw2tiff.c $(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET) raw2tiff.exe : raw2tiff.obj LINK/EXE=$(MMS$TARGET) $(MMS$SOURCE), $(LIBS) rgb2ycbcr.obj : rgb2ycbcr.c $(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET) rgb2ycbcr.exe : rgb2ycbcr.obj LINK/EXE=$(MMS$TARGET) $(MMS$SOURCE), $(LIBS) sgi2tiff.obj : sgi2tiff.c $(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET) sgi2tiff.exe : sgi2tiff.obj LINK/EXE=$(MMS$TARGET) $(MMS$SOURCE), $(LIBS) sgisv.obj : sgisv.c $(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET) sgisv.exe : sgisv.obj LINK/EXE=$(MMS$TARGET) $(MMS$SOURCE), $(LIBS) thumbnail.obj : thumbnail.c $(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET) thumbnail.exe : thumbnail.obj LINK/EXE=$(MMS$TARGET) $(MMS$SOURCE), $(LIBS) tiff2bw.obj : tiff2bw.c $(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET) tiff2bw.exe : tiff2bw.obj LINK/EXE=$(MMS$TARGET) $(MMS$SOURCE), $(LIBS) tiff2pdf.obj : tiff2pdf.c $(CC) $(CFLAGS) /NOWARN $(MMS$SOURCE) /OBJ=$(MMS$TARGET) tiff2pdf.exe : tiff2pdf.obj LINK/EXE=$(MMS$TARGET) $(MMS$SOURCE), $(LIBS) tiff2ps.obj : tiff2ps.c $(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET) tiff2ps.exe : tiff2ps.obj LINK/EXE=$(MMS$TARGET) $(MMS$SOURCE), $(LIBS) tiff2rgba.obj : tiff2rgba.c $(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET) tiff2rgba.exe : tiff2rgba.obj LINK/EXE=$(MMS$TARGET) $(MMS$SOURCE), $(LIBS) tiffcmp.obj : tiffcmp.c $(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET) tiffcmp.exe : tiffcmp.obj LINK/EXE=$(MMS$TARGET) $(MMS$SOURCE), $(LIBS) tiffcp.obj : tiffcp.c $(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET) tiffcp.exe : tiffcp.obj LINK/EXE=$(MMS$TARGET) $(MMS$SOURCE), $(LIBS) tiffcrop.obj : tiffcrop.c $(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET) tiffcrop.exe : tiffcrop.obj LINK/EXE=$(MMS$TARGET) $(MMS$SOURCE), $(LIBS) tiffdither.obj : tiffdither.c $(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET) tiffdither.exe : tiffdither.obj LINK/EXE=$(MMS$TARGET) $(MMS$SOURCE), $(LIBS) tiffdump.obj : tiffdump.c $(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET) tiffdump.exe : tiffdump.obj LINK/EXE=$(MMS$TARGET) $(MMS$SOURCE), $(LIBS) tiffgt.obj : tiffgt.c $(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET) tiffgt.exe : tiffgt.obj LINK/EXE=$(MMS$TARGET) $(MMS$SOURCE), $(LIBS) tiffinfo.obj : tiffinfo.c $(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET) tiffinfo.exe : tiffinfo.obj LINK/EXE=$(MMS$TARGET) $(MMS$SOURCE), $(LIBS) tiffmedian.obj : tiffmedian.c $(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET) tiffmedian.exe : tiffmedian.obj LINK/EXE=$(MMS$TARGET) $(MMS$SOURCE), $(LIBS) tiffset.obj : tiffset.c $(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET) tiffset.exe : tiffset.obj LINK/EXE=$(MMS$TARGET) $(MMS$SOURCE), $(LIBS) tiffsplit.obj : tiffsplit.c $(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET) tiffsplit.exe : tiffsplit.obj LINK/EXE=$(MMS$TARGET) $(MMS$SOURCE), $(LIBS) ycbcr.obj : ycbcr.c $(CC) $(CFLAGS) $(MMS$SOURCE) /OBJ=$(MMS$TARGET) ycbcr.exe : ycbcr.obj LINK/EXE=$(MMS$TARGET) $(MMS$SOURCE), $(LIBS) CLEAN : DEL ALL.;* DEL *.OBJ;* DEL *.EXE;* $! $! $! $!copiing and patching TIFF_CONF.H, TIF_CONFIG.H $! $CURRENT = F$ENVIRONMENT (""DEFAULT"") $CURRENT[F$LOCATE("]",CURRENT),9]:=".LIBTIFF]" $WRITE SYS$OUTPUT "Creating TIFFCONF.H and TIF_CONFIG.H" $COPY SYS$INPUT 'CURRENT'TIFFCONF.H /* Configuration defines for installed libtiff. This file maintained for backward compatibility. Do not use definitions from this file in your programs. */ #ifndef _TIFFCONF_ #define _TIFFCONF_ /* Define to 1 if the system has the type `int16'. */ //#define HAVE_INT16 /* Define to 1 if the system has the type `int32'. */ //#define HAVE_INT32 /* Define to 1 if the system has the type `int8'. */ //#define HAVE_INT8 /* The size of a `int', as computed by sizeof. */ #define SIZEOF_INT 4 /* The size of a `long', as computed by sizeof. */ #define SIZEOF_LONG 4 /* Compatibility stuff. */ /* Define as 0 or 1 according to the floating point format suported by the machine */ #ifdef __IEEE_FLOAT #define HAVE_IEEEFP 1 #endif #define HAVE_GETOPT 1 /* Set the native cpu bit order (FILLORDER_LSB2MSB or FILLORDER_MSB2LSB) */ #define HOST_FILLORDER FILLORDER_LSB2MSB /* Native cpu byte order: 1 if big-endian (Motorola) or 0 if little-endian (Intel) */ #define HOST_BIGENDIAN 0 /* Support CCITT Group 3 & 4 algorithms */ #define CCITT_SUPPORT 1 /* Support LogLuv high dynamic range encoding */ #define LOGLUV_SUPPORT 1 /* Support LZW algorithm */ #define LZW_SUPPORT 1 /* Support NeXT 2-bit RLE algorithm */ #define NEXT_SUPPORT 1 /* Support Old JPEG compresson (read contrib/ojpeg/README first! Compilation fails with unpatched IJG JPEG library) */ /* Support Macintosh PackBits algorithm */ #define PACKBITS_SUPPORT 1 /* Support Pixar log-format algorithm (requires Zlib) */ #define PIXARLOG_SUPPORT 1 /* Support ThunderScan 4-bit RLE algorithm */ #define THUNDER_SUPPORT 1 /* Support Deflate compression */ /* #undef ZIP_SUPPORT */ /* Support strip chopping (whether or not to convert single-strip uncompressed images to mutiple strips of ~8Kb to reduce memory usage) */ #define STRIPCHOP_DEFAULT TIFF_STRIPCHOP /* Enable SubIFD tag (330) support */ #define SUBIFD_SUPPORT 1 /* Treat extra sample as alpha (default enabled). The RGBA interface will treat a fourth sample with no EXTRASAMPLE_ value as being ASSOCALPHA. Many packages produce RGBA files but don't mark the alpha properly. */ #define DEFAULT_EXTRASAMPLE_AS_ALPHA 1 /* Pick up YCbCr subsampling info from the JPEG data stream to support files lacking the tag (default enabled). */ #define CHECK_JPEG_YCBCR_SUBSAMPLING 1 /* * Feature support definitions. * XXX: These macros are obsoleted. Don't use them in your apps! * Macros stays here for backward compatibility and should be always defined. */ #define COLORIMETRY_SUPPORT #define YCBCR_SUPPORT #define CMYK_SUPPORT #define ICC_SUPPORT #define PHOTOSHOP_SUPPORT #define IPTC_SUPPORT #endif /* _TIFFCONF_ */ $COPY SYS$INPUT 'CURRENT'TIF_CONFIG.H /* Define to 1 if you have the <assert.h> header file. */ #ifndef HAVE_GETOPT # define HAVE_GETOPT 1 #endif #define HAVE_ASSERT_H 1 /* Define to 1 if you have the <fcntl.h> header file. */ #define HAVE_FCNTL_H 1 /* Define as 0 or 1 according to the floating point format suported by the machine */ #ifdef __IEEE_FLOAT #define HAVE_IEEEFP 1 #endif #define HAVE_UNISTD_H 1 #define HAVE_STRING_H 1 /* Define to 1 if you have the <sys/types.h> header file. */ #define HAVE_SYS_TYPES_H 1 /* Define to 1 if you have the <io.h> header file. */ //#define HAVE_IO_H 1 /* Define to 1 if you have the <search.h> header file. */ //#define HAVE_SEARCH_H 1 /* The size of a `int', as computed by sizeof. */ #define SIZEOF_INT 4 /* The size of a `long', as computed by sizeof. */ #define SIZEOF_LONG 4 /* Set the native cpu bit order */ #define HOST_FILLORDER FILLORDER_LSB2MSB /* Define to 1 if your processor stores words with the most significant byte first (like Motorola and SPARC, unlike Intel and VAX). */ /* #undef WORDS_BIGENDIAN */ /* Define to `__inline__' or `__inline' if that's what the C compiler calls it, or to nothing if 'inline' is not supported under any name. */ /* #ifndef __cplusplus # ifndef inline # define inline __inline # endif #endif */ /* Support CCITT Group 3 & 4 algorithms */ #define CCITT_SUPPORT 1 /* Pick up YCbCr subsampling info from the JPEG data stream to support files lacking the tag (default enabled). */ #define CHECK_JPEG_YCBCR_SUBSAMPLING 1 /* Support C++ stream API (requires C++ compiler) */ #define CXX_SUPPORT 1 /* Treat extra sample as alpha (default enabled). The RGBA interface will treat a fourth sample with no EXTRASAMPLE_ value as being ASSOCALPHA. Many packages produce RGBA files but don't mark the alpha properly. */ #define DEFAULT_EXTRASAMPLE_AS_ALPHA 1 /* little Endian */ #define HOST_BIGENDIAN 0 #define JPEG_SUPPORT 1 #define LOGLUV_SUPPORT 1 /* Support LZW algorithm */ #define LZW_SUPPORT 1 /* Support Microsoft Document Imaging format */ #define MDI_SUPPORT 1 /* Support NeXT 2-bit RLE algorithm */ #define NEXT_SUPPORT 1 #define OJPEG_SUPPORT 1 /* Name of package */ #define PACKAGE "tiff" /* Define to the address where bug reports for this package should be sent. */ #define PACKAGE_BUGREPORT "[email protected]" /* Define to the full name of this package. */ #define PACKAGE_NAME "LibTIFF Software" /* Define to the full name and version of this package. */ #define PACKAGE_STRING "LibTIFF Software 3.9.0beta for VMS" /* Define to the one symbol short name of this package. */ #define PACKAGE_TARNAME "tiff" $PURGE 'CURRENT'TIFFCONF.H $PURGE 'CURRENT'TIF_CONFIG.H $OPEN/APPEND OUT 'CURRENT'TIF_CONFIG.H $IF HAVE_LFIND.EQ.1 $ THEN $ WRITE OUT "#define HAVE_SEARCH_H 1" $ ELSE $ WRITE OUT "#undef HAVE_SEARCH_H" $ENDIF $CLOSE OUT $! $! $WRITE SYS$OUTPUT " " $WRITE SYS$OUTPUT " " $WRITE SYS$OUTPUT "Now you can type @BUILD " $! $EXIT: $DEFINE SYS$ERROR _NLA0: $DEFINE SYS$OUTPUT _NLA0: $DEL TEST.OBJ;* $DEL TEST.C;* $DEL TEST.EXE;* $DEAS SYS$ERROR $DEAS SYS$OUTPUT
{ "pile_set_name": "Github" }
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <title>root</title> </head> <body> </body> </html>
{ "pile_set_name": "Github" }
# # Copyright 2016 [email protected] # # 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 Eyescale Software GmbH 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. # # ============================================================================= # # HTTPXX # #============================================================================== # This module uses the following input variables: # # HTTPXX_ROOT - Path to the httpxx module # # This module defines the following output variables: # # HTTPXX_FOUND - Was httpxx and all of the specified components found? # # HTTPXX_INCLUDE_DIRS - Where to find the headers # # HTTPXX_LIBRARIES - The httpxx libraries #============================================================================== # # Assume not found. set(HTTPXX_FOUND FALSE) set(HTTPXX_PATH) # Find headers find_path(HTTPXX_INCLUDE_DIR httpxx/Message.hpp HINTS ${HTTPXX_ROOT}/include $ENV{HTTPXX_ROOT}/include ${COMMON_SOURCE_DIR}/httpxx ${CMAKE_SOURCE_DIR}/httpxx /usr/local/include /opt/local/include /usr/include) if(HTTPXX_INCLUDE_DIR) set(HTTPXX_PATH "${HTTPXX_INCLUDE_DIR}/..") endif() # Find dynamic libraries if(HTTPXX_PATH) set(__libraries httpxx) foreach(__library ${__libraries}) if(TARGET ${__library}) list(APPEND HTTPXX_LIBRARIES ${__library}) set(HTTPXX_FOUND_SUBPROJECT ON) else() find_library(${__library} NAMES ${__library} HINTS ${HTTPXX_ROOT} $ENV{HTTPXX_ROOT} PATHS ${HTTPXX_PATH}/lib64 ${HTTPXX_PATH}/lib) list(APPEND HTTPXX_LIBRARIES ${${__library}}) endif() endforeach() mark_as_advanced(HTTPXX_LIBRARIES) endif() if(NOT httpxx_FIND_QUIETLY) set(_httpxx_output 1) endif() include(FindPackageHandleStandardArgs) find_package_handle_standard_args(httpxx DEFAULT_MSG HTTPXX_LIBRARIES HTTPXX_INCLUDE_DIR) if(HTTPXX_FOUND) set(HTTPXX_INCLUDE_DIRS ${HTTPXX_INCLUDE_DIR}) if(_httpxx_output ) message(STATUS "Found httpxx in ${HTTPXX_INCLUDE_DIR}:${HTTPXX_LIBRARIES}") endif() else() set(HTTPXX_FOUND) set(HTTPXX_INCLUDE_DIR) set(HTTPXX_INCLUDE_DIRS) set(HTTPXX_LIBRARIES) endif()
{ "pile_set_name": "Github" }
// Copyright (c) 2011 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 "ipc/ipc_message_utils.h" #include "ppapi/c/ppb_audio.h" #include "ppapi/c/ppp_instance.h" #include "ppapi/proxy/ppapi_messages.h" #include "ppapi/proxy/ppapi_proxy_test.h" namespace ppapi { namespace proxy { namespace { bool received_create = false; // Implement PPB_Audio since it's a relatively simple PPB interface and // includes bidirectional communication. PP_Resource Create(PP_Instance instance, PP_Resource config, PPB_Audio_Callback audio_callback, void* user_data) { received_create = true; return 0; } PP_Bool IsAudio(PP_Resource resource) { return PP_FALSE; } PP_Resource GetCurrentConfig(PP_Resource audio) { return 0; } PP_Bool StartPlayback(PP_Resource audio) { return PP_FALSE; } PP_Bool StopPlayback(PP_Resource audio) { return PP_FALSE; } PPB_Audio dummy_audio_interface = { &Create, &IsAudio, &GetCurrentConfig, &StartPlayback, &StopPlayback }; PPP_Instance dummy_ppp_instance_interface = {}; } // namespace class PluginDispatcherTest : public PluginProxyTest { public: PluginDispatcherTest() {} bool HasTargetProxy(ApiID id) { return !!plugin_dispatcher()->proxies_[id].get(); } }; TEST_F(PluginDispatcherTest, SupportsInterface) { RegisterTestInterface(PPB_AUDIO_INTERFACE, &dummy_audio_interface); RegisterTestInterface(PPP_INSTANCE_INTERFACE, &dummy_ppp_instance_interface); // Sending a request for a random interface should fail. EXPECT_FALSE(SupportsInterface("Random interface")); // Sending a request for a supported PPP interface should succeed. EXPECT_TRUE(SupportsInterface(PPP_INSTANCE_INTERFACE)); } TEST_F(PluginDispatcherTest, PPBCreation) { // Sending a PPB message out of the blue should create a target proxy for // that interface in the plugin. EXPECT_FALSE(HasTargetProxy(API_ID_PPB_AUDIO)); PpapiMsg_PPBAudio_NotifyAudioStreamCreated audio_msg( API_ID_PPB_AUDIO, HostResource(), 0, ppapi::proxy::SerializedHandle( ppapi::proxy::SerializedHandle::SOCKET), ppapi::proxy::SerializedHandle( ppapi::proxy::SerializedHandle::SHARED_MEMORY)); plugin_dispatcher()->OnMessageReceived(audio_msg); EXPECT_TRUE(HasTargetProxy(API_ID_PPB_AUDIO)); } } // namespace proxy } // namespace ppapi
{ "pile_set_name": "Github" }
package io.cattle.platform.resource.pool.impl; import static io.cattle.platform.core.model.tables.ResourcePoolTable.*; import io.cattle.platform.core.model.ResourcePool; import io.cattle.platform.object.ObjectManager; import io.cattle.platform.object.util.ObjectUtils; import io.cattle.platform.resource.pool.PooledResource; import io.cattle.platform.resource.pool.PooledResourceItemGenerator; import io.cattle.platform.resource.pool.PooledResourceItemGeneratorFactory; import io.cattle.platform.resource.pool.PooledResourceOptions; import io.cattle.platform.resource.pool.ResourcePoolManager; import io.cattle.platform.util.type.CollectionUtils; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import javax.inject.Inject; import org.apache.commons.lang3.StringUtils; import org.jooq.exception.DataAccessException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class ResourcePoolManagerImpl implements ResourcePoolManager { private static final Logger log = LoggerFactory.getLogger(ResourcePoolManagerImpl.class); ObjectManager objectManager; List<PooledResourceItemGeneratorFactory> factories; @Override public List<PooledResource> allocateResource(Object pool, Object owner, PooledResourceOptions options) { String qualifier = options.getQualifier(); int count = options.getCount(); String poolType = getResourceType(pool); long poolId = getResourceId(pool); String ownerType = getResourceType(owner); long ownerId = getResourceId(owner); Map<Object, Object> keys = CollectionUtils.asMap((Object) RESOURCE_POOL.POOL_TYPE, poolType, (Object) RESOURCE_POOL.POOL_ID, poolId, RESOURCE_POOL.QUALIFIER, qualifier, RESOURCE_POOL.OWNER_TYPE, ownerType, RESOURCE_POOL.OWNER_ID, ownerId); List<ResourcePool> resourcePools = new ArrayList<ResourcePool>(objectManager.find(ResourcePool.class, keys)); List<PooledResource> result = new ArrayList<PooledResource>(); for (ResourcePool resourcePool : resourcePools) { result.add(new DefaultPooledResource(resourcePool.getItem())); } while (result.size() < count) { String item = getItem(keys, pool, qualifier, options); if (item == null) { break; } else { log.info("Assigning [{}] from pool [{}:{}] to owner [{}:{}]", item, poolType, poolId, ownerType, ownerId); } result.add(new DefaultPooledResource(item)); } if (result.size() != count) { log.info("Failed to find [{}] items for pool [{}:{}] and owner [{}:{}]", count, poolType, poolId, ownerType, ownerId); releaseResource(pool, owner, options); return null; } return result; } @Override public void releaseResource(Object pool, Object owner) { releaseResource(pool, owner, new PooledResourceOptions()); } @Override public void releaseResource(Object pool, Object owner, PooledResourceOptions options) { String poolType = getResourceType(pool); long poolId = getResourceId(pool); String ownerType = getResourceType(owner); long ownerId = getResourceId(owner); Map<Object, Object> keys = CollectionUtils.asMap((Object) RESOURCE_POOL.POOL_TYPE, poolType, (Object) RESOURCE_POOL.POOL_ID, poolId, RESOURCE_POOL.QUALIFIER, options.getQualifier(), RESOURCE_POOL.OWNER_TYPE, ownerType, RESOURCE_POOL.OWNER_ID, ownerId); for (ResourcePool resource : objectManager.find(ResourcePool.class, keys)) { log.info("Releasing [{}] id [{}] to pool [{}:{}] from owner [{}:{}]", resource.getItem(), resource.getId(), poolType, poolId, ownerType, ownerId); objectManager.delete(resource); } } @Override public void transferResource(Object pool, Object owner, Object newOwner) { transferResource(pool, owner, newOwner, new PooledResourceOptions()); } @Override public void transferResource(Object pool, Object owner, Object newOwner, PooledResourceOptions options) { String poolType = getResourceType(pool); long poolId = getResourceId(pool); String ownerType = getResourceType(owner); long ownerId = getResourceId(owner); String newOwnerType = getResourceType(newOwner); long newOwnerId = getResourceId(newOwner); Map<Object, Object> keys = CollectionUtils.asMap((Object) RESOURCE_POOL.POOL_TYPE, poolType, (Object) RESOURCE_POOL.POOL_ID, poolId, RESOURCE_POOL.QUALIFIER, options.getQualifier(), RESOURCE_POOL.OWNER_TYPE, ownerType, RESOURCE_POOL.OWNER_ID, ownerId); for (ResourcePool resource : objectManager.find(ResourcePool.class, keys)) { log.info("Transfering [{}] id [{}] from pool [{}:{}] from owner [{}:{}] to owner [{}:{}]", resource.getItem(), resource.getId(), poolType, poolId, ownerType, ownerId, newOwnerType, newOwnerId); resource.setOwnerType(newOwnerType); resource.setOwnerId(newOwnerId); objectManager.persist(resource); } } @Override public PooledResource allocateOneResource(Object pool, Object owner, PooledResourceOptions options) { List<PooledResource> resources = allocateResource(pool, owner, options); return (resources == null || resources.size() == 0) ? null : resources.get(0); } protected String getItem(Map<Object, Object> keys, Object pool, String qualifier, PooledResourceOptions options) { PooledResourceItemGenerator generator = null; List<String> tryItems = new ArrayList<>(); if (options.getRequestedItems() != null) { tryItems.addAll(options.getRequestedItems()); } else { tryItems.add(options.getRequestedItem()); } for (PooledResourceItemGeneratorFactory factory : factories) { generator = factory.getGenerator(pool, qualifier); if (generator != null) { break; } } if (generator == null) { log.error("Failed to find generator for pool [{}]", pool); return null; } // trying to allocate resource from tryItems for (String item: tryItems) { if (!StringUtils.isEmpty(item) && generator.isInPool(item)) { Map<Object, Object> newKeys = new HashMap<Object, Object>(keys); newKeys.put(RESOURCE_POOL.ITEM, item); Map<String, Object> props = objectManager.convertToPropertiesFor(ResourcePool.class, newKeys); try { return objectManager.create(ResourcePool.class, props).getItem(); } catch (DataAccessException e) { log.debug("Failed to create item [{}]", item); } } } // then allocate from generator while (generator.hasNext()) { String item = generator.next(); Map<Object, Object> newKeys = new HashMap<Object, Object>(keys); newKeys.put(RESOURCE_POOL.ITEM, item); Map<String, Object> props = objectManager.convertToPropertiesFor(ResourcePool.class, newKeys); try { return objectManager.create(ResourcePool.class, props).getItem(); } catch (DataAccessException e) { log.debug("Failed to create item [{}]", item); } } return null; } protected String getResourceType(Object obj) { if (GLOBAL.equals(obj)) { return GLOBAL; } String type = objectManager.getType(obj); if (type == null) { throw new IllegalStateException("Failed to find resource type for [" + obj + "]"); } return type; } protected long getResourceId(Object obj) { if (GLOBAL.equals(obj)) { return 1; } Object id = ObjectUtils.getId(obj); if (id instanceof Number) { return ((Number) id).longValue(); } throw new IllegalStateException("Failed to find resource id for [" + obj + "]"); } public ObjectManager getObjectManager() { return objectManager; } @Inject public void setObjectManager(ObjectManager objectManager) { this.objectManager = objectManager; } public List<PooledResourceItemGeneratorFactory> getFactories() { return factories; } @Inject public void setFactories(List<PooledResourceItemGeneratorFactory> factories) { this.factories = factories; } }
{ "pile_set_name": "Github" }
{% extends "baseTemplate/index.html" %} {% load i18n %} {% block title %}{% trans "Back up Home - CyberPanel" %}{% endblock %} {% block content %} {% load static %} {% get_current_language as LANGUAGE_CODE %} <!-- Current language: {{ LANGUAGE_CODE }} --> <div class="container"> <div id="page-title"> <h2>{% trans "Back up" %}</h2> <p>{% trans "Back up and restore sites." %}</p> </div> <div class="panel col-md-11"> <div class="panel-body"> <h3 class="content-box-header"> {% trans "Available Functions" %} </h3> <div class="example-box-wrapper"> <div class="row"> {% if createBackup or admin %} <div class="col-md-3 btn-min-width"> <a href="{% url 'backupSite' %}" title="{% trans 'Back up Site' %}" class="tile-box tile-box-shortcut btn-primary"> <div class="tile-header"> {% trans "Back up" %} </div> <div class="tile-content-wrapper"> <i class="fa fa-clone"></i> </div> </a> </div> {% endif %} {% if restoreBackup or admin %} <div class="col-md-3 btn-min-width"> <a href="{% url 'restoreSite' %}" title="{% trans 'Restore Back up' %}" class="tile-box tile-box-shortcut btn-primary"> <div class="tile-header"> {% trans "Restore" %} </div> <div class="tile-content-wrapper"> <i class="fa fa-undo"></i> </div> </a> </div> {% endif %} {% if addDeleteDestinations or admin %} <div class="col-md-3 btn-min-width"> <a href="{% url 'backupDestinations' %}" title="{% trans 'Add/Delete Destinations' %}" class="tile-box tile-box-shortcut btn-primary"> <div class="tile-header"> {% trans "Add/Delete Destinations" %} </div> <div class="tile-content-wrapper"> <i class="fa fa-map-pin"></i> </div> </a> </div> {% endif %} {% if scheDuleBackups or admin %} <div class="col-md-3 btn-min-width"> <a href="{% url 'scheduleBackup' %}" title="{% trans 'Schedule Back up' %}" class="tile-box tile-box-shortcut btn-primary"> <div class="tile-header"> {% trans "Schedule Back up" %} </div> <div class="tile-content-wrapper"> <i class="fa fa-refresh"></i> </div> </a> </div> {% endif %} {% if remoteBackups or admin %} <div class="col-md-3 btn-min-width"> <a href="{% url 'remoteBackups' %}" title="{% trans 'Remote Back ups' %}" class="tile-box tile-box-shortcut btn-primary"> <div class="tile-header"> {% trans "Remote Back ups" %} </div> <div class="tile-content-wrapper"> <i class="fa fa-cloud-upload"></i> </div> </a> </div> {% endif %} </div> </div> </div> </div> </div> {% endblock %}
{ "pile_set_name": "Github" }
GL_SGIX_pixel_texture_bits http://www.opengl.org/registry/specs/SGIX/pixel_texture_bits.txt GL_SGIX_pixel_texture_bits
{ "pile_set_name": "Github" }
/*- * Copyright (c) 1982, 1986, 1993 * The Regents of the University of California. All rights reserved. * * 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. * 4. Neither the name of the University 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 REGENTS 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 REGENTS 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. * * @(#)time.h 8.5 (Berkeley) 5/4/95 * from: FreeBSD: src/sys/sys/time.h,v 1.43 2000/03/20 14:09:05 phk Exp * $FreeBSD: release/9.0.0/sys/sys/timespec.h 205792 2010-03-28 13:13:22Z ed $ */ #ifndef _SYS_TIMESPEC_H_ #define _SYS_TIMESPEC_H_ #include <sys/cdefs.h> #include <sys/_timespec.h> #if __BSD_VISIBLE #define TIMEVAL_TO_TIMESPEC(tv, ts) \ do { \ (ts)->tv_sec = (tv)->tv_sec; \ (ts)->tv_nsec = (tv)->tv_usec * 1000; \ } while (0) #define TIMESPEC_TO_TIMEVAL(tv, ts) \ do { \ (tv)->tv_sec = (ts)->tv_sec; \ (tv)->tv_usec = (ts)->tv_nsec / 1000; \ } while (0) #endif /* __BSD_VISIBLE */ /* * Structure defined by POSIX.1b to be like a itimerval, but with * timespecs. Used in the timer_*() system calls. */ struct itimerspec { struct timespec it_interval; struct timespec it_value; }; #endif /* _SYS_TIMESPEC_H_ */
{ "pile_set_name": "Github" }
Author URL Directive ==================== .. highlight:: python This adds a link to the author name in postmeta. Simply add it to your extensions in ``conf.py``: :: # Add other Sphinx extensions here extensions = [..., 'authorurl-directive'] and specify a default URL: :: author_url = 'http://www.yoursite.com/pages/about.html#about-me' Usage: Add ``.. author_url:: default`` or ``.. author_url:: http://site.com/`` to posts where you want to add a website link to an author.
{ "pile_set_name": "Github" }
/***************************************************************************** Copyright (c) 2014, Intel Corp. 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. * Neither the name of Intel Corporation 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. ***************************************************************************** * Contents: Native high-level C interface to LAPACK function cspsv * Author: Intel Corporation * Generated November 2015 *****************************************************************************/ #include "lapacke_utils.h" lapack_int LAPACKE_cspsv( int matrix_layout, char uplo, lapack_int n, lapack_int nrhs, lapack_complex_float* ap, lapack_int* ipiv, lapack_complex_float* b, lapack_int ldb ) { if( matrix_layout != LAPACK_COL_MAJOR && matrix_layout != LAPACK_ROW_MAJOR ) { LAPACKE_xerbla( "LAPACKE_cspsv", -1 ); return -1; } #ifndef LAPACK_DISABLE_NAN_CHECK if( LAPACKE_get_nancheck() ) { /* Optionally check input matrices for NaNs */ if( LAPACKE_csp_nancheck( n, ap ) ) { return -5; } if( LAPACKE_cge_nancheck( matrix_layout, n, nrhs, b, ldb ) ) { return -7; } } #endif return LAPACKE_cspsv_work( matrix_layout, uplo, n, nrhs, ap, ipiv, b, ldb ); }
{ "pile_set_name": "Github" }
/* * 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. */ #include "config.h" #include <cairo/cairo.h> #include <guacamole/client.h> #include <guacamole/layer.h> #include <guacamole/protocol.h> #include <guacamole/socket.h> #include <guacamole/user.h> /* Dimensions */ const int guac_common_blank_cursor_width = 1; const int guac_common_blank_cursor_height = 1; /* Format */ const cairo_format_t guac_common_blank_cursor_format = CAIRO_FORMAT_ARGB32; const int guac_common_blank_cursor_stride = 4; /* Embedded blank cursor graphic */ unsigned char guac_common_blank_cursor[] = { 0x00,0x00,0x00,0x00 }; void guac_common_set_blank_cursor(guac_user* user) { guac_client* client = user->client; guac_socket* socket = user->socket; /* Draw to buffer */ guac_layer* cursor = guac_client_alloc_buffer(client); cairo_surface_t* graphic = cairo_image_surface_create_for_data( guac_common_blank_cursor, guac_common_blank_cursor_format, guac_common_blank_cursor_width, guac_common_blank_cursor_height, guac_common_blank_cursor_stride); guac_user_stream_png(user, socket, GUAC_COMP_SRC, cursor, 0, 0, graphic); cairo_surface_destroy(graphic); /* Set cursor */ guac_protocol_send_cursor(socket, 0, 0, cursor, 0, 0, guac_common_blank_cursor_width, guac_common_blank_cursor_height); /* Free buffer */ guac_client_free_buffer(client, cursor); guac_client_log(client, GUAC_LOG_DEBUG, "Client cursor image set to generic transparent (blank) cursor."); }
{ "pile_set_name": "Github" }
package main import "github.com/sourcegraph/sourcegraph/cmd/server/shared" func main() { shared.Main() }
{ "pile_set_name": "Github" }
fp = dirname(@__FILE__) @testset "DSGE impulse responses to a pre-specified impact matrix" begin matdata = load(joinpath(fp, "../../../reference/test_irfdsge.jld2")) irfout = impulse_responses(matdata["TTT"], matdata["RRR"], matdata["zz"], zeros(size(matdata["zz"], 1)), matdata["mmm"], matdata["impact"], 1; accumulate = true, cum_inds = 1) nobs = size(matdata["zz"], 1) for i = 1:nobs @test vec(matdata["aairf"][:, nobs * (i - 1) + 1:nobs * i]) ≈ vec(irfout[:, :, i]) end irfout_accum1 = impulse_responses(matdata["TTT"], matdata["RRR"], matdata["zz"], zeros(size(matdata["zz"], 1)), matdata["mmm"], matdata["impact"], 2; accumulate = true, cum_inds = 1) irfout_nocum1 = impulse_responses(matdata["TTT"], matdata["RRR"], matdata["zz"], zeros(size(matdata["zz"], 1)), matdata["mmm"], matdata["impact"], 2; accumulate = false, cum_inds = 1) irfout_accum2 = impulse_responses(matdata["TTT"], matdata["RRR"], matdata["zz"], zeros(size(matdata["zz"], 1)), matdata["mmm"], matdata["impact"], 2; accumulate = true, cum_inds = 1:2) irfout_nocum2 = impulse_responses(matdata["TTT"], matdata["RRR"], matdata["zz"], zeros(size(matdata["zz"], 1)), matdata["mmm"], matdata["impact"], 2; accumulate = false, cum_inds = 1:2) irfout_accum3 = impulse_responses(matdata["TTT"], matdata["RRR"], matdata["zz"], zeros(size(matdata["zz"], 1)), matdata["mmm"], matdata["impact"], 2; accumulate = true, cum_inds = [1,3]) irfout_nocum3 = impulse_responses(matdata["TTT"], matdata["RRR"], matdata["zz"], zeros(size(matdata["zz"], 1)), matdata["mmm"], matdata["impact"], 2; accumulate = false, cum_inds = [1,3]) for i = 1:size(irfout_accum1, 3) @test cumsum(irfout_nocum1[1, :, i]) ≈ irfout_accum1[1, :, i] @test irfout_nocum1[2:end, :, i] ≈ irfout_accum1[2:end, :, i] @test cumsum(irfout_nocum2[1:2, :, i]; dims = 2) ≈ irfout_accum2[1:2, :, i] @test irfout_nocum2[end, :, i] ≈ irfout_accum2[end, :, i] @test cumsum(irfout_nocum3[[1,3], :, i]; dims = 2) ≈ irfout_accum3[[1,3], :, i] @test irfout_nocum3[2, :, i] ≈ irfout_accum3[2, :, i] end end if VERSION < v"1.5" @testset "Impulse responses to structural shocks identified by a DSGE-VAR" begin matdata1 = load(joinpath(fp, "../../../reference/test_irfdsge.jld2")) matdata2 = load(joinpath(fp, "../../../reference/test_rotations.jld2")) ŷ = DSGE.impulse_responses(matdata1["TTT"], matdata1["RRR"], matdata1["zz"], zeros(size(matdata1["zz"], 1)), matdata1["mmm"], matdata1["impact"].^2, Int(matdata2["k"]), convert(Matrix{Float64}, matdata2["cct_sim"]'), matdata2["sig_sim"], Int(matdata2["qahead"]), vec(matdata2["XXpred"]); normalize_rotation = false, test_shocks = convert(Matrix{Float64}, matdata2["Shocks"]')) @test ŷ ≈ matdata2["yypred"]' Random.seed!(1793) # drawing shocks, so this shouldn't be the same ŷ1 = DSGE.impulse_responses(matdata1["TTT"], matdata1["RRR"], matdata1["zz"], zeros(size(matdata1["zz"], 1)), matdata1["mmm"], matdata1["impact"].^2, Int(matdata2["k"]), convert(Matrix{Float64}, matdata2["cct_sim"]'), matdata2["sig_sim"], Int(matdata2["qahead"]), vec(matdata2["XXpred"]), draw_shocks = true, normalize_rotation = false) Random.seed!(1793) # re-seeding should work ŷ2 = DSGE.impulse_responses(matdata1["TTT"], matdata1["RRR"], matdata1["zz"], zeros(size(matdata1["zz"], 1)), matdata1["mmm"], matdata1["impact"].^2, Int(matdata2["k"]), convert(Matrix{Float64}, matdata2["cct_sim"]'), matdata2["sig_sim"], Int(matdata2["qahead"]), vec(matdata2["XXpred"]), draw_shocks = true, normalize_rotation = false) Random.seed!(1793) # flipping shocks shouldn't yield anything different @info "The following warning is expected." ŷ3 = DSGE.impulse_responses(matdata1["TTT"], matdata1["RRR"], matdata1["zz"], zeros(size(matdata1["zz"], 1)), matdata1["mmm"], matdata1["impact"].^2, Int(matdata2["k"]), convert(Matrix{Float64}, matdata2["cct_sim"]'), matdata2["sig_sim"], Int(matdata2["qahead"]), vec(matdata2["XXpred"]), draw_shocks = true, flip_shocks = true, normalize_rotation = false) @test !(ŷ1 ≈ matdata2["yypred"]') @test ŷ1 ≈ ŷ2 @test ŷ1 ≈ ŷ3 end @testset "Impulse responses of a VAR using a DSGE as a prior" begin jlddata = load(joinpath(fp, "../../../reference/test_dsgevar_lambda_irfs.jld2")) m = Model1002("ss10", custom_settings = Dict{Symbol,Setting}(:add_laborshare_measurement => Setting(:add_laborshare_measurement, true), :add_NominalWageGrowth => Setting(:add_NominalWageGrowth, true))) m <= Setting(:impulse_response_horizons, 10) dsgevar = DSGEVAR(m, collect(keys(m.exogenous_shocks)), "ss11") DSGE.update!(dsgevar, λ = 1.) DSGE.update!(dsgevar, jlddata["modal_param"]) Random.seed!(1793) out = impulse_responses(dsgevar, jlddata["data"], :cholesky, 1) out_lr = impulse_responses(dsgevar, jlddata["data"], :choleskyLR, 1) out_maxbc = impulse_responses(dsgevar, jlddata["data"], :maxBC, 1) Random.seed!(1793) _ = impulse_responses(dsgevar, jlddata["data"], :cholesky, 1) out_lr2 = impulse_responses(dsgevar, jlddata["data"], :cholesky_long_run, 1) out_maxbc2 = impulse_responses(dsgevar, jlddata["data"], :maximum_business_cycle_variance, 1) Random.seed!(1793) out_flip = impulse_responses(dsgevar, jlddata["data"], :cholesky, 1, flip_shocks = true,) out_lr_flip = impulse_responses(dsgevar, jlddata["data"], :choleskyLR, 1, flip_shocks = true) out_maxbc_flip = impulse_responses(dsgevar, jlddata["data"], :maxBC, 1, flip_shocks = true) Random.seed!(1793) out_h = impulse_responses(dsgevar, jlddata["data"], :cholesky, 1, horizon = impulse_response_horizons(dsgevar)) out_lr_h = impulse_responses(dsgevar, jlddata["data"], :choleskyLR, 1, horizon = impulse_response_horizons(dsgevar)) out_maxbc_h = impulse_responses(dsgevar, jlddata["data"], :maxBC, 1, horizon = impulse_response_horizons(dsgevar)) @test @test_matrix_approx_eq jlddata["exp_modal_cholesky_irf"] out @test @test_matrix_approx_eq jlddata["exp_modal_choleskyLR_irf"] out_lr @test @test_matrix_approx_eq jlddata["exp_modal_choleskyLR_irf"] out_lr2 @test @test_matrix_approx_eq jlddata["exp_modal_cholesky_irf"] -out_flip @test @test_matrix_approx_eq jlddata["exp_modal_choleskyLR_irf"] -out_lr_flip @test @test_matrix_approx_eq jlddata["exp_modal_cholesky_irf"] out_h @test @test_matrix_approx_eq jlddata["exp_modal_choleskyLR_irf"] out_lr_h # Test maxBC separately b/c these have a slightly different error bound that leads to errors on Julia 1.0 but not Julia 1.1 if VERSION >= v"1.1" @test @test_matrix_approx_eq jlddata["exp_modal_maxBC_irf"] out_maxbc @test @test_matrix_approx_eq jlddata["exp_modal_maxBC_irf"] out_maxbc2 @test @test_matrix_approx_eq jlddata["exp_modal_maxBC_irf"] out_maxbc_h @test @test_matrix_approx_eq jlddata["exp_modal_maxBC_irf"] -out_maxbc_flip else @test maximum(abs.(jlddata["exp_modal_maxBC_irf"] - out_maxbc)) < 6e-6 @test maximum(abs.(jlddata["exp_modal_maxBC_irf"] - out_maxbc2)) < 6e-6 @test maximum(abs.(jlddata["exp_modal_maxBC_irf"] - out_maxbc_h)) < 6e-6 @test maximum(abs.(jlddata["exp_modal_maxBC_irf"] + out_maxbc_flip)) < 6e-6 end end @testset "Impulse responses of VAR by using a DSGE as prior and to identify the rotation matrix" begin jlddata = load(joinpath(fp, "../../../reference/test_dsgevar_lambda_irfs.jld2")) m = Model1002("ss10", custom_settings = Dict{Symbol,Setting}(:add_laborshare_measurement => Setting(:add_laborshare_measurement, true), :add_NominalWageGrowth => Setting(:add_NominalWageGrowth, true))) m <= Setting(:impulse_response_horizons, 10) dsgevar = DSGEVAR(m, collect(keys(m.exogenous_shocks)), "ss11") DSGE.update!(dsgevar, λ = 1.) DSGE.update!(dsgevar, jlddata["modal_param"]) Random.seed!(1793) out = impulse_responses(dsgevar, jlddata["data"], normalize_rotation = false) Random.seed!(1793) out_flip = impulse_responses(dsgevar, jlddata["data"]; flip_shocks = true, normalize_rotation = false) nobs = size(jlddata["data"], 1) lags = DSGE.get_lags(dsgevar) k = nobs * lags + 1 XX = DSGE.lag_data(jlddata["data"], lags; use_intercept = true) X̂ = vcat(1, jlddata["data"][:, end], XX[end, 1+1:k - nobs]) Random.seed!(1793) out_X̂ = impulse_responses(dsgevar, jlddata["data"], X̂, normalize_rotation = false) Random.seed!(1793) out_MM1 = impulse_responses(dsgevar, jlddata["data"]; MM = zeros(DSGE.n_observables(dsgevar), DSGE.n_shocks(dsgevar)), normalize_rotation = false) Random.seed!(1793) out_MM2 = impulse_responses(dsgevar, jlddata["data"]; MM = rand(DSGE.n_observables(dsgevar), DSGE.n_shocks(dsgevar)), normalize_rotation = false) Random.seed!(1793) out_draw = impulse_responses(dsgevar, jlddata["data"]; draw_shocks = true, normalize_rotation = false) Random.seed!(1793) # now use deviations out_dev = impulse_responses(dsgevar, jlddata["data"], deviations = true, normalize_rotation = false) Random.seed!(1793) # flip shock out_dev_flip = impulse_responses(dsgevar, jlddata["data"], deviations = true, flip_shocks = true, normalize_rotation = false) Random.seed!(1793) # draw shock out_dev_draw = impulse_responses(dsgevar, jlddata["data"], deviations = true, draw_shocks = true, normalize_rotation = false) @test @test_matrix_approx_eq jlddata["rotation_irf_by_shock"] out @test @test_matrix_approx_eq jlddata["flip_rotation_irf_by_shock"] out_flip @test @test_matrix_approx_eq out out_MM1 @test !(out ≈ out_MM2) @test @test_matrix_approx_eq out out_X̂ @test @test_matrix_approx_eq jlddata["rotation_irf_draw_shock"] out_draw @test @test_matrix_approx_eq out_dev jlddata["deviations_rotation_irf_by_shock"] @test @test_matrix_approx_eq out_dev_draw jlddata["deviations_rotation_irf_draw_shock"] @test @test_matrix_approx_eq out_dev -out_dev_flip end @testset "Impulse responses of a VAR approximation to a DSGE (or λ = ∞)" begin m = AnSchorfheide() m <= Setting(:impulse_response_horizons, 10) Random.seed!(1793) observables = [:obs_gdp, :obs_nominalrate, :z_t] shocks = collect(keys(m.exogenous_shocks)) fp = dirname(@__FILE__) jlddata = load(joinpath(fp, "../../../reference/var_approx_dsge_irfs.jld2")) dsgevar = DSGEVAR(m, shocks, "ss0") DSGE.update!(dsgevar, lags = 4, observables = observables, λ = 1.) out1 = impulse_responses(dsgevar, :cholesky, 1) out2 = impulse_responses(dsgevar, :choleskyLR, 1) out3 = impulse_responses(dsgevar, :maximum_business_cycle_variance, 1) out4 = impulse_responses(dsgevar, :cholesky_long_run, 1) out5 = impulse_responses(dsgevar, :maxBC, 1) out6 = impulse_responses(dsgevar, :cholesky, 1, flip_shocks = true) out7 = impulse_responses(dsgevar, :choleskyLR, 1, flip_shocks = true) out8 = impulse_responses(dsgevar, :maxBC, 1, flip_shocks = true) out9 = impulse_responses(dsgevar, :cholesky, 1, use_intercept = true) out10 = impulse_responses(dsgevar, :choleskyLR, 1, use_intercept = true) out11 = impulse_responses(dsgevar, :maxBC, 1, use_intercept = true) out12 = impulse_responses(dsgevar, :cholesky, 1, use_intercept = true, flip_shocks = true) out13 = impulse_responses(dsgevar, :choleskyLR, 1, use_intercept = true, flip_shocks = true) out14 = impulse_responses(dsgevar, :maxBC, 1, use_intercept = true, flip_shocks = true) @test @test_matrix_approx_eq jlddata["exp_cholesky"][:, :, 1] out1 @test @test_matrix_approx_eq jlddata["exp_choleskyLR"][:, :, 1] out2 @test @test_matrix_approx_eq jlddata["exp_maxBC"][:, :, 1] out3 @test @test_matrix_approx_eq jlddata["exp_choleskyLR"][:, :, 1] out4 @test @test_matrix_approx_eq jlddata["exp_maxBC"][:, :, 1] out5 @test @test_matrix_approx_eq jlddata["exp_cholesky"][:, :, 1] -out6 @test @test_matrix_approx_eq jlddata["exp_choleskyLR"][:, :, 1] -out7 @test @test_matrix_approx_eq jlddata["exp_maxBC"][:, :, 1] -out8 @test @test_matrix_approx_eq jlddata["exp_cholesky_int"][:, :, 1] out9 @test @test_matrix_approx_eq jlddata["exp_choleskyLR_int"][:, :, 1] out10 @test @test_matrix_approx_eq jlddata["exp_maxBC_int"][:, :, 1] out11 @test @test_matrix_approx_eq jlddata["exp_cholesky_int"][:, :, 1] -out12 @test @test_matrix_approx_eq jlddata["exp_choleskyLR_int"][:, :, 1] -out13 @test @test_matrix_approx_eq jlddata["exp_maxBC_int"][:, :, 1] -out14 end end nothing
{ "pile_set_name": "Github" }
package com.lx.multimedialearn.camerastudy.render; import android.content.Context; import android.graphics.SurfaceTexture; import android.opengl.GLES11Ext; import android.opengl.GLES20; import android.opengl.GLSurfaceView; import com.lx.multimedialearn.R; import com.lx.multimedialearn.utils.FileUtils; import com.lx.multimedialearn.utils.GlUtil; import java.nio.FloatBuffer; import java.nio.ShortBuffer; import javax.microedition.khronos.egl.EGLConfig; import javax.microedition.khronos.opengles.GL10; /** * GlsurfaceView进行图像预览 * 1. 实例化SurfaceTexture,获取camera的预览数据:思考,这里能不能让三个view公用这一个surfacetexture * 2. 使用Render进行绘画,画出预览数据,这里可以对图像进行处理 * 思考:自定义SurfaceTexture获取摄像头数据,存储在显存里,并有一个TextureID,通过updateTexImage(),把camera中的数据生成最新的纹理,使用glsl语言把内容画在glsurfaceview上 * * @author lixiao * @since 2017-09-17 15:13 */ public class CameraRender implements GLSurfaceView.Renderer { private SurfaceTexture mSurfaceTexture; //使用共享,在应用层创建,并传进来获取摄像头数据 private int mTextureID; //预览Camera画面对应的纹理id,通过该id画图 private Context mContext; public CameraRender(Context context, SurfaceTexture surfaceTexture, int textureID) { this.mSurfaceTexture = surfaceTexture; this.mTextureID = textureID; this.mContext = context; } /***************************画笔所需要的相关参数,整合在这里*************************************/ //设置opengl的相关程序,以及初始化变量,然后执行,就是画图的全过程 private FloatBuffer mVertexBuffer; // 顶点缓存 private FloatBuffer mTextureCoordsBuffer; // 纹理坐标映射缓存 private ShortBuffer drawListBuffer; // 绘制顺序缓存 private int mProgram; // OpenGL 可执行程序 private int mPositionHandle; private int mTextureCoordHandle; private int mMVPMatrixHandle; private short drawOrder[] = {0, 2, 1, 0, 3, 2}; // 绘制顶点的顺序 private final int COORDS_PER_VERTEX = 2; // 每个顶点的坐标数 private final int vertexStride = COORDS_PER_VERTEX * 4; //每个坐标数4 bytes,那么每个顶点占8 bytes private float mVertices[] = { -1.0f, 1.0f, -1.0f, -1.0f, 1.0f, -1.0f, 1.0f, 1.0f, }; private float mTextureCoords[] = { 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f, }; private float[] mMVP = { -1.0f, 0.0f, 0.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f }; @Override public void onSurfaceCreated(GL10 gl, EGLConfig config) { //根据TextureID设置画图的初始参数,初始化画图程序,参数 //(1)根据vertexShader,fragmentShader设置绘图程序 String vertexShader = FileUtils.readTextFileFromResource(mContext, R.raw.camera_vertex_shader); String fragmentShader = FileUtils.readTextFileFromResource(mContext, R.raw.camera_fragment_shader); mProgram = GlUtil.createProgram(vertexShader, fragmentShader); //(2)获取gl程序中参数,进行赋值 mPositionHandle = GLES20.glGetAttribLocation(mProgram, "vPosition"); mTextureCoordHandle = GLES20.glGetAttribLocation(mProgram, "inputTextureCoordinate"); mMVPMatrixHandle = GLES20.glGetUniformLocation(mProgram, "uMVPMatrix"); //(3)初始化显示的顶点等坐标,在这些坐标范围内显示相机预览数据? mVertexBuffer = GlUtil.createFloatBuffer(mVertices); mTextureCoordsBuffer = GlUtil.createFloatBuffer(mTextureCoords); drawListBuffer = GlUtil.createShortBuffer(drawOrder); } @Override public void onSurfaceChanged(GL10 gl, int width, int height) { gl.glViewport(0, 0, width, height);// GlSurfaceView基本参数设置 } @Override public void onDrawFrame(GL10 gl) { synchronized (mSurfaceTexture) { GLES20.glClearColor(1.0f, 1.0f, 1.0f, 1.0f); //清理屏幕,设置屏幕为白板 GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT | GLES20.GL_DEPTH_BUFFER_BIT); mSurfaceTexture.attachToGLContext(mTextureID); mSurfaceTexture.updateTexImage(); //拿到最新的数据 //绘制预览数据 GLES20.glUseProgram(mProgram); GLES20.glActiveTexture(GLES20.GL_TEXTURE0); GLES20.glBindTexture(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, mTextureID); GLES20.glEnableVertexAttribArray(mPositionHandle); GLES20.glVertexAttribPointer(mPositionHandle, COORDS_PER_VERTEX, GLES20.GL_FLOAT, false, vertexStride, mVertexBuffer); GLES20.glEnableVertexAttribArray(mTextureCoordHandle); GLES20.glVertexAttribPointer(mTextureCoordHandle, COORDS_PER_VERTEX, GLES20.GL_FLOAT, false, vertexStride, mTextureCoordsBuffer); //进行图形的转换 GLES20.glUniformMatrix4fv(mMVPMatrixHandle, 1, false, mMVP, 0); GLES20.glDrawElements(GLES20.GL_TRIANGLES, drawOrder.length, GLES20.GL_UNSIGNED_SHORT, drawListBuffer); GLES20.glDisableVertexAttribArray(mPositionHandle); GLES20.glDisableVertexAttribArray(mTextureCoordHandle); mSurfaceTexture.detachFromGLContext(); } } }
{ "pile_set_name": "Github" }
/** * @file Server_Peer.h * * @author Carlos O'Ryan <[email protected]> */ #ifndef Server_Peer__h_ #define Server_Peer__h_ #include "TestS.h" class Server_Peer : public POA_Test::Peer { public: Server_Peer (unsigned int seed, CORBA::ORB_ptr orb, CORBA::ULong payload_size); void callme(Test::Peer_ptr callback, CORBA::ULong max_depth, Test::Payload const & extra_data); void crash(void); void noop(void); private: unsigned int seed_; CORBA::ORB_var orb_; CORBA::ULong payload_size_; }; #endif /* Server_Peer__h_ */
{ "pile_set_name": "Github" }
<?php /** * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. * * ParentalControlSettings File * PHP version 7 * * @category Library * @package Microsoft.Graph * @copyright © Microsoft Corporation. All rights reserved. * @license https://opensource.org/licenses/MIT MIT License * @link https://graph.microsoft.com */ namespace Beta\Microsoft\Graph\Model; /** * ParentalControlSettings class * * @category Model * @package Microsoft.Graph * @copyright © Microsoft Corporation. All rights reserved. * @license https://opensource.org/licenses/MIT MIT License * @link https://graph.microsoft.com */ class ParentalControlSettings extends Entity { /** * Gets the countriesBlockedForMinors * Specifies the two-letter ISO country codes. Access to the application will be blocked for minors from the countries specified in this list. * * @return string The countriesBlockedForMinors */ public function getCountriesBlockedForMinors() { if (array_key_exists("countriesBlockedForMinors", $this->_propDict)) { return $this->_propDict["countriesBlockedForMinors"]; } else { return null; } } /** * Sets the countriesBlockedForMinors * Specifies the two-letter ISO country codes. Access to the application will be blocked for minors from the countries specified in this list. * * @param string $val The value of the countriesBlockedForMinors * * @return ParentalControlSettings */ public function setCountriesBlockedForMinors($val) { $this->_propDict["countriesBlockedForMinors"] = $val; return $this; } /** * Gets the legalAgeGroupRule * Specifies the legal age group rule that applies to users of the app. Can be set to one of the following values: ValueDescriptionAllowDefault. Enforces the legal minimum. This means parental consent is required for minors in the European Union and Korea.RequireConsentForPrivacyServicesEnforces the user to specify date of birth to comply with COPPA rules. RequireConsentForMinorsRequires parental consent for ages below 18, regardless of country minor rules.RequireConsentForKidsRequires parental consent for ages below 14, regardless of country minor rules.BlockMinorsBlocks minors from using the app. * * @return string The legalAgeGroupRule */ public function getLegalAgeGroupRule() { if (array_key_exists("legalAgeGroupRule", $this->_propDict)) { return $this->_propDict["legalAgeGroupRule"]; } else { return null; } } /** * Sets the legalAgeGroupRule * Specifies the legal age group rule that applies to users of the app. Can be set to one of the following values: ValueDescriptionAllowDefault. Enforces the legal minimum. This means parental consent is required for minors in the European Union and Korea.RequireConsentForPrivacyServicesEnforces the user to specify date of birth to comply with COPPA rules. RequireConsentForMinorsRequires parental consent for ages below 18, regardless of country minor rules.RequireConsentForKidsRequires parental consent for ages below 14, regardless of country minor rules.BlockMinorsBlocks minors from using the app. * * @param string $val The value of the legalAgeGroupRule * * @return ParentalControlSettings */ public function setLegalAgeGroupRule($val) { $this->_propDict["legalAgeGroupRule"] = $val; return $this; } }
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="utf-8"?> <!-- animate the translationZ property of a view when pressed --> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_pressed="true"> <set> <objectAnimator android:propertyName="translationZ" android:duration="100" android:valueTo="2" android:valueType="floatType"/> <!-- you could have other objectAnimator elements here for "x" and "y", or other properties --> </set> </item> <item android:state_enabled="true" android:state_pressed="false" android:state_focused="true"> <set> <objectAnimator android:propertyName="translationZ" android:duration="100" android:valueTo="10" android:valueType="floatType"/> </set> </item> </selector>
{ "pile_set_name": "Github" }
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>src/utils/math/math.js - sceneGraph.js</title> <link rel="stylesheet" href="http://yui.yahooapis.com/3.9.1/build/cssgrids/cssgrids-min.css"> <link rel="stylesheet" href="../assets/vendor/prettify/prettify-min.css"> <link rel="stylesheet" href="../assets/css/main.css" id="site_styles"> <link rel="shortcut icon" type="image/png" href="../assets/favicon.png"> <script src="http://yui.yahooapis.com/combo?3.9.1/build/yui/yui-min.js"></script> </head> <body class="yui3-skin-sam"> <div id="doc"> <div id="hd" class="yui3-g header"> <div class="yui3-u-3-4"> <h1><img src="../../logo/logoCGSG_256x57.png" title="sceneGraph.js"></h1> </div> <div class="yui3-u-1-4 version"> <em>API Docs for: v2.1.0</em> </div> </div> <div id="bd" class="yui3-g"> <div class="yui3-u-1-4"> <div id="docs-sidebar" class="sidebar apidocs"> <div id="api-list"> <h2 class="off-left">APIs</h2> <div id="api-tabview" class="tabview"> <ul class="tabs"> <li><a href="#api-classes">Classes</a></li> <li><a href="#api-modules">Modules</a></li> </ul> <div id="api-tabview-filter"> <input type="search" id="api-filter" placeholder="Type to filter APIs"> </div> <div id="api-tabview-panel"> <ul id="api-classes" class="apis classes"> <li><a href="../classes/CGSG.html">CGSG</a></li> <li><a href="../classes/CGSGAccordion.html">CGSGAccordion</a></li> <li><a href="../classes/CGSGAnimationManager.html">CGSGAnimationManager</a></li> <li><a href="../classes/CGSGAnimationMethod.html">CGSGAnimationMethod</a></li> <li><a href="../classes/CGSGBindEntry.html">CGSGBindEntry</a></li> <li><a href="../classes/CGSGButtonMode.html">CGSGButtonMode</a></li> <li><a href="../classes/CGSGCollisionGhostOnDemandTester.html">CGSGCollisionGhostOnDemandTester</a></li> <li><a href="../classes/CGSGCollisionManager.html">CGSGCollisionManager</a></li> <li><a href="../classes/CGSGCollisionMethod.html">CGSGCollisionMethod</a></li> <li><a href="../classes/CGSGCollisionRegionTester.html">CGSGCollisionRegionTester</a></li> <li><a href="../classes/CGSGCollisionTesterFactory.html">CGSGCollisionTesterFactory</a></li> <li><a href="../classes/CGSGColor.html">CGSGColor</a></li> <li><a href="../classes/CGSGCSSManager.html">CGSGCSSManager</a></li> <li><a href="../classes/CGSGDimension.html">CGSGDimension</a></li> <li><a href="../classes/CGSGEvent.html">CGSGEvent</a></li> <li><a href="../classes/CGSGEventManager.html">CGSGEventManager</a></li> <li><a href="../classes/CGSGHandleBox.html">CGSGHandleBox</a></li> <li><a href="../classes/CGSGImgManager.html">CGSGImgManager</a></li> <li><a href="../classes/CGSGInterpolator.html">CGSGInterpolator</a></li> <li><a href="../classes/CGSGInterpolatorLinear.html">CGSGInterpolatorLinear</a></li> <li><a href="../classes/CGSGInterpolatorTCB.html">CGSGInterpolatorTCB</a></li> <li><a href="../classes/CGSGKeyFrame.html">CGSGKeyFrame</a></li> <li><a href="../classes/CGSGMap.html">CGSGMap</a></li> <li><a href="../classes/CGSGMask.html">CGSGMask</a></li> <li><a href="../classes/CGSGMaskCache.html">CGSGMaskCache</a></li> <li><a href="../classes/CGSGMaskClip.html">CGSGMaskClip</a></li> <li><a href="../classes/CGSGMath.html">CGSGMath</a></li> <li><a href="../classes/CGSGNode.html">CGSGNode</a></li> <li><a href="../classes/CGSGNodeButton.html">CGSGNodeButton</a></li> <li><a href="../classes/CGSGNodeCircle.html">CGSGNodeCircle</a></li> <li><a href="../classes/CGSGNodeColorPicker.html">CGSGNodeColorPicker</a></li> <li><a href="../classes/CGSGNodeCurveTCB.html">CGSGNodeCurveTCB</a></li> <li><a href="../classes/CGSGNodeDomElement.html">CGSGNodeDomElement</a></li> <li><a href="../classes/CGSGNodeEllipse.html">CGSGNodeEllipse</a></li> <li><a href="../classes/CGSGNodeImage.html">CGSGNodeImage</a></li> <li><a href="../classes/CGSGNodeLine.html">CGSGNodeLine</a></li> <li><a href="../classes/CGSGNodeSlider.html">CGSGNodeSlider</a></li> <li><a href="../classes/CGSGNodeSliderHandle.html">CGSGNodeSliderHandle</a></li> <li><a href="../classes/CGSGNodeSprite.html">CGSGNodeSprite</a></li> <li><a href="../classes/CGSGNodeSquare.html">CGSGNodeSquare</a></li> <li><a href="../classes/CGSGNodeTabMenu.html">CGSGNodeTabMenu</a></li> <li><a href="../classes/CGSGNodeText.html">CGSGNodeText</a></li> <li><a href="../classes/CGSGNodeWebview.html">CGSGNodeWebview</a></li> <li><a href="../classes/CGSGParticle.html">CGSGParticle</a></li> <li><a href="../classes/CGSGParticleEmitter.html">CGSGParticleEmitter</a></li> <li><a href="../classes/CGSGParticleSystem.html">CGSGParticleSystem</a></li> <li><a href="../classes/CGSGPickNodeMethod.html">CGSGPickNodeMethod</a></li> <li><a href="../classes/CGSGPosition.html">CGSGPosition</a></li> <li><a href="../classes/CGSGRegion.html">CGSGRegion</a></li> <li><a href="../classes/CGSGRotation.html">CGSGRotation</a></li> <li><a href="../classes/CGSGScale.html">CGSGScale</a></li> <li><a href="../classes/CGSGSceneGraph.html">CGSGSceneGraph</a></li> <li><a href="../classes/CGSGSection.html">CGSGSection</a></li> <li><a href="../classes/CGSGTimeline.html">CGSGTimeline</a></li> <li><a href="../classes/CGSGTraverser.html">CGSGTraverser</a></li> <li><a href="../classes/CGSGVector2D.html">CGSGVector2D</a></li> <li><a href="../classes/CGSGView.html">CGSGView</a></li> <li><a href="../classes/CGSGWEBVIEWMODE.html">CGSGWEBVIEWMODE</a></li> <li><a href="../classes/CGSGWrapMode.html">CGSGWrapMode</a></li> <li><a href="../classes/GLOBAL_CONSTANTS.html">GLOBAL_CONSTANTS</a></li> <li><a href="../classes/GLOBAL_METHODS.html">GLOBAL_METHODS</a></li> <li><a href="../classes/GLOBAL_PROPERTIES.html">GLOBAL_PROPERTIES</a></li> <li><a href="../classes/UTIL_ARRAY.html">UTIL_ARRAY</a></li> <li><a href="../classes/WUICCGSGNodeImageFactory.html">WUICCGSGNodeImageFactory</a></li> </ul> <ul id="api-modules" class="apis modules"> <li><a href="../modules/Animation.html">Animation</a></li> <li><a href="../modules/Collision.html">Collision</a></li> <li><a href="../modules/Math.html">Math</a></li> <li><a href="../modules/Node.html">Node</a></li> <li><a href="../modules/ParticleSystem.html">ParticleSystem</a></li> <li><a href="../modules/Scene.html">Scene</a></li> <li><a href="../modules/Util.html">Util</a></li> </ul> </div> </div> </div> </div> </div> <div class="yui3-u-3-4"> <div id="api-options"> Show: <label for="api-show-inherited"> <input type="checkbox" id="api-show-inherited" checked> Inherited </label> <label for="api-show-protected"> <input type="checkbox" id="api-show-protected"> Protected </label> <label for="api-show-private"> <input type="checkbox" id="api-show-private"> Private </label> <label for="api-show-deprecated"> <input type="checkbox" id="api-show-deprecated"> Deprecated </label> </div> <div class="apidocs"> <div id="docs-main"> <div class="content"> <h1 class="file-heading">File: src/utils/math/math.js</h1> <div class="file"> <pre class="code prettyprint linenums"> /* * Copyright (c) 2014 Gwennael Buchet * * License/Terms of Use * * Permission is hereby granted, free of charge and for the term of intellectual property rights on the Software, to any * person obtaining a copy of this software and associated documentation files (the &quot;Software&quot;), to use, copy, modify * and propagate free of charge, anywhere in the world, all or part of the Software subject to the following mandatory * conditions: * * • The above copyright notice and this permission notice shall be included in all copies or substantial portions * of the Software. * * Any failure to comply with the above shall automatically terminate the license and be construed as a breach of these * Terms of Use causing significant harm to Gwennael Buchet. * * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. 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. * * Except as contained in this notice, the name of Gwennael Buchet shall not be used in advertising or otherwise to promote * the use or other dealings in this Software without prior written authorization from Gwennael Buchet. * * These Terms of Use are subject to French law. */ /** * Static class that encapsulates some useful methods. * @module Math * @main Math * @static * @class CGSGMath * @author Gwennael Buchet ([email protected]) */ var CGSGMath = { /** * PI x 2 * @static * @property PI2 */ PI2: 6.28318530718, //Math.PI * 2.0, /** * Convert degree to radian * @method deg2rad * @static * @param {Number} angle * @return {Number} The radian value */ deg2rad: function (angle) { return (angle / 180.0) * Math.PI; }, /** * Convert radian to degree * @method rad2deg * @static * @param {Number} angle * @return {Number} The degree value */ rad2deg: function (angle) { return angle * 57.29577951308232; }, /** * Compute the rounded integer of n * @method fixedPoint * @static * @param {Number} n * @return {Number} The integer value */ fixedPoint: function (n) { return (0.5 + n) &lt;&lt; 0; }, /** * Linear interpolation between &#x27;from&#x27; and &#x27;to&#x27; * @method lerp * @static * @param {Number} from * @param {Number} to * @param {Number} weight Percentage to apply to the first value * @return {Number} The interpolated value */ lerp: function (from, to, weight) { return from + (to - from) * weight; } }; </pre> </div> </div> </div> </div> </div> </div> </div> <script src="../assets/vendor/prettify/prettify-min.js"></script> <script>prettyPrint();</script> <script src="../assets/js/yui-prettify.js"></script> <script src="../assets/../api.js"></script> <script src="../assets/js/api-filter.js"></script> <script src="../assets/js/api-list.js"></script> <script src="../assets/js/api-search.js"></script> <script src="../assets/js/apidocs.js"></script> </body> </html>
{ "pile_set_name": "Github" }
# This is a MakeHuman target originally developed by Manuel Bastioni. # # Original copyright (C) 2014 Manuel Bastioni # # The copyright was explicitly transfered to other team members in 2016. # # Copyright (C) 2020 Data Collection AB, https://www.datacollection.se # Copyright (C) 2020 Joel Palmius # Copyright (C) 2020 Jonas Hauquier # # The primary legal contact for MakeHuman is Data Collection AB. # # For more information, see homepage at http://www.makehumancommunity.org # # This file is licensed AGPLv3 # # This file is part of MakeHuman (www.makehumancommunity.org). # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # published by the Free Software Foundation, either version 3 of the # License, or (at your option) any later version. # # This program 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 Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # # basemesh hm08 309 0 -.002 0 310 0 0 0 311 0 -.003 0 312 0 -.005 0 313 0 -.002 0 314 0 -.003 0 315 0 -.005 0 316 0 -.008 0 317 0 -.01 0 331 0 0 0 341 0 -.007 0 342 0 -.01 0 343 0 -.012 0 355 .002 -.015 -.012 356 0 -.023 -.002 357 -.003 -.014 -.001 359 0 0 0 361 .003 -.002 0 362 0 -.023 -.001 363 .005 -.004 0 368 .005 -.004 0 369 .004 -.003 0 370 -.012 0 .012 371 -.005 0 .005 372 .002 0 0 373 0 0 .001 374 .004 -.003 0 375 .005 .005 -.002 376 .003 -.003 0 377 .004 -.004 0 378 .005 -.004 0 379 .003 -.002 0 380 0 0 0 399 -.003 0 .005 400 -.008 0 .01 401 -.009 -.004 .013 402 .004 -.003 0 403 .003 -.002 0 404 0 0 .001 405 -.004 .002 .003 406 -.012 .008 .009 407 .005 -.004 0 408 .005 -.004 0 409 -.001 -.014 -.007 410 .001 -.009 0 411 .004 -.003 -.001 412 .004 -.004 0 413 .004 -.004 0 414 .004 -.003 0 415 .003 -.003 0 416 .003 -.002 0 417 .001 0 0 418 .002 0 0 420 .001 0 0 422 .003 -.003 0 423 .002 -.002 0 424 .005 -.004 0 425 .003 -.002 0 426 .002 -.002 0 427 .004 -.004 0 428 .002 -.002 0 429 .002 0 0 430 .003 -.003 0 431 .001 0 0 432 .001 0 0 433 .003 -.002 0 436 .002 -.002 0 437 0 0 0 438 -.002 .005 0 439 -.004 .012 .001 440 -.003 .007 .001 442 0 .002 0 447 0 -.007 0 448 0 -.005 0 449 0 0 0 450 0 -.025 -.005 451 0 -.015 -.005 452 0 -.012 -.003 453 0 0 0 454 0 -.027 -.005 455 0 -.028 -.005 456 .001 -.017 -.005 457 0 -.016 -.004 458 0 -.015 -.003 459 0 -.002 0 460 0 -.021 -.004 461 0 -.018 -.003 462 0 -.003 0 463 0 -.024 -.004 464 0 -.021 -.003 465 0 -.007 0 466 0 -.025 -.004 467 0 -.022 -.003 468 0 -.009 0 473 0 0 0 474 0 -.003 0 475 -.008 .018 .004 476 -.014 .029 .008 477 -.017 .036 .013 478 -.015 .026 .011 479 -.004 -.002 .009 480 -.009 .012 .019 481 -.013 .038 .023 482 -.015 .038 .028 483 -.020 .028 .052 484 -.017 .019 .044 485 0 .016 .012 486 0 .003 .044 487 -.004 .036 .043 488 -.004 .035 .048 489 -.003 .017 .064 490 -.002 0 .070 491 0 .021 .022 492 0 0 .063 493 0 .036 .05 494 0 .035 .056 495 0 .025 .078 496 0 .004 .082 497 .002 -.002 0 498 .003 -.003 0 499 .004 -.003 0 500 .003 -.002 0 501 .002 -.002 0 502 -.004 .009 0 503 0 0 0 504 0 -.003 0 505 0 -.004 0 506 0 -.006 0 507 0 -.009 0 508 0 -.012 0 509 0 -.015 0 510 -.017 .034 .01 511 -.018 .038 .037 512 -.006 .031 .058 513 0 .034 .062 517 -.003 .034 .041 518 -.011 .038 .02 519 -.004 .011 .002 523 0 .035 .046 528 .001 0 0 534 -.002 .03 .03 535 -.009 .033 .018 540 0 .032 .04 551 0 .018 .021 552 -.004 .017 .009 557 0 .027 .032 568 0 .008 .009 569 0 .003 .001 574 0 .019 .019 585 0 .003 .001 591 0 .013 .01 711 .004 -.003 0 721 -.007 -.003 .011 722 0 0 .002 723 0 .009 .004 724 0 .016 .012 729 -.002 0 .003 730 -.007 -.002 .009 731 0 .003 0 733 0 .008 .002 734 -.006 0 .009 897 -.003 0 .003 898 -.004 0 .005 3699 0 0 .001 3701 0 0 .001 3702 .002 0 0 3703 .001 0 0 3704 .001 0 0 3705 .001 0 0 3706 .001 0 0 3731 .001 0 0 3732 .002 -.002 0 3733 .003 -.002 0 3734 .003 -.003 0 3735 .003 -.003 0 3736 .004 -.003 0 3737 .004 -.004 0 3738 .004 -.003 0 3739 .002 -.002 0 5071 0 -.012 0 5072 0 -.014 0 5073 0 -.003 0 5074 0 -.01 0 5138 0 -.006 0 5145 .002 -.002 0 5160 -.003 0 .003 5258 0 0 0 5334 0 -.012 -.002 5335 -.006 .002 .012 5336 0 .019 .026 5337 0 .018 .036 5338 0 0 0 5339 .005 -.004 0 5340 .001 0 0 5342 0 -.017 0 5343 0 -.016 0 5344 0 -.014 0 5345 0 -.011 0 5346 0 -.006 0 5351 0 -.01 -.002 5352 0 -.007 -.002 5353 0 0 0 5354 0 -.014 -.002 5361 0 -.003 -.001 5363 0 0 0 5364 0 -.008 -.001 7073 0 -.002 0 7074 0 0 0 7075 0 -.003 0 7076 0 -.002 0 7077 0 -.003 0 7078 0 -.005 0 7079 0 -.008 0 7093 0 0 0 7103 0 -.007 0 7104 0 -.01 0 7116 -.002 -.015 -.012 7117 0 -.023 -.002 7118 .003 -.014 -.001 7120 0 0 0 7122 -.003 -.002 0 7123 -.005 -.004 0 7128 -.005 -.004 0 7129 -.004 -.003 0 7130 .012 0 .012 7131 .005 0 .005 7132 -.002 0 0 7133 0 0 .001 7134 -.004 -.003 0 7135 -.005 .005 -.002 7136 -.003 -.003 0 7137 -.004 -.004 0 7138 -.005 -.004 0 7139 -.003 -.002 0 7140 0 0 0 7159 .003 0 .005 7160 .008 0 .01 7161 .009 -.004 .013 7162 -.004 -.003 0 7163 -.003 -.002 0 7164 0 0 .001 7165 .004 .002 .003 7166 .012 .008 .009 7167 -.005 -.004 0 7168 -.005 -.004 0 7169 .001 -.014 -.007 7170 -.001 -.009 0 7171 -.004 -.003 -.001 7172 -.004 -.004 0 7173 -.004 -.004 0 7174 -.004 -.003 0 7175 -.003 -.003 0 7176 -.003 -.002 0 7177 -.001 0 0 7178 -.002 0 0 7180 -.001 0 0 7182 -.003 -.003 0 7183 -.002 -.002 0 7184 -.005 -.004 0 7185 -.003 -.002 0 7186 -.002 -.002 0 7187 -.004 -.004 0 7188 -.002 -.002 0 7189 -.002 0 0 7190 -.003 -.003 0 7191 -.001 0 0 7192 -.001 0 0 7193 -.003 -.002 0 7196 -.002 -.002 0 7197 0 0 0 7198 .002 .005 0 7199 .004 .012 .001 7200 .003 .007 .001 7202 0 .002 0 7207 0 -.007 0 7208 0 -.005 0 7209 0 0 0 7210 0 -.025 -.005 7211 0 -.015 -.005 7212 0 -.012 -.003 7213 0 0 0 7214 0 -.027 -.005 7215 -.001 -.017 -.005 7216 0 -.016 -.004 7217 0 -.015 -.003 7218 0 -.002 0 7219 0 -.021 -.004 7220 0 -.018 -.003 7221 0 -.003 0 7222 0 -.024 -.004 7223 0 -.021 -.003 7224 0 -.007 0 7229 0 0 0 7230 .008 .018 .004 7231 .014 .029 .008 7232 .017 .036 .013 7233 .015 .026 .011 7234 .004 -.002 .009 7235 .009 .012 .019 7236 .013 .038 .023 7237 .015 .038 .028 7238 .020 .028 .052 7239 .017 .019 .044 7240 0 .016 .012 7241 0 .003 .044 7242 .004 .036 .043 7243 .004 .035 .048 7244 .003 .017 .064 7245 .002 0 .070 7246 -.002 -.002 0 7247 -.003 -.003 0 7248 -.004 -.003 0 7249 -.003 -.002 0 7250 -.002 -.002 0 7251 .004 .009 0 7252 0 0 0 7253 0 -.003 0 7254 0 -.004 0 7255 0 -.006 0 7256 0 -.009 0 7257 0 -.012 0 7258 .017 .034 .01 7259 .018 .038 .037 7260 .006 .031 .058 7264 .003 .034 .041 7265 .011 .038 .02 7266 .004 .011 .002 7273 -.001 0 0 7279 .002 .03 .03 7280 .009 .033 .018 7294 0 .018 .021 7295 .004 .017 .009 7309 0 .008 .009 7310 0 .003 .001 7324 0 .003 .001 7434 -.004 -.003 0 7444 .007 -.003 .011 7445 0 0 .002 7446 0 .009 .004 7451 .002 0 .003 7452 .007 -.002 .009 7453 0 .003 0 7454 .006 0 .009 7599 .003 0 .003 7600 .004 0 .005 10367 0 0 .001 10369 0 0 .001 10370 -.002 0 0 10371 -.001 0 0 10372 -.001 0 0 10373 -.001 0 0 10374 -.001 0 0 10399 -.001 0 0 10400 -.002 -.002 0 10401 -.003 -.002 0 10402 -.003 -.003 0 10403 -.003 -.003 0 10404 -.004 -.003 0 10405 -.004 -.004 0 10406 -.004 -.003 0 10407 -.002 -.002 0 11687 0 -.012 0 11688 0 -.003 0 11689 0 -.01 0 11752 0 -.006 0 11759 -.002 -.002 0 11774 .003 0 .003 11866 0 0 0 11938 0 -.012 -.002 11939 .006 .002 .012 11940 0 .019 .026 11941 0 0 0 11942 -.005 -.004 0 11943 -.001 0 0 11945 0 -.016 0 11946 0 -.014 0 11947 0 -.011 0 11948 0 -.006 0 11953 0 -.01 -.002 11954 0 -.007 -.002 11955 0 0 0 11956 0 -.014 -.002 11963 0 -.003 -.001 11965 0 0 0 11966 0 -.008 -.001
{ "pile_set_name": "Github" }
.oof { background-image: url('./images/png/sprite.png'); background-position: 0 0; width: 150px; height: 12px; } .rab { background-image: url('./images/png/sprite.png'); background-position: 0 -12px; width: 150px; height: 24px; } .tset { background-image: url('./images/png/sprite.png'); background-position: 0 -36px; width: 150px; height: 12px; }
{ "pile_set_name": "Github" }
/* * Copyright (C) 2008 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. */ #include "signal_catcher.h" #include <fcntl.h> #include <pthread.h> #include <signal.h> #include <stdlib.h> #include <sys/stat.h> #include <sys/time.h> #include <sys/types.h> #include <unistd.h> #include "base/unix_file/fd_file.h" #include "class_linker.h" #include "gc/heap.h" #include "instruction_set.h" #include "os.h" #include "runtime.h" #include "scoped_thread_state_change.h" #include "signal_set.h" #include "thread.h" #include "thread_list.h" #include "utils.h" namespace art { static void DumpCmdLine(std::ostream& os) { #if defined(__linux__) // Show the original command line, and the current command line too if it's changed. // On Android, /proc/self/cmdline will have been rewritten to something like "system_server". // Note: The string "Cmd line:" is chosen to match the format used by debuggerd. std::string current_cmd_line; if (ReadFileToString("/proc/self/cmdline", &current_cmd_line)) { current_cmd_line.resize(current_cmd_line.find_last_not_of('\0') + 1); // trim trailing '\0's std::replace(current_cmd_line.begin(), current_cmd_line.end(), '\0', ' '); os << "Cmd line: " << current_cmd_line << "\n"; const char* stashed_cmd_line = GetCmdLine(); if (stashed_cmd_line != NULL && current_cmd_line != stashed_cmd_line && strcmp(stashed_cmd_line, "<unset>") != 0) { os << "Original command line: " << stashed_cmd_line << "\n"; } } #else os << "Cmd line: " << GetCmdLine() << "\n"; #endif } SignalCatcher::SignalCatcher(const std::string& stack_trace_file) : stack_trace_file_(stack_trace_file), lock_("SignalCatcher lock"), cond_("SignalCatcher::cond_", lock_), thread_(NULL) { SetHaltFlag(false); // Create a raw pthread; its start routine will attach to the runtime. CHECK_PTHREAD_CALL(pthread_create, (&pthread_, NULL, &Run, this), "signal catcher thread"); Thread* self = Thread::Current(); MutexLock mu(self, lock_); while (thread_ == NULL) { cond_.Wait(self); } } SignalCatcher::~SignalCatcher() { // Since we know the thread is just sitting around waiting for signals // to arrive, send it one. SetHaltFlag(true); CHECK_PTHREAD_CALL(pthread_kill, (pthread_, SIGQUIT), "signal catcher shutdown"); CHECK_PTHREAD_CALL(pthread_join, (pthread_, NULL), "signal catcher shutdown"); } void SignalCatcher::SetHaltFlag(bool new_value) { MutexLock mu(Thread::Current(), lock_); halt_ = new_value; } bool SignalCatcher::ShouldHalt() { MutexLock mu(Thread::Current(), lock_); return halt_; } void SignalCatcher::Output(const std::string& s) { if (stack_trace_file_.empty()) { LOG(INFO) << s; return; } ScopedThreadStateChange tsc(Thread::Current(), kWaitingForSignalCatcherOutput); int fd = open(stack_trace_file_.c_str(), O_APPEND | O_CREAT | O_WRONLY, 0666); if (fd == -1) { PLOG(ERROR) << "Unable to open stack trace file '" << stack_trace_file_ << "'"; return; } std::unique_ptr<File> file(new File(fd, stack_trace_file_, true)); bool success = file->WriteFully(s.data(), s.size()); if (success) { success = file->FlushCloseOrErase() == 0; } else { file->Erase(); } if (success) { LOG(INFO) << "Wrote stack traces to '" << stack_trace_file_ << "'"; } else { PLOG(ERROR) << "Failed to write stack traces to '" << stack_trace_file_ << "'"; } } void SignalCatcher::HandleSigQuit() { Runtime* runtime = Runtime::Current(); ThreadList* thread_list = runtime->GetThreadList(); // Grab exclusively the mutator lock, set state to Runnable without checking for a pending // suspend request as we're going to suspend soon anyway. We set the state to Runnable to avoid // giving away the mutator lock. thread_list->SuspendAll(); Thread* self = Thread::Current(); Locks::mutator_lock_->AssertExclusiveHeld(self); const char* old_cause = self->StartAssertNoThreadSuspension("Handling SIGQUIT"); ThreadState old_state = self->SetStateUnsafe(kRunnable); std::ostringstream os; os << "\n" << "----- pid " << getpid() << " at " << GetIsoDate() << " -----\n"; DumpCmdLine(os); // Note: The string "ABI:" is chosen to match the format used by debuggerd. os << "ABI: " << GetInstructionSetString(runtime->GetInstructionSet()) << "\n"; os << "Build type: " << (kIsDebugBuild ? "debug" : "optimized") << "\n"; runtime->DumpForSigQuit(os); if (false) { std::string maps; if (ReadFileToString("/proc/self/maps", &maps)) { os << "/proc/self/maps:\n" << maps; } } os << "----- end " << getpid() << " -----\n"; CHECK_EQ(self->SetStateUnsafe(old_state), kRunnable); self->EndAssertNoThreadSuspension(old_cause); thread_list->ResumeAll(); // Run the checkpoints after resuming the threads to prevent deadlocks if the checkpoint function // acquires the mutator lock. if (self->ReadFlag(kCheckpointRequest)) { self->RunCheckpointFunction(); } Output(os.str()); } void SignalCatcher::HandleSigUsr1() { LOG(INFO) << "SIGUSR1 forcing GC (no HPROF)"; Runtime::Current()->GetHeap()->CollectGarbage(false); } int SignalCatcher::WaitForSignal(Thread* self, SignalSet& signals) { ScopedThreadStateChange tsc(self, kWaitingInMainSignalCatcherLoop); // Signals for sigwait() must be blocked but not ignored. We // block signals like SIGQUIT for all threads, so the condition // is met. When the signal hits, we wake up, without any signal // handlers being invoked. int signal_number = signals.Wait(); if (!ShouldHalt()) { // Let the user know we got the signal, just in case the system's too screwed for us to // actually do what they want us to do... LOG(INFO) << *self << ": reacting to signal " << signal_number; // If anyone's holding locks (which might prevent us from getting back into state Runnable), say so... Runtime::Current()->DumpLockHolders(LOG(INFO)); } return signal_number; } void* SignalCatcher::Run(void* arg) { SignalCatcher* signal_catcher = reinterpret_cast<SignalCatcher*>(arg); CHECK(signal_catcher != NULL); Runtime* runtime = Runtime::Current(); CHECK(runtime->AttachCurrentThread("Signal Catcher", true, runtime->GetSystemThreadGroup(), !runtime->IsCompiler())); Thread* self = Thread::Current(); DCHECK_NE(self->GetState(), kRunnable); { MutexLock mu(self, signal_catcher->lock_); signal_catcher->thread_ = self; signal_catcher->cond_.Broadcast(self); } // Set up mask with signals we want to handle. SignalSet signals; signals.Add(SIGQUIT); signals.Add(SIGUSR1); while (true) { int signal_number = signal_catcher->WaitForSignal(self, signals); if (signal_catcher->ShouldHalt()) { runtime->DetachCurrentThread(); return NULL; } switch (signal_number) { case SIGQUIT: signal_catcher->HandleSigQuit(); break; case SIGUSR1: signal_catcher->HandleSigUsr1(); break; default: LOG(ERROR) << "Unexpected signal %d" << signal_number; break; } } } } // namespace art
{ "pile_set_name": "Github" }
// **************************************************************** // Copyright 2007, Charlie Poole // This is free software licensed under the NUnit license. You may // obtain a copy of the license at http://nunit.org // **************************************************************** using System; using System.Reflection; using System.Collections; using NUnit.Framework; using NUnit.Core.Builders; using NUnit.TestUtilities; using NUnit.TestData.AttributeDescriptionFixture; namespace NUnit.Core.Tests { // TODO: Review to see if we need these tests [TestFixture] public class TestAttributeFixture { static readonly Type FixtureType = typeof( MockFixture ); [Test] public void ReflectionTest() { Test testCase = TestBuilder.MakeTestCase( FixtureType, "Method" ); Assert.AreEqual( RunState.Runnable, testCase.RunState ); } [Test] public void Description() { Test testCase = TestBuilder.MakeTestCase(FixtureType, "Method"); Assert.AreEqual("Test Description", testCase.Description); } [Test] public void DescriptionInResult() { TestSuite suite = new TestSuite("Mock Fixture"); suite.Add(TestBuilder.MakeFixture(typeof(MockFixture))); TestResult result = suite.Run(NullListener.NULL, TestFilter.Empty); TestResult caseResult = TestFinder.Find("Method", result, true); Assert.AreEqual("Test Description", caseResult.Description); caseResult = TestFinder.Find("NoDescriptionMethod", result, true); Assert.IsNull(caseResult.Description); } [Test] public void NoDescription() { Test testCase = TestBuilder.MakeTestCase( FixtureType, "NoDescriptionMethod" ); Assert.IsNull(testCase.Description); } [Test] public void FixtureDescription() { TestSuite suite = new TestSuite("suite"); suite.Add( TestBuilder.MakeFixture( typeof( MockFixture ) ) ); IList tests = suite.Tests; TestSuite mockFixtureSuite = (TestSuite)tests[0]; Assert.AreEqual("Fixture Description", mockFixtureSuite.Description); } [Test] public void FixtureDescriptionInResult() { TestSuite suite = new TestSuite("Mock Fixture"); suite.Add( TestBuilder.MakeFixture( typeof( MockFixture ) ) ); TestResult result = suite.Run(NullListener.NULL, TestFilter.Empty); TestResult fixtureResult = TestFinder.Find("MockFixture", result, true); Assert.AreEqual("Fixture Description", fixtureResult.Description); } [Test] public void SeparateDescriptionAttribute() { Test testCase = TestBuilder.MakeTestCase(FixtureType, "SeparateDescriptionMethod"); Assert.AreEqual("Separate Description", testCase.Description); } [Test] public void SeparateDescriptionInResult() { TestSuite suite = new TestSuite("Mock Fixture"); suite.Add(TestBuilder.MakeFixture(typeof(MockFixture))); TestResult result = suite.Run(NullListener.NULL, TestFilter.Empty); TestResult caseResult = TestFinder.Find("SeparateDescriptionMethod", result, true); Assert.AreEqual("Separate Description", caseResult.Description); } } }
{ "pile_set_name": "Github" }
package risk var _ BlackList = (*BlackListFake)(nil) // BlackListFake is a in memory implementation of a BlackList used for testing. type BlackListFake struct { blacklist map[string]bool } // HasURL checks whether a given url exists in the blacklist. func (b BlackListFake) HasURL(url string) (bool, error) { _, found := b.blacklist[url] return found, nil } // NewBlackListFake initializes an in-memory blacklist. func NewBlackListFake(blacklist map[string]bool) BlackListFake { return BlackListFake{ blacklist, } }
{ "pile_set_name": "Github" }
<?php /** * Magento * * NOTICE OF LICENSE * * This source file is subject to the Open Software License (OSL 3.0) * that is bundled with this package in the file LICENSE.txt. * It is also available through the world-wide-web at this URL: * http://opensource.org/licenses/osl-3.0.php * If you did not receive a copy of the license and are unable to * obtain it through the world-wide-web, please send an email * to [email protected] so we can send you a copy immediately. * * DISCLAIMER * * Do not edit or add to this file if you wish to upgrade Magento to newer * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * * @category Mage * @package Mage_SalesRule * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ $installer = $this; /** @var $installer Mage_Core_Model_Resource_Setup */ $installer = $this; $connection = $installer->getConnection(); $connection->createTable($connection->createTableByDdl( $installer->getTable('salesrule/coupon_aggregated'), $installer->getTable('salesrule/coupon_aggregated_updated') ));
{ "pile_set_name": "Github" }
--- title: Querying Partitioned Regions --- <!-- 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. --> <%=vars.product_name%> allows you to manage and store large amounts of data across distributed nodes using partitioned regions. The basic unit of storage for a partitioned region is a bucket, which resides on a <%=vars.product_name%> node and contains all the entries that map to a single hashcode. In a typical partitioned region query, the system distributes the query to all buckets across all nodes, then merges the result sets and sends back the query results. <a id="querying_partitioned_regions__section_4C603563DEDC4303818FB8F894470457"></a> The following list summarizes the querying functionality supported by <%=vars.product_name%> for partitioned regions: - **Ability to target specific nodes in a query**. If you know that a specific bucket contains the data that you want to query, you can use a function to ensure that your query only runs the specific node that holds the data. This can greatly improve query efficiency. The ability to query data on a specific node is only available if you are using functions and if the function is executed on one single region. In order to do this, you need to use `Query.execute(RegionFunctionContext context)`. See the [Java API](/releases/latest/javadoc/org/apache/geode/cache/query/Query.html) and [Querying a Partitioned Region on a Single Node](../query_additional/query_on_a_single_node.html#concept_30B18A6507534993BD55C2C9E0544A97) for more details. - **Ability to optimize partitioned region query performance using key indexes**. You can improve query performance on data that is partitioned by key or a field value by creating a key index and then executing the query using use `Query.execute(RegionFunctionContext context)` with the key or field value used as filter. See the [Java API](/releases/latest/javadoc/org/apache/geode/cache/query/Query.html) and [Optimizing Queries on Data Partitioned by a Key or Field Value](../query_additional/partitioned_region_key_or_field_value.html#concept_3010014DFBC9479783B2B45982014454) for more details. - **Ability to perform equi-join queries between partitioned regions and between partitioned regions and replicated regions**. Join queries between partitioned region and between partitioned regions and replicated regions are supported through the function service. In order to perform equi-join operations on partitioned regions or partitioned regions and replicated regions, the partitioned regions must be colocated, and you need to use the need to use `Query.execute(RegionFunctionContext context)`. See the [Java API](/releases/latest/javadoc/org/apache/geode/cache/query/Query.html) and [Performing an Equi-Join Query on Partitioned Regions](../partitioned_regions/join_query_partitioned_regions.html#concept_B930D276F49541F282A2CFE639F107DD) for more details. - **[Using ORDER BY on Partitioned Regions](../query_additional/order_by_on_partitioned_regions.html)** - **[Querying a Partitioned Region on a Single Node](../query_additional/query_on_a_single_node.html)** - **[Optimizing Queries on Data Partitioned by a Key or Field Value](../query_additional/partitioned_region_key_or_field_value.html)** - **[Performing an Equi-Join Query on Partitioned Regions](../partitioned_regions/join_query_partitioned_regions.html)** - **[Partitioned Region Query Restrictions](../query_additional/partitioned_region_query_restrictions.html)**
{ "pile_set_name": "Github" }
/* * Copyright (C) 2008 Apple Inc. All rights reserved. * * 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 Apple Computer, Inc. ("Apple") 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 APPLE AND ITS 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 APPLE OR ITS 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. */ #ifndef DebuggerCallFrame_h #define DebuggerCallFrame_h #include "CallFrame.h" namespace JSC { class DebuggerCallFrame { public: enum Type { ProgramType, FunctionType }; DebuggerCallFrame(CallFrame* callFrame) : m_callFrame(callFrame) { } DebuggerCallFrame(CallFrame* callFrame, JSValue exception) : m_callFrame(callFrame) , m_exception(exception) { } JSGlobalObject* dynamicGlobalObject() const { return m_callFrame->dynamicGlobalObject(); } const ScopeChainNode* scopeChain() const { return m_callFrame->scopeChain(); } const UString* functionName() const; UString calculatedFunctionName() const; Type type() const; JSObject* thisObject() const; JSValue evaluate(const UString&, JSValue& exception) const; JSValue exception() const { return m_exception; } #if QT_BUILD_SCRIPT_LIB CallFrame* callFrame() const { return m_callFrame; } #endif private: CallFrame* m_callFrame; JSValue m_exception; }; } // namespace JSC #endif // DebuggerCallFrame_h
{ "pile_set_name": "Github" }
digraph G{ margin="0" node[shape=record] s[label="('', ananym)"]; sl[label="('', ananym)"]; sr[label="(a, nanym)"]; s->sl[label="fail"]; s->sr[label="match"]; sll[label="('', ananym)"]; slr[label="(a, ananym)"]; sl->sll[label="fail"]; sl->slr[label="match"]; srl[label="('', ananym)"]; srr[label="(an, anym)"]; sr->srl[label="fail"]; sr->srr[label="match"]; slldot[label="...", shape=plaintext]; sll->slldot[style=invis]; slrdot[label="...", shape=plaintext]; slr->slrdot[style=invis]; srldot[label="...", shape=plaintext]; srl->srldot[style=invis]; srrl[label="('', ananym)"]; srrr[label="(ana, nym)"]; srr->srrl[label="fail"]; srr->srrr[label="match"]; srrldot[label="...", shape=plaintext]; srrl->srrldot[style=invis]; srrrl[label="(a, nanym)"]; srrrr[label="(anan, ym)"]; srrr->srrrl[label="fail"]; srrr->srrrr[label="match"]; srrrldot[label="...", shape=plaintext]; srrrl->srrrldot[style=invis]; s4rl[label="(an, anym)"]; s5r[label="(anany, m)"]; srrrr->s4rl[label="fail"]; srrrr->s5r[label="match"]; s5rl[label="('', ananym)"]; s6r[label="(ananym, '')"]; s6rl[label="('', ananym)"]; s5r->s5rl[label="fail"]; s5r->s6r[label="match"]; s6rl[label="('', ananym)"]; s7r[label="empty"]; s6r->s6rl[label="fail"]; s6r->s7r; }
{ "pile_set_name": "Github" }
## Process this file with automake to produce Makefile.in. AUTOMAKE_OPTIONS = foreign dejagnu no-dist EXPECT = expect # Override default. DEJATOOL = boehm-gc CLEANFILES = *.exe core* *.log *.sum # We need more things in site.exp, but automake completely controls the # creation of that file; there's no way to append to it without messing up # the dependancy chains. So we overrule automake. This rule is exactly # what it would have generated, plus our own additions. site.exp: Makefile @echo 'Making a new site.exp file...' @echo '## these variables are automatically generated by make ##' >site.tmp @echo '# Do not edit here. If you wish to override these values' >>site.tmp @echo '# edit the last section' >>site.tmp @echo 'set srcdir $(srcdir)' >>site.tmp @echo "set objdir `pwd`" >>site.tmp @echo 'set build_alias "$(build_alias)"' >>site.tmp @echo 'set build_triplet $(build_triplet)' >>site.tmp @echo 'set host_alias "$(host_alias)"' >>site.tmp @echo 'set host_triplet $(host_triplet)' >>site.tmp @echo 'set target_alias "$(target_alias)"' >>site.tmp @echo 'set target_triplet $(target_triplet)' >>site.tmp @echo 'set threadcflags "$(THREADCFLAGS)"' >>site.tmp @echo 'set threadlibs "$(THREADLIBS)"' >>site.tmp @echo 'set extra_test_libs "$(EXTRA_TEST_LIBS)"' >>site.tmp @echo '## All variables above are generated by configure. Do Not Edit ##' >>site.tmp @test ! -f site.exp || \ sed '1,/^## All variables above are.*##/ d' site.exp >> site.tmp @-rm -f site.bak @test ! -f site.exp || mv site.exp site.bak @mv site.tmp site.exp
{ "pile_set_name": "Github" }
// tokeniser_helper.hpp // Copyright (c) 2007-2009 Ben Hanson (http://www.benhanson.net/) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file licence_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) #ifndef BOOST_LEXER_RE_TOKENISER_HELPER_H #define BOOST_LEXER_RE_TOKENISER_HELPER_H #include "../../char_traits.hpp" // strlen() #include <cstring> #include "../../size_t.hpp" #include "re_tokeniser_state.hpp" namespace boost { namespace lexer { namespace detail { template<typename CharT, typename Traits = char_traits<CharT> > class basic_re_tokeniser_helper { public: typedef basic_re_tokeniser_state<CharT> state; typedef std::basic_string<CharT> string; static const CharT *escape_sequence (state &state_, CharT &ch_, std::size_t &str_len_) { bool eos_ = state_.eos (); if (eos_) { throw runtime_error ("Unexpected end of regex " "following '\\'."); } const CharT *str_ = charset_shortcut (*state_._curr, str_len_); if (str_) { state_.increment (); } else { ch_ = chr (state_); } return str_; } // This function can call itself. static void charset (state &state_, string &chars_, bool &negated_) { CharT ch_ = 0; bool eos_ = state_.next (ch_); if (eos_) { // Pointless returning index if at end of string throw runtime_error ("Unexpected end of regex " "following '['."); } negated_ = ch_ == '^'; if (negated_) { eos_ = state_.next (ch_); if (eos_) { // Pointless returning index if at end of string throw runtime_error ("Unexpected end of regex " "following '^'."); } } bool chset_ = false; CharT prev_ = 0; while (ch_ != ']') { if (ch_ == '\\') { std::size_t str_len_ = 0; const CharT *str_ = escape_sequence (state_, prev_, str_len_); chset_ = str_ != 0; if (chset_) { state temp_state_ (str_ + 1, str_ + str_len_, state_._flags, state_._locale); string temp_chars_; bool temp_negated_ = false; charset (temp_state_, temp_chars_, temp_negated_); if (negated_ != temp_negated_) { std::ostringstream ss_; ss_ << "Mismatch in charset negation preceding " "index " << state_.index () << '.'; throw runtime_error (ss_.str ().c_str ()); } chars_ += temp_chars_; } } /* else if (ch_ == '[' && !state_.eos () && *state_._curr == ':') { // TODO: POSIX charsets } */ else { chset_ = false; prev_ = ch_; } eos_ = state_.next (ch_); // Covers preceding if, else if and else if (eos_) { // Pointless returning index if at end of string throw runtime_error ("Unexpected end of regex " "(missing ']')."); } if (ch_ == '-') { charset_range (chset_, state_, eos_, ch_, prev_, chars_); } else if (!chset_) { if ((state_._flags & icase) && (std::isupper (prev_, state_._locale) || std::islower (prev_, state_._locale))) { CharT upper_ = std::toupper (prev_, state_._locale); CharT lower_ = std::tolower (prev_, state_._locale); chars_ += upper_; chars_ += lower_; } else { chars_ += prev_; } } } if (!negated_ && chars_.empty ()) { throw runtime_error ("Empty charsets not allowed."); } } static CharT chr (state &state_) { CharT ch_ = 0; // eos_ has already been checked for. switch (*state_._curr) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': ch_ = decode_octal (state_); break; case 'a': ch_ = '\a'; state_.increment (); break; case 'b': ch_ = '\b'; state_.increment (); break; case 'c': ch_ = decode_control_char (state_); break; case 'e': ch_ = 27; // '\e' not recognised by compiler state_.increment (); break; case 'f': ch_ = '\f'; state_.increment (); break; case 'n': ch_ = '\n'; state_.increment (); break; case 'r': ch_ = '\r'; state_.increment (); break; case 't': ch_ = '\t'; state_.increment (); break; case 'v': ch_ = '\v'; state_.increment (); break; case 'x': ch_ = decode_hex (state_); break; default: ch_ = *state_._curr; state_.increment (); break; } return ch_; } private: static const char *charset_shortcut (const char ch_, std::size_t &str_len_) { const char *str_ = 0; switch (ch_) { case 'd': str_ = "[0-9]"; break; case 'D': str_ = "[^0-9]"; break; case 's': str_ = "[ \t\n\r\f\v]"; break; case 'S': str_ = "[^ \t\n\r\f\v]"; break; case 'w': str_ = "[_0-9A-Za-z]"; break; case 'W': str_ = "[^_0-9A-Za-z]"; break; } if (str_) { // Some systems have strlen in namespace std. using namespace std; str_len_ = strlen (str_); } else { str_len_ = 0; } return str_; } static const wchar_t *charset_shortcut (const wchar_t ch_, std::size_t &str_len_) { const wchar_t *str_ = 0; switch (ch_) { case 'd': str_ = L"[0-9]"; break; case 'D': str_ = L"[^0-9]"; break; case 's': str_ = L"[ \t\n\r\f\v]"; break; case 'S': str_ = L"[^ \t\n\r\f\v]"; break; case 'w': str_ = L"[_0-9A-Za-z]"; break; case 'W': str_ = L"[^_0-9A-Za-z]"; break; } if (str_) { // Some systems have wcslen in namespace std. using namespace std; str_len_ = wcslen (str_); } else { str_len_ = 0; } return str_; } static CharT decode_octal (state &state_) { std::size_t accumulator_ = 0; CharT ch_ = *state_._curr; unsigned short count_ = 3; bool eos_ = false; for (;;) { accumulator_ *= 8; accumulator_ += ch_ - '0'; --count_; state_.increment (); eos_ = state_.eos (); if (!count_ || eos_) break; ch_ = *state_._curr; // Don't consume invalid chars! if (ch_ < '0' || ch_ > '7') { break; } } return static_cast<CharT> (accumulator_); } static CharT decode_control_char (state &state_) { // Skip over 'c' state_.increment (); CharT ch_ = 0; bool eos_ = state_.next (ch_); if (eos_) { // Pointless returning index if at end of string throw runtime_error ("Unexpected end of regex following \\c."); } else { if (ch_ >= 'a' && ch_ <= 'z') { ch_ -= 'a' - 1; } else if (ch_ >= 'A' && ch_ <= 'Z') { ch_ -= 'A' - 1; } else if (ch_ == '@') { // Apparently... ch_ = 0; } else { std::ostringstream ss_; ss_ << "Invalid control char at index " << state_.index () - 1 << '.'; throw runtime_error (ss_.str ().c_str ()); } } return ch_; } static CharT decode_hex (state &state_) { // Skip over 'x' state_.increment (); CharT ch_ = 0; bool eos_ = state_.next (ch_); if (eos_) { // Pointless returning index if at end of string throw runtime_error ("Unexpected end of regex following \\x."); } if (!((ch_ >= '0' && ch_ <= '9') || (ch_ >= 'a' && ch_ <= 'f') || (ch_ >= 'A' && ch_ <= 'F'))) { std::ostringstream ss_; ss_ << "Illegal char following \\x at index " << state_.index () - 1 << '.'; throw runtime_error (ss_.str ().c_str ()); } std::size_t hex_ = 0; do { hex_ *= 16; if (ch_ >= '0' && ch_ <= '9') { hex_ += ch_ - '0'; } else if (ch_ >= 'a' && ch_ <= 'f') { hex_ += 10 + (ch_ - 'a'); } else { hex_ += 10 + (ch_ - 'A'); } eos_ = state_.eos (); if (!eos_) { ch_ = *state_._curr; // Don't consume invalid chars! if (((ch_ >= '0' && ch_ <= '9') || (ch_ >= 'a' && ch_ <= 'f') || (ch_ >= 'A' && ch_ <= 'F'))) { state_.increment (); } else { eos_ = true; } } } while (!eos_); return static_cast<CharT> (hex_); } static void charset_range (const bool chset_, state &state_, bool &eos_, CharT &ch_, const CharT prev_, string &chars_) { if (chset_) { std::ostringstream ss_; ss_ << "Charset cannot form start of range preceding " "index " << state_.index () - 1 << '.'; throw runtime_error (ss_.str ().c_str ()); } eos_ = state_.next (ch_); if (eos_) { // Pointless returning index if at end of string throw runtime_error ("Unexpected end of regex " "following '-'."); } CharT curr_ = 0; if (ch_ == '\\') { std::size_t str_len_ = 0; if (escape_sequence (state_, curr_, str_len_)) { std::ostringstream ss_; ss_ << "Charset cannot form end of range preceding index " << state_.index () << '.'; throw runtime_error (ss_.str ().c_str ()); } } /* else if (ch_ == '[' && !state_.eos () && *state_._curr == ':') { std::ostringstream ss_; ss_ << "POSIX char class cannot form end of range at " "index " << state_.index () - 1 << '.'; throw runtime_error (ss_.str ().c_str ()); } */ else { curr_ = ch_; } eos_ = state_.next (ch_); // Covers preceding if and else if (eos_) { // Pointless returning index if at end of string throw runtime_error ("Unexpected end of regex " "(missing ']')."); } std::size_t start_ = static_cast<typename Traits::index_type> (prev_); std::size_t end_ = static_cast<typename Traits::index_type> (curr_); // Semanic check if (end_ < start_) { std::ostringstream ss_; ss_ << "Invalid range in charset preceding index " << state_.index () - 1 << '.'; throw runtime_error (ss_.str ().c_str ()); } chars_.reserve (chars_.size () + (end_ + 1 - start_)); for (; start_ <= end_; ++start_) { CharT ch_ = static_cast<CharT> (start_); if ((state_._flags & icase) && (std::isupper (ch_, state_._locale) || std::islower (ch_, state_._locale))) { CharT upper_ = std::toupper (ch_, state_._locale); CharT lower_ = std::tolower (ch_, state_._locale); chars_ += (upper_); chars_ += (lower_); } else { chars_ += (ch_); } } } }; } } } #endif
{ "pile_set_name": "Github" }
///////////////////////////////////////////////////////////////////////////// // Name: wx/cocoa/checkbox.h // Purpose: wxCheckBox class // Author: David Elliott // Modified by: // Created: 2003/03/16 // RCS-ID: $Id: checkbox.h 47907 2007-08-06 14:55:00Z DE $ // Copyright: (c) 2003 David Elliott // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// #ifndef __WX_COCOA_CHECKBOX_H__ #define __WX_COCOA_CHECKBOX_H__ #include "wx/cocoa/NSButton.h" // ======================================================================== // wxCheckBox // ======================================================================== class WXDLLEXPORT wxCheckBox: public wxCheckBoxBase , protected wxCocoaNSButton { DECLARE_DYNAMIC_CLASS(wxCheckBox) DECLARE_EVENT_TABLE() WX_DECLARE_COCOA_OWNER(NSButton,NSControl,NSView) // ------------------------------------------------------------------------ // initialization // ------------------------------------------------------------------------ public: wxCheckBox() { } wxCheckBox(wxWindow *parent, wxWindowID winid, const wxString& label, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxCheckBoxNameStr) { Create(parent, winid, label, pos, size, style, validator, name); } bool Create(wxWindow *parent, wxWindowID winid, const wxString& label, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxCheckBoxNameStr); virtual ~wxCheckBox(); // ------------------------------------------------------------------------ // Cocoa callbacks // ------------------------------------------------------------------------ protected: virtual void Cocoa_wxNSButtonAction(void); // ------------------------------------------------------------------------ // Implementation // ------------------------------------------------------------------------ public: virtual void SetValue(bool); virtual bool GetValue() const; virtual void SetLabel(const wxString& label); virtual wxString GetLabel() const; protected: virtual void DoSet3StateValue(wxCheckBoxState state); virtual wxCheckBoxState DoGet3StateValue() const; }; #endif // __WX_COCOA_CHECKBOX_H__
{ "pile_set_name": "Github" }
// Protocol Buffers for Go with Gadgets // // Copyright (c) 2013, The GoGo Authors. All rights reserved. // http://github.com/gogo/protobuf // // 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 // 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. syntax = "proto2"; package test; import "github.com/gogo/protobuf/gogoproto/gogo.proto"; option (gogoproto.goproto_stringer_all) = false; option (gogoproto.goproto_enum_prefix_all) = false; option (gogoproto.goproto_getters_all) = false; option (gogoproto.equal_all) = true; option (gogoproto.verbose_equal_all) = true; option (gogoproto.stringer_all) = true; option (gogoproto.gostring_all) = true; option (gogoproto.face_all) = true; option (gogoproto.description_all) = true; option (gogoproto.testgen_all) = true; option (gogoproto.populate_all) = true; option (gogoproto.benchgen_all) = true; option (gogoproto.unmarshaler_all) = false; option (gogoproto.marshaler_all) = false; option (gogoproto.sizer_all) = true; option (gogoproto.protosizer_all) = false; option (gogoproto.goproto_enum_stringer_all) = false; option (gogoproto.enum_stringer_all) = true; option (gogoproto.unsafe_marshaler_all) = false; option (gogoproto.unsafe_unmarshaler_all) = false; option (gogoproto.compare_all) = true; message NidOptNative { optional double Field1 = 1 [(gogoproto.nullable) = false]; optional float Field2 = 2 [(gogoproto.nullable) = false]; optional int32 Field3 = 3 [(gogoproto.nullable) = false]; optional int64 Field4 = 4 [(gogoproto.nullable) = false]; optional uint32 Field5 = 5 [(gogoproto.nullable) = false]; optional uint64 Field6 = 6 [(gogoproto.nullable) = false]; optional sint32 Field7 = 7 [(gogoproto.nullable) = false]; optional sint64 Field8 = 8 [(gogoproto.nullable) = false]; optional fixed32 Field9 = 9 [(gogoproto.nullable) = false]; optional sfixed32 Field10 = 10 [(gogoproto.nullable) = false]; optional fixed64 Field11 = 11 [(gogoproto.nullable) = false]; optional sfixed64 Field12 = 12 [(gogoproto.nullable) = false]; optional bool Field13 = 13 [(gogoproto.nullable) = false]; optional string Field14 = 14 [(gogoproto.nullable) = false]; optional bytes Field15 = 15 [(gogoproto.nullable) = false]; } message NinOptNative { optional double Field1 = 1; optional float Field2 = 2; optional int32 Field3 = 3; optional int64 Field4 = 4; optional uint32 Field5 = 5; optional uint64 Field6 = 6; optional sint32 Field7 = 7; optional sint64 Field8 = 8; optional fixed32 Field9 = 9; optional sfixed32 Field10 = 10; optional fixed64 Field11 = 11; optional sfixed64 Field12 = 12; optional bool Field13 = 13; optional string Field14 = 14; optional bytes Field15 = 15; } message NidRepNative { repeated double Field1 = 1 [(gogoproto.nullable) = false]; repeated float Field2 = 2 [(gogoproto.nullable) = false]; repeated int32 Field3 = 3 [(gogoproto.nullable) = false]; repeated int64 Field4 = 4 [(gogoproto.nullable) = false]; repeated uint32 Field5 = 5 [(gogoproto.nullable) = false]; repeated uint64 Field6 = 6 [(gogoproto.nullable) = false]; repeated sint32 Field7 = 7 [(gogoproto.nullable) = false]; repeated sint64 Field8 = 8 [(gogoproto.nullable) = false]; repeated fixed32 Field9 = 9 [(gogoproto.nullable) = false]; repeated sfixed32 Field10 = 10 [(gogoproto.nullable) = false]; repeated fixed64 Field11 = 11 [(gogoproto.nullable) = false]; repeated sfixed64 Field12 = 12 [(gogoproto.nullable) = false]; repeated bool Field13 = 13 [(gogoproto.nullable) = false]; repeated string Field14 = 14 [(gogoproto.nullable) = false]; repeated bytes Field15 = 15 [(gogoproto.nullable) = false]; } message NinRepNative { repeated double Field1 = 1; repeated float Field2 = 2; repeated int32 Field3 = 3; repeated int64 Field4 = 4; repeated uint32 Field5 = 5; repeated uint64 Field6 = 6; repeated sint32 Field7 = 7; repeated sint64 Field8 = 8; repeated fixed32 Field9 = 9; repeated sfixed32 Field10 = 10; repeated fixed64 Field11 = 11; repeated sfixed64 Field12 = 12; repeated bool Field13 = 13; repeated string Field14 = 14; repeated bytes Field15 = 15; } message NidRepPackedNative { repeated double Field1 = 1 [(gogoproto.nullable) = false, packed = true]; repeated float Field2 = 2 [(gogoproto.nullable) = false, packed = true]; repeated int32 Field3 = 3 [(gogoproto.nullable) = false, packed = true]; repeated int64 Field4 = 4 [(gogoproto.nullable) = false, packed = true]; repeated uint32 Field5 = 5 [(gogoproto.nullable) = false, packed = true]; repeated uint64 Field6 = 6 [(gogoproto.nullable) = false, packed = true]; repeated sint32 Field7 = 7 [(gogoproto.nullable) = false, packed = true]; repeated sint64 Field8 = 8 [(gogoproto.nullable) = false, packed = true]; repeated fixed32 Field9 = 9 [(gogoproto.nullable) = false, packed = true]; repeated sfixed32 Field10 = 10 [(gogoproto.nullable) = false, packed = true]; repeated fixed64 Field11 = 11 [(gogoproto.nullable) = false, packed = true]; repeated sfixed64 Field12 = 12 [(gogoproto.nullable) = false, packed = true]; repeated bool Field13 = 13 [(gogoproto.nullable) = false, packed = true]; } message NinRepPackedNative { repeated double Field1 = 1 [packed = true]; repeated float Field2 = 2 [packed = true]; repeated int32 Field3 = 3 [packed = true]; repeated int64 Field4 = 4 [packed = true]; repeated uint32 Field5 = 5 [packed = true]; repeated uint64 Field6 = 6 [packed = true]; repeated sint32 Field7 = 7 [packed = true]; repeated sint64 Field8 = 8 [packed = true]; repeated fixed32 Field9 = 9 [packed = true]; repeated sfixed32 Field10 = 10 [packed = true]; repeated fixed64 Field11 = 11 [packed = true]; repeated sfixed64 Field12 = 12 [packed = true]; repeated bool Field13 = 13 [packed = true]; } message NidOptStruct { optional double Field1 = 1 [(gogoproto.nullable) = false]; optional float Field2 = 2 [(gogoproto.nullable) = false]; optional NidOptNative Field3 = 3 [(gogoproto.nullable) = false]; optional NinOptNative Field4 = 4 [(gogoproto.nullable) = false]; optional uint64 Field6 = 6 [(gogoproto.nullable) = false]; optional sint32 Field7 = 7 [(gogoproto.nullable) = false]; optional NidOptNative Field8 = 8 [(gogoproto.nullable) = false]; optional bool Field13 = 13 [(gogoproto.nullable) = false]; optional string Field14 = 14 [(gogoproto.nullable) = false]; optional bytes Field15 = 15 [(gogoproto.nullable) = false]; } message NinOptStruct { optional double Field1 = 1; optional float Field2 = 2; optional NidOptNative Field3 = 3; optional NinOptNative Field4 = 4; optional uint64 Field6 = 6; optional sint32 Field7 = 7; optional NidOptNative Field8 = 8; optional bool Field13 = 13; optional string Field14 = 14; optional bytes Field15 = 15; } message NidRepStruct { repeated double Field1 = 1 [(gogoproto.nullable) = false]; repeated float Field2 = 2 [(gogoproto.nullable) = false]; repeated NidOptNative Field3 = 3 [(gogoproto.nullable) = false]; repeated NinOptNative Field4 = 4 [(gogoproto.nullable) = false]; repeated uint64 Field6 = 6 [(gogoproto.nullable) = false]; repeated sint32 Field7 = 7 [(gogoproto.nullable) = false]; repeated NidOptNative Field8 = 8 [(gogoproto.nullable) = false]; repeated bool Field13 = 13 [(gogoproto.nullable) = false]; repeated string Field14 = 14 [(gogoproto.nullable) = false]; repeated bytes Field15 = 15 [(gogoproto.nullable) = false]; } message NinRepStruct { repeated double Field1 = 1; repeated float Field2 = 2; repeated NidOptNative Field3 = 3; repeated NinOptNative Field4 = 4; repeated uint64 Field6 = 6; repeated sint32 Field7 = 7; repeated NidOptNative Field8 = 8; repeated bool Field13 = 13; repeated string Field14 = 14; repeated bytes Field15 = 15; } message NidEmbeddedStruct { optional NidOptNative Field1 = 1 [(gogoproto.embed) = true]; optional NidOptNative Field200 = 200 [(gogoproto.nullable) = false]; optional bool Field210 = 210 [(gogoproto.nullable) = false]; } message NinEmbeddedStruct { optional NidOptNative Field1 = 1 [(gogoproto.embed) = true]; optional NidOptNative Field200 = 200; optional bool Field210 = 210; } message NidNestedStruct { optional NidOptStruct Field1 = 1 [(gogoproto.nullable) = false]; repeated NidRepStruct Field2 = 2 [(gogoproto.nullable) = false]; } message NinNestedStruct { optional NinOptStruct Field1 = 1; repeated NinRepStruct Field2 = 2; } message NidOptCustom { optional bytes Id = 1 [(gogoproto.customtype) = "Uuid", (gogoproto.nullable) = false]; optional bytes Value = 2 [(gogoproto.customtype) = "github.com/gogo/protobuf/test/custom.Uint128", (gogoproto.nullable) = false]; } message CustomDash { optional bytes Value = 1 [(gogoproto.customtype) = "github.com/gogo/protobuf/test/custom-dash-type.Bytes"]; } message NinOptCustom { optional bytes Id = 1 [(gogoproto.customtype) = "Uuid"]; optional bytes Value = 2 [(gogoproto.customtype) = "github.com/gogo/protobuf/test/custom.Uint128"]; } message NidRepCustom { repeated bytes Id = 1 [(gogoproto.customtype) = "Uuid", (gogoproto.nullable) = false]; repeated bytes Value = 2 [(gogoproto.customtype) = "github.com/gogo/protobuf/test/custom.Uint128", (gogoproto.nullable) = false]; } message NinRepCustom { repeated bytes Id = 1 [(gogoproto.customtype) = "Uuid"]; repeated bytes Value = 2 [(gogoproto.customtype) = "github.com/gogo/protobuf/test/custom.Uint128"]; } message NinOptNativeUnion { option (gogoproto.onlyone) = true; optional double Field1 = 1; optional float Field2 = 2; optional int32 Field3 = 3; optional int64 Field4 = 4; optional uint32 Field5 = 5; optional uint64 Field6 = 6; optional bool Field13 = 13; optional string Field14 = 14; optional bytes Field15 = 15; } message NinOptStructUnion { option (gogoproto.onlyone) = true; optional double Field1 = 1; optional float Field2 = 2; optional NidOptNative Field3 = 3; optional NinOptNative Field4 = 4; optional uint64 Field6 = 6; optional sint32 Field7 = 7; optional bool Field13 = 13; optional string Field14 = 14; optional bytes Field15 = 15; } message NinEmbeddedStructUnion { option (gogoproto.onlyone) = true; optional NidOptNative Field1 = 1 [(gogoproto.embed) = true]; optional NinOptNative Field200 = 200; optional bool Field210 = 210; } message NinNestedStructUnion { option (gogoproto.onlyone) = true; optional NinOptNativeUnion Field1 = 1; optional NinOptStructUnion Field2 = 2; optional NinEmbeddedStructUnion Field3 = 3; } message Tree { option (gogoproto.onlyone) = true; optional OrBranch Or = 1; optional AndBranch And = 2; optional Leaf Leaf = 3; } message OrBranch { optional Tree Left = 1 [(gogoproto.nullable) = false]; optional Tree Right = 2 [(gogoproto.nullable) = false]; } message AndBranch { optional Tree Left = 1 [(gogoproto.nullable) = false]; optional Tree Right = 2 [(gogoproto.nullable) = false]; } message Leaf { optional int64 Value = 1 [(gogoproto.nullable) = false]; optional string StrValue = 2 [(gogoproto.nullable) = false]; } message DeepTree { option (gogoproto.onlyone) = true; optional ADeepBranch Down = 1; optional AndDeepBranch And = 2; optional DeepLeaf Leaf = 3; } message ADeepBranch { optional DeepTree Down = 2 [(gogoproto.nullable) = false]; } message AndDeepBranch { optional DeepTree Left = 1 [(gogoproto.nullable) = false]; optional DeepTree Right = 2 [(gogoproto.nullable) = false]; } message DeepLeaf { optional Tree Tree = 1 [(gogoproto.nullable) = false]; } message Nil { } enum TheTestEnum { A = 0; B = 1; C = 2; } enum AnotherTestEnum { option (gogoproto.goproto_enum_prefix) = false; D = 10; E = 11; } // YetAnotherTestEnum is used to test cross-package import of custom name // fields and default resolution. enum YetAnotherTestEnum { option (gogoproto.goproto_enum_prefix) = false; AA = 0; BB = 1 [(gogoproto.enumvalue_customname) = "BetterYetBB"]; } // YetAnotherTestEnum is used to test cross-package import of custom name // fields and default resolution. enum YetYetAnotherTestEnum { option (gogoproto.goproto_enum_prefix) = true; CC = 0; DD = 1 [(gogoproto.enumvalue_customname) = "BetterYetDD"]; } message NidOptEnum { optional TheTestEnum Field1 = 1 [(gogoproto.nullable) = false]; } message NinOptEnum { optional TheTestEnum Field1 = 1; optional YetAnotherTestEnum Field2 = 2; optional YetYetAnotherTestEnum Field3 = 3; } message NidRepEnum { repeated TheTestEnum Field1 = 1 [(gogoproto.nullable) = false]; repeated YetAnotherTestEnum Field2 = 2 [(gogoproto.nullable) = false]; repeated YetYetAnotherTestEnum Field3 = 3 [(gogoproto.nullable) = false]; } message NinRepEnum { repeated TheTestEnum Field1 = 1; repeated YetAnotherTestEnum Field2 = 2; repeated YetYetAnotherTestEnum Field3 = 3; } message NinOptEnumDefault { option (gogoproto.goproto_getters) = true; option (gogoproto.face) = false; optional TheTestEnum Field1 = 1 [default=C]; optional YetAnotherTestEnum Field2 = 2 [default=BB]; optional YetYetAnotherTestEnum Field3 = 3 [default=CC]; } message AnotherNinOptEnum { optional AnotherTestEnum Field1 = 1; optional YetAnotherTestEnum Field2 = 2; optional YetYetAnotherTestEnum Field3 = 3; } message AnotherNinOptEnumDefault { option (gogoproto.goproto_getters) = true; option (gogoproto.face) = false; optional AnotherTestEnum Field1 = 1 [default=E]; optional YetAnotherTestEnum Field2 = 2 [default=BB]; optional YetYetAnotherTestEnum Field3 = 3 [default=CC]; } message Timer { optional sfixed64 Time1 = 1 [(gogoproto.nullable) = false]; optional sfixed64 Time2 = 2 [(gogoproto.nullable) = false]; optional bytes Data = 3 [(gogoproto.nullable) = false]; } message MyExtendable { option (gogoproto.face) = false; optional int64 Field1 = 1; extensions 100 to 199; } extend MyExtendable { optional double FieldA = 100; optional NinOptNative FieldB = 101; optional NinEmbeddedStruct FieldC = 102; repeated int64 FieldD = 104; repeated NinOptNative FieldE = 105; } message OtherExtenable { option (gogoproto.face) = false; optional int64 Field2 = 2; extensions 14 to 16; optional int64 Field13 = 13; extensions 10 to 12; optional MyExtendable M = 1; } message NestedDefinition { optional int64 Field1 = 1; message NestedMessage { optional fixed64 NestedField1 = 1; optional NestedNestedMsg NNM = 2; message NestedNestedMsg { optional string NestedNestedField1 = 10; } } enum NestedEnum { TYPE_NESTED = 1; } optional NestedEnum EnumField = 2; optional NestedMessage.NestedNestedMsg NNM = 3; optional NestedMessage NM = 4; } message NestedScope { optional NestedDefinition.NestedMessage.NestedNestedMsg A = 1; optional NestedDefinition.NestedEnum B = 2; optional NestedDefinition.NestedMessage C = 3; } message NinOptNativeDefault { option (gogoproto.goproto_getters) = true; option (gogoproto.face) = false; optional double Field1 = 1 [default = 1234.1234]; optional float Field2 = 2 [default = 1234.1234]; optional int32 Field3 = 3 [default = 1234]; optional int64 Field4 = 4 [default = 1234]; optional uint32 Field5 = 5 [default = 1234]; optional uint64 Field6 = 6 [default = 1234]; optional sint32 Field7 = 7 [default = 1234]; optional sint64 Field8 = 8 [default = 1234]; optional fixed32 Field9 = 9 [default = 1234]; optional sfixed32 Field10 = 10 [default = 1234]; optional fixed64 Field11 = 11 [default = 1234]; optional sfixed64 Field12 = 12 [default = 1234]; optional bool Field13 = 13 [default = true]; optional string Field14 = 14 [default = "1234"]; optional bytes Field15 = 15; } message CustomContainer { optional NidOptCustom CustomStruct = 1 [(gogoproto.nullable) = false]; } message CustomNameNidOptNative { optional double Field1 = 1 [(gogoproto.nullable) = false, (gogoproto.customname) = "FieldA"]; optional float Field2 = 2 [(gogoproto.nullable) = false, (gogoproto.customname) = "FieldB"]; optional int32 Field3 = 3 [(gogoproto.nullable) = false, (gogoproto.customname) = "FieldC"]; optional int64 Field4 = 4 [(gogoproto.nullable) = false, (gogoproto.customname) = "FieldD"]; optional uint32 Field5 = 5 [(gogoproto.nullable) = false, (gogoproto.customname) = "FieldE"]; optional uint64 Field6 = 6 [(gogoproto.nullable) = false, (gogoproto.customname) = "FieldF"]; optional sint32 Field7 = 7 [(gogoproto.nullable) = false, (gogoproto.customname) = "FieldG"]; optional sint64 Field8 = 8 [(gogoproto.nullable) = false, (gogoproto.customname) = "FieldH"]; optional fixed32 Field9 = 9 [(gogoproto.nullable) = false, (gogoproto.customname) = "FieldI"]; optional sfixed32 Field10 = 10 [(gogoproto.nullable) = false, (gogoproto.customname) = "FieldJ"]; optional fixed64 Field11 = 11 [(gogoproto.nullable) = false, (gogoproto.customname) = "FieldK"]; optional sfixed64 Field12 = 12 [(gogoproto.nullable) = false, (gogoproto.customname) = "FieldL"]; optional bool Field13 = 13 [(gogoproto.nullable) = false, (gogoproto.customname) = "FieldM"]; optional string Field14 = 14 [(gogoproto.nullable) = false, (gogoproto.customname) = "FieldN"]; optional bytes Field15 = 15 [(gogoproto.nullable) = false, (gogoproto.customname) = "FieldO"]; } message CustomNameNinOptNative { optional double Field1 = 1 [(gogoproto.customname) = "FieldA"]; optional float Field2 = 2 [(gogoproto.customname) = "FieldB"]; optional int32 Field3 = 3 [(gogoproto.customname) = "FieldC"]; optional int64 Field4 = 4 [(gogoproto.customname) = "FieldD"]; optional uint32 Field5 = 5 [(gogoproto.customname) = "FieldE"]; optional uint64 Field6 = 6 [(gogoproto.customname) = "FieldF"]; optional sint32 Field7 = 7 [(gogoproto.customname) = "FieldG"]; optional sint64 Field8 = 8 [(gogoproto.customname) = "FieldH"]; optional fixed32 Field9 = 9 [(gogoproto.customname) = "FieldI"]; optional sfixed32 Field10 = 10 [(gogoproto.customname) = "FieldJ"]; optional fixed64 Field11 = 11 [(gogoproto.customname) = "FieldK"]; optional sfixed64 Field12 = 12 [(gogoproto.customname) = "FielL"]; optional bool Field13 = 13 [(gogoproto.customname) = "FieldM"]; optional string Field14 = 14 [(gogoproto.customname) = "FieldN"]; optional bytes Field15 = 15 [(gogoproto.customname) = "FieldO"]; } message CustomNameNinRepNative { repeated double Field1 = 1 [(gogoproto.customname) = "FieldA"]; repeated float Field2 = 2 [(gogoproto.customname) = "FieldB"]; repeated int32 Field3 = 3 [(gogoproto.customname) = "FieldC"]; repeated int64 Field4 = 4 [(gogoproto.customname) = "FieldD"]; repeated uint32 Field5 = 5 [(gogoproto.customname) = "FieldE"]; repeated uint64 Field6 = 6 [(gogoproto.customname) = "FieldF"]; repeated sint32 Field7 = 7 [(gogoproto.customname) = "FieldG"]; repeated sint64 Field8 = 8 [(gogoproto.customname) = "FieldH"]; repeated fixed32 Field9 = 9 [(gogoproto.customname) = "FieldI"]; repeated sfixed32 Field10 = 10 [(gogoproto.customname) = "FieldJ"]; repeated fixed64 Field11 = 11 [(gogoproto.customname) = "FieldK"]; repeated sfixed64 Field12 = 12 [(gogoproto.customname) = "FieldL"]; repeated bool Field13 = 13 [(gogoproto.customname) = "FieldM"]; repeated string Field14 = 14 [(gogoproto.customname) = "FieldN"]; repeated bytes Field15 = 15 [(gogoproto.customname) = "FieldO"]; } message CustomNameNinStruct { optional double Field1 = 1 [(gogoproto.customname) = "FieldA"]; optional float Field2 = 2 [(gogoproto.customname) = "FieldB"]; optional NidOptNative Field3 = 3 [(gogoproto.customname) = "FieldC"]; repeated NinOptNative Field4 = 4 [(gogoproto.customname) = "FieldD"]; optional uint64 Field6 = 6 [(gogoproto.customname) = "FieldE"]; optional sint32 Field7 = 7 [(gogoproto.customname) = "FieldF"]; optional NidOptNative Field8 = 8 [(gogoproto.customname) = "FieldG"]; optional bool Field13 = 13 [(gogoproto.customname) = "FieldH"]; optional string Field14 = 14 [(gogoproto.customname) = "FieldI"]; optional bytes Field15 = 15 [(gogoproto.customname) = "FieldJ"]; } message CustomNameCustomType { optional bytes Id = 1 [(gogoproto.customname) = "FieldA", (gogoproto.customtype) = "Uuid"]; optional bytes Value = 2 [(gogoproto.customname) = "FieldB", (gogoproto.customtype) = "github.com/gogo/protobuf/test/custom.Uint128"]; repeated bytes Ids = 3 [(gogoproto.customname) = "FieldC", (gogoproto.customtype) = "Uuid"]; repeated bytes Values = 4 [(gogoproto.customname) = "FieldD", (gogoproto.customtype) = "github.com/gogo/protobuf/test/custom.Uint128"]; } message CustomNameNinEmbeddedStructUnion { option (gogoproto.onlyone) = true; optional NidOptNative Field1 = 1 [(gogoproto.embed) = true]; optional NinOptNative Field200 = 200 [(gogoproto.customname) = "FieldA"]; optional bool Field210 = 210 [(gogoproto.customname) = "FieldB"]; } message CustomNameEnum { optional TheTestEnum Field1 = 1 [(gogoproto.customname) = "FieldA"]; repeated TheTestEnum Field2 = 2 [(gogoproto.customname) = "FieldB"]; } message NoExtensionsMap { option (gogoproto.face) = false; option (gogoproto.goproto_extensions_map) = false; optional int64 Field1 = 1; extensions 100 to 199; } extend NoExtensionsMap { optional double FieldA1 = 100; optional NinOptNative FieldB1 = 101; optional NinEmbeddedStruct FieldC1 = 102; } message Unrecognized { option (gogoproto.goproto_unrecognized) = false; optional string Field1 = 1; } message UnrecognizedWithInner { message Inner { option (gogoproto.goproto_unrecognized) = false; optional uint32 Field1 = 1; } repeated Inner embedded = 1; optional string Field2 = 2; } message UnrecognizedWithEmbed { message Embedded { option (gogoproto.goproto_unrecognized) = false; optional uint32 Field1 = 1; } optional Embedded embedded = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; optional string Field2 = 2; } message Node { optional string Label = 1; repeated Node Children = 2; } message NonByteCustomType { optional ProtoType Field1 = 1 [(gogoproto.customtype) = "T"]; } message NidOptNonByteCustomType { optional ProtoType Field1 = 1 [(gogoproto.customtype) = "T", (gogoproto.nullable) = false]; } message NinOptNonByteCustomType { optional ProtoType Field1 = 1 [(gogoproto.customtype) = "T"]; } message NidRepNonByteCustomType { repeated ProtoType Field1 = 1 [(gogoproto.customtype) = "T", (gogoproto.nullable) = false]; } message NinRepNonByteCustomType { repeated ProtoType Field1 = 1 [(gogoproto.customtype) = "T"]; } message ProtoType { optional string Field2 = 1; }
{ "pile_set_name": "Github" }
--- id: bad87fee1248bd9aedf08824 title: Add Different Margins to Each Side of an Element challengeType: 0 videoUrl: '' localeTitle: Añadir diferentes márgenes a cada lado de un elemento --- ## Descripción <section id="description"> A veces querrá personalizar un elemento para que tenga un <code>margin</code> diferente en cada uno de sus lados. CSS le permite controlar el <code>margin</code> de los cuatro lados individuales de un elemento con las propiedades <code>margin-top</code> , <code>margin-right</code> , <code>margin-bottom</code> y <code>margin-left</code> . </section> ## Instrucciones <section id="instructions"> Dé a la caja azul un <code>margin</code> de <code>40px</code> en su lado superior e izquierdo, pero solo <code>20px</code> en su lado inferior y derecho. </section> ## Pruebas <section id='tests'> ```yml tests: - text: Su clase de <code>blue-box</code> debe dar a la parte superior de los elementos <code>40px</code> de <code>margin</code> . testString: 'assert($(".blue-box").css("margin-top") === "40px", "Your <code>blue-box</code> class should give the top of elements <code>40px</code> of <code>margin</code>.");' - text: Su clase de <code>blue-box</code> debe otorgar el derecho de los elementos 20 <code>20px</code> de <code>margin</code> . testString: 'assert($(".blue-box").css("margin-right") === "20px", "Your <code>blue-box</code> class should give the right of elements <code>20px</code> of <code>margin</code>.");' - text: Su clase de <code>blue-box</code> debe dar a la parte inferior de los elementos 20 <code>20px</code> de <code>margin</code> . testString: 'assert($(".blue-box").css("margin-bottom") === "20px", "Your <code>blue-box</code> class should give the bottom of elements <code>20px</code> of <code>margin</code>.");' - text: Su clase de <code>blue-box</code> debe dar a la izquierda de los elementos <code>40px</code> de <code>margin</code> . testString: 'assert($(".blue-box").css("margin-left") === "40px", "Your <code>blue-box</code> class should give the left of elements <code>40px</code> of <code>margin</code>.");' ``` </section> ## Challenge Seed <section id='challengeSeed'> <div id='html-seed'> ```html <style> .injected-text { margin-bottom: -25px; text-align: center; } .box { border-style: solid; border-color: black; border-width: 5px; text-align: center; } .yellow-box { background-color: yellow; padding: 10px; } .red-box { background-color: crimson; color: #fff; margin-top: 40px; margin-right: 20px; margin-bottom: 20px; margin-left: 40px; } .blue-box { background-color: blue; color: #fff; } </style> <h5 class="injected-text">margin</h5> <div class="box yellow-box"> <h5 class="box red-box">padding</h5> <h5 class="box blue-box">padding</h5> </div> ``` </div> </section> ## Solución <section id='solution'> ```js // solution required ``` </section>
{ "pile_set_name": "Github" }
-- -- Regression Test for DDL of Object Permission Checks -- -- clean-up in case a prior regression run failed SET client_min_messages TO 'warning'; DROP DATABASE IF EXISTS sepgsql_test_regression; DROP USER IF EXISTS regress_sepgsql_test_user; RESET client_min_messages; -- confirm required permissions using audit messages SELECT sepgsql_getcon(); -- confirm client privilege sepgsql_getcon ---------------------------------------------------------- unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 (1 row) SET sepgsql.debug_audit = true; SET client_min_messages = LOG; -- -- CREATE Permission checks -- CREATE DATABASE sepgsql_test_regression; LOG: SELinux: allowed { getattr } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=system_u:object_r:sepgsql_db_t:s0 tclass=db_database name="template1" LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_db_t:s0 tclass=db_database name="sepgsql_test_regression" CREATE USER regress_sepgsql_test_user; CREATE SCHEMA regtest_schema; LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" LOG: SELinux: allowed { search } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=system_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="public" GRANT ALL ON SCHEMA regtest_schema TO regress_sepgsql_test_user; SET search_path = regtest_schema, public; CREATE TABLE regtest_table (x serial primary key, y text); LOG: SELinux: allowed { search } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" LINE 1: CREATE TABLE regtest_table (x serial primary key, y text); ^ LOG: SELinux: allowed { search } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=system_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="public" LINE 1: CREATE TABLE regtest_table (x serial primary key, y text); ^ LOG: SELinux: allowed { add_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_seq_t:s0 tclass=db_sequence name="regtest_schema.regtest_table_x_seq" LOG: SELinux: allowed { add_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="regtest_schema.regtest_table" LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_table.tableoid" LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_table.cmax" LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_table.xmax" LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_table.cmin" LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_table.xmin" LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_table.ctid" LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_table.x" LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_table.y" LOG: SELinux: allowed { search } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=system_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="pg_catalog" LOG: SELinux: allowed { search } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" LOG: SELinux: allowed { search } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=system_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="pg_catalog" LOG: SELinux: allowed { search } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" LOG: SELinux: allowed { add_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" LOG: SELinux: allowed { setattr } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="regtest_schema.regtest_table" LOG: SELinux: allowed { search } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" LOG: SELinux: allowed { search } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" LOG: SELinux: allowed { setattr } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_seq_t:s0 tclass=db_sequence name="regtest_schema.regtest_table_x_seq" ALTER TABLE regtest_table ADD COLUMN z int; LOG: SELinux: allowed { search } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=system_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="pg_catalog" LINE 1: ALTER TABLE regtest_table ADD COLUMN z int; ^ LOG: SELinux: allowed { search } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=system_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="pg_catalog" LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_table.z" CREATE TABLE regtest_table_2 (a int) WITH OIDS; LOG: SELinux: allowed { search } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=system_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="pg_catalog" LINE 1: CREATE TABLE regtest_table_2 (a int) WITH OIDS; ^ LOG: SELinux: allowed { search } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=system_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="pg_catalog" LOG: SELinux: allowed { add_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="regtest_schema.regtest_table_2" LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_table_2.tableoid" LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_table_2.cmax" LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_table_2.xmax" LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_table_2.cmin" LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_table_2.xmin" LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_table_2.oid" LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_table_2.ctid" LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_table_2.a" CREATE TABLE regtest_ptable (a int) PARTITION BY RANGE (a); LOG: SELinux: allowed { search } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=system_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="pg_catalog" LINE 1: CREATE TABLE regtest_ptable (a int) PARTITION BY RANGE (a); ^ LOG: SELinux: allowed { search } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=system_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="pg_catalog" LOG: SELinux: allowed { add_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="regtest_schema.regtest_ptable" LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable.tableoid" LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable.cmax" LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable.xmax" LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable.cmin" LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable.xmin" LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable.ctid" LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable.a" CREATE TABLE regtest_ptable_ones PARTITION OF regtest_ptable FOR VALUES FROM ('0') TO ('10'); LOG: SELinux: allowed { add_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="regtest_schema.regtest_ptable_ones" LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_ones.tableoid" LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_ones.cmax" LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_ones.xmax" LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_ones.cmin" LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_ones.xmin" LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_ones.ctid" LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_ones.a" CREATE TABLE regtest_ptable_tens PARTITION OF regtest_ptable FOR VALUES FROM ('10') TO ('100'); LOG: SELinux: allowed { add_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="regtest_schema.regtest_ptable_tens" LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_tens.tableoid" LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_tens.cmax" LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_tens.xmax" LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_tens.cmin" LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_tens.xmin" LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_tens.ctid" LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_tens.a" ALTER TABLE regtest_ptable ADD COLUMN q int; LOG: SELinux: allowed { search } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=system_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="pg_catalog" LINE 1: ALTER TABLE regtest_ptable ADD COLUMN q int; ^ LOG: SELinux: allowed { search } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=system_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="pg_catalog" LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable.q" LOG: SELinux: allowed { search } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=system_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="pg_catalog" LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_ones.q" LOG: SELinux: allowed { search } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=system_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="pg_catalog" LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_tens.q" -- corresponding toast table should not have label and permission checks ALTER TABLE regtest_table_2 ADD COLUMN b text; LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_table_2.b" -- VACUUM FULL internally create a new table and swap them later. VACUUM FULL regtest_table; VACUUM FULL regtest_ptable; CREATE VIEW regtest_view AS SELECT * FROM regtest_table WHERE x < 100; LOG: SELinux: allowed { add_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_view_t:s0 tclass=db_view name="regtest_schema.regtest_view" CREATE VIEW regtest_pview AS SELECT * FROM regtest_ptable WHERE a < 99; LOG: SELinux: allowed { add_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_view_t:s0 tclass=db_view name="regtest_schema.regtest_pview" CREATE SEQUENCE regtest_seq; LOG: SELinux: allowed { add_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_seq_t:s0 tclass=db_sequence name="regtest_schema.regtest_seq" CREATE TYPE regtest_comptype AS (a int, b text); LOG: SELinux: allowed { search } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=system_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="pg_catalog" LOG: SELinux: allowed { add_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" CREATE FUNCTION regtest_func(text,int[]) RETURNS bool LANGUAGE plpgsql AS 'BEGIN RAISE NOTICE ''regtest_func => %'', $1; RETURN true; END'; LOG: SELinux: allowed { search } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=system_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="pg_catalog" LOG: SELinux: allowed { add_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_proc_exec_t:s0 tclass=db_procedure name="regtest_schema.regtest_func(pg_catalog.text,integer[])" CREATE AGGREGATE regtest_agg ( sfunc1 = int4pl, basetype = int4, stype1 = int4, initcond1 = '0' ); LOG: SELinux: allowed { add_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_proc_exec_t:s0 tclass=db_procedure name="regtest_schema.regtest_agg(integer)" -- CREATE objects owned by others SET SESSION AUTHORIZATION regress_sepgsql_test_user; SET search_path = regtest_schema, public; CREATE TABLE regtest_table_3 (x int, y serial); LOG: SELinux: allowed { search } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" LINE 1: CREATE TABLE regtest_table_3 (x int, y serial); ^ LOG: SELinux: allowed { search } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=system_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="public" LINE 1: CREATE TABLE regtest_table_3 (x int, y serial); ^ LOG: SELinux: allowed { search } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=system_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="pg_catalog" LINE 1: CREATE TABLE regtest_table_3 (x int, y serial); ^ LOG: SELinux: allowed { add_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_seq_t:s0 tclass=db_sequence name="regtest_schema.regtest_table_3_y_seq" LOG: SELinux: allowed { search } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=system_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="pg_catalog" LOG: SELinux: allowed { add_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="regtest_schema.regtest_table_3" LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_table_3.tableoid" LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_table_3.cmax" LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_table_3.xmax" LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_table_3.cmin" LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_table_3.xmin" LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_table_3.ctid" LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_table_3.x" LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_table_3.y" LOG: SELinux: allowed { search } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=system_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="pg_catalog" LOG: SELinux: allowed { search } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" LOG: SELinux: allowed { search } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=system_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="pg_catalog" LOG: SELinux: allowed { search } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" LOG: SELinux: allowed { search } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" LOG: SELinux: allowed { setattr } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_seq_t:s0 tclass=db_sequence name="regtest_schema.regtest_table_3_y_seq" CREATE TABLE regtest_ptable_3 (o int, p serial) PARTITION BY RANGE (o); LOG: SELinux: allowed { search } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=system_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="pg_catalog" LINE 1: CREATE TABLE regtest_ptable_3 (o int, p serial) PARTITION BY... ^ LOG: SELinux: allowed { add_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_seq_t:s0 tclass=db_sequence name="regtest_schema.regtest_ptable_3_p_seq" LOG: SELinux: allowed { search } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=system_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="pg_catalog" LOG: SELinux: allowed { add_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="regtest_schema.regtest_ptable_3" LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_3.tableoid" LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_3.cmax" LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_3.xmax" LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_3.cmin" LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_3.xmin" LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_3.ctid" LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_3.o" LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_3.p" LOG: SELinux: allowed { search } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=system_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="pg_catalog" LOG: SELinux: allowed { search } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" LOG: SELinux: allowed { search } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=system_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="pg_catalog" LOG: SELinux: allowed { search } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" LOG: SELinux: allowed { search } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" LOG: SELinux: allowed { setattr } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_seq_t:s0 tclass=db_sequence name="regtest_schema.regtest_ptable_3_p_seq" CREATE TABLE regtest_ptable_3_ones PARTITION OF regtest_ptable_3 FOR VALUES FROM ('0') to ('10'); LOG: SELinux: allowed { add_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="regtest_schema.regtest_ptable_3_ones" LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_3_ones.tableoid" LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_3_ones.cmax" LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_3_ones.xmax" LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_3_ones.cmin" LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_3_ones.xmin" LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_3_ones.ctid" LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_3_ones.o" LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_3_ones.p" CREATE TABLE regtest_ptable_3_tens PARTITION OF regtest_ptable_3 FOR VALUES FROM ('10') to ('100'); LOG: SELinux: allowed { add_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="regtest_schema.regtest_ptable_3_tens" LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_3_tens.tableoid" LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_3_tens.cmax" LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_3_tens.xmax" LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_3_tens.cmin" LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_3_tens.xmin" LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_3_tens.ctid" LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_3_tens.o" LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_3_tens.p" CREATE VIEW regtest_view_2 AS SELECT * FROM regtest_table_3 WHERE x < y; LOG: SELinux: allowed { add_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_view_t:s0 tclass=db_view name="regtest_schema.regtest_view_2" CREATE VIEW regtest_pview_2 AS SELECT * FROM regtest_ptable_3 WHERE o < p; LOG: SELinux: allowed { add_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_view_t:s0 tclass=db_view name="regtest_schema.regtest_pview_2" CREATE FUNCTION regtest_func_2(int) RETURNS bool LANGUAGE plpgsql AS 'BEGIN RETURN $1 * $1 < 100; END'; LOG: SELinux: allowed { search } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=system_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="pg_catalog" LOG: SELinux: allowed { add_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_proc_exec_t:s0 tclass=db_procedure name="regtest_schema.regtest_func_2(integer)" RESET SESSION AUTHORIZATION; -- -- ALTER and CREATE/DROP extra attribute permissions -- CREATE TABLE regtest_table_4 (x int primary key, y int, z int); LOG: SELinux: allowed { search } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" LINE 1: CREATE TABLE regtest_table_4 (x int primary key, y int, z in... ^ LOG: SELinux: allowed { search } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=system_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="public" LINE 1: CREATE TABLE regtest_table_4 (x int primary key, y int, z in... ^ LOG: SELinux: allowed { search } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=system_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="pg_catalog" LINE 1: CREATE TABLE regtest_table_4 (x int primary key, y int, z in... ^ LOG: SELinux: allowed { search } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=system_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="pg_catalog" LINE 1: ...REATE TABLE regtest_table_4 (x int primary key, y int, z int... ^ LOG: SELinux: allowed { search } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=system_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="pg_catalog" LINE 1: ...ATE TABLE regtest_table_4 (x int primary key, y int, z int); ^ LOG: SELinux: allowed { search } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=system_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="pg_catalog" LOG: SELinux: allowed { search } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=system_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="pg_catalog" LOG: SELinux: allowed { search } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=system_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="pg_catalog" LOG: SELinux: allowed { add_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="regtest_schema.regtest_table_4" LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_table_4.tableoid" LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_table_4.cmax" LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_table_4.xmax" LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_table_4.cmin" LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_table_4.xmin" LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_table_4.ctid" LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_table_4.x" LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_table_4.y" LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_table_4.z" LOG: SELinux: allowed { search } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" LOG: SELinux: allowed { add_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" LOG: SELinux: allowed { setattr } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="regtest_schema.regtest_table_4" CREATE INDEX regtest_index_tbl4_y ON regtest_table_4(y); LOG: SELinux: allowed { add_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" LOG: SELinux: allowed { setattr } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="regtest_schema.regtest_table_4" CREATE INDEX regtest_index_tbl4_z ON regtest_table_4(z); LOG: SELinux: allowed { add_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" LOG: SELinux: allowed { setattr } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="regtest_schema.regtest_table_4" ALTER TABLE regtest_table_4 ALTER COLUMN y TYPE float; LOG: SELinux: allowed { search } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=system_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="pg_catalog" LOG: SELinux: allowed { search } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=system_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="pg_catalog" LOG: SELinux: allowed { setattr } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_table_4.y" LOG: SELinux: allowed { execute } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=system_u:object_r:sepgsql_proc_exec_t:s0 tclass=db_procedure name="pg_catalog.float8(integer)" DROP INDEX regtest_index_tbl4_y; LOG: SELinux: allowed { remove_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" LOG: SELinux: allowed { setattr } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="regtest_schema.regtest_table_4" ALTER TABLE regtest_table_4 ADD CONSTRAINT regtest_tbl4_con EXCLUDE USING btree (z WITH =); LOG: SELinux: allowed { add_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" LOG: SELinux: allowed { setattr } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="regtest_schema.regtest_table_4" DROP TABLE regtest_table_4 CASCADE; LOG: SELinux: allowed { remove_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" LOG: SELinux: allowed { setattr } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="regtest_schema.regtest_table_4" LOG: SELinux: allowed { remove_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" LOG: SELinux: allowed { setattr } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="regtest_schema.regtest_table_4" LOG: SELinux: allowed { remove_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" LOG: SELinux: allowed { setattr } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="regtest_schema.regtest_table_4" LOG: SELinux: allowed { remove_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="regtest_schema.regtest_table_4" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_table_4.tableoid" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_table_4.cmax" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_table_4.xmax" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_table_4.cmin" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_table_4.xmin" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_table_4.ctid" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_table_4.x" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_table_4.y" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_table_4.z" -- For partitioned tables CREATE TABLE regtest_ptable_4 (x int, y int, z int) PARTITION BY RANGE (x); LOG: SELinux: allowed { search } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=system_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="pg_catalog" LINE 1: CREATE TABLE regtest_ptable_4 (x int, y int, z int) PARTITIO... ^ LOG: SELinux: allowed { search } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=system_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="pg_catalog" LINE 1: CREATE TABLE regtest_ptable_4 (x int, y int, z int) PARTITIO... ^ LOG: SELinux: allowed { search } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=system_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="pg_catalog" LINE 1: CREATE TABLE regtest_ptable_4 (x int, y int, z int) PARTITIO... ^ LOG: SELinux: allowed { search } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=system_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="pg_catalog" LOG: SELinux: allowed { search } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=system_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="pg_catalog" LOG: SELinux: allowed { search } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=system_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="pg_catalog" LOG: SELinux: allowed { add_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="regtest_schema.regtest_ptable_4" LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_4.tableoid" LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_4.cmax" LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_4.xmax" LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_4.cmin" LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_4.xmin" LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_4.ctid" LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_4.x" LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_4.y" LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_4.z" CREATE TABLE regtest_ptable_4_ones PARTITION OF regtest_ptable_4 FOR VALUES FROM ('0') TO ('10'); LOG: SELinux: allowed { add_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="regtest_schema.regtest_ptable_4_ones" LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_4_ones.tableoid" LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_4_ones.cmax" LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_4_ones.xmax" LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_4_ones.cmin" LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_4_ones.xmin" LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_4_ones.ctid" LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_4_ones.x" LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_4_ones.y" LOG: SELinux: allowed { create } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_4_ones.z" CREATE INDEX regtest_pindex_tbl4_y ON regtest_ptable_4_ones(y); LOG: SELinux: allowed { add_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" LOG: SELinux: allowed { setattr } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="regtest_schema.regtest_ptable_4_ones" CREATE INDEX regtest_pindex_tbl4_z ON regtest_ptable_4_ones(z); LOG: SELinux: allowed { add_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" LOG: SELinux: allowed { setattr } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="regtest_schema.regtest_ptable_4_ones" ALTER TABLE regtest_ptable_4 ALTER COLUMN y TYPE float; LOG: SELinux: allowed { search } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=system_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="pg_catalog" LOG: SELinux: allowed { search } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=system_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="pg_catalog" LOG: SELinux: allowed { search } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=system_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="pg_catalog" LOG: SELinux: allowed { setattr } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_4.y" LOG: SELinux: allowed { search } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=system_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="pg_catalog" LOG: SELinux: allowed { setattr } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_4_ones.y" LOG: SELinux: allowed { execute } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=system_u:object_r:sepgsql_proc_exec_t:s0 tclass=db_procedure name="pg_catalog.float8(integer)" DROP INDEX regtest_pindex_tbl4_y; LOG: SELinux: allowed { remove_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" LOG: SELinux: allowed { setattr } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="regtest_schema.regtest_ptable_4_ones" ALTER TABLE regtest_ptable_4_ones ADD CONSTRAINT regtest_ptbl4_con EXCLUDE USING btree (z WITH =); LOG: SELinux: allowed { add_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" LOG: SELinux: allowed { setattr } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="regtest_schema.regtest_ptable_4_ones" DROP TABLE regtest_ptable_4 CASCADE; LOG: SELinux: allowed { remove_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" LOG: SELinux: allowed { setattr } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="regtest_schema.regtest_ptable_4_ones" LOG: SELinux: allowed { remove_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" LOG: SELinux: allowed { setattr } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="regtest_schema.regtest_ptable_4_ones" LOG: SELinux: allowed { remove_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="regtest_schema.regtest_ptable_4_ones" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_4_ones.tableoid" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_4_ones.cmax" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_4_ones.xmax" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_4_ones.cmin" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_4_ones.xmin" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_4_ones.ctid" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_4_ones.x" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_4_ones.y" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_4_ones.z" LOG: SELinux: allowed { remove_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="regtest_schema.regtest_ptable_4" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_4.tableoid" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_4.cmax" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_4.xmax" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_4.cmin" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_4.xmin" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_4.ctid" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_4.x" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_4.y" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_4.z" -- -- DROP Permission checks (with clean-up) -- DROP FUNCTION regtest_func(text,int[]); LOG: SELinux: allowed { search } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=system_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="pg_catalog" LOG: SELinux: allowed { remove_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_proc_exec_t:s0 tclass=db_procedure name="regtest_schema.regtest_func(pg_catalog.text,integer[])" DROP AGGREGATE regtest_agg(int); LOG: SELinux: allowed { search } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=system_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="pg_catalog" LOG: SELinux: allowed { remove_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_proc_exec_t:s0 tclass=db_procedure name="regtest_schema.regtest_agg(integer)" DROP SEQUENCE regtest_seq; LOG: SELinux: allowed { remove_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_seq_t:s0 tclass=db_sequence name="regtest_schema.regtest_seq" DROP VIEW regtest_view; LOG: SELinux: allowed { remove_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_view_t:s0 tclass=db_view name="regtest_schema.regtest_view" ALTER TABLE regtest_table DROP COLUMN y; LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_table.y" ALTER TABLE regtest_table_2 SET WITHOUT OIDS; LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_table_2.oid" ALTER TABLE regtest_ptable DROP COLUMN q CASCADE; LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_ones.q" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_tens.q" NOTICE: drop cascades to view regtest_pview LOG: SELinux: allowed { remove_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_view_t:s0 tclass=db_view name="regtest_schema.regtest_pview" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable.q" DROP TABLE regtest_table; LOG: SELinux: allowed { remove_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_seq_t:s0 tclass=db_sequence name="regtest_schema.regtest_table_x_seq" LOG: SELinux: allowed { remove_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" LOG: SELinux: allowed { setattr } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="regtest_schema.regtest_table" LOG: SELinux: allowed { remove_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="regtest_schema.regtest_table" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_table.tableoid" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_table.cmax" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_table.xmax" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_table.cmin" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_table.xmin" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_table.ctid" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_table.x" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_table.z" DROP TABLE regtest_ptable CASCADE; LOG: SELinux: allowed { remove_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="regtest_schema.regtest_ptable_tens" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_tens.tableoid" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_tens.cmax" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_tens.xmax" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_tens.cmin" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_tens.xmin" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_tens.ctid" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_tens.a" LOG: SELinux: allowed { remove_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="regtest_schema.regtest_ptable_ones" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_ones.tableoid" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_ones.cmax" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_ones.xmax" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_ones.cmin" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_ones.xmin" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_ones.ctid" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_ones.a" LOG: SELinux: allowed { remove_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="regtest_schema.regtest_ptable" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable.tableoid" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable.cmax" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable.xmax" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable.cmin" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable.xmin" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable.ctid" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable.a" DROP OWNED BY regress_sepgsql_test_user; LOG: SELinux: allowed { search } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" LOG: SELinux: allowed { search } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=system_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="public" LOG: SELinux: allowed { remove_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_proc_exec_t:s0 tclass=db_procedure name="regtest_schema.regtest_func_2(integer)" LOG: SELinux: allowed { remove_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_view_t:s0 tclass=db_view name="regtest_schema.regtest_pview_2" LOG: SELinux: allowed { remove_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_view_t:s0 tclass=db_view name="regtest_schema.regtest_view_2" LOG: SELinux: allowed { remove_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="regtest_schema.regtest_ptable_3_tens" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_3_tens.tableoid" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_3_tens.cmax" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_3_tens.xmax" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_3_tens.cmin" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_3_tens.xmin" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_3_tens.ctid" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_3_tens.o" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_3_tens.p" LOG: SELinux: allowed { remove_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="regtest_schema.regtest_ptable_3_ones" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_3_ones.tableoid" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_3_ones.cmax" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_3_ones.xmax" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_3_ones.cmin" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_3_ones.xmin" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_3_ones.ctid" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_3_ones.o" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_3_ones.p" LOG: SELinux: allowed { remove_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_seq_t:s0 tclass=db_sequence name="regtest_schema.regtest_ptable_3_p_seq" LOG: SELinux: allowed { remove_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="regtest_schema.regtest_ptable_3" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_3.tableoid" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_3.cmax" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_3.xmax" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_3.cmin" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_3.xmin" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_3.ctid" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_3.o" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_ptable_3.p" LOG: SELinux: allowed { remove_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_seq_t:s0 tclass=db_sequence name="regtest_schema.regtest_table_3_y_seq" LOG: SELinux: allowed { remove_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="regtest_schema.regtest_table_3" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_table_3.tableoid" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_table_3.cmax" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_table_3.xmax" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_table_3.cmin" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_table_3.xmin" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_table_3.ctid" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_table_3.x" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_table_3.y" DROP DATABASE sepgsql_test_regression; LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_db_t:s0 tclass=db_database name="sepgsql_test_regression" DROP USER regress_sepgsql_test_user; DROP SCHEMA IF EXISTS regtest_schema CASCADE; LOG: SELinux: allowed { search } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" LOG: SELinux: allowed { search } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=system_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="public" NOTICE: drop cascades to 2 other objects DETAIL: drop cascades to table regtest_table_2 drop cascades to type regtest_comptype LOG: SELinux: allowed { remove_name } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_table name="regtest_schema.regtest_table_2" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_table_2.tableoid" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_table_2.cmax" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_table_2.xmax" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_table_2.cmin" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_table_2.xmin" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_table_2.ctid" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_table_2.a" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_table_t:s0 tclass=db_column name="regtest_schema.regtest_table_2.b" LOG: SELinux: allowed { drop } scontext=unconfined_u:unconfined_r:sepgsql_regtest_superuser_t:s0 tcontext=unconfined_u:object_r:sepgsql_schema_t:s0 tclass=db_schema name="regtest_schema"
{ "pile_set_name": "Github" }
/* * Copyright (C) 2005-2013 Team XBMC * http://www.xbmc.org * * This Program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * * This Program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License * along with XBMC; see the file COPYING. If not, see * <http://www.gnu.org/licenses/>. * */ #include "XSLTUtils.h" #include "log.h" #include <libxslt/xslt.h> #include <libxslt/transform.h> #define TMP_BUF_SIZE 512 void err(void *ctx, const char *msg, ...) { char string[TMP_BUF_SIZE]; va_list arg_ptr; va_start(arg_ptr, msg); vsnprintf(string, TMP_BUF_SIZE, msg, arg_ptr); va_end(arg_ptr); CLog::Log(LOGDEBUG, "XSLT: %s", string); return; } XSLTUtils::XSLTUtils() : m_xmlInput(NULL), m_xmlStylesheet(NULL), m_xsltStylesheet(NULL) { // initialize libxslt xmlSubstituteEntitiesDefault(1); xmlLoadExtDtdDefaultValue = 0; xsltSetGenericErrorFunc(NULL, err); } XSLTUtils::~XSLTUtils() { if (m_xmlInput) xmlFreeDoc(m_xmlInput); if (m_xmlOutput) xmlFreeDoc(m_xmlOutput); if (m_xsltStylesheet) xsltFreeStylesheet(m_xsltStylesheet); } bool XSLTUtils::XSLTTransform(std::string& output) { const char *params[16+1]; params[0] = NULL; m_xmlOutput = xsltApplyStylesheet(m_xsltStylesheet, m_xmlInput, params); if (!m_xmlOutput) { CLog::Log(LOGDEBUG, "XSLT: xslt transformation failed"); return false; } xmlChar *xmlResultBuffer = NULL; int xmlResultLength = 0; int res = xsltSaveResultToString(&xmlResultBuffer, &xmlResultLength, m_xmlOutput, m_xsltStylesheet); if (res == -1) { xmlFree(xmlResultBuffer); return false; } output.append((const char *)xmlResultBuffer, xmlResultLength); xmlFree(xmlResultBuffer); return true; } bool XSLTUtils::SetInput(const std::string& input) { m_xmlInput = xmlParseMemory(input.c_str(), input.size()); if (!m_xmlInput) return false; return true; } bool XSLTUtils::SetStylesheet(const std::string& stylesheet) { if (m_xsltStylesheet) { xsltFreeStylesheet(m_xsltStylesheet); m_xsltStylesheet = NULL; } m_xmlStylesheet = xmlParseMemory(stylesheet.c_str(), stylesheet.size()); if (!m_xmlStylesheet) { CLog::Log(LOGDEBUG, "could not xmlParseMemory stylesheetdoc"); return false; } m_xsltStylesheet = xsltParseStylesheetDoc(m_xmlStylesheet); if (!m_xsltStylesheet) { CLog::Log(LOGDEBUG, "could not parse stylesheetdoc"); xmlFree(m_xmlStylesheet); m_xmlStylesheet = NULL; return false; } return true; }
{ "pile_set_name": "Github" }
#ifndef BOOST_MPL_VECTOR_VECTOR50_HPP_INCLUDED #define BOOST_MPL_VECTOR_VECTOR50_HPP_INCLUDED // Copyright Aleksey Gurtovoy 2000-2004 // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // // See http://www.boost.org/libs/mpl for documentation. // $Id: vector50.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ // $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #if !defined(BOOST_MPL_PREPROCESSING_MODE) # include <boost/mpl/vector/vector40.hpp> #endif #include <boost/mpl/aux_/config/use_preprocessed.hpp> #if !defined(BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS) \ && !defined(BOOST_MPL_PREPROCESSING_MODE) # define BOOST_MPL_PREPROCESSED_HEADER vector50.hpp # include <boost/mpl/vector/aux_/include_preprocessed.hpp> #else # include <boost/mpl/aux_/config/typeof.hpp> # include <boost/mpl/aux_/config/ctps.hpp> # include <boost/preprocessor/iterate.hpp> namespace boost { namespace mpl { # define BOOST_PP_ITERATION_PARAMS_1 \ (3,(41, 50, <boost/mpl/vector/aux_/numbered.hpp>)) # include BOOST_PP_ITERATE() }} #endif // BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS #endif // BOOST_MPL_VECTOR_VECTOR50_HPP_INCLUDED
{ "pile_set_name": "Github" }
[general] description = Classical PSHA Risk QA Test Case 1 calculation_mode = classical_risk hazard_curves_csv = hazard_curve-mean.csv structural_vulnerability_file = vulnerability.xml exposure_file = exposure.xml lrem_steps_per_interval = 5 conditional_loss_poes = 0.01 region = -2 2, 2 2, 2 -2, -2 -2
{ "pile_set_name": "Github" }
package com.mashibing.controller.base; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.stereotype.Controller; /** * <p> * 业主服务_办理结果 前端控制器 * </p> * * @author lian * @since 2020-04-18 */ @Controller @RequestMapping("/zhCsHandleResult") public class ZhCsHandleResultController { }
{ "pile_set_name": "Github" }
// g2o - General Graph Optimization // Copyright (C) 2011 R. Kuemmerle, G. Grisetti, W. Burgard // 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. #ifndef G2O_OPTIMIZATION_ALGORITHM_WITH_HESSIAN_H #define G2O_OPTIMIZATION_ALGORITHM_WITH_HESSIAN_H #include "optimization_algorithm.h" namespace g2o { class Solver; /** * \brief Base for solvers operating on the approximated Hessian, e.g., Gauss-Newton, Levenberg */ class OptimizationAlgorithmWithHessian : public OptimizationAlgorithm { public: explicit OptimizationAlgorithmWithHessian(Solver* solver); virtual ~OptimizationAlgorithmWithHessian(); virtual bool init(bool online = false); virtual bool computeMarginals(SparseBlockMatrix<MatrixXd>& spinv, const std::vector<std::pair<int, int> >& blockIndices); virtual bool buildLinearStructure(); virtual void updateLinearSystem(); virtual bool updateStructure(const std::vector<HyperGraph::Vertex*>& vset, const HyperGraph::EdgeSet& edges); //! return the underlying solver used to solve the linear system Solver* solver() { return _solver;} /** * write debug output of the Hessian if system is not positive definite */ virtual void setWriteDebug(bool writeDebug); virtual bool writeDebug() const { return _writeDebug->value();} protected: Solver* _solver; Property<bool>* _writeDebug; }; }// end namespace #endif
{ "pile_set_name": "Github" }
'use strict'; var GetIntrinsic = require('../GetIntrinsic'); var $RangeError = GetIntrinsic('%RangeError%'); var $TypeError = GetIntrinsic('%TypeError%'); var assign = require('object.assign'); var isPropertyDescriptor = require('../helpers/isPropertyDescriptor'); var IsArray = require('./IsArray'); var IsAccessorDescriptor = require('./IsAccessorDescriptor'); var IsDataDescriptor = require('./IsDataDescriptor'); var OrdinaryDefineOwnProperty = require('./OrdinaryDefineOwnProperty'); var OrdinaryGetOwnProperty = require('./OrdinaryGetOwnProperty'); var ToNumber = require('./ToNumber'); var ToString = require('./ToString'); var ToUint32 = require('./ToUint32'); var Type = require('./Type'); // https://www.ecma-international.org/ecma-262/6.0/#sec-arraysetlength // eslint-disable-next-line max-statements, max-lines-per-function module.exports = function ArraySetLength(A, Desc) { if (!IsArray(A)) { throw new $TypeError('Assertion failed: A must be an Array'); } if (!isPropertyDescriptor({ Type: Type, IsDataDescriptor: IsDataDescriptor, IsAccessorDescriptor: IsAccessorDescriptor }, Desc)) { throw new $TypeError('Assertion failed: Desc must be a Property Descriptor'); } if (!('[[Value]]' in Desc)) { return OrdinaryDefineOwnProperty(A, 'length', Desc); } var newLenDesc = assign({}, Desc); var newLen = ToUint32(Desc['[[Value]]']); var numberLen = ToNumber(Desc['[[Value]]']); if (newLen !== numberLen) { throw new $RangeError('Invalid array length'); } newLenDesc['[[Value]]'] = newLen; var oldLenDesc = OrdinaryGetOwnProperty(A, 'length'); if (!IsDataDescriptor(oldLenDesc)) { throw new $TypeError('Assertion failed: an array had a non-data descriptor on `length`'); } var oldLen = oldLenDesc['[[Value]]']; if (newLen >= oldLen) { return OrdinaryDefineOwnProperty(A, 'length', newLenDesc); } if (!oldLenDesc['[[Writable]]']) { return false; } var newWritable; if (!('[[Writable]]' in newLenDesc) || newLenDesc['[[Writable]]']) { newWritable = true; } else { newWritable = false; newLenDesc['[[Writable]]'] = true; } var succeeded = OrdinaryDefineOwnProperty(A, 'length', newLenDesc); if (!succeeded) { return false; } while (newLen < oldLen) { oldLen -= 1; // eslint-disable-next-line no-param-reassign var deleteSucceeded = delete A[ToString(oldLen)]; if (!deleteSucceeded) { newLenDesc['[[Value]]'] = oldLen + 1; if (!newWritable) { newLenDesc['[[Writable]]'] = false; OrdinaryDefineOwnProperty(A, 'length', newLenDesc); return false; } } } if (!newWritable) { return OrdinaryDefineOwnProperty(A, 'length', { '[[Writable]]': false }); } return true; };
{ "pile_set_name": "Github" }
// // NSObject+Observable.swift // SimpleTwoWayBinding // // Created by Manish Katoch on 11/26/17. // import Foundation extension NSObject { public func observe<T>(for observable: Observable<T>, with: @escaping (T) -> ()) { observable.bind { observable, value in DispatchQueue.main.async { with(value) } } } }
{ "pile_set_name": "Github" }
package stroom.config.global.shared; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import stroom.util.shared.PageResponse; import stroom.util.shared.ResultPage; import java.util.List; @JsonInclude(Include.NON_NULL) public class ListConfigResponse extends ResultPage<ConfigProperty> { public ListConfigResponse(@JsonProperty("values") final List<ConfigProperty> values) { super(values); } @JsonCreator public ListConfigResponse(@JsonProperty("values") final List<ConfigProperty> values, @JsonProperty("pageResponse") final PageResponse pageResponse) { super(values, pageResponse); } }
{ "pile_set_name": "Github" }
/** * FastText.js * @author Loreto Parisi (loretoparisi at gmail dot com) * @copyright Copyright (c) 2017-2019 Loreto Parisi */ "use strict"; (function () { var readline = require('readline'); /** * A simple Command Line Interface * using events */ function startCLI() { var rl = readline.createInterface({ input: process.stdin, output: process.stdout }); console.log("Welcome to FastText.js CLI\nType exit or CTRL-Z to exit"); //rl.setPrompt('Say something> '); rl.prompt(); rl.on('line', function (line) { line = line.trim(); switch (line) { case 'exit': ft.unload() .then(done => { console.log("model unloaded."); process.exit(0); }) .catch(error => { console.error("predict error", error); process.exit(0); }); break; default: ft.predict(line) .then(labels => { console.log(labels); }) .catch(error => { console.error("predict error", error); }); break; } rl.prompt(); }).on('close', function () { console.log('model unloaded.'); process.exit(0); }); } var MODELS_ROOT = __dirname + '/models'; var FastText = require('../lib/index'); var ft = new FastText({ loadModel: process.env.MODEL || (MODELS_ROOT + '/sms_model.bin') // must specifiy filename and ext }); console.log("Loading model..."); ft.load() .then(done => { console.log("model loaded."); startCLI(); }) .catch(error => { console.error("predict error", error); }); }).call(this);
{ "pile_set_name": "Github" }
package com.ofsoft.cms.core.config; public final class FrontConst { /** 站点存放到session中 **/ public static final String VERSION= "OFCMS"; public static final String TEMPLATE_PATE= "/"; public static final String SITE_SESSION = "site"; public static final String DIRECTIVE_PREFIX = "of"; /** 错误页面404 */ public static String pageError = "/404.html"; }
{ "pile_set_name": "Github" }
#include "clar_libgit2.h" #include "buffer.h" static git_repository *_repo; void test_repo_hashfile__initialize(void) { _repo = cl_git_sandbox_init("status"); } void test_repo_hashfile__cleanup(void) { cl_git_sandbox_cleanup(); _repo = NULL; } void test_repo_hashfile__simple(void) { git_oid a, b; git_buf full = GIT_BUF_INIT; /* hash with repo relative path */ cl_git_pass(git_odb_hashfile(&a, "status/current_file", GIT_OBJ_BLOB)); cl_git_pass(git_repository_hashfile(&b, _repo, "current_file", GIT_OBJ_BLOB, NULL)); cl_assert(git_oid_equal(&a, &b)); cl_git_pass(git_buf_joinpath(&full, git_repository_workdir(_repo), "current_file")); /* hash with full path */ cl_git_pass(git_odb_hashfile(&a, full.ptr, GIT_OBJ_BLOB)); cl_git_pass(git_repository_hashfile(&b, _repo, full.ptr, GIT_OBJ_BLOB, NULL)); cl_assert(git_oid_equal(&a, &b)); /* hash with invalid type */ cl_git_fail(git_odb_hashfile(&a, full.ptr, GIT_OBJ_ANY)); cl_git_fail(git_repository_hashfile(&b, _repo, full.ptr, GIT_OBJ_OFS_DELTA, NULL)); git_buf_free(&full); } void test_repo_hashfile__filtered(void) { git_oid a, b; cl_repo_set_bool(_repo, "core.autocrlf", true); cl_git_append2file("status/.gitattributes", "*.txt text\n*.bin binary\n\n"); /* create some sample content with CRLF in it */ cl_git_mkfile("status/testfile.txt", "content\r\n"); cl_git_mkfile("status/testfile.bin", "other\r\nstuff\r\n"); /* not equal hashes because of filtering */ cl_git_pass(git_odb_hashfile(&a, "status/testfile.txt", GIT_OBJ_BLOB)); cl_git_pass(git_repository_hashfile(&b, _repo, "testfile.txt", GIT_OBJ_BLOB, NULL)); cl_assert(git_oid_cmp(&a, &b)); /* equal hashes because filter is binary */ cl_git_pass(git_odb_hashfile(&a, "status/testfile.bin", GIT_OBJ_BLOB)); cl_git_pass(git_repository_hashfile(&b, _repo, "testfile.bin", GIT_OBJ_BLOB, NULL)); cl_assert(git_oid_equal(&a, &b)); /* equal hashes when 'as_file' points to binary filtering */ cl_git_pass(git_odb_hashfile(&a, "status/testfile.txt", GIT_OBJ_BLOB)); cl_git_pass(git_repository_hashfile(&b, _repo, "testfile.txt", GIT_OBJ_BLOB, "foo.bin")); cl_assert(git_oid_equal(&a, &b)); /* not equal hashes when 'as_file' points to text filtering */ cl_git_pass(git_odb_hashfile(&a, "status/testfile.bin", GIT_OBJ_BLOB)); cl_git_pass(git_repository_hashfile(&b, _repo, "testfile.bin", GIT_OBJ_BLOB, "foo.txt")); cl_assert(git_oid_cmp(&a, &b)); /* equal hashes when 'as_file' is empty and turns off filtering */ cl_git_pass(git_odb_hashfile(&a, "status/testfile.txt", GIT_OBJ_BLOB)); cl_git_pass(git_repository_hashfile(&b, _repo, "testfile.txt", GIT_OBJ_BLOB, "")); cl_assert(git_oid_equal(&a, &b)); cl_git_pass(git_odb_hashfile(&a, "status/testfile.bin", GIT_OBJ_BLOB)); cl_git_pass(git_repository_hashfile(&b, _repo, "testfile.bin", GIT_OBJ_BLOB, "")); cl_assert(git_oid_equal(&a, &b)); /* some hash type failures */ cl_git_fail(git_odb_hashfile(&a, "status/testfile.txt", 0)); cl_git_fail(git_repository_hashfile(&b, _repo, "testfile.txt", GIT_OBJ_ANY, NULL)); }
{ "pile_set_name": "Github" }
// Protocol Buffers for Go with Gadgets // // Copyright (c) 2013, The GoGo Authors. All rights reserved. // http://github.com/gogo/protobuf // // 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 // 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. package embedconflict import ( "os" "os/exec" "strings" "testing" ) func TestEmbedConflict(t *testing.T) { cmd := exec.Command("protoc", "--gogo_out=.", "-I=../../../../../:../../protobuf/:.", "ec.proto") data, err := cmd.CombinedOutput() if err == nil && !strings.Contains(string(data), "Plugin failed with status code 1") { t.Errorf("Expected error, got: %s", data) if err = os.Remove("ec.pb.go"); err != nil { t.Error(err) } } t.Logf("received expected error = %v and output = %v", err, string(data)) } func TestEmbedMarshaler(t *testing.T) { cmd := exec.Command("protoc", "--gogo_out=.", "-I=../../../../../:../../protobuf/:.", "em.proto") data, err := cmd.CombinedOutput() dataStr := string(data) t.Logf("received error = %v and output = %v", err, dataStr) if !strings.Contains(dataStr, "WARNING: found non-") || !strings.Contains(dataStr, "unsafe_marshaler") { t.Errorf("Expected WARNING: found non-[marshaler unsafe_marshaler] C with embedded marshaler D") } if err = os.Remove("em.pb.go"); err != nil { t.Error(err) } } func TestEmbedExtend(t *testing.T) { cmd := exec.Command("protoc", "--gogo_out=.", "-I=../../../../../:../../protobuf/:.", "ee.proto") data, err := cmd.CombinedOutput() if err == nil && !strings.Contains(string(data), "Plugin failed with status code 1") { t.Errorf("Expected error, got: %s", data) if err = os.Remove("ee.pb.go"); err != nil { t.Error(err) } } t.Logf("received expected error = %v and output = %v", err, string(data)) } func TestCustomName(t *testing.T) { cmd := exec.Command("protoc", "--gogo_out=.", "-I=../../../../../:../../protobuf/:.", "en.proto") data, err := cmd.CombinedOutput() if err == nil && !strings.Contains(string(data), "Plugin failed with status code 1") { t.Errorf("Expected error, got: %s", data) if err = os.Remove("en.pb.go"); err != nil { t.Error(err) } } t.Logf("received expected error = %v and output = %v", err, string(data)) } func TestRepeatedEmbed(t *testing.T) { cmd := exec.Command("protoc", "--gogo_out=.", "-I=../../../../../:../../protobuf/:.", "er.proto") data, err := cmd.CombinedOutput() if err == nil && !strings.Contains(string(data), "Plugin failed with status code 1") { t.Errorf("Expected error, got: %s", data) if err = os.Remove("er.pb.go"); err != nil { t.Error(err) } } dataStr := string(data) t.Logf("received error = %v and output = %v", err, dataStr) warning := "ERROR: found repeated embedded field B in message A" if !strings.Contains(dataStr, warning) { t.Errorf("Expected " + warning) } } func TestTakesTooLongToDebug(t *testing.T) { cmd := exec.Command("protoc", "--gogo_out=.", "-I=../../../../../:../../protobuf/:.", "eb.proto") data, err := cmd.CombinedOutput() if err == nil && !strings.Contains(string(data), "Plugin failed with status code 1") { t.Errorf("Expected error, got: %s", data) if err = os.Remove("eb.pb.go"); err != nil { t.Error(err) } } dataStr := string(data) t.Logf("received error = %v and output = %v", err, dataStr) warning := "ERROR: found embedded bytes field" if !strings.Contains(dataStr, warning) { t.Errorf("Expected " + warning) } }
{ "pile_set_name": "Github" }
'\" '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" .TH Tk_CanvasTextInfo 3 4.0 Tk "Tk Library Procedures" .so man.macros .BS .SH NAME Tk_CanvasTextInfo \- additional information for managing text items in canvases .SH SYNOPSIS .nf \fB#include <tk.h>\fR .sp Tk_CanvasTextInfo * \fBTk_CanvasGetTextInfo\fR(\fIcanvas\fR) .SH ARGUMENTS .AS Tk_Canvas canvas .AP Tk_Canvas canvas in A token that identifies a particular canvas widget. .BE .SH DESCRIPTION .PP Textual canvas items are somewhat more complicated to manage than other items, due to things like the selection and the input focus. \fBTk_CanvasGetTextInfo\fR may be invoked by a type manager to obtain additional information needed for items that display text. The return value from \fBTk_CanvasGetTextInfo\fR is a pointer to a structure that is shared between Tk and all the items that display text. The structure has the following form: .CS typedef struct Tk_CanvasTextInfo { Tk_3DBorder \fIselBorder\fR; int \fIselBorderWidth\fR; XColor *\fIselFgColorPtr\fR; Tk_Item *\fIselItemPtr\fR; int \fIselectFirst\fR; int \fIselectLast\fR; Tk_Item *\fIanchorItemPtr\fR; int \fIselectAnchor\fR; Tk_3DBorder \fIinsertBorder\fR; int \fIinsertWidth\fR; int \fIinsertBorderWidth\fR; Tk_Item *\fIfocusItemPtr\fR; int \fIgotFocus\fR; int \fIcursorOn\fR; } \fBTk_CanvasTextInfo\fR; .CE The \fBselBorder\fR field identifies a Tk_3DBorder that should be used for drawing the background under selected text. \fIselBorderWidth\fR gives the width of the raised border around selected text, in pixels. \fIselFgColorPtr\fR points to an XColor that describes the foreground color to be used when drawing selected text. \fIselItemPtr\fR points to the item that is currently selected, or NULL if there is no item selected or if the canvas does not have the selection. \fIselectFirst\fR and \fIselectLast\fR give the indices of the first and last selected characters in \fIselItemPtr\fR, as returned by the \fIindexProc\fR for that item. \fIanchorItemPtr\fR points to the item that currently has the selection anchor; this is not necessarily the same as \fIselItemPtr\fR. \fIselectAnchor\fR is an index that identifies the anchor position within \fIanchorItemPtr\fR. \fIinsertBorder\fR contains a Tk_3DBorder to use when drawing the insertion cursor; \fIinsertWidth\fR gives the total width of the insertion cursor in pixels, and \fIinsertBorderWidth\fR gives the width of the raised border around the insertion cursor. \fIfocusItemPtr\fR identifies the item that currently has the input focus, or NULL if there is no such item. \fIgotFocus\fR is 1 if the canvas widget has the input focus and 0 otherwise. \fIcursorOn\fR is 1 if the insertion cursor should be drawn in \fIfocusItemPtr\fR and 0 if it should not be drawn; this field is toggled on and off by Tk to make the cursor blink. .PP The structure returned by \fBTk_CanvasGetTextInfo\fR is shared between Tk and the type managers; typically the type manager calls \fBTk_CanvasGetTextInfo\fR once when an item is created and then saves the pointer in the item's record. Tk will update information in the Tk_CanvasTextInfo; for example, a \fBconfigure\fR widget command might change the \fIselBorder\fR field, or a \fBselect\fR widget command might change the \fIselectFirst\fR field, or Tk might change \fIcursorOn\fR in order to make the insertion cursor flash on and off during successive redisplays. .PP Type managers should treat all of the fields of the Tk_CanvasTextInfo structure as read-only, except for \fIselItemPtr\fR, \fIselectFirst\fR, \fIselectLast\fR, and \fIselectAnchor\fR. Type managers may change \fIselectFirst\fR, \fIselectLast\fR, and \fIselectAnchor\fR to adjust for insertions and deletions in the item (but only if the item is the current owner of the selection or anchor, as determined by \fIselItemPtr\fR or \fIanchorItemPtr\fR). If all of the selected text in the item is deleted, the item should set \fIselItemPtr\fR to NULL to indicate that there is no longer a selection. .SH KEYWORDS canvas, focus, insertion cursor, selection, selection anchor, text
{ "pile_set_name": "Github" }
#!/bin/sh cd ${0%/*} || exit 1 # run from this directory # Source tutorial clean functions . $WM_PROJECT_DIR/bin/tools/CleanFunctions cleanCase rm -rf 0/lagrangian 0/dsmcSigmaTcRMax 0/uniform > /dev/null 2>&1 # ----------------------------------------------------------------- end-of-file
{ "pile_set_name": "Github" }
/* Copyright 2006-2009, BeatriX * File coded by BeatriX * * This file is part of BeaEngine. * * BeaEngine 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 3 of the License, or * (at your option) any later version. * * BeaEngine 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 BeaEngine. If not, see <http://www.gnu.org/licenses/>. */ /* ==================================================================== * 0fbah * ==================================================================== */ void __bea_callspec__ G8_EvIb(PDISASM pMyDisasm) { GV.REGOPCODE = ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 3) & 0x7; EvIb(pMyDisasm); if (GV.REGOPCODE == 4) { (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+BIT_UInt8; #ifndef BEA_LIGHT_DISASSEMBLY (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "bt "); #endif (*pMyDisasm).Argument1.AccessMode = READ; FillFlags(pMyDisasm, 11); } else if (GV.REGOPCODE == 5) { if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; } (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+BIT_UInt8; #ifndef BEA_LIGHT_DISASSEMBLY (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "bts "); #endif (*pMyDisasm).Argument1.AccessMode = READ; FillFlags(pMyDisasm, 11); } else if (GV.REGOPCODE == 6) { if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; } (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+BIT_UInt8; #ifndef BEA_LIGHT_DISASSEMBLY (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "btr "); #endif (*pMyDisasm).Argument1.AccessMode = READ; FillFlags(pMyDisasm, 11); } else if (GV.REGOPCODE == 7) { if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) { (*pMyDisasm).Prefix.LockPrefix = InUsePrefix; } (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+BIT_UInt8; #ifndef BEA_LIGHT_DISASSEMBLY (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "btc "); #endif (*pMyDisasm).Argument1.AccessMode = READ; FillFlags(pMyDisasm, 11); } else { FailDecode(pMyDisasm); } }
{ "pile_set_name": "Github" }
#include "cpp-utils/lock/ConditionBarrier.h" // Test the header can be included without needing additional dependencies
{ "pile_set_name": "Github" }
<?xml version="1.0"?> <ModuleDefinition xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <Fields> <FieldDefinition> <FieldName>autoTorque</FieldName> </FieldDefinition> </Fields> <Methods> <MethodDefinition> <MethodName>EvtAutoTorqueToggle</MethodName> </MethodDefinition> </Methods> </ModuleDefinition>
{ "pile_set_name": "Github" }
// (C) Copyright Mateusz Loskot 2008, [email protected] // Distributed under the BSD License // (See accompanying file LICENSE.txt or copy at // http://www.opensource.org/licenses/bsd-license.php) // #include <liblas/bounds.hpp> #include <tut/tut.hpp> #include <string> #include <vector> #include <stdexcept> #include "common.hpp" #include "liblas_test.hpp" namespace tut { struct lastransform_data { std::string gdal_datasource; std::string lidar_data; lastransform_data() : gdal_datasource(g_test_data_path + "//autzen.jpg") , lidar_data(g_test_data_path + "//autzen.las") {} }; typedef test_group<lastransform_data> tg; typedef tg::object to; tg test_group_lastransform("liblas::TransformI"); #ifdef HAVE_GDAL // Test default constructor template<> template<> void to::test<1>() { liblas::Header header; liblas::TransformPtr color_fetch; { std::ifstream ifs; ifs.open(lidar_data.c_str(), std::ios::in | std::ios::binary); liblas::Reader reader(ifs); header = reader.GetHeader(); } { header.SetDataFormatId(liblas::ePointFormat3); header.SetVersionMinor(2); std::vector<boost::uint32_t> bands; bands.resize(3); bands[0] = 1; bands[1] = 2; bands[2] = 3; color_fetch = liblas::TransformPtr(new liblas::ColorFetchingTransform(gdal_datasource, bands, &header)); } std::ifstream ifs; ifs.open(lidar_data.c_str(), std::ios::in | std::ios::binary); liblas::Reader reader(ifs); std::vector<liblas::TransformPtr> transforms; transforms.push_back(color_fetch); reader.SetTransforms(transforms); reader.ReadNextPoint(); liblas::Point const& p = reader.GetPoint(); ensure_equals("Red is incorrect for point", p.GetColor().GetRed(), 210); ensure_equals("Green is incorrect for point", p.GetColor().GetGreen(), 205); ensure_equals("Blue is incorrect for point", p.GetColor().GetBlue(), 185); } #endif }
{ "pile_set_name": "Github" }
/** * Copyright (c) 2015-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * The particular require runtime that we are using looks for a global * `ErrorUtils` object and if it exists, then it requires modules with the * error handler specified via ErrorUtils.setGlobalHandler by calling the * require function with applyWithGuard. Since the require module is loaded * before any of the modules, this ErrorUtils must be defined (and the handler * set) globally before requiring anything. */ /* eslint global-strict:0 */ (function(global) { var ErrorUtils = { _inGuard: 0, _globalHandler: null, setGlobalHandler: function(fun) { ErrorUtils._globalHandler = fun; }, reportError: function(error) { ErrorUtils._globalHandler && ErrorUtils._globalHandler(error); }, reportFatalError: function(error) { ErrorUtils._globalHandler && ErrorUtils._globalHandler(error, true); }, applyWithGuard: function(fun, context, args) { try { ErrorUtils._inGuard++; return fun.apply(context, args); } catch (e) { ErrorUtils.reportError(e); } finally { ErrorUtils._inGuard--; } }, applyWithGuardIfNeeded: function(fun, context, args) { if (ErrorUtils.inGuard()) { return fun.apply(context, args); } else { ErrorUtils.applyWithGuard(fun, context, args); } }, inGuard: function() { return ErrorUtils._inGuard; }, guard: function(fun, name, context) { if (typeof fun !== 'function') { console.warn('A function must be passed to ErrorUtils.guard, got ', fun); return null; } name = name || fun.name || '<generated guard>'; function guarded() { return ( ErrorUtils.applyWithGuard( fun, context || this, arguments, null, name ) ); } return guarded; } }; global.ErrorUtils = ErrorUtils; /** * This is the error handler that is called when we encounter an exception * when loading a module. */ function setupErrorGuard() { var onError = function(e) { global.console.error( 'Error: ' + '\n stack: ' + e.stack + '\n line: ' + e.line + '\n message: ' + e.message, e ); }; global.ErrorUtils.setGlobalHandler(onError); } setupErrorGuard(); })(this);
{ "pile_set_name": "Github" }
--- extends: _layouts.usecase date: 2018-01-02 link: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Logical_Operators reference: Logical operators category: syntax --- ```javascript const isOverage = false; if (!isOverage) { console.log("You are underage"); } ``` <pre class="output">You are underage</pre>
{ "pile_set_name": "Github" }
/**************************************************************************** Copyright (c) 2012 cocos2d-x.org http://www.cocos2d-x.org 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 __CCCONTROL_EXTENSIONS_H__ #define __CCCONTROL_EXTENSIONS_H__ #include "CCScale9Sprite.h" #include "CCControl.h" #include "CCControlButton.h" #include "CCControlColourPicker.h" #include "CCControlPotentiometer.h" #include "CCControlSlider.h" #include "CCControlStepper.h" #include "CCControlSwitch.h" #endif
{ "pile_set_name": "Github" }
// // SCNNode.h // // Copyright (c) 2012-2015 Apple Inc. All rights reserved. // #import <Foundation/Foundation.h> #import <QuartzCore/QuartzCore.h> #import <SceneKit/SCNAnimation.h> #import <SceneKit/SCNBoundingVolume.h> #import <SceneKit/SCNAction.h> NS_ASSUME_NONNULL_BEGIN @class SCNLight; @class SCNCamera; @class SCNGeometry; @class SCNSkinner; @class SCNMorpher; @class SCNConstraint; @class SCNPhysicsBody; @class SCNPhysicsField; @class SCNPhysicsBody; @protocol SCNNodeRendererDelegate; /*! @group Rendering arguments @discussion These keys are used in the 'arguments' dictionary of renderNode:renderer:arguments: and in the 'semantic' argument of -[SCNProgram setSemantic:forSymbol:options:]. Transforms are SCNMatrix4 wrapped in NSValues. */ SCN_EXTERN NSString * const SCNModelTransform; SCN_EXTERN NSString * const SCNViewTransform; SCN_EXTERN NSString * const SCNProjectionTransform; SCN_EXTERN NSString * const SCNNormalTransform; SCN_EXTERN NSString * const SCNModelViewTransform; SCN_EXTERN NSString * const SCNModelViewProjectionTransform; /*! @class SCNNode @abstract SCNNode is the model class for node-tree objects. @discussion It encapsulates the position, rotations, and other transforms of a node, which define a coordinate system. The coordinate systems of all the sub-nodes are relative to the one of their parent node. */ NS_CLASS_AVAILABLE(10_8, 8_0) @interface SCNNode : NSObject <NSCopying, NSSecureCoding, SCNAnimatable, SCNActionable, SCNBoundingVolume> #pragma mark - Creating a Node /*! @method node @abstract Creates and initializes a node instance. */ + (instancetype)node; /*! @method nodeWithGeometry: @abstract Creates and initializes a node instance with the specified geometry attached. @param geometry The geometry to attach. */ + (SCNNode *)nodeWithGeometry:(nullable SCNGeometry *)geometry; #pragma mark - Copying the Node /*! @method clone @abstract Returns a copy of the receiver. The returned instance is autoreleased. @discussion The copy is recursive: every child node will be cloned, too. For a non-recursive copy, use copy instead. The copied nodes will share their attached objects (light, geometry, camera, ...) with the original instances; if you want, for example, to change the materials of the copy independently of the original object, you'll have to copy the geometry of the node separately. */ - (instancetype)clone; /* @method flattenedClone @abstract Returns a clone of the node containing a geometry that concatenates all the geometries contained in the node hierarchy. The returned clone is autoreleased. */ - (instancetype)flattenedClone NS_AVAILABLE(10_9, 8_0); #pragma mark - Managing the Node Attributes /*! @property name @abstract Determines the name of the receiver. */ @property(nonatomic, copy, nullable) NSString *name; /*! @property light @abstract Determines the light attached to the receiver. */ @property(nonatomic, retain, nullable) SCNLight *light; /*! @property camera @abstract Determines the camera attached to the receiver. */ @property(nonatomic, retain, nullable) SCNCamera *camera; /*! @property geometry @abstract Returns the geometry attached to the receiver. */ @property(nonatomic, retain, nullable) SCNGeometry *geometry; /*! @property skinner @abstract Returns the skinner attached to the receiver. */ @property(nonatomic, retain, nullable) SCNSkinner *skinner NS_AVAILABLE(10_9, 8_0); /*! @property morpher @abstract Returns the morpher attached to the receiver. */ @property(nonatomic, retain, nullable) SCNMorpher *morpher NS_AVAILABLE(10_9, 8_0); #pragma mark - Modifying the Node's Transform /*! @property transform @abstract Determines the receiver's transform. Animatable. @discussion The transform is the combination of the position, rotation and scale defined below. So when the transform is set, the receiver's position, rotation and scale are changed to match the new transform. */ @property(nonatomic) SCNMatrix4 transform; /*! @property position @abstract Determines the receiver's position. Animatable. */ @property(nonatomic) SCNVector3 position; /*! @property rotation @abstract Determines the receiver's rotation. Animatable. @discussion The rotation is axis angle rotation. The three first components are the axis, the fourth one is the rotation (in radian). */ @property(nonatomic) SCNVector4 rotation; /*! @property orientation @abstract Determines the receiver's orientation as a unit quaternion. Animatable. */ @property(nonatomic) SCNQuaternion orientation NS_AVAILABLE(10_10, 8_0); /*! @property eulerAngles @abstract Determines the receiver's euler angles. Animatable. @dicussion Specify the intrinsic euler angles (in radians). It represents a sequence of 3 rotations about the x, y, and z axis with the following order: z, y, x (or roll, yaw, pitch). */ @property(nonatomic) SCNVector3 eulerAngles NS_AVAILABLE(10_10, 8_0); /*! @property scale @abstract Determines the receiver's scale. Animatable. */ @property(nonatomic) SCNVector3 scale; /*! @property pivot @abstract Determines the receiver's pivot. Animatable. */ @property(nonatomic) SCNMatrix4 pivot; /*! @property worldTransform @abstract Returns the receiver's world transform. @discussion A world transform is the transform relative to the scene. */ @property(nonatomic, readonly) SCNMatrix4 worldTransform; #pragma mark - Modifying the Node's Visibility /*! @property hidden @abstract Determines whether the receiver is displayed. Defaults to NO. Animatable. */ @property(nonatomic, getter=isHidden) BOOL hidden; /*! @property opacity @abstract Determines the opacity of the receiver. Default is 1. Animatable. */ @property(nonatomic) CGFloat opacity; /*! @property renderingOrder @abstract Determines the rendering order of the receiver. @discussion Nodes with greater rendering orders are rendered last. Defaults to 0. */ @property(nonatomic) NSInteger renderingOrder; /*! @property castsShadow @abstract Determines if the node is rendered in shadow maps. Defaults to YES. */ @property(nonatomic) BOOL castsShadow NS_AVAILABLE(10_10, 8_0); #pragma mark - Managing the Node Hierarchy /*! @property parentNode @abstract Returns the parent node of the receiver. */ @property(nonatomic, readonly, nullable) SCNNode *parentNode; /*! @property childNodes @abstract Returns the child node array of the receiver. */ @property(nonatomic, readonly) NSArray<SCNNode *> *childNodes; /*! @method addChildNode: @abstract Appends the node to the receiver’s childNodes array. @param child The node to be added to the receiver’s childNodes array. */ - (void)addChildNode:(SCNNode *)child; /*! @method insertChildNode:atIndex: @abstract Insert a node in the childNodes array at the specified index. @param child The node to insert. @param index Index in the childNodes array to insert the node. */ - (void)insertChildNode:(SCNNode *)child atIndex:(NSUInteger)index; /*! @method removeFromParentNode @abstract Removes the node from the childNodes array of the receiver’s parentNode. */ - (void)removeFromParentNode; /*! @method replaceChildNode:with: @abstract Remove `child' from the childNode array of the receiver and insert 'child2' if non-nil in its position. @discussion If the parentNode of `child' is not the receiver, the behavior is undefined. @param oldChild The node to replace in the childNodes array. @param newChild The new node that will replace the previous one. */ - (void)replaceChildNode:(SCNNode *)oldChild with:(SCNNode *)newChild; #pragma mark - Searching the Node Hierarchy /*! @method childNodeWithName:recursively: @abstract Returns the first node found in the node tree with the specified name. @discussion The search uses a pre-order tree traversal. @param name The name of the node you are searching for. @param recursively Set to YES if you want the search to look through the sub-nodes recursively. */ - (nullable SCNNode *)childNodeWithName:(NSString *)name recursively:(BOOL)recursively; /*! @method childNodesPassingTest: @abstract Returns the child nodes of the receiver that passes a test in a given Block. @discussion The search is recursive and uses a pre-order tree traversal. @param predicate The block to apply to child nodes of the receiver. The block takes two arguments: "child" is a child node and "stop" is a reference to a Boolean value. The block can set the value to YES to stop further processing of the node hierarchy. The stop argument is an out-only argument. You should only ever set this Boolean to YES within the Block. The Block returns a Boolean value that indicates whether "child" passed the test. */ - (NSArray<SCNNode *> *)childNodesPassingTest:(BOOL (^)(SCNNode *child, BOOL *stop))predicate; /*! @method enumerateChildNodesUsingBlock: @abstract Executes a given block using each child node under the receiver. @discussion The search is recursive and uses a pre-order tree traversal. @param block The block to apply to child nodes of the receiver. The block takes two arguments: "child" is a child node and "stop" is a reference to a Boolean value. The block can set the value to YES to stop further processing of the node hierarchy. The stop argument is an out-only argument. You should only ever set this Boolean to YES within the Block. */ - (void)enumerateChildNodesUsingBlock:(void (^)(SCNNode *child, BOOL *stop))block NS_AVAILABLE(10_10, 8_0); #pragma mark - Converting Between Node Coordinate Systems /*! @method convertPosition:toNode: @abstract Converts a position from the receiver’s coordinate system to that of the specified node. @param position A position specified in the local coordinate system of the receiver. @param node The node into whose coordinate system "position" is to be converted. If "node" is nil, this method instead converts to world coordinates. */ - (SCNVector3)convertPosition:(SCNVector3)position toNode:(nullable SCNNode *)node NS_AVAILABLE(10_9, 8_0); /*! @method convertPosition:fromNode: @abstract Converts a position from the coordinate system of a given node to that of the receiver. @param position A position specified in the local coordinate system of "node". @param node The node from whose coordinate system "position" is to be converted. If "node" is nil, this method instead converts from world coordinates. */ - (SCNVector3)convertPosition:(SCNVector3)position fromNode:(nullable SCNNode *)node NS_AVAILABLE(10_9, 8_0); /*! @method convertTransform:toNode: @abstract Converts a transform from the receiver’s coordinate system to that of the specified node. @param transform A transform specified in the local coordinate system of the receiver. @param node The node into whose coordinate system "transform" is to be converted. If "node" is nil, this method instead converts to world coordinates. */ - (SCNMatrix4)convertTransform:(SCNMatrix4)transform toNode:(nullable SCNNode *)node NS_AVAILABLE(10_9, 8_0); /*! @method convertTransform:fromNode: @abstract Converts a transform from the coordinate system of a given node to that of the receiver. @param transform A transform specified in the local coordinate system of "node". @param node The node from whose coordinate system "transform" is to be converted. If "node" is nil, this method instead converts from world coordinates. */ - (SCNMatrix4)convertTransform:(SCNMatrix4)transform fromNode:(nullable SCNNode *)node NS_AVAILABLE(10_9, 8_0); #pragma mark - Managing the SCNNode's physics body /*! @property physicsBody @abstract The description of the physics body of the receiver. @discussion Default is nil. */ @property(nonatomic, retain, nullable) SCNPhysicsBody *physicsBody NS_AVAILABLE(10_10, 8_0); #pragma mark - Managing the Node's Physics Field /*! @property physicsField @abstract The description of the physics field of the receiver. @discussion Default is nil. */ @property(nonatomic, retain, nullable) SCNPhysicsField *physicsField NS_AVAILABLE(10_10, 8_0); #pragma mark - Managing the Node's Constraints /*! @property constraints @abstract An array of SCNConstraint that are applied to the receiver. @discussion Adding or removing a constraint can be implicitly animated based on the current transaction. */ @property(copy, nullable) NSArray<SCNConstraint *> *constraints NS_AVAILABLE(10_9, 8_0); #pragma mark - Accessing the Node's Filters /*! @property filters @abstract An array of Core Image filters that are applied to the rendering of the receiver and its child nodes. Animatable. @discussion Defaults to nil. Filter properties should be modified by calling setValue:forKeyPath: on each node that the filter is attached to. If the inputs of the filter are modified directly after the filter is attached to a node, the behavior is undefined. */ @property(nonatomic, copy, nullable) NSArray<CIFilter *> *filters NS_AVAILABLE(10_9, 8_0); #pragma mark - Accessing the Presentation Node /*! @method presentationNode @abstract Returns the presentation node. @discussion Returns a copy of the node containing all the properties as they were at the start of the current transaction, with any active animations applied. This gives a close approximation to the version of the node that is currently displayed. The effect of attempting to modify the returned node in any way is undefined. The returned node has no parent and no child nodes. */ @property(nonatomic, readonly) SCNNode *presentationNode; #pragma mark - Pause /*! @property paused @abstract Controls whether or not the node's actions and animations are updated or paused. Defaults to NO. */ @property(nonatomic, getter=isPaused) BOOL paused NS_AVAILABLE(10_10, 8_0); #pragma mark - Overriding the Rendering with Custom OpenGL Code /*! @property rendererDelegate @abstract Specifies the receiver's renderer delegate object. @discussion Setting a renderer delegate prevents the SceneKit renderer from drawing the node and lets you use custom OpenGL code instead. The preferred way to customize the rendering is to tweak the material properties of the different materials of the node's geometry. SCNMaterial conforms to the SCNShadable protocol and allows for more advanced rendering using GLSL. You would typically use a renderer delegate with a node that has no geometry and only serves as a location in space. An example would be attaching a particle system to that node and render it with custom OpenGL code. */ @property(nonatomic, assign, nullable) id <SCNNodeRendererDelegate> rendererDelegate; #pragma mark - Hit Testing in the Node /*! @method hitTestWithSegmentFromPoint:toPoint:options: @abstract Returns an array of SCNHitTestResult for each node in the receiver's sub tree that intersects the specified segment. @param pointA The first point of the segment relative to the receiver. @param pointB The second point of the segment relative to the receiver. @param options Optional parameters (see the "Hit test options" section in SCNSceneRenderer.h for the available options). @discussion See SCNSceneRenderer.h for a screen-space hit testing method. */ - (NSArray<SCNHitTestResult *> *)hitTestWithSegmentFromPoint:(SCNVector3)pointA toPoint:(SCNVector3)pointB options:(nullable NSDictionary<NSString *, id> *)options NS_AVAILABLE(10_9, 8_0); #pragma mark - Categories /*! @property categoryBitMask @abstract Defines what logical 'categories' the receiver belongs too. Defaults to 1. @discussion Categories can be used to exclude nodes from the influence of a given light (see SCNLight's categoryBitMask). It can also be used to include/exclude nodes from render passes (see SCNTechnique.h). */ @property(nonatomic) NSUInteger categoryBitMask NS_AVAILABLE(10_10, 8_0); @end /*! @category NSObject (SCNNodeRendererDelegate) @abstract The SCNNodeRendererDelegate protocol declares the methods that an instance of SCNNode invokes to let a delegate customize its rendering. */ @protocol SCNNodeRendererDelegate <NSObject> @optional /*! @method renderNode:renderer:arguments: @abstract Invoked when a node is rendered. @discussion The preferred way to customize the rendering is to tweak the material properties of the different materials of the node's geometry. SCNMaterial conforms to the SCNShadable protocol and allows for more advanced rendering using GLSL. You would typically use a renderer delegate with a node that has no geometry and only serves as a location in space. An example would be attaching a particle system to that node and render it with custom OpenGL code. Only drawing calls and the means to achieve them are supposed to be performed during the renderer delegate callback, any changes in the model (nodes, geometry...) would involve unexpected results. @param node The node to render. @param renderer The scene renderer to render into. @param arguments A dictionary that can have any of the entries described at the beginning of this file. */ - (void)renderNode:(SCNNode *)node renderer:(SCNRenderer *)renderer arguments:(NSDictionary<NSString *, NSValue *> *)arguments; @end NS_ASSUME_NONNULL_END
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="utf-8"?> <style xmlns="http://purl.org/net/xbiblio/csl" version="1.0" default-locale="en-US"> <!-- Elsevier, generated from "elsevier" metadata at https://github.com/citation-style-language/journals --> <info> <title>Anaerobe</title> <id>http://www.zotero.org/styles/anaerobe</id> <link href="http://www.zotero.org/styles/anaerobe" rel="self"/> <link href="http://www.zotero.org/styles/elsevier-with-titles" rel="independent-parent"/> <category citation-format="numeric"/> <issn>1075-9964</issn> <updated>2018-02-16T12:00:00+00:00</updated> <rights license="http://creativecommons.org/licenses/by-sa/3.0/">This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 License</rights> </info> </style>
{ "pile_set_name": "Github" }
/*! * \copy * Copyright (c) 2013, Cisco Systems * 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. * */ #ifndef ENCODE_MB_AUX_H #define ENCODE_MB_AUX_H #include "typedefs.h" #include "wels_func_ptr_def.h" #include "copy_mb.h" namespace WelsEnc { void WelsInitEncodingFuncs (SWelsFuncPtrList* pFuncList, uint32_t uiCpuFlag); int32_t WelsGetNoneZeroCount_c (int16_t* pLevel); /**************************************************************************** * Scan and Score functions ****************************************************************************/ void WelsScan4x4Ac_c (int16_t* pZigValue, int16_t* pDct); void WelsScan4x4Dc (int16_t* pLevel, int16_t* pDct); void WelsScan4x4DcAc_c (int16_t* pLevel, int16_t* pDct); int32_t WelsCalculateSingleCtr4x4_c (int16_t* pDct); /**************************************************************************** * HDM and Quant functions ****************************************************************************/ void WelsHadamardT4Dc_c (int16_t* pLumaDc, int16_t* pDct); int32_t WelsHadamardQuant2x2_c (int16_t* pRes, const int16_t kiFF, int16_t iMF, int16_t* pDct, int16_t* pBlock); int32_t WelsHadamardQuant2x2Skip_c (int16_t* pRes, int16_t iFF, int16_t iMF); void WelsQuant4x4_c (int16_t* pDct, const int16_t* pFF, const int16_t* pMF); void WelsQuant4x4Dc_c (int16_t* pDct, int16_t iFF, int16_t iMF); void WelsQuantFour4x4_c (int16_t* pDct, const int16_t* pFF, const int16_t* pQpTable); void WelsQuantFour4x4Max_c (int16_t* pDct, const int16_t* pF, const int16_t* pQpTable, int16_t* pMax); /**************************************************************************** * DCT functions ****************************************************************************/ void WelsDctT4_c (int16_t* pDct, uint8_t* pPixel1, int32_t iStride1, uint8_t* pPixel2, int32_t iStride2); // dct_data is no-use here, just for the same interface with dct_save functions void WelsDctFourT4_c (int16_t* pDct, uint8_t* pPixel1, int32_t iStride1, uint8_t* pPixel2, int32_t iStride2); #if defined(__cplusplus) extern "C" { #endif//__cplusplus #ifdef X86_ASM int32_t WelsGetNoneZeroCount_sse2 (int16_t* pLevel); int32_t WelsGetNoneZeroCount_sse42 (int16_t* pLevel); /**************************************************************************** * Scan and Score functions ****************************************************************************/ void WelsScan4x4Ac_sse2 (int16_t* zig_value, int16_t* pDct); void WelsScan4x4DcAc_ssse3 (int16_t* pLevel, int16_t* pDct); void WelsScan4x4DcAc_sse2 (int16_t* pLevel, int16_t* pDct); int32_t WelsCalculateSingleCtr4x4_sse2 (int16_t* pDct); /**************************************************************************** * DCT functions ****************************************************************************/ void WelsDctT4_mmx (int16_t* pDct, uint8_t* pPixel1, int32_t iStride1, uint8_t* pPixel2, int32_t iStride2); void WelsDctT4_sse2 (int16_t* pDct, uint8_t* pPixel1, int32_t iStride1, uint8_t* pPixel2, int32_t iStride2); void WelsDctFourT4_sse2 (int16_t* pDct, uint8_t* pPixel1, int32_t iStride1, uint8_t* pPixel2, int32_t iStride2); void WelsDctT4_avx2 (int16_t* pDct, uint8_t* pPixel1, int32_t iStride1, uint8_t* pPixel2, int32_t iStride2); void WelsDctFourT4_avx2 (int16_t* pDct, uint8_t* pPixel1, int32_t iStride1, uint8_t* pPixel2, int32_t iStride2); /**************************************************************************** * HDM and Quant functions ****************************************************************************/ int32_t WelsHadamardQuant2x2_mmx (int16_t* pRes, const int16_t kiFF, int16_t iMF, int16_t* pDct, int16_t* pBlock); void WelsHadamardT4Dc_sse2 (int16_t* pLumaDc, int16_t* pDct); int32_t WelsHadamardQuant2x2Skip_mmx (int16_t* pRes, int16_t iFF, int16_t iMF); void WelsQuant4x4_sse2 (int16_t* pDct, const int16_t* pFF, const int16_t* pMF); void WelsQuant4x4Dc_sse2 (int16_t* pDct, int16_t iFF, int16_t iMF); void WelsQuantFour4x4_sse2 (int16_t* pDct, const int16_t* pFF, const int16_t* pMF); void WelsQuantFour4x4Max_sse2 (int16_t* pDct, const int16_t* pFF, const int16_t* pMF, int16_t* pMax); void WelsQuant4x4_avx2 (int16_t* pDct, const int16_t* pFF, const int16_t* pMF); void WelsQuant4x4Dc_avx2 (int16_t* pDct, int16_t iFF, int16_t iMF); void WelsQuantFour4x4_avx2 (int16_t* pDct, const int16_t* pFF, const int16_t* pMF); void WelsQuantFour4x4Max_avx2 (int16_t* pDct, const int16_t* pFF, const int16_t* pMF, int16_t* pMax); #endif #ifdef HAVE_NEON void WelsHadamardT4Dc_neon (int16_t* pLumaDc, int16_t* pDct); int32_t WelsHadamardQuant2x2_neon (int16_t* pRes, const int16_t kiFF, int16_t iMF, int16_t* pDct, int16_t* pBlock); int32_t WelsHadamardQuant2x2Skip_neon (int16_t* pRes, int16_t iFF, int16_t iMF); int32_t WelsHadamardQuant2x2SkipKernel_neon (int16_t* pRes, int16_t iThreshold); // avoid divide operator void WelsDctT4_neon (int16_t* pDct, uint8_t* pPixel1, int32_t iStride1, uint8_t* pPixel2, int32_t iStride2); void WelsDctFourT4_neon (int16_t* pDct, uint8_t* pPixel1, int32_t iStride1, uint8_t* pPixel2, int32_t iStride2); int32_t WelsGetNoneZeroCount_neon (int16_t* pLevel); void WelsQuant4x4_neon (int16_t* pDct, const int16_t* pFF, const int16_t* pMF); void WelsQuant4x4Dc_neon (int16_t* pDct, int16_t iFF, int16_t iMF); void WelsQuantFour4x4_neon (int16_t* pDct, const int16_t* pFF, const int16_t* pMF); void WelsQuantFour4x4Max_neon (int16_t* pDct, const int16_t* pFF, const int16_t* pMF, int16_t* pMax); #endif #ifdef HAVE_NEON_AARCH64 void WelsHadamardT4Dc_AArch64_neon (int16_t* pLumaDc, int16_t* pDct); int32_t WelsHadamardQuant2x2_AArch64_neon (int16_t* pRes, const int16_t kiFF, int16_t iMF, int16_t* pDct, int16_t* pBlock); int32_t WelsHadamardQuant2x2Skip_AArch64_neon (int16_t* pRes, int16_t iFF, int16_t iMF); int32_t WelsHadamardQuant2x2SkipKernel_AArch64_neon (int16_t* pRes, int16_t iThreshold); // avoid divide operator void WelsDctT4_AArch64_neon (int16_t* pDct, uint8_t* pPixel1, int32_t iStride1, uint8_t* pPixel2, int32_t iStride2); void WelsDctFourT4_AArch64_neon (int16_t* pDct, uint8_t* pPixel1, int32_t iStride1, uint8_t* pPixel2, int32_t iStride2); int32_t WelsGetNoneZeroCount_AArch64_neon (int16_t* pLevel); void WelsQuant4x4_AArch64_neon (int16_t* pDct, const int16_t* pFF, const int16_t* pMF); void WelsQuant4x4Dc_AArch64_neon (int16_t* pDct, int16_t iFF, int16_t iMF); void WelsQuantFour4x4_AArch64_neon (int16_t* pDct, const int16_t* pFF, const int16_t* pMF); void WelsQuantFour4x4Max_AArch64_neon (int16_t* pDct, const int16_t* pFF, const int16_t* pMF, int16_t* pMax); #endif #ifdef HAVE_MMI int32_t WelsGetNoneZeroCount_mmi (int16_t* pLevel); /**************************************************************************** * * Scan and Score functions * ****************************************************************************/ void WelsScan4x4Ac_mmi (int16_t* zig_value, int16_t* pDct); void WelsScan4x4DcAc_mmi (int16_t* pLevel, int16_t* pDct); int32_t WelsCalculateSingleCtr4x4_mmi (int16_t* pDct); /**************************************************************************** * * DCT functions * ****************************************************************************/ void WelsDctT4_mmi (int16_t* pDct, uint8_t* pPixel1, int32_t iStride1, uint8_t* pPixel2, int32_t iStride2); void WelsDctFourT4_mmi (int16_t* pDct, uint8_t* pPixel1, int32_t iStride1, uint8_t* pPixel2, int32_t iStride2); /**************************************************************************** * * HDM and Quant functions * ****************************************************************************/ void WelsHadamardT4Dc_mmi (int16_t* pLumaDc, int16_t* pDct); void WelsQuant4x4_mmi (int16_t* pDct, const int16_t* pFF, const int16_t* pMF); void WelsQuant4x4Dc_mmi (int16_t* pDct, int16_t iFF, int16_t iMF); void WelsQuantFour4x4_mmi (int16_t* pDct, const int16_t* pFF, const int16_t* pMF); void WelsQuantFour4x4Max_mmi (int16_t* pDct, const int16_t* pFF, const int16_t* pMF, int16_t* pMax); #endif//HAVE_MMI #if defined(__cplusplus) } #endif//__cplusplus ALIGNED_DECLARE (extern const int16_t, g_kiQuantInterFF[58][8], 16); #define g_iQuantIntraFF (g_kiQuantInterFF +6 ) ALIGNED_DECLARE (extern const int16_t, g_kiQuantMF[52][8], 16); } #endif//ENCODE_MB_AUX_H
{ "pile_set_name": "Github" }
// Copyright (c) Microsoft. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. #include <cstdlib> #include <cstddef> #include "testrunnerswitcher.h" #include "micromock.h" #include "micromockcharstararenullterminatedstrings.h" #include "azure_c_shared_utility/lock.h" #include "module_loader.h" #include "experimental/event_system.h" #include "gateway.h" #include "../src/gateway_internal.h" #include <parson.h> #include "azure_c_shared_utility/vector_types_internal.h" #ifdef OUTPROCESS_ENABLED #include "module_loaders/outprocess_loader.h" #endif #define DUMMY_JSON_PATH "x.json" #define MISCONFIG_JSON_PATH "invalid_json.json" #define MISSING_INFO_JSON_PATH "missing_info_json.json" #define VALID_JSON_PATH "valid_json.json" #define VALID_JSON_NULL_ARGS_PATH "valid_json_null.json" #define VALID_JSON_CONTENT "validJsonContent" #define GBALLOC_H extern "C" int gballoc_init(void); extern "C" void gballoc_deinit(void); extern "C" void* gballoc_malloc(size_t size); extern "C" void* gballoc_calloc(size_t nmemb, size_t size); extern "C" void* gballoc_realloc(void* ptr, size_t size); extern "C" void gballoc_free(void* ptr); namespace BASEIMPLEMENTATION { /*if malloc is defined as gballoc_malloc at this moment, there'd be serious trouble*/ #define Lock(x) (LOCK_OK + gballocState - gballocState) /*compiler warning about constant in if condition*/ #define Unlock(x) (LOCK_OK + gballocState - gballocState) #define Lock_Init() (LOCK_HANDLE)0x42 #define Lock_Deinit(x) (LOCK_OK + gballocState - gballocState) #include "gballoc.c" #undef Lock #undef Unlock #undef Lock_Init #undef Lock_Deinit #include "vector.c" }; static MODULE_API_1 dummyAPIs; static size_t currentBroker_ref_count; static MODULE_LOADER_API default_module_loader; static MODULE_LOADER dummyModuleLoader; static GATEWAY_MODULE_LOADER_INFO dummyLoaderInfo; TYPED_MOCK_CLASS(CGatewayMocks, CGlobalMock) { public: /*Parson Mocks*/ MOCK_STATIC_METHOD_1(, JSON_Value *, json_parse_string, const char *, string) JSON_Value* value = NULL; if (string != NULL) { value = (JSON_Value*)malloc(1); } MOCK_METHOD_END(JSON_Value*, value); MOCK_STATIC_METHOD_1(, JSON_Value*, json_parse_file, const char *, filename) JSON_Value* value = NULL; if (filename != NULL) { value = (JSON_Value*)malloc(1); } MOCK_METHOD_END(JSON_Value*, value); MOCK_STATIC_METHOD_1(, JSON_Object*, json_value_get_object, const JSON_Value*, value) JSON_Object* object = NULL; if (value != NULL) { object = (JSON_Object*)0x42; } MOCK_METHOD_END(JSON_Object*, object); MOCK_STATIC_METHOD_2(, JSON_Array*, json_object_get_array, const JSON_Object*, object, const char*, name) JSON_Array* arr = NULL; if (object != NULL && name != NULL) { arr = (JSON_Array*)0x42; } MOCK_METHOD_END(JSON_Array*, arr); MOCK_STATIC_METHOD_1(, size_t, json_array_get_count, const JSON_Array*, arr) size_t size = 0; MOCK_METHOD_END(size_t, size); MOCK_STATIC_METHOD_2(, JSON_Object*, json_array_get_object, const JSON_Array*, arr, size_t, index) JSON_Object* object = NULL; if (arr != NULL) { object = (JSON_Object*)0x42; } MOCK_METHOD_END(JSON_Object*, object); MOCK_STATIC_METHOD_2(, const char*, json_object_get_string, const JSON_Object*, object, const char*, name) const char* string = NULL; if (object != NULL && name != NULL) { string = name; } MOCK_METHOD_END(const char*, string); MOCK_STATIC_METHOD_2(, JSON_Object*, json_object_get_object, const JSON_Object*, object, const char*, name) JSON_Object* object1 = NULL; if (object != NULL && name != NULL) { object1 = (JSON_Object*)0x42; } MOCK_METHOD_END(JSON_Object*, object1); MOCK_STATIC_METHOD_2(, JSON_Value*, json_object_get_value, const JSON_Object*, object, const char*, name) JSON_Value* value = NULL; if (object != NULL && name != NULL) { value = (JSON_Value*)0x42; } MOCK_METHOD_END(JSON_Value*, value); MOCK_STATIC_METHOD_1(, char*, json_serialize_to_string, const JSON_Value*, value) char* serialized_string = NULL; const char* text = "[serialized string]"; if (value != NULL) { serialized_string = (char*)malloc(sizeof(char) * strlen(text) + 1); strcpy(serialized_string, text); } MOCK_METHOD_END(char*, serialized_string); MOCK_STATIC_METHOD_1(, void, json_value_free, JSON_Value*, value) BASEIMPLEMENTATION::gballoc_free(value); MOCK_VOID_METHOD_END(); MOCK_STATIC_METHOD_1(, void, json_free_serialized_string, char*, string) BASEIMPLEMENTATION::gballoc_free(string); MOCK_VOID_METHOD_END(); /*Gateway Mocks*/ MOCK_STATIC_METHOD_2( , int, Gateway_RemoveModuleByName, GATEWAY_HANDLE, gw, const char *, module_name) MOCK_METHOD_END(int, 0); MOCK_STATIC_METHOD_2( , void, Gateway_RemoveLink,GATEWAY_HANDLE, gw, const GATEWAY_LINK_ENTRY*, entryLink) MOCK_VOID_METHOD_END(); MOCK_STATIC_METHOD_1(, GATEWAY_HANDLE, Gateway_Create, const GATEWAY_PROPERTIES*, properties) GATEWAY_HANDLE gateway = (GATEWAY_HANDLE_DATA*)malloc(sizeof(GATEWAY_HANDLE_DATA)); memset(gateway, 0, sizeof(GATEWAY_HANDLE_DATA)); gateway->broker = (BROKER_HANDLE)Broker_Create(); gateway->modules = VECTOR_create(sizeof(MODULE_DATA*)); gateway->links = VECTOR_create(sizeof(LINK_DATA)); gateway->event_system = EventSystem_Init(); EventSystem_ReportEvent(gateway->event_system, gateway, GATEWAY_CREATED); EventSystem_ReportEvent(gateway->event_system, gateway, GATEWAY_MODULE_LIST_CHANGED); MOCK_METHOD_END(GATEWAY_HANDLE, gateway); MOCK_STATIC_METHOD_1(, void, Gateway_Destroy, GATEWAY_HANDLE, gw) BASEIMPLEMENTATION::gballoc_free(gw); MOCK_VOID_METHOD_END(); MOCK_STATIC_METHOD_1(, GATEWAY_START_RESULT, Gateway_Start, GATEWAY_HANDLE, gw) MOCK_METHOD_END(GATEWAY_START_RESULT, GATEWAY_START_SUCCESS); /*Broker Mocks*/ MOCK_STATIC_METHOD_0(, BROKER_HANDLE, Broker_Create) ++currentBroker_ref_count; BROKER_HANDLE result1 = (BROKER_HANDLE)BASEIMPLEMENTATION::gballoc_malloc(1); MOCK_METHOD_END(BROKER_HANDLE, result1); MOCK_STATIC_METHOD_1(, void, Broker_Destroy, BROKER_HANDLE, broker) if (currentBroker_ref_count > 0) { --currentBroker_ref_count; if (currentBroker_ref_count == 0) { BASEIMPLEMENTATION::gballoc_free(broker); } } MOCK_VOID_METHOD_END(); MOCK_STATIC_METHOD_1(, void, Broker_DecRef, BROKER_HANDLE, broker) if (currentBroker_ref_count > 0) { --currentBroker_ref_count; if (currentBroker_ref_count == 0) { BASEIMPLEMENTATION::gballoc_free(broker); } } MOCK_VOID_METHOD_END(); MOCK_STATIC_METHOD_1(, void, Broker_IncRef, BROKER_HANDLE, broker) ++currentBroker_ref_count; MOCK_VOID_METHOD_END(); MOCK_STATIC_METHOD_2(, BROKER_RESULT, Broker_AddModule, BROKER_HANDLE, handle, const MODULE*, module) MOCK_METHOD_END(BROKER_RESULT, BROKER_OK); MOCK_STATIC_METHOD_2(, BROKER_RESULT, Broker_RemoveModule, BROKER_HANDLE, handle, const MODULE*, module) MOCK_METHOD_END(BROKER_RESULT, BROKER_OK); MOCK_STATIC_METHOD_2(, BROKER_RESULT, Broker_AddLink, BROKER_HANDLE, handle, const BROKER_LINK_DATA*, link) MOCK_METHOD_END(BROKER_RESULT, BROKER_OK) MOCK_STATIC_METHOD_2(, BROKER_RESULT, Broker_RemoveLink, BROKER_HANDLE, handle, const BROKER_LINK_DATA*, link) MOCK_METHOD_END(BROKER_RESULT, BROKER_OK) /*ModuleLoader Mocks*/ MOCK_STATIC_METHOD_0(, const MODULE_LOADER_API*, DynamicLoader_GetApi) MOCK_METHOD_END(const MODULE_LOADER_API*, &default_module_loader); MOCK_STATIC_METHOD_2(, MODULE_LIBRARY_HANDLE, DynamicModuleLoader_Load, const struct MODULE_LOADER_TAG*, loader, const void*, entrypoint) MOCK_METHOD_END(MODULE_LIBRARY_HANDLE, (MODULE_LIBRARY_HANDLE)BASEIMPLEMENTATION::gballoc_malloc(1)); MOCK_STATIC_METHOD_2(, const MODULE_API*, DynamicModuleLoader_GetModuleApi, const struct MODULE_LOADER_TAG*, loader, MODULE_LIBRARY_HANDLE, module_library_handle) const MODULE_API* apis = reinterpret_cast<const MODULE_API*>(&dummyAPIs); MOCK_METHOD_END(const MODULE_API*, apis); MOCK_STATIC_METHOD_2(, void, DynamicModuleLoader_Unload, const struct MODULE_LOADER_TAG*, loader, MODULE_LIBRARY_HANDLE, moduleLibraryHandle) BASEIMPLEMENTATION::gballoc_free(moduleLibraryHandle); MOCK_VOID_METHOD_END(); MOCK_STATIC_METHOD_2(, void*, DynamicModuleLoader_ParseEntrypointFromJson, const struct MODULE_LOADER_TAG*, loader, const JSON_Value*, json) void* r = BASEIMPLEMENTATION::gballoc_malloc(1); MOCK_METHOD_END(void*, r); MOCK_STATIC_METHOD_2(, void, DynamicModuleLoader_FreeEntrypoint, const struct MODULE_LOADER_TAG*, loader, void*, entrypoint) BASEIMPLEMENTATION::gballoc_free(entrypoint); MOCK_VOID_METHOD_END(); MOCK_STATIC_METHOD_2(, MODULE_LOADER_BASE_CONFIGURATION*, DynamicModuleLoader_ParseConfigurationFromJson, const struct MODULE_LOADER_TAG*, loader, const JSON_Value*, json) MODULE_LOADER_BASE_CONFIGURATION* r = (MODULE_LOADER_BASE_CONFIGURATION*)BASEIMPLEMENTATION::gballoc_malloc(1); MOCK_METHOD_END(MODULE_LOADER_BASE_CONFIGURATION*, r); MOCK_STATIC_METHOD_2(, void, DynamicModuleLoader_FreeConfiguration, const struct MODULE_LOADER_TAG*, loader, MODULE_LOADER_BASE_CONFIGURATION*, configuration) BASEIMPLEMENTATION::gballoc_free(configuration); MOCK_VOID_METHOD_END(); MOCK_STATIC_METHOD_3(, void*, DynamicModuleLoader_BuildModuleConfiguration, const struct MODULE_LOADER_TAG*, loader, const void*, entrypoint, const void*, module_configuration) void* r = BASEIMPLEMENTATION::gballoc_malloc(1); MOCK_METHOD_END(void*, r); MOCK_STATIC_METHOD_2(, void, DynamicModuleLoader_FreeModuleConfiguration, const struct MODULE_LOADER_TAG*, loader, const void*, module_configuration) BASEIMPLEMENTATION::gballoc_free((void*)module_configuration); MOCK_VOID_METHOD_END(); MOCK_STATIC_METHOD_0(, MODULE_LOADER_RESULT, ModuleLoader_Initialize); MOCK_METHOD_END(MODULE_LOADER_RESULT, MODULE_LOADER_SUCCESS); MOCK_STATIC_METHOD_1(, MODULE_LOADER_RESULT, ModuleLoader_InitializeFromJson, const JSON_Value*, loaders); MOCK_METHOD_END(MODULE_LOADER_RESULT, MODULE_LOADER_SUCCESS); MOCK_STATIC_METHOD_0(, void, ModuleLoader_Destroy); MOCK_VOID_METHOD_END(); MOCK_STATIC_METHOD_1(, MODULE_LOADER*, ModuleLoader_FindByName, const char*, name) MOCK_METHOD_END(MODULE_LOADER*, &dummyModuleLoader); MOCK_STATIC_METHOD_0(, void, OutprocessLoader_JoinChildProcesses); MOCK_VOID_METHOD_END(); MOCK_STATIC_METHOD_0(, int, OutprocessLoader_SpawnChildProcesses); MOCK_METHOD_END(int, 0); /*EventSystem Mocks*/ MOCK_STATIC_METHOD_0(, EVENTSYSTEM_HANDLE, EventSystem_Init) MOCK_METHOD_END(EVENTSYSTEM_HANDLE, (EVENTSYSTEM_HANDLE)BASEIMPLEMENTATION::gballoc_malloc(1)); MOCK_STATIC_METHOD_4(, void, EventSystem_AddEventCallback, EVENTSYSTEM_HANDLE, event_system, GATEWAY_EVENT, event_type, GATEWAY_CALLBACK, callback, void*, user_param) MOCK_VOID_METHOD_END(); MOCK_STATIC_METHOD_3(, void, EventSystem_ReportEvent, EVENTSYSTEM_HANDLE, event_system, GATEWAY_HANDLE, gw, GATEWAY_EVENT, event_type) MOCK_VOID_METHOD_END(); MOCK_STATIC_METHOD_1(, void, EventSystem_Destroy, EVENTSYSTEM_HANDLE, handle) BASEIMPLEMENTATION::gballoc_free(handle); MOCK_VOID_METHOD_END(); /*Vector Mocks*/ MOCK_STATIC_METHOD_1(, VECTOR_HANDLE, VECTOR_create, size_t, elementSize) VECTOR_HANDLE vector = BASEIMPLEMENTATION::VECTOR_create(elementSize); MOCK_METHOD_END(VECTOR_HANDLE, vector); MOCK_STATIC_METHOD_1(, void, VECTOR_destroy, VECTOR_HANDLE, handle) BASEIMPLEMENTATION::VECTOR_destroy(handle); MOCK_VOID_METHOD_END(); MOCK_STATIC_METHOD_3(, int, VECTOR_push_back, VECTOR_HANDLE, handle, const void*, elements, size_t, numElements) int result1 = BASEIMPLEMENTATION::VECTOR_push_back(handle, elements, numElements); MOCK_METHOD_END(int, result1); MOCK_STATIC_METHOD_3(, void, VECTOR_erase, VECTOR_HANDLE, handle, void*, elements, size_t, index) BASEIMPLEMENTATION::VECTOR_erase(handle, elements, index); MOCK_VOID_METHOD_END(); MOCK_STATIC_METHOD_2(, void*, VECTOR_element, const VECTOR_HANDLE, handle, size_t, index) auto element = BASEIMPLEMENTATION::VECTOR_element(handle, index); MOCK_METHOD_END(void*, element); MOCK_STATIC_METHOD_1(, void*, VECTOR_front, const VECTOR_HANDLE, handle) auto element = BASEIMPLEMENTATION::VECTOR_front(handle); MOCK_METHOD_END(void*, element); MOCK_STATIC_METHOD_1(, void*, VECTOR_back, const VECTOR_HANDLE, handle) auto element = BASEIMPLEMENTATION::VECTOR_back(handle); MOCK_METHOD_END(void*, element); MOCK_STATIC_METHOD_1(, size_t, VECTOR_size, const VECTOR_HANDLE, handle) auto size = BASEIMPLEMENTATION::VECTOR_size(handle); MOCK_METHOD_END(size_t, size); MOCK_STATIC_METHOD_3(, void*, VECTOR_find_if, const VECTOR_HANDLE, handle, PREDICATE_FUNCTION, pred, const void*, value) void* element = BASEIMPLEMENTATION::VECTOR_find_if(handle, pred, value); MOCK_METHOD_END(void*, element); /*crt_abstractions Mocks*/ MOCK_STATIC_METHOD_2(, int, mallocAndStrcpy_s, char**, destination, const char*, source) (*destination) = (char*)malloc(strlen(source) + 1); strcpy(*destination, source); MOCK_METHOD_END(int, 0); /*gballoc Mocks*/ MOCK_STATIC_METHOD_1(, void*, gballoc_malloc, size_t, size) void* result2 = BASEIMPLEMENTATION::gballoc_malloc(size); MOCK_METHOD_END(void*, result2); MOCK_STATIC_METHOD_2(, void*, gballoc_realloc, void*, ptr, size_t, size) MOCK_METHOD_END(void*, BASEIMPLEMENTATION::gballoc_realloc(ptr, size)); MOCK_STATIC_METHOD_1(, void, gballoc_free, void*, ptr) BASEIMPLEMENTATION::gballoc_free(ptr); MOCK_VOID_METHOD_END() MOCK_STATIC_METHOD_1(, MODULE_HANDLE, mock_Module_ParseConfigurationFromJson, const char*, configuration) MOCK_METHOD_END(MODULE_HANDLE, (MODULE_HANDLE)BASEIMPLEMENTATION::gballoc_malloc(1)); MOCK_STATIC_METHOD_1(, void, mock_Module_FreeConfiguration, void*, configuration) BASEIMPLEMENTATION::gballoc_free(configuration); MOCK_VOID_METHOD_END(); MOCK_STATIC_METHOD_2(, MODULE_HANDLE, mock_Module_Create, BROKER_HANDLE, broker, const void*, configuration) MOCK_METHOD_END(MODULE_HANDLE, (MODULE_HANDLE)BASEIMPLEMENTATION::gballoc_malloc(1)); MOCK_STATIC_METHOD_1(, void, mock_Module_Destroy, MODULE_HANDLE, moduleHandle) BASEIMPLEMENTATION::gballoc_free(moduleHandle); MOCK_VOID_METHOD_END(); MOCK_STATIC_METHOD_2(, void, mock_Module_Receive, MODULE_HANDLE, moduleHandle, MESSAGE_HANDLE, messageHandle) MOCK_VOID_METHOD_END(); }; DECLARE_GLOBAL_MOCK_METHOD_1(CGatewayMocks, , JSON_Value *, json_parse_string, const char *, string); DECLARE_GLOBAL_MOCK_METHOD_1(CGatewayMocks, , JSON_Value*, json_parse_file, const char *, filename); DECLARE_GLOBAL_MOCK_METHOD_1(CGatewayMocks, , JSON_Object*, json_value_get_object, const JSON_Value*, value); DECLARE_GLOBAL_MOCK_METHOD_2(CGatewayMocks, , JSON_Array*, json_object_get_array, const JSON_Object*, object, const char*, name); DECLARE_GLOBAL_MOCK_METHOD_1(CGatewayMocks, , size_t, json_array_get_count, const JSON_Array*, arr); DECLARE_GLOBAL_MOCK_METHOD_2(CGatewayMocks, , JSON_Object*, json_array_get_object, const JSON_Array*, arr, size_t, index); DECLARE_GLOBAL_MOCK_METHOD_2(CGatewayMocks, , const char*, json_object_get_string, const JSON_Object*, object, const char*, name); DECLARE_GLOBAL_MOCK_METHOD_2(CGatewayMocks, , JSON_Object*, json_object_get_object, const JSON_Object*, object, const char*, name); DECLARE_GLOBAL_MOCK_METHOD_2(CGatewayMocks, , JSON_Value*, json_object_get_value, const JSON_Object*, object, const char*, name); DECLARE_GLOBAL_MOCK_METHOD_1(CGatewayMocks, , char*, json_serialize_to_string, const JSON_Value*, value); DECLARE_GLOBAL_MOCK_METHOD_1(CGatewayMocks, , void, json_value_free, JSON_Value*, value); DECLARE_GLOBAL_MOCK_METHOD_1(CGatewayMocks, , void, json_free_serialized_string, char*, string); DECLARE_GLOBAL_MOCK_METHOD_2(CGatewayMocks, , void, Gateway_RemoveLink, GATEWAY_HANDLE, gw, const GATEWAY_LINK_ENTRY*, entryLink); DECLARE_GLOBAL_MOCK_METHOD_1(CGatewayMocks, , GATEWAY_HANDLE, Gateway_Create, const GATEWAY_PROPERTIES*, properties); DECLARE_GLOBAL_MOCK_METHOD_1(CGatewayMocks, , void, Gateway_Destroy, GATEWAY_HANDLE, gw); DECLARE_GLOBAL_MOCK_METHOD_1(CGatewayMocks, , GATEWAY_START_RESULT, Gateway_Start, GATEWAY_HANDLE, gw); DECLARE_GLOBAL_MOCK_METHOD_2(CGatewayMocks, , int, Gateway_RemoveModuleByName, GATEWAY_HANDLE, gw, const char *, module_name); DECLARE_GLOBAL_MOCK_METHOD_0(CGatewayMocks, , BROKER_HANDLE, Broker_Create); DECLARE_GLOBAL_MOCK_METHOD_1(CGatewayMocks, , void, Broker_Destroy, BROKER_HANDLE, broker); DECLARE_GLOBAL_MOCK_METHOD_1(CGatewayMocks, , void, Broker_IncRef, BROKER_HANDLE, broker); DECLARE_GLOBAL_MOCK_METHOD_1(CGatewayMocks, , void, Broker_DecRef, BROKER_HANDLE, broker); DECLARE_GLOBAL_MOCK_METHOD_2(CGatewayMocks, , BROKER_RESULT, Broker_AddModule, BROKER_HANDLE, handle, const MODULE*, module); DECLARE_GLOBAL_MOCK_METHOD_2(CGatewayMocks, , BROKER_RESULT, Broker_RemoveModule, BROKER_HANDLE, handle, const MODULE*, module); DECLARE_GLOBAL_MOCK_METHOD_2(CGatewayMocks, , BROKER_RESULT, Broker_AddLink, BROKER_HANDLE, handle, const BROKER_LINK_DATA*, link); DECLARE_GLOBAL_MOCK_METHOD_2(CGatewayMocks, , BROKER_RESULT, Broker_RemoveLink, BROKER_HANDLE, handle, const BROKER_LINK_DATA*, link); DECLARE_GLOBAL_MOCK_METHOD_0(CGatewayMocks, , const MODULE_LOADER_API*, DynamicLoader_GetApi); DECLARE_GLOBAL_MOCK_METHOD_2(CGatewayMocks, , MODULE_LIBRARY_HANDLE, DynamicModuleLoader_Load, const struct MODULE_LOADER_TAG*, loader, const void*, entrypoint); DECLARE_GLOBAL_MOCK_METHOD_2(CGatewayMocks, , const MODULE_API*, DynamicModuleLoader_GetModuleApi, const struct MODULE_LOADER_TAG*, loader, MODULE_LIBRARY_HANDLE, module_library_handle); DECLARE_GLOBAL_MOCK_METHOD_2(CGatewayMocks, , void, DynamicModuleLoader_Unload, const struct MODULE_LOADER_TAG*, loader, MODULE_LIBRARY_HANDLE, moduleLibraryHandle); DECLARE_GLOBAL_MOCK_METHOD_2(CGatewayMocks, , void*, DynamicModuleLoader_ParseEntrypointFromJson, const struct MODULE_LOADER_TAG*, loader, const JSON_Value*, json); DECLARE_GLOBAL_MOCK_METHOD_2(CGatewayMocks, , void, DynamicModuleLoader_FreeEntrypoint, const struct MODULE_LOADER_TAG*, loader, void*, entrypoint); DECLARE_GLOBAL_MOCK_METHOD_2(CGatewayMocks, , MODULE_LOADER_BASE_CONFIGURATION*, DynamicModuleLoader_ParseConfigurationFromJson, const struct MODULE_LOADER_TAG*, loader, const JSON_Value*, json); DECLARE_GLOBAL_MOCK_METHOD_2(CGatewayMocks, , void, DynamicModuleLoader_FreeConfiguration, const struct MODULE_LOADER_TAG*, loader, MODULE_LOADER_BASE_CONFIGURATION*, configuration); DECLARE_GLOBAL_MOCK_METHOD_3(CGatewayMocks, , void*, DynamicModuleLoader_BuildModuleConfiguration, const struct MODULE_LOADER_TAG*, loader, const void*, entrypoint, const void*, module_configuration); DECLARE_GLOBAL_MOCK_METHOD_2(CGatewayMocks, , void, DynamicModuleLoader_FreeModuleConfiguration, const struct MODULE_LOADER_TAG*, loader, const void*, module_configuration); DECLARE_GLOBAL_MOCK_METHOD_0(CGatewayMocks, , MODULE_LOADER_RESULT, ModuleLoader_Initialize); DECLARE_GLOBAL_MOCK_METHOD_1(CGatewayMocks, , MODULE_LOADER_RESULT, ModuleLoader_InitializeFromJson, const JSON_Value*, loaders); DECLARE_GLOBAL_MOCK_METHOD_0(CGatewayMocks, , void, ModuleLoader_Destroy); DECLARE_GLOBAL_MOCK_METHOD_1(CGatewayMocks, , MODULE_LOADER*, ModuleLoader_FindByName, const char*, name); DECLARE_GLOBAL_MOCK_METHOD_0(CGatewayMocks, , void, OutprocessLoader_JoinChildProcesses); DECLARE_GLOBAL_MOCK_METHOD_0(CGatewayMocks, , int, OutprocessLoader_SpawnChildProcesses); DECLARE_GLOBAL_MOCK_METHOD_0(CGatewayMocks, , EVENTSYSTEM_HANDLE, EventSystem_Init); DECLARE_GLOBAL_MOCK_METHOD_4(CGatewayMocks, , void, EventSystem_AddEventCallback, EVENTSYSTEM_HANDLE, event_system, GATEWAY_EVENT, event_type, GATEWAY_CALLBACK, callback, void*, user_param); DECLARE_GLOBAL_MOCK_METHOD_3(CGatewayMocks, , void, EventSystem_ReportEvent, EVENTSYSTEM_HANDLE, event_system, GATEWAY_HANDLE, gw, GATEWAY_EVENT, event_type); DECLARE_GLOBAL_MOCK_METHOD_1(CGatewayMocks, , void, EventSystem_Destroy, EVENTSYSTEM_HANDLE, handle); DECLARE_GLOBAL_MOCK_METHOD_1(CGatewayMocks, , VECTOR_HANDLE, VECTOR_create, size_t, elementSize); DECLARE_GLOBAL_MOCK_METHOD_1(CGatewayMocks, , void, VECTOR_destroy, VECTOR_HANDLE, handle); DECLARE_GLOBAL_MOCK_METHOD_3(CGatewayMocks, , int, VECTOR_push_back, VECTOR_HANDLE, handle, const void*, elements, size_t, numElements); DECLARE_GLOBAL_MOCK_METHOD_3(CGatewayMocks, , void, VECTOR_erase, VECTOR_HANDLE, handle, void*, elements, size_t, index); DECLARE_GLOBAL_MOCK_METHOD_2(CGatewayMocks, , void*, VECTOR_element, const VECTOR_HANDLE, handle, size_t, index); DECLARE_GLOBAL_MOCK_METHOD_1(CGatewayMocks, , void*, VECTOR_front, const VECTOR_HANDLE, handle); DECLARE_GLOBAL_MOCK_METHOD_1(CGatewayMocks, , void*, VECTOR_back, const VECTOR_HANDLE, handle); DECLARE_GLOBAL_MOCK_METHOD_1(CGatewayMocks, , size_t, VECTOR_size, const VECTOR_HANDLE, handle); DECLARE_GLOBAL_MOCK_METHOD_3(CGatewayMocks, , void*, VECTOR_find_if, const VECTOR_HANDLE, handle, PREDICATE_FUNCTION, pred, const void*, value); DECLARE_GLOBAL_MOCK_METHOD_2(CGatewayMocks, , int, mallocAndStrcpy_s, char**, destination, const char*, source); DECLARE_GLOBAL_MOCK_METHOD_1(CGatewayMocks, , void*, gballoc_malloc, size_t, size); DECLARE_GLOBAL_MOCK_METHOD_2(CGatewayMocks, , void*, gballoc_realloc, void*, ptr, size_t, size); DECLARE_GLOBAL_MOCK_METHOD_1(CGatewayMocks, , void, gballoc_free, void*, ptr) DECLARE_GLOBAL_MOCK_METHOD_1(CGatewayMocks, , MODULE_HANDLE, mock_Module_ParseConfigurationFromJson, const char*, configuration); DECLARE_GLOBAL_MOCK_METHOD_1(CGatewayMocks, , void, mock_Module_FreeConfiguration, void*, configuration); DECLARE_GLOBAL_MOCK_METHOD_2(CGatewayMocks, , MODULE_HANDLE, mock_Module_Create, BROKER_HANDLE, broker, const void*, configuration); DECLARE_GLOBAL_MOCK_METHOD_1(CGatewayMocks, , void, mock_Module_Destroy, MODULE_HANDLE, moduleHandle); DECLARE_GLOBAL_MOCK_METHOD_2(CGatewayMocks, , void, mock_Module_Receive, MODULE_HANDLE, moduleHandle, MESSAGE_HANDLE, messageHandle); static MICROMOCK_GLOBAL_SEMAPHORE_HANDLE g_dllByDll; static MICROMOCK_MUTEX_HANDLE g_testByTest; BEGIN_TEST_SUITE(gateway_createfromjson_ut) TEST_SUITE_INITIALIZE(TestClassInitialize) { TEST_INITIALIZE_MEMORY_DEBUG(g_dllByDll); g_testByTest = MicroMockCreateMutex(); ASSERT_IS_NOT_NULL(g_testByTest); currentBroker_ref_count = 0; dummyAPIs = { { MODULE_API_VERSION_1 }, mock_Module_ParseConfigurationFromJson, mock_Module_FreeConfiguration, mock_Module_Create, mock_Module_Destroy, mock_Module_Receive, NULL }; default_module_loader = { DynamicModuleLoader_Load, DynamicModuleLoader_Unload, DynamicModuleLoader_GetModuleApi, DynamicModuleLoader_ParseEntrypointFromJson, DynamicModuleLoader_FreeEntrypoint, DynamicModuleLoader_ParseConfigurationFromJson, DynamicModuleLoader_FreeConfiguration, DynamicModuleLoader_BuildModuleConfiguration, DynamicModuleLoader_FreeModuleConfiguration }; dummyModuleLoader = { NATIVE, "dummy loader", NULL, &default_module_loader }; dummyLoaderInfo = { &dummyModuleLoader, (void*)0x42 }; } TEST_SUITE_CLEANUP(TestClassCleanup) { MicroMockDestroyMutex(g_testByTest); TEST_DEINITIALIZE_MEMORY_DEBUG(g_dllByDll); } TEST_FUNCTION_INITIALIZE(TestMethodInitialize) { if (!MicroMockAcquireMutex(g_testByTest)) { ASSERT_FAIL("our mutex is ABANDONED. Failure in test framework"); } } TEST_FUNCTION_CLEANUP(TestMethodCleanup) { if (!MicroMockReleaseMutex(g_testByTest)) { ASSERT_FAIL("failure in test framework at ReleaseMutex"); } } /*Tests_SRS_GATEWAY_JSON_14_001: [If file_path is NULL the function shall return NULL.]*/ TEST_FUNCTION(Gateway_CreateFromJson_Returns_NULL_For_NULL_JSON_Input) { //Act GATEWAY_HANDLE gateway = Gateway_CreateFromJson(NULL); //Assert ASSERT_IS_NULL(gateway); } /*Tests_SRS_GATEWAY_JSON_17_012: [ This function shall return NULL if the module list is not initialized. ]*/ TEST_FUNCTION(Gateway_CreateFromJson_Returns_NULL_ModuleLoader_fails) { //Arrange CGatewayMocks mocks; STRICT_EXPECTED_CALL(mocks, ModuleLoader_Initialize()) .SetFailReturn(MODULE_LOADER_ERROR); //Act GATEWAY_HANDLE gateway = Gateway_CreateFromJson(DUMMY_JSON_PATH); //Assert ASSERT_IS_NULL(gateway); mocks.AssertActualAndExpectedCalls(); } /*Tests_SRS_GATEWAY_JSON_14_003: [The function shall return NULL if the file contents could not be read and / or parsed to a JSON_Value.]*/ /*Tests_SRS_GATEWAY_JSON_17_006: [ Upon failure this function shall destroy the module loader list. ]*/ TEST_FUNCTION(Gateway_CreateFromJson_Returns_NULL_If_File_Not_Exist) { //Arrange CGatewayMocks mocks; STRICT_EXPECTED_CALL(mocks, ModuleLoader_Initialize()); STRICT_EXPECTED_CALL(mocks, ModuleLoader_Destroy()); STRICT_EXPECTED_CALL(mocks, json_parse_file(DUMMY_JSON_PATH)) .SetFailReturn((JSON_Value*)NULL); //Act GATEWAY_HANDLE gateway = Gateway_CreateFromJson(DUMMY_JSON_PATH); //Assert ASSERT_IS_NULL(gateway); mocks.AssertActualAndExpectedCalls(); } /*Tests_SRS_GATEWAY_JSON_17_007: [ The function shall parse the "loaders" JSON array and initialize new module loaders or update the existing default loaders. ]*/ TEST_FUNCTION(Gateway_CreateFromJson_Returns_NULL_If_ML_init_fromjson_fails) { //Arrange CGatewayMocks mocks; STRICT_EXPECTED_CALL(mocks, ModuleLoader_Initialize()); STRICT_EXPECTED_CALL(mocks, ModuleLoader_Destroy()); STRICT_EXPECTED_CALL(mocks, json_parse_file(DUMMY_JSON_PATH)); STRICT_EXPECTED_CALL(mocks, json_value_free(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, gballoc_malloc(sizeof(GATEWAY_PROPERTIES))); STRICT_EXPECTED_CALL(mocks, gballoc_free(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, json_value_get_object(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, json_object_get_value(IGNORED_PTR_ARG, "loaders")) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, ModuleLoader_InitializeFromJson(IGNORED_PTR_ARG)) .IgnoreArgument(1) .SetFailReturn(MODULE_LOADER_ERROR); //Act GATEWAY_HANDLE gateway = Gateway_CreateFromJson(DUMMY_JSON_PATH); //Assert ASSERT_IS_NULL(gateway); mocks.AssertActualAndExpectedCalls(); } /*Tests_SRS_GATEWAY_JSON_14_008: [ This function shall return NULL upon any memory allocation failure. ]*/ TEST_FUNCTION(Gateway_CreateFromJson_Returns_NULL_On_Properties_Malloc_Failure) { //Arrange CGatewayMocks mocks; STRICT_EXPECTED_CALL(mocks, ModuleLoader_Initialize()); STRICT_EXPECTED_CALL(mocks, ModuleLoader_Destroy()); STRICT_EXPECTED_CALL(mocks, json_parse_file(DUMMY_JSON_PATH)); STRICT_EXPECTED_CALL(mocks, json_value_free(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, gballoc_malloc(sizeof(GATEWAY_PROPERTIES))) .SetFailReturn((void*)NULL); //Act GATEWAY_HANDLE gateway = Gateway_CreateFromJson(DUMMY_JSON_PATH); //Assert ASSERT_IS_NULL(gateway); mocks.AssertActualAndExpectedCalls(); } static void setup_2module_gw(CGatewayMocks& mocks, char * path) { STRICT_EXPECTED_CALL(mocks, ModuleLoader_Initialize()); STRICT_EXPECTED_CALL(mocks, json_parse_file(path)); STRICT_EXPECTED_CALL(mocks, gballoc_malloc(sizeof(GATEWAY_PROPERTIES))); STRICT_EXPECTED_CALL(mocks, json_value_get_object(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, json_object_get_value(IGNORED_PTR_ARG, "loaders")) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, ModuleLoader_InitializeFromJson(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, json_object_get_array(IGNORED_PTR_ARG, "modules")) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, json_object_get_array(IGNORED_PTR_ARG, "links")) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, json_array_get_count(IGNORED_PTR_ARG)) .IgnoreArgument(1) .SetReturn(2); STRICT_EXPECTED_CALL(mocks, VECTOR_create(sizeof(GATEWAY_MODULES_ENTRY))); } static void setup_parse_modules_entry(CGatewayMocks& mocks, size_t index, const char * modulename, const char* loadername = "loader1") { STRICT_EXPECTED_CALL(mocks, json_array_get_object(IGNORED_PTR_ARG, index)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, json_object_get_object(IGNORED_PTR_ARG, "loader")) .IgnoreArgument(1) .SetReturn((JSON_Object*)0x42); STRICT_EXPECTED_CALL(mocks, json_object_get_string(IGNORED_PTR_ARG, "name")) .IgnoreArgument(1) .SetReturn(loadername); STRICT_EXPECTED_CALL(mocks, ModuleLoader_FindByName(loadername == NULL ? "native" : "loader1")); STRICT_EXPECTED_CALL(mocks, json_object_get_value(IGNORED_PTR_ARG, "entrypoint")) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, DynamicModuleLoader_ParseEntrypointFromJson(IGNORED_PTR_ARG, IGNORED_PTR_ARG)) .IgnoreArgument(1) .IgnoreArgument(2); STRICT_EXPECTED_CALL(mocks, json_object_get_string(IGNORED_PTR_ARG, "name")) .IgnoreArgument(1) .SetReturn(modulename); STRICT_EXPECTED_CALL(mocks, json_object_get_value(IGNORED_PTR_ARG, "args")) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, json_serialize_to_string(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, VECTOR_push_back(IGNORED_PTR_ARG, IGNORED_PTR_ARG, 1)) .IgnoreArgument(1) .IgnoreArgument(2); } static void setup_links_entry(CGatewayMocks& mocks, size_t index, const char * source, const char * sink) { STRICT_EXPECTED_CALL(mocks, json_array_get_object(IGNORED_PTR_ARG, index)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, json_object_get_string(IGNORED_PTR_ARG, "source")) .IgnoreArgument(1) .SetReturn(source); STRICT_EXPECTED_CALL(mocks, json_object_get_string(IGNORED_PTR_ARG, "sink")) .IgnoreArgument(1) .SetReturn(sink); STRICT_EXPECTED_CALL(mocks, VECTOR_push_back(IGNORED_PTR_ARG, IGNORED_PTR_ARG, 1)) .IgnoreArgument(1) .IgnoreArgument(2); } static void add_a_module(CGatewayMocks& mocks, size_t index) { STRICT_EXPECTED_CALL(mocks, VECTOR_element(IGNORED_PTR_ARG, index)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, VECTOR_find_if(IGNORED_PTR_ARG, IGNORED_PTR_ARG, IGNORED_PTR_ARG)) .IgnoreAllArguments(); STRICT_EXPECTED_CALL(mocks, gballoc_malloc(sizeof(MODULE_DATA))); STRICT_EXPECTED_CALL(mocks, DynamicModuleLoader_Load(IGNORED_PTR_ARG, IGNORED_PTR_ARG)) .IgnoreAllArguments(); STRICT_EXPECTED_CALL(mocks, DynamicModuleLoader_GetModuleApi(IGNORED_PTR_ARG, IGNORED_PTR_ARG)) .IgnoreArgument(1) .IgnoreArgument(2); STRICT_EXPECTED_CALL(mocks, mock_Module_ParseConfigurationFromJson("[serialized string]")); STRICT_EXPECTED_CALL(mocks, DynamicModuleLoader_BuildModuleConfiguration(IGNORED_PTR_ARG, IGNORED_PTR_ARG, IGNORED_PTR_ARG)) .IgnoreAllArguments(); STRICT_EXPECTED_CALL(mocks, mock_Module_Create(IGNORED_PTR_ARG, IGNORED_PTR_ARG)) .IgnoreAllArguments(); STRICT_EXPECTED_CALL(mocks, mock_Module_FreeConfiguration(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, DynamicModuleLoader_FreeModuleConfiguration(IGNORED_PTR_ARG, IGNORED_PTR_ARG)) .IgnoreArgument(1) .IgnoreArgument(2); STRICT_EXPECTED_CALL(mocks, Broker_AddModule(IGNORED_PTR_ARG, IGNORED_PTR_ARG)) .IgnoreArgument(1) .IgnoreArgument(2); EXPECTED_CALL(mocks, mallocAndStrcpy_s(IGNORED_PTR_ARG, IGNORED_PTR_ARG)); STRICT_EXPECTED_CALL(mocks, Broker_IncRef(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, VECTOR_push_back(IGNORED_PTR_ARG, IGNORED_PTR_ARG, 1)) .IgnoreArgument(1) .IgnoreArgument(2); STRICT_EXPECTED_CALL(mocks, VECTOR_back(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, VECTOR_size(IGNORED_PTR_ARG)) .IgnoreArgument(1); } static void add_a_link(CGatewayMocks& mocks, size_t index) { STRICT_EXPECTED_CALL(mocks, VECTOR_element(IGNORED_PTR_ARG, index)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, VECTOR_find_if(IGNORED_PTR_ARG, IGNORED_PTR_ARG, IGNORED_PTR_ARG)) .IgnoreArgument(1) .IgnoreArgument(2) .IgnoreArgument(3); STRICT_EXPECTED_CALL(mocks, VECTOR_find_if(IGNORED_PTR_ARG, IGNORED_PTR_ARG, IGNORED_PTR_ARG)) .IgnoreArgument(1) .IgnoreArgument(2) .IgnoreArgument(3); STRICT_EXPECTED_CALL(mocks, VECTOR_find_if(IGNORED_PTR_ARG, IGNORED_PTR_ARG, IGNORED_PTR_ARG)) .IgnoreArgument(1) .IgnoreArgument(2) .IgnoreArgument(3); STRICT_EXPECTED_CALL(mocks, Broker_AddLink(IGNORED_PTR_ARG, IGNORED_PTR_ARG)) .IgnoreArgument(1) .IgnoreArgument(2); STRICT_EXPECTED_CALL(mocks, VECTOR_push_back(IGNORED_PTR_ARG, IGNORED_PTR_ARG, 1)) .IgnoreArgument(1) .IgnoreArgument(2); } /*Tests_SRS_GATEWAY_JSON_14_008: [ This function shall return NULL upon any memory allocation failure. */ TEST_FUNCTION(Gateway_CreateFromJson_Returns_NULL_on_gateway_create_internal_fail) { //Arrange CGatewayMocks mocks; setup_2module_gw(mocks, (char *)VALID_JSON_PATH); // modules array setup_parse_modules_entry(mocks, 0, "module1"); setup_parse_modules_entry(mocks, 1, "module2"); // links entry STRICT_EXPECTED_CALL(mocks, VECTOR_create(sizeof(GATEWAY_LINK_ENTRY))); STRICT_EXPECTED_CALL(mocks, json_array_get_count(IGNORED_PTR_ARG)) .IgnoreArgument(1) .SetReturn(2); setup_links_entry(mocks, 0, "module1", "module2"); setup_links_entry(mocks, 1, "module2", "module1"); STRICT_EXPECTED_CALL(mocks, gballoc_malloc(sizeof(GATEWAY_HANDLE_DATA))) .SetFailReturn(nullptr); STRICT_EXPECTED_CALL(mocks, json_value_free(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, VECTOR_size(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, VECTOR_element(IGNORED_PTR_ARG, 0)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, json_free_serialized_string((char *)"[serialized string]")); STRICT_EXPECTED_CALL(mocks, VECTOR_element(IGNORED_PTR_ARG, 1)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, json_free_serialized_string((char *)"[serialized string]")); STRICT_EXPECTED_CALL(mocks, VECTOR_destroy(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, VECTOR_destroy(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, gballoc_free(IGNORED_PTR_ARG)) .IgnoreAllArguments(); STRICT_EXPECTED_CALL(mocks, DynamicModuleLoader_FreeEntrypoint(IGNORED_PTR_ARG, IGNORED_PTR_ARG)) .IgnoreArgument(1) .IgnoreArgument(2); STRICT_EXPECTED_CALL(mocks, DynamicModuleLoader_FreeEntrypoint(IGNORED_PTR_ARG, IGNORED_PTR_ARG)) .IgnoreArgument(1) .IgnoreArgument(2); STRICT_EXPECTED_CALL(mocks, ModuleLoader_Destroy()); //Act GATEWAY_HANDLE gateway = Gateway_CreateFromJson(VALID_JSON_PATH); //Assert ASSERT_IS_NULL(gateway); mocks.AssertActualAndExpectedCalls(); } /*Tests_SRS_GATEWAY_JSON_14_002: [The function shall use parson to read the file and parse the JSON string to a parson JSON_Value structure.]*/ /*Tests_SRS_GATEWAY_JSON_17_005: [ The function shall parse the "loading args" for "module path" and fill a DYNAMIC_LOADER_CONFIG structure with the module path information. ]*/ /*Tests_SRS_GATEWAY_JSON_14_004: [The function shall traverse the JSON_Value object to initialize a GATEWAY_PROPERTIES instance.]*/ /*Tests_SRS_GATEWAY_JSON_14_005: [The function shall set the value of const void* module_properties in the GATEWAY_PROPERTIES instance to a char* representing the serialized args value for the particular module.]*/ /*Tests_SRS_GATEWAY_JSON_14_007: [The function shall use the GATEWAY_PROPERTIES instance to create and return a GATEWAY_HANDLE using the lower level API.]*/ /*Tests_SRS_GATEWAY_JSON_04_001: [The function shall create a Vector to Store all links to this gateway.] */ /*Tests_SRS_GATEWAY_JSON_04_002: [The function shall add all modules source and sink to GATEWAY_PROPERTIES inside gateway_links.] */ /*Tests_SRS_GATEWAY_JSON_17_004: [ The function shall set the module loader to the default dynamically linked library module loader. ]*/ /*Tests_SRS_GATEWAY_JSON_17_001: [Upon successful creation, this function shall start the gateway.]*/ /*Tests_SRS_GATEWAY_JSON_17_008: [ The function shall parse the "modules" JSON array for each module entry. ]*/ /*Tests_SRS_GATEWAY_JSON_17_009: [ For each module, the function shall call the loader's ParseEntrypointFromJson function to parse the entrypoint JSON. ]*/ /*Tests_SRS_GATEWAY_JSON_17_011: [ The function shall the loader's BuildModuleConfiguration to construct module input from module's "args" and "loader.entrypoint". ]*/ /*Tests_SRS_GATEWAY_JSON_17_013: [ The function shall parse each modules object for "loader.name" and "loader.entrypoint". ]*/ /*Tests_SRS_GATEWAY_JSON_17_014: [ The function shall find the correct loader by "loader.name". ]*/ TEST_FUNCTION(Gateway_CreateFromJson_Parses_Valid_JSON_Configuration_File) { //Arrange CGatewayMocks mocks; setup_2module_gw(mocks, (char *)VALID_JSON_PATH); // modules array setup_parse_modules_entry(mocks, 0, "module1"); setup_parse_modules_entry(mocks, 1, "module2"); // links entry STRICT_EXPECTED_CALL(mocks, VECTOR_create(sizeof(GATEWAY_LINK_ENTRY))); STRICT_EXPECTED_CALL(mocks, json_array_get_count(IGNORED_PTR_ARG)) .IgnoreArgument(1) .SetReturn(2); setup_links_entry(mocks, 0, "module1", "module2"); setup_links_entry(mocks, 1, "module2", "module1"); STRICT_EXPECTED_CALL(mocks, gballoc_malloc(sizeof(GATEWAY_HANDLE_DATA))); STRICT_EXPECTED_CALL(mocks, Broker_Create()); STRICT_EXPECTED_CALL(mocks, VECTOR_create(sizeof(MODULE_DATA*))); STRICT_EXPECTED_CALL(mocks, VECTOR_create(sizeof(LINK_DATA))); STRICT_EXPECTED_CALL(mocks, VECTOR_size(IGNORED_PTR_ARG)) .IgnoreArgument(1); //Adding module 1 (Success) add_a_module(mocks, 0); //Adding module 2 (Success) add_a_module(mocks, 1); //process the links STRICT_EXPECTED_CALL(mocks, VECTOR_size(IGNORED_PTR_ARG)) .IgnoreArgument(1); add_a_link(mocks, 0); add_a_link(mocks, 1); //Gateway start STRICT_EXPECTED_CALL(mocks, EventSystem_Init()); STRICT_EXPECTED_CALL(mocks, EventSystem_ReportEvent(IGNORED_PTR_ARG, IGNORED_PTR_ARG, GATEWAY_CREATED)) .IgnoreArgument(1) .IgnoreArgument(2); STRICT_EXPECTED_CALL(mocks, EventSystem_ReportEvent(IGNORED_PTR_ARG, IGNORED_PTR_ARG, GATEWAY_MODULE_LIST_CHANGED)) .IgnoreArgument(1) .IgnoreArgument(2); STRICT_EXPECTED_CALL(mocks, Gateway_Start(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, VECTOR_size(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, VECTOR_element(IGNORED_PTR_ARG, 0)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, DynamicModuleLoader_FreeEntrypoint(IGNORED_PTR_ARG, IGNORED_PTR_ARG)) .IgnoreArgument(1) .IgnoreArgument(2); STRICT_EXPECTED_CALL(mocks, json_free_serialized_string((char*)"[serialized string]")); STRICT_EXPECTED_CALL(mocks, VECTOR_element(IGNORED_PTR_ARG, 1)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, DynamicModuleLoader_FreeEntrypoint(IGNORED_PTR_ARG, IGNORED_PTR_ARG)) .IgnoreArgument(1) .IgnoreArgument(2); STRICT_EXPECTED_CALL(mocks, json_free_serialized_string((char*)"[serialized string]")); STRICT_EXPECTED_CALL(mocks, VECTOR_destroy(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, VECTOR_destroy(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, gballoc_free(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, json_value_free(IGNORED_PTR_ARG)) .IgnoreArgument(1); //Act GATEWAY_HANDLE gateway = Gateway_CreateFromJson(VALID_JSON_PATH); //Assert ASSERT_IS_NOT_NULL(gateway); mocks.AssertActualAndExpectedCalls(); //Cleanup gateway_destroy_internal(gateway); } //Tests_SRS_GATEWAY_JSON_17_002: [ This function shall return NULL if starting the gateway fails. ] TEST_FUNCTION(Gateway_Create_Start_fails_returns_null) { //Arrange CGatewayMocks mocks; setup_2module_gw(mocks, (char *)VALID_JSON_PATH); // modules array setup_parse_modules_entry(mocks, 0, "module1"); setup_parse_modules_entry(mocks, 1, "module2"); // links entry STRICT_EXPECTED_CALL(mocks, VECTOR_create(sizeof(GATEWAY_LINK_ENTRY))); STRICT_EXPECTED_CALL(mocks, json_array_get_count(IGNORED_PTR_ARG)) .IgnoreArgument(1) .SetReturn(2); setup_links_entry(mocks, 0, "module1", "module2"); setup_links_entry(mocks, 1, "module2", "module1"); STRICT_EXPECTED_CALL(mocks, gballoc_malloc(sizeof(GATEWAY_HANDLE_DATA))); STRICT_EXPECTED_CALL(mocks, Broker_Create()); STRICT_EXPECTED_CALL(mocks, VECTOR_create(sizeof(MODULE_DATA*))); STRICT_EXPECTED_CALL(mocks, VECTOR_create(sizeof(LINK_DATA))); STRICT_EXPECTED_CALL(mocks, VECTOR_size(IGNORED_PTR_ARG)) .IgnoreArgument(1); //Adding module 1 (Success) add_a_module(mocks, 0); //Adding module 2 (Success) add_a_module(mocks, 1); //process the links STRICT_EXPECTED_CALL(mocks, VECTOR_size(IGNORED_PTR_ARG)) .IgnoreArgument(1); add_a_link(mocks, 0); add_a_link(mocks, 1); STRICT_EXPECTED_CALL(mocks, EventSystem_Init()); STRICT_EXPECTED_CALL(mocks, EventSystem_ReportEvent(IGNORED_PTR_ARG, IGNORED_PTR_ARG, GATEWAY_CREATED)) .IgnoreArgument(1) .IgnoreArgument(2); STRICT_EXPECTED_CALL(mocks, EventSystem_ReportEvent(IGNORED_PTR_ARG, IGNORED_PTR_ARG, GATEWAY_MODULE_LIST_CHANGED)) .IgnoreArgument(1) .IgnoreArgument(2); STRICT_EXPECTED_CALL(mocks, Gateway_Start(IGNORED_PTR_ARG)) .IgnoreArgument(1) .SetFailReturn((GATEWAY_START_RESULT)GATEWAY_START_INVALID_ARGS); STRICT_EXPECTED_CALL(mocks, VECTOR_size(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, VECTOR_element(IGNORED_PTR_ARG,0)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, json_free_serialized_string((char *)"[serialized string]")); STRICT_EXPECTED_CALL(mocks, VECTOR_element(IGNORED_PTR_ARG,1)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, json_free_serialized_string((char *)"[serialized string]")); STRICT_EXPECTED_CALL(mocks, VECTOR_destroy(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, VECTOR_destroy(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, gballoc_free(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, gballoc_free(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, gballoc_free(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, json_value_free(IGNORED_PTR_ARG)) .IgnoreArgument(1); //Cleaning up calls STRICT_EXPECTED_CALL(mocks, EventSystem_ReportEvent(IGNORED_PTR_ARG, IGNORED_PTR_ARG, GATEWAY_DESTROYED)) .IgnoreArgument(1) .IgnoreArgument(2); STRICT_EXPECTED_CALL(mocks, EventSystem_Destroy(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, VECTOR_front(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, VECTOR_front(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, VECTOR_front(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, VECTOR_front(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, VECTOR_size(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, VECTOR_size(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, VECTOR_size(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, VECTOR_size(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, VECTOR_size(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, VECTOR_size(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, Broker_RemoveLink(IGNORED_PTR_ARG,IGNORED_PTR_ARG)) .IgnoreArgument(1) .IgnoreArgument(2); STRICT_EXPECTED_CALL(mocks, Broker_RemoveLink(IGNORED_PTR_ARG,IGNORED_PTR_ARG)) .IgnoreArgument(1) .IgnoreArgument(2); STRICT_EXPECTED_CALL(mocks, VECTOR_erase(IGNORED_PTR_ARG,IGNORED_PTR_ARG, 1)) .IgnoreArgument(1) .IgnoreArgument(2); STRICT_EXPECTED_CALL(mocks, VECTOR_erase(IGNORED_PTR_ARG,IGNORED_PTR_ARG, 1)) .IgnoreArgument(1) .IgnoreArgument(2); STRICT_EXPECTED_CALL(mocks, VECTOR_erase(IGNORED_PTR_ARG,IGNORED_PTR_ARG, 1)) .IgnoreArgument(1) .IgnoreArgument(2); STRICT_EXPECTED_CALL(mocks, VECTOR_erase(IGNORED_PTR_ARG,IGNORED_PTR_ARG, 1)) .IgnoreArgument(1) .IgnoreArgument(2); STRICT_EXPECTED_CALL(mocks, Broker_RemoveModule(IGNORED_PTR_ARG,IGNORED_PTR_ARG)) .IgnoreArgument(1) .IgnoreArgument(2); STRICT_EXPECTED_CALL(mocks, Broker_RemoveModule(IGNORED_PTR_ARG,IGNORED_PTR_ARG)) .IgnoreArgument(1) .IgnoreArgument(2); STRICT_EXPECTED_CALL(mocks, Broker_DecRef(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, Broker_DecRef(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, Broker_Destroy(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, VECTOR_destroy(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, VECTOR_destroy(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, gballoc_free(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, gballoc_free(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, gballoc_free(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, mock_Module_Destroy(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, mock_Module_Destroy(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, DynamicModuleLoader_GetModuleApi(IGNORED_PTR_ARG, IGNORED_PTR_ARG)) .IgnoreArgument(1) .IgnoreArgument(2); STRICT_EXPECTED_CALL(mocks, DynamicModuleLoader_GetModuleApi(IGNORED_PTR_ARG, IGNORED_PTR_ARG)) .IgnoreArgument(1) .IgnoreArgument(2); STRICT_EXPECTED_CALL(mocks, DynamicModuleLoader_Unload(IGNORED_PTR_ARG, IGNORED_PTR_ARG)) .IgnoreArgument(1) .IgnoreArgument(2); STRICT_EXPECTED_CALL(mocks, DynamicModuleLoader_Unload(IGNORED_PTR_ARG, IGNORED_PTR_ARG)) .IgnoreArgument(1) .IgnoreArgument(2); STRICT_EXPECTED_CALL(mocks, DynamicModuleLoader_FreeEntrypoint(IGNORED_PTR_ARG, IGNORED_PTR_ARG)) .IgnoreArgument(1) .IgnoreArgument(2); STRICT_EXPECTED_CALL(mocks, DynamicModuleLoader_FreeEntrypoint(IGNORED_PTR_ARG, IGNORED_PTR_ARG)) .IgnoreArgument(1) .IgnoreArgument(2); STRICT_EXPECTED_CALL(mocks, ModuleLoader_Destroy()); #ifdef OUTPROCESS_ENABLED EXPECTED_CALL(mocks, OutprocessLoader_JoinChildProcesses()); #endif //Act GATEWAY_HANDLE gateway = Gateway_CreateFromJson(VALID_JSON_PATH); //Assert ASSERT_IS_NULL(gateway); mocks.AssertActualAndExpectedCalls(); //Cleanup } /*Tests_SRS_GATEWAY_JSON_14_002: [The function shall use parson to read the file and parse the JSON string to a parson JSON_Value structure.]*/ /*Tests_SRS_GATEWAY_JSON_14_004: [The function shall traverse the JSON_Value object to initialize a GATEWAY_PROPERTIES instance.]*/ /*Tests_SRS_GATEWAY_JSON_14_005: [The function shall set the value of const void* module_properties in the GATEWAY_PROPERTIES instance to a char* representing the serialized args value for the particular module.]*/ /*Tests_SRS_GATEWAY_JSON_14_006: [The function shall return NULL if the JSON_Value contains incomplete information.]*/ TEST_FUNCTION(Gateway_CreateFromJson_Traverses_JSON_Push_Back_Fail) { //Arrange CGatewayMocks mocks; setup_2module_gw(mocks, (char *)VALID_JSON_PATH); // modules array setup_parse_modules_entry(mocks, 0, "module1"); STRICT_EXPECTED_CALL(mocks, json_array_get_object(IGNORED_PTR_ARG, 1)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, json_object_get_object(IGNORED_PTR_ARG, "loader")) .IgnoreArgument(1) .SetReturn((JSON_Object*)0x42); STRICT_EXPECTED_CALL(mocks, json_object_get_string(IGNORED_PTR_ARG, "name")) .IgnoreArgument(1) .SetReturn("loader1"); STRICT_EXPECTED_CALL(mocks, ModuleLoader_FindByName("loader1")); STRICT_EXPECTED_CALL(mocks, json_object_get_value(IGNORED_PTR_ARG, "entrypoint")) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, DynamicModuleLoader_ParseEntrypointFromJson(IGNORED_PTR_ARG, IGNORED_PTR_ARG)) .IgnoreArgument(1) .IgnoreArgument(2); STRICT_EXPECTED_CALL(mocks, json_object_get_string(IGNORED_PTR_ARG, "name")) .IgnoreArgument(1) .SetReturn("Module2"); STRICT_EXPECTED_CALL(mocks, json_object_get_value(IGNORED_PTR_ARG, "args")) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, json_serialize_to_string(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, VECTOR_push_back(IGNORED_PTR_ARG, IGNORED_PTR_ARG, 1)) .IgnoreArgument(1) .IgnoreArgument(2) .SetFailReturn(-1); STRICT_EXPECTED_CALL(mocks, json_free_serialized_string(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, gballoc_free(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, VECTOR_size(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, VECTOR_element(IGNORED_PTR_ARG, 0)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, json_free_serialized_string(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, VECTOR_destroy(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, json_value_free(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, DynamicModuleLoader_FreeEntrypoint(IGNORED_PTR_ARG, IGNORED_PTR_ARG)) .IgnoreArgument(1) .IgnoreArgument(2); STRICT_EXPECTED_CALL(mocks, DynamicModuleLoader_FreeEntrypoint(IGNORED_PTR_ARG, IGNORED_PTR_ARG)) .IgnoreArgument(1) .IgnoreArgument(2); STRICT_EXPECTED_CALL(mocks, ModuleLoader_Destroy()); //Act GATEWAY_HANDLE gateway = Gateway_CreateFromJson(VALID_JSON_PATH); //Assert ASSERT_IS_NULL(gateway); mocks.AssertActualAndExpectedCalls(); } /*Tests_SRS_GATEWAY_JSON_14_006: [The function shall return NULL if the JSON_Value contains incomplete information.]*/ TEST_FUNCTION(Gateway_CreateFromJson_Traverses_JSON_Value_NULL_Modules_Array) { //Arrange CGatewayMocks mocks; STRICT_EXPECTED_CALL(mocks, ModuleLoader_Initialize()); STRICT_EXPECTED_CALL(mocks, json_parse_file(VALID_JSON_PATH)); STRICT_EXPECTED_CALL(mocks, gballoc_malloc(sizeof(GATEWAY_PROPERTIES))); STRICT_EXPECTED_CALL(mocks, json_value_get_object(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, json_object_get_value(IGNORED_PTR_ARG, "loaders")) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, ModuleLoader_InitializeFromJson(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, json_object_get_array(IGNORED_PTR_ARG, "modules")) .IgnoreArgument(1) .SetFailReturn((JSON_Array*)NULL); STRICT_EXPECTED_CALL(mocks, json_object_get_array(IGNORED_PTR_ARG, "links")) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, VECTOR_create(sizeof(GATEWAY_LINK_ENTRY))); STRICT_EXPECTED_CALL(mocks, json_array_get_count(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, VECTOR_destroy(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, json_value_free(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, gballoc_free(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, ModuleLoader_Destroy()); //Act GATEWAY_HANDLE gateway = Gateway_CreateFromJson(VALID_JSON_PATH); //Assert ASSERT_IS_NULL(gateway); mocks.AssertActualAndExpectedCalls(); } /*Tests_SRS_GATEWAY_JSON_14_006: [The function shall return NULL if the JSON_Value contains incomplete information.]*/ TEST_FUNCTION(Gateway_CreateFromJson_Traverses_JSON_Value_NULL_Loaders_Array_success) { //Arrange CGatewayMocks mocks; STRICT_EXPECTED_CALL(mocks, ModuleLoader_Initialize()); STRICT_EXPECTED_CALL(mocks, json_parse_file(VALID_JSON_PATH)); STRICT_EXPECTED_CALL(mocks, gballoc_malloc(sizeof(GATEWAY_PROPERTIES))); STRICT_EXPECTED_CALL(mocks, json_value_get_object(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, json_object_get_value(IGNORED_PTR_ARG, "loaders")) .IgnoreArgument(1) .SetFailReturn(nullptr); STRICT_EXPECTED_CALL(mocks, json_object_get_array(IGNORED_PTR_ARG, "modules")) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, json_object_get_array(IGNORED_PTR_ARG, "links")) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, json_array_get_count(IGNORED_PTR_ARG)) .IgnoreArgument(1) .SetReturn(2); STRICT_EXPECTED_CALL(mocks, VECTOR_create(sizeof(GATEWAY_MODULES_ENTRY))); // modules array setup_parse_modules_entry(mocks, 0, "module1"); setup_parse_modules_entry(mocks, 1, "module2"); // links entry STRICT_EXPECTED_CALL(mocks, VECTOR_create(sizeof(GATEWAY_LINK_ENTRY))); STRICT_EXPECTED_CALL(mocks, json_array_get_count(IGNORED_PTR_ARG)) .IgnoreArgument(1) .SetReturn(2); setup_links_entry(mocks, 0, "module1", "module2"); setup_links_entry(mocks, 1, "module2", "module1"); STRICT_EXPECTED_CALL(mocks, gballoc_malloc(sizeof(GATEWAY_HANDLE_DATA))); STRICT_EXPECTED_CALL(mocks, Broker_Create()); STRICT_EXPECTED_CALL(mocks, VECTOR_create(sizeof(MODULE_DATA*))); STRICT_EXPECTED_CALL(mocks, VECTOR_create(sizeof(LINK_DATA))); STRICT_EXPECTED_CALL(mocks, VECTOR_size(IGNORED_PTR_ARG)) .IgnoreArgument(1); //Adding module 1 (Success) add_a_module(mocks, 0); //Adding module 2 (Success) add_a_module(mocks, 1); //process the links STRICT_EXPECTED_CALL(mocks, VECTOR_size(IGNORED_PTR_ARG)) .IgnoreArgument(1); add_a_link(mocks, 0); add_a_link(mocks, 1); //Gateway start STRICT_EXPECTED_CALL(mocks, EventSystem_Init()); STRICT_EXPECTED_CALL(mocks, EventSystem_ReportEvent(IGNORED_PTR_ARG, IGNORED_PTR_ARG, GATEWAY_CREATED)) .IgnoreArgument(1) .IgnoreArgument(2); STRICT_EXPECTED_CALL(mocks, EventSystem_ReportEvent(IGNORED_PTR_ARG, IGNORED_PTR_ARG, GATEWAY_MODULE_LIST_CHANGED)) .IgnoreArgument(1) .IgnoreArgument(2); STRICT_EXPECTED_CALL(mocks, Gateway_Start(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, VECTOR_size(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, VECTOR_element(IGNORED_PTR_ARG, 0)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, DynamicModuleLoader_FreeEntrypoint(IGNORED_PTR_ARG, IGNORED_PTR_ARG)) .IgnoreArgument(1) .IgnoreArgument(2); STRICT_EXPECTED_CALL(mocks, json_free_serialized_string((char *)"[serialized string]")); STRICT_EXPECTED_CALL(mocks, VECTOR_element(IGNORED_PTR_ARG, 1)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, DynamicModuleLoader_FreeEntrypoint(IGNORED_PTR_ARG, IGNORED_PTR_ARG)) .IgnoreArgument(1) .IgnoreArgument(2); STRICT_EXPECTED_CALL(mocks, json_free_serialized_string((char *)"[serialized string]")); STRICT_EXPECTED_CALL(mocks, VECTOR_destroy(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, VECTOR_destroy(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, gballoc_free(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, json_value_free(IGNORED_PTR_ARG)) .IgnoreArgument(1); //Act GATEWAY_HANDLE gateway = Gateway_CreateFromJson(VALID_JSON_PATH); //Assert ASSERT_IS_NOT_NULL(gateway); mocks.AssertActualAndExpectedCalls(); //Cleanup gateway_destroy_internal(gateway); } /*Tests_SRS_GATEWAY_JSON_14_006: [The function shall return NULL if the JSON_Value contains incomplete information.]*/ TEST_FUNCTION(Gateway_CreateFromJson_Traverses_JSON_Value_ML_fail) { //Arrange CGatewayMocks mocks; STRICT_EXPECTED_CALL(mocks, ModuleLoader_Initialize()); STRICT_EXPECTED_CALL(mocks, json_parse_file(VALID_JSON_PATH)); STRICT_EXPECTED_CALL(mocks, gballoc_malloc(sizeof(GATEWAY_PROPERTIES))); STRICT_EXPECTED_CALL(mocks, json_value_get_object(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, json_object_get_value(IGNORED_PTR_ARG, "loaders")) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, ModuleLoader_InitializeFromJson(IGNORED_PTR_ARG)) .IgnoreArgument(1) .SetFailReturn(MODULE_LOADER_ERROR); STRICT_EXPECTED_CALL(mocks, json_value_free(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, gballoc_free(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, ModuleLoader_Destroy()); //Act GATEWAY_HANDLE gateway = Gateway_CreateFromJson(VALID_JSON_PATH); //Assert ASSERT_IS_NULL(gateway); mocks.AssertActualAndExpectedCalls(); } /*Tests_SRS_GATEWAY_JSON_14_008: [This function shall return NULL upon any memory allocation failure.]*/ TEST_FUNCTION(Gateway_CreateFromJson_Traverses_JSON_Value_VECTOR_Create_Fail) { //Arrange CGatewayMocks mocks; STRICT_EXPECTED_CALL(mocks, ModuleLoader_Initialize()); STRICT_EXPECTED_CALL(mocks, json_parse_file(VALID_JSON_PATH)); STRICT_EXPECTED_CALL(mocks, gballoc_malloc(sizeof(GATEWAY_PROPERTIES))); STRICT_EXPECTED_CALL(mocks, json_value_get_object(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, json_object_get_value(IGNORED_PTR_ARG, "loaders")) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, ModuleLoader_InitializeFromJson(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, json_object_get_array(IGNORED_PTR_ARG, "modules")) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, json_object_get_array(IGNORED_PTR_ARG, "links")) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, VECTOR_create(sizeof(GATEWAY_MODULES_ENTRY))) .SetFailReturn((VECTOR_HANDLE)NULL); STRICT_EXPECTED_CALL(mocks, json_value_free(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, gballoc_free(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, ModuleLoader_Destroy()); //Act GATEWAY_HANDLE gateway = Gateway_CreateFromJson(VALID_JSON_PATH); //Assert ASSERT_IS_NULL(gateway); mocks.AssertActualAndExpectedCalls(); } /*Tests_SRS_GATEWAY_JSON_14_008: [This function shall return NULL upon any memory allocation failure.]*/ TEST_FUNCTION(Gateway_CreateFromJson_Traverses_JSON_Value_VECTOR_Create_for_links_Fail) { //Arrange CGatewayMocks mocks; setup_2module_gw(mocks, (char*)VALID_JSON_PATH); setup_parse_modules_entry(mocks, 0, "module0"); setup_parse_modules_entry(mocks, 1, "module0"); STRICT_EXPECTED_CALL(mocks, VECTOR_create(sizeof(GATEWAY_LINK_ENTRY))) .SetFailReturn((VECTOR_HANDLE)NULL); STRICT_EXPECTED_CALL(mocks, VECTOR_size(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, VECTOR_element(IGNORED_PTR_ARG, 0)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, json_free_serialized_string(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, VECTOR_element(IGNORED_PTR_ARG, 1)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, json_free_serialized_string(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, VECTOR_destroy(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, json_value_free(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, gballoc_free(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, DynamicModuleLoader_FreeEntrypoint(IGNORED_PTR_ARG, IGNORED_PTR_ARG)) .IgnoreArgument(1) .IgnoreArgument(2); STRICT_EXPECTED_CALL(mocks, DynamicModuleLoader_FreeEntrypoint(IGNORED_PTR_ARG, IGNORED_PTR_ARG)) .IgnoreArgument(1) .IgnoreArgument(2); STRICT_EXPECTED_CALL(mocks, ModuleLoader_Destroy()); //Act GATEWAY_HANDLE gateway = Gateway_CreateFromJson(VALID_JSON_PATH); //Assert ASSERT_IS_NULL(gateway); mocks.AssertActualAndExpectedCalls(); } /*Tests_SRS_GATEWAY_JSON_14_004: [The function shall traverse the JSON_Value object to initialize a GATEWAY_PROPERTIES instance.]*/ /*Tests_SRS_GATEWAY_JSON_14_006: [The function shall return NULL if the JSON_Value contains incomplete information.]*/ TEST_FUNCTION(Gateway_CreateFromJson_Traverses_JSON_Value_NULL_Root_Value_Failure) { //Arrange CGatewayMocks mocks; STRICT_EXPECTED_CALL(mocks, ModuleLoader_Initialize()); STRICT_EXPECTED_CALL(mocks, json_parse_file(DUMMY_JSON_PATH)); STRICT_EXPECTED_CALL(mocks, gballoc_malloc(sizeof(GATEWAY_PROPERTIES))); STRICT_EXPECTED_CALL(mocks, json_value_get_object(IGNORED_PTR_ARG)) .IgnoreArgument(1) .SetFailReturn((JSON_Object*)NULL); STRICT_EXPECTED_CALL(mocks, json_value_free(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, gballoc_free(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, ModuleLoader_Destroy()); //Act GATEWAY_HANDLE gateway = Gateway_CreateFromJson(DUMMY_JSON_PATH); //Assert ASSERT_IS_NULL(gateway); mocks.AssertActualAndExpectedCalls(); //Cleanup Gateway_Destroy(gateway); } /*Tests_SRS_GATEWAY_JSON_14_006: [The function shall return NULL if the JSON_Value contains incomplete information.]*/ TEST_FUNCTION(Gateway_CreateFromJson_Fails_For_Missing_Info_In_JSON_Configuration) { //Arrange CGatewayMocks mocks; setup_2module_gw(mocks, (char*)MISSING_INFO_JSON_PATH); STRICT_EXPECTED_CALL(mocks, json_array_get_object(IGNORED_PTR_ARG, 0)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, json_object_get_object(IGNORED_PTR_ARG, "loader")) .IgnoreArgument(1) .SetReturn((JSON_Object*)0x42); STRICT_EXPECTED_CALL(mocks, json_object_get_string(IGNORED_PTR_ARG, "name")) .IgnoreArgument(1) .SetReturn("loader1"); STRICT_EXPECTED_CALL(mocks, ModuleLoader_FindByName("loader1")); STRICT_EXPECTED_CALL(mocks, json_object_get_value(IGNORED_PTR_ARG, "entrypoint")) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, DynamicModuleLoader_ParseEntrypointFromJson(IGNORED_PTR_ARG, IGNORED_PTR_ARG)) .IgnoreArgument(1) .IgnoreArgument(2); STRICT_EXPECTED_CALL(mocks, json_object_get_string(IGNORED_PTR_ARG, "name")) .IgnoreArgument(1) .SetReturn((char*)NULL); STRICT_EXPECTED_CALL(mocks, VECTOR_size(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, VECTOR_destroy(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, json_value_free(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, gballoc_free(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, DynamicModuleLoader_FreeEntrypoint(IGNORED_PTR_ARG, IGNORED_PTR_ARG)) .IgnoreArgument(1) .IgnoreArgument(2); STRICT_EXPECTED_CALL(mocks, ModuleLoader_Destroy()); //Act GATEWAY_HANDLE gateway = Gateway_CreateFromJson(MISSING_INFO_JSON_PATH); //Assert ASSERT_IS_NULL(gateway); mocks.AssertActualAndExpectedCalls(); } //Tests_SRS_GATEWAY_JSON_13_001: [ If loader.name is not found in the JSON then the gateway assumes that the loader name is native. ] TEST_FUNCTION(Gateway_CreateFromJson_uses_native_loader_when_loader_name_is_missing) { //Arrange CGatewayMocks mocks; setup_2module_gw(mocks, (char*)VALID_JSON_PATH); // modules array setup_parse_modules_entry(mocks, 0, "module1", NULL); setup_parse_modules_entry(mocks, 1, "module2", NULL); // links entry STRICT_EXPECTED_CALL(mocks, VECTOR_create(sizeof(GATEWAY_LINK_ENTRY))); STRICT_EXPECTED_CALL(mocks, json_array_get_count(IGNORED_PTR_ARG)) .IgnoreArgument(1) .SetReturn(2); setup_links_entry(mocks, 0, "module1", "module2"); setup_links_entry(mocks, 1, "module2", "module1"); STRICT_EXPECTED_CALL(mocks, gballoc_malloc(sizeof(GATEWAY_HANDLE_DATA))); STRICT_EXPECTED_CALL(mocks, Broker_Create()); STRICT_EXPECTED_CALL(mocks, VECTOR_create(sizeof(MODULE_DATA*))); STRICT_EXPECTED_CALL(mocks, VECTOR_create(sizeof(LINK_DATA))); STRICT_EXPECTED_CALL(mocks, VECTOR_size(IGNORED_PTR_ARG)) .IgnoreArgument(1); //Adding module 1 (Success) add_a_module(mocks, 0); //Adding module 2 (Success) add_a_module(mocks, 1); //process the links STRICT_EXPECTED_CALL(mocks, VECTOR_size(IGNORED_PTR_ARG)) .IgnoreArgument(1); add_a_link(mocks, 0); add_a_link(mocks, 1); //Gateway start STRICT_EXPECTED_CALL(mocks, EventSystem_Init()); STRICT_EXPECTED_CALL(mocks, EventSystem_ReportEvent(IGNORED_PTR_ARG, IGNORED_PTR_ARG, GATEWAY_CREATED)) .IgnoreArgument(1) .IgnoreArgument(2); STRICT_EXPECTED_CALL(mocks, EventSystem_ReportEvent(IGNORED_PTR_ARG, IGNORED_PTR_ARG, GATEWAY_MODULE_LIST_CHANGED)) .IgnoreArgument(1) .IgnoreArgument(2); STRICT_EXPECTED_CALL(mocks, Gateway_Start(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, VECTOR_size(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, VECTOR_element(IGNORED_PTR_ARG, 0)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, DynamicModuleLoader_FreeEntrypoint(IGNORED_PTR_ARG, IGNORED_PTR_ARG)) .IgnoreArgument(1) .IgnoreArgument(2); STRICT_EXPECTED_CALL(mocks, json_free_serialized_string((char *)"[serialized string]")); STRICT_EXPECTED_CALL(mocks, VECTOR_element(IGNORED_PTR_ARG, 1)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, DynamicModuleLoader_FreeEntrypoint(IGNORED_PTR_ARG, IGNORED_PTR_ARG)) .IgnoreArgument(1) .IgnoreArgument(2); STRICT_EXPECTED_CALL(mocks, json_free_serialized_string((char *)"[serialized string]")); STRICT_EXPECTED_CALL(mocks, VECTOR_destroy(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, VECTOR_destroy(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, gballoc_free(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, json_value_free(IGNORED_PTR_ARG)) .IgnoreArgument(1); //Act GATEWAY_HANDLE gateway = Gateway_CreateFromJson(VALID_JSON_PATH); //Assert ASSERT_IS_NOT_NULL(gateway); mocks.AssertActualAndExpectedCalls(); //Cleanup gateway_destroy_internal(gateway); } /*Tests_SRS_GATEWAY_JSON_17_010: [ If the module's loader is not found by name, the the function shall fail and return NULL. ]*/ TEST_FUNCTION(Gateway_CreateFromJson_Fails_For_not_finding_loader) { //Arrange CGatewayMocks mocks; setup_2module_gw(mocks, (char*)MISSING_INFO_JSON_PATH); STRICT_EXPECTED_CALL(mocks, json_array_get_object(IGNORED_PTR_ARG, 0)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, json_object_get_object(IGNORED_PTR_ARG, "loader")) .IgnoreArgument(1) .SetReturn((JSON_Object*)0x42); STRICT_EXPECTED_CALL(mocks, json_object_get_string(IGNORED_PTR_ARG, "name")) .IgnoreArgument(1) .SetReturn("loader1"); STRICT_EXPECTED_CALL(mocks, ModuleLoader_FindByName("loader1")) .SetFailReturn( (MODULE_LOADER*)NULL); STRICT_EXPECTED_CALL(mocks, VECTOR_size(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, VECTOR_destroy(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, json_value_free(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, gballoc_free(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, ModuleLoader_Destroy()); //Act GATEWAY_HANDLE gateway = Gateway_CreateFromJson(MISSING_INFO_JSON_PATH); //Assert ASSERT_IS_NULL(gateway); mocks.AssertActualAndExpectedCalls(); } /*Tests_SRS_GATEWAY_JSON_14_006: [The function shall return NULL if the JSON_Value contains incomplete information.]*/ TEST_FUNCTION(Gateway_CreateFromJson_fails_with_no_entry_point) { //Arrange CGatewayMocks mocks; setup_2module_gw(mocks, (char*)VALID_JSON_PATH); // modules array STRICT_EXPECTED_CALL(mocks, json_array_get_object(IGNORED_PTR_ARG, 0)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, json_object_get_object(IGNORED_PTR_ARG, "loader")) .IgnoreArgument(1) .SetReturn((JSON_Object*)0x42); STRICT_EXPECTED_CALL(mocks, json_object_get_string(IGNORED_PTR_ARG, "name")) .IgnoreArgument(1) .SetReturn("loader1"); STRICT_EXPECTED_CALL(mocks, ModuleLoader_FindByName("loader1")); STRICT_EXPECTED_CALL(mocks, json_object_get_value(IGNORED_PTR_ARG, "entrypoint")) .IgnoreArgument(1) .SetFailReturn(nullptr); STRICT_EXPECTED_CALL(mocks, json_object_get_string(IGNORED_PTR_ARG, "name")) .IgnoreArgument(1) .SetReturn("module1"); STRICT_EXPECTED_CALL(mocks, json_object_get_value(IGNORED_PTR_ARG, "args")) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, json_serialize_to_string(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, VECTOR_push_back(IGNORED_PTR_ARG, IGNORED_PTR_ARG, 1)) .IgnoreArgument(1) .IgnoreArgument(2); setup_parse_modules_entry(mocks, 1, "module2"); // links entry STRICT_EXPECTED_CALL(mocks, VECTOR_create(sizeof(GATEWAY_LINK_ENTRY))); STRICT_EXPECTED_CALL(mocks, json_array_get_count(IGNORED_PTR_ARG)) .IgnoreArgument(1) .SetReturn(2); setup_links_entry(mocks, 0, "module1", "module2"); setup_links_entry(mocks, 1, "module2", "module1"); // Create gateway until 1st module fails immediately STRICT_EXPECTED_CALL(mocks, gballoc_malloc(sizeof(GATEWAY_HANDLE_DATA))); STRICT_EXPECTED_CALL(mocks, Broker_Create()); STRICT_EXPECTED_CALL(mocks, VECTOR_create(sizeof(MODULE_DATA*))); STRICT_EXPECTED_CALL(mocks, VECTOR_create(sizeof(LINK_DATA))); STRICT_EXPECTED_CALL(mocks, VECTOR_size(IGNORED_PTR_ARG)) .IgnoreArgument(1); //tear down. STRICT_EXPECTED_CALL(mocks, VECTOR_size(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, VECTOR_size(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, VECTOR_destroy(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, VECTOR_destroy(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, Broker_Destroy(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, VECTOR_size(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, VECTOR_element(IGNORED_PTR_ARG, 0)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, VECTOR_element(IGNORED_PTR_ARG, 0)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, DynamicModuleLoader_FreeEntrypoint(IGNORED_PTR_ARG, IGNORED_PTR_ARG)) .IgnoreArgument(1) .IgnoreArgument(2); STRICT_EXPECTED_CALL(mocks, json_free_serialized_string((char *)"[serialized string]")); STRICT_EXPECTED_CALL(mocks, VECTOR_element(IGNORED_PTR_ARG, 1)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, DynamicModuleLoader_FreeEntrypoint(IGNORED_PTR_ARG, IGNORED_PTR_ARG)) .IgnoreArgument(1) .IgnoreArgument(2); STRICT_EXPECTED_CALL(mocks, json_free_serialized_string((char *)"[serialized string]")); STRICT_EXPECTED_CALL(mocks, VECTOR_destroy(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, VECTOR_destroy(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, gballoc_free(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, gballoc_free(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, json_value_free(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, ModuleLoader_Destroy()); #ifdef OUTPROCESS_ENABLED EXPECTED_CALL(mocks, OutprocessLoader_JoinChildProcesses()); #endif //Act GATEWAY_HANDLE gateway = Gateway_CreateFromJson(VALID_JSON_PATH); //Assert ASSERT_IS_NULL(gateway); mocks.AssertActualAndExpectedCalls(); //Cleanup gateway_destroy_internal(gateway); } /*Tests_SRS_GATEWAY_JSON_14_006: [The function shall return NULL if the JSON_Value contains incomplete information.]*/ TEST_FUNCTION(Gateway_CreateFromJson_Fails_For_not_parsing_loader_entrypoint) { //Arrange CGatewayMocks mocks; setup_2module_gw(mocks, (char*)MISSING_INFO_JSON_PATH); STRICT_EXPECTED_CALL(mocks, json_array_get_object(IGNORED_PTR_ARG, 0)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, json_object_get_object(IGNORED_PTR_ARG, "loader")) .IgnoreArgument(1) .SetReturn((JSON_Object*)0x42); STRICT_EXPECTED_CALL(mocks, json_object_get_string(IGNORED_PTR_ARG, "name")) .IgnoreArgument(1) .SetReturn("loader1"); STRICT_EXPECTED_CALL(mocks, ModuleLoader_FindByName("loader1")); STRICT_EXPECTED_CALL(mocks, json_object_get_value(IGNORED_PTR_ARG, "entrypoint")) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, DynamicModuleLoader_ParseEntrypointFromJson(IGNORED_PTR_ARG, IGNORED_PTR_ARG)) .IgnoreArgument(1) .IgnoreArgument(2) .SetFailReturn(nullptr); STRICT_EXPECTED_CALL(mocks, VECTOR_size(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, VECTOR_destroy(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, json_value_free(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, gballoc_free(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, ModuleLoader_Destroy()); //Act GATEWAY_HANDLE gateway = Gateway_CreateFromJson(MISSING_INFO_JSON_PATH); //Assert ASSERT_IS_NULL(gateway); mocks.AssertActualAndExpectedCalls(); } /*Tests_SRS_GATEWAY_JSON_14_006: [ The function shall return NULL if the JSON_Value contains incomplete information. ]*/ TEST_FUNCTION(Gateway_CreateFromJson_Fails_links_parsing_no_source) { //Arrange CGatewayMocks mocks; setup_2module_gw(mocks, (char*)VALID_JSON_PATH); // modules array setup_parse_modules_entry(mocks, 0, "module1"); setup_parse_modules_entry(mocks, 1, "module2"); // links entry STRICT_EXPECTED_CALL(mocks, VECTOR_create(sizeof(GATEWAY_LINK_ENTRY))); STRICT_EXPECTED_CALL(mocks, json_array_get_count(IGNORED_PTR_ARG)) .IgnoreArgument(1) .SetReturn(2); setup_links_entry(mocks, 0, "module1", "module2"); STRICT_EXPECTED_CALL(mocks, json_array_get_object(IGNORED_PTR_ARG, 1)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, json_object_get_string(IGNORED_PTR_ARG, "source")) .IgnoreArgument(1) .SetReturn(nullptr); STRICT_EXPECTED_CALL(mocks, json_object_get_string(IGNORED_PTR_ARG, "sink")) .IgnoreArgument(1) .SetReturn("module1"); STRICT_EXPECTED_CALL(mocks, VECTOR_size(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, VECTOR_element(IGNORED_PTR_ARG, 0)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, DynamicModuleLoader_FreeEntrypoint(IGNORED_PTR_ARG, IGNORED_PTR_ARG)) .IgnoreArgument(1) .IgnoreArgument(2); STRICT_EXPECTED_CALL(mocks, json_free_serialized_string((char *)"[serialized string]")); STRICT_EXPECTED_CALL(mocks, VECTOR_element(IGNORED_PTR_ARG, 1)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, DynamicModuleLoader_FreeEntrypoint(IGNORED_PTR_ARG, IGNORED_PTR_ARG)) .IgnoreArgument(1) .IgnoreArgument(2); STRICT_EXPECTED_CALL(mocks, json_free_serialized_string((char *)"[serialized string]")); STRICT_EXPECTED_CALL(mocks, VECTOR_destroy(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, VECTOR_destroy(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, json_value_free(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, gballoc_free(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, ModuleLoader_Destroy()); //Act GATEWAY_HANDLE gateway = Gateway_CreateFromJson(VALID_JSON_PATH); //Assert ASSERT_IS_NULL(gateway); mocks.AssertActualAndExpectedCalls(); } /*Tests_SRS_GATEWAY_JSON_14_008: [ This function shall return NULL upon any memory allocation failure. ]*/ TEST_FUNCTION(Gateway_CreateFromJson_Fails_links_parsing_pushback_fails) { //Arrange CGatewayMocks mocks; setup_2module_gw(mocks, (char*)VALID_JSON_PATH); // modules array setup_parse_modules_entry(mocks, 0, "module1"); setup_parse_modules_entry(mocks, 1, "module2"); // links entry STRICT_EXPECTED_CALL(mocks, VECTOR_create(sizeof(GATEWAY_LINK_ENTRY))); STRICT_EXPECTED_CALL(mocks, json_array_get_count(IGNORED_PTR_ARG)) .IgnoreArgument(1) .SetReturn(2); setup_links_entry(mocks, 0, "module1", "module2"); STRICT_EXPECTED_CALL(mocks, json_array_get_object(IGNORED_PTR_ARG, 1)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, json_object_get_string(IGNORED_PTR_ARG, "source")) .IgnoreArgument(1) .SetReturn("module2"); STRICT_EXPECTED_CALL(mocks, json_object_get_string(IGNORED_PTR_ARG, "sink")) .IgnoreArgument(1) .SetReturn("module1"); STRICT_EXPECTED_CALL(mocks, VECTOR_push_back(IGNORED_PTR_ARG, IGNORED_PTR_ARG, 1)) .IgnoreArgument(1) .IgnoreArgument(2) .SetFailReturn(1); STRICT_EXPECTED_CALL(mocks, VECTOR_size(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, VECTOR_element(IGNORED_PTR_ARG, 0)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, DynamicModuleLoader_FreeEntrypoint(IGNORED_PTR_ARG, IGNORED_PTR_ARG)) .IgnoreArgument(1) .IgnoreArgument(2); STRICT_EXPECTED_CALL(mocks, json_free_serialized_string((char *)"[serialized string]")); STRICT_EXPECTED_CALL(mocks, VECTOR_element(IGNORED_PTR_ARG, 1)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, DynamicModuleLoader_FreeEntrypoint(IGNORED_PTR_ARG, IGNORED_PTR_ARG)) .IgnoreArgument(1) .IgnoreArgument(2); STRICT_EXPECTED_CALL(mocks, json_free_serialized_string((char *)"[serialized string]")); STRICT_EXPECTED_CALL(mocks, VECTOR_destroy(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, VECTOR_destroy(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, json_value_free(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, gballoc_free(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, ModuleLoader_Destroy()); //Act GATEWAY_HANDLE gateway = Gateway_CreateFromJson(VALID_JSON_PATH); //Assert ASSERT_IS_NULL(gateway); mocks.AssertActualAndExpectedCalls(); } /* Tests_SRS_GATEWAY_JSON_04_003: [ If json_content is NULL the function shall return error. ] */ TEST_FUNCTION(Gateway_UpdateFromJson_Returns_nonZero_For_NULL_JSON_Input) { //Arrange CGatewayMocks mocks; GATEWAY_HANDLE gateway = Gateway_Create(NULL); mocks.ResetAllCalls(); //Act int result = Gateway_UpdateFromJson(gateway, NULL); //Assert ASSERT_ARE_NOT_EQUAL(int, 0, result); } /* Tests_SRS_GATEWAY_JSON_04_004: [ If gw is NULL the function shall return error. ] */ TEST_FUNCTION(Gateway_UpdateFromJson_Returns_nonZero_For_NULL_gw_Input) { //Arrange //Act int result = Gateway_UpdateFromJson(NULL, (const char*)"AnyThing"); //Assert ASSERT_ARE_NOT_EQUAL(int, 0, result); } /* Tests_SRS_GATEWAY_JSON_04_005: [ The function shall use parson to parse the JSON string to a parson JSON_Value structure. ] */ /* Tests_SRS_GATEWAY_JSON_04_006: [ The function shall return error if the JSON content could not be parsed to a JSON_Value. ] */ TEST_FUNCTION(Gateway_UpdateFromJson_parse_string_fail_fail) { //Arrange CGatewayMocks mocks; GATEWAY_HANDLE gateway = Gateway_Create(NULL); mocks.ResetAllCalls(); STRICT_EXPECTED_CALL(mocks, json_parse_string(IGNORED_PTR_ARG)) .IgnoreAllArguments() .SetFailReturn((JSON_Value*)NULL); //Act int result = Gateway_UpdateFromJson(gateway, (const char*)"AnyThing"); //Assert ASSERT_ARE_NOT_EQUAL(int, 0, result); } /* Tests_SRS_GATEWAY_JSON_04_008: [ This function shall return error upon any memory allocation failure. ] */ TEST_FUNCTION(Gateway_UpdateFromJson_gateway_property_malloc_fail_fail) { //Arrange CGatewayMocks mocks; GATEWAY_HANDLE gateway = Gateway_Create(NULL); mocks.ResetAllCalls(); STRICT_EXPECTED_CALL(mocks, json_parse_string(IGNORED_PTR_ARG)) .IgnoreAllArguments(); STRICT_EXPECTED_CALL(mocks, json_value_free(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, gballoc_malloc(sizeof(GATEWAY_PROPERTIES))) .SetFailReturn((void*)NULL); //Act int result = Gateway_UpdateFromJson(gateway, (const char*)"AnyThing"); //Assert ASSERT_ARE_NOT_EQUAL(int, 0, result); } /* Tests_SRS_GATEWAY_JSON_04_007: [ The function shall traverse the JSON_Value object to initialize a GATEWAY_PROPERTIES instance. ] */ /* Tests_SRS_GATEWAY_JSON_04_010: [ The function shall return error if the JSON_Value contains incomplete information. ] */ /* Tests_SRS_GATEWAY_JSON_04_009: [ The function shall be able to roll back previous operation if any module or link fails to be added. ] */ TEST_FUNCTION(Gateway_UpdateFromJson_parse_json_internal_json_value_get_object_fail_fail) { //Arrange CGatewayMocks mocks; GATEWAY_HANDLE gateway = Gateway_Create(NULL); mocks.ResetAllCalls(); STRICT_EXPECTED_CALL(mocks, json_parse_string(IGNORED_PTR_ARG)) .IgnoreAllArguments(); STRICT_EXPECTED_CALL(mocks, json_value_free(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, gballoc_malloc(sizeof(GATEWAY_PROPERTIES))); STRICT_EXPECTED_CALL(mocks, json_value_get_object(IGNORED_PTR_ARG)) .IgnoreAllArguments() .SetFailReturn((JSON_Object*)NULL); STRICT_EXPECTED_CALL(mocks, gballoc_free(IGNORED_PTR_ARG)) .IgnoreAllArguments(); //Act int result = Gateway_UpdateFromJson(gateway, (const char*)"AnyThing"); //Assert ASSERT_ARE_NOT_EQUAL(int, 0, result); } static void setup_2module_update_gw(CGatewayMocks& mocks, char * json_content) { STRICT_EXPECTED_CALL(mocks, json_parse_string(json_content)); STRICT_EXPECTED_CALL(mocks, gballoc_malloc(sizeof(GATEWAY_PROPERTIES))); STRICT_EXPECTED_CALL(mocks, json_value_get_object(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, json_object_get_value(IGNORED_PTR_ARG, "loaders")) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, ModuleLoader_InitializeFromJson(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, json_object_get_array(IGNORED_PTR_ARG, "modules")) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, json_object_get_array(IGNORED_PTR_ARG, "links")) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, VECTOR_create(sizeof(GATEWAY_MODULES_ENTRY))); STRICT_EXPECTED_CALL(mocks, json_array_get_count(IGNORED_PTR_ARG)) .IgnoreArgument(1) .SetReturn(2); } /* Tests_SRS_GATEWAY_JSON_04_007: [ The function shall traverse the JSON_Value object to initialize a GATEWAY_PROPERTIES instance. ] */ TEST_FUNCTION(Gateway_UpdateFromJson_Parses_Valid_JSON_Configuration_File_Succeed) { //Arrange CGatewayMocks mocks; GATEWAY_HANDLE gateway = Gateway_Create(NULL); mocks.ResetAllCalls(); setup_2module_update_gw(mocks, (char *)VALID_JSON_CONTENT); //// modules array setup_parse_modules_entry(mocks, 0, "module1"); setup_parse_modules_entry(mocks, 1, "module2"); //// links entry STRICT_EXPECTED_CALL(mocks, VECTOR_create(sizeof(GATEWAY_LINK_ENTRY))); STRICT_EXPECTED_CALL(mocks, json_array_get_count(IGNORED_PTR_ARG)) .IgnoreArgument(1) .SetReturn(2); setup_links_entry(mocks, 0, "module1", "module2"); setup_links_entry(mocks, 1, "module2", "module1"); //Vector to track the successfull added link. STRICT_EXPECTED_CALL(mocks, VECTOR_create(sizeof(GATEWAY_MODULES_ENTRY))); STRICT_EXPECTED_CALL(mocks, VECTOR_create(sizeof(GATEWAY_LINK_ENTRY))); STRICT_EXPECTED_CALL(mocks, VECTOR_size(IGNORED_PTR_ARG)) .IgnoreArgument(1); //Adding module 1 (Success) add_a_module(mocks, 0); STRICT_EXPECTED_CALL(mocks, VECTOR_push_back(IGNORED_PTR_ARG, IGNORED_PTR_ARG, 1)) .IgnoreArgument(1) .IgnoreArgument(2); //Adding module 2 (Success) add_a_module(mocks, 1); STRICT_EXPECTED_CALL(mocks, VECTOR_push_back(IGNORED_PTR_ARG, IGNORED_PTR_ARG, 1)) .IgnoreArgument(1) .IgnoreArgument(2); ////process the links STRICT_EXPECTED_CALL(mocks, VECTOR_size(IGNORED_PTR_ARG)) .IgnoreArgument(1); add_a_link(mocks, 0); STRICT_EXPECTED_CALL(mocks, VECTOR_push_back(IGNORED_PTR_ARG, IGNORED_PTR_ARG, 1)) .IgnoreArgument(1) .IgnoreArgument(2); add_a_link(mocks, 1); STRICT_EXPECTED_CALL(mocks, VECTOR_push_back(IGNORED_PTR_ARG, IGNORED_PTR_ARG, 1)) .IgnoreArgument(1) .IgnoreArgument(2); STRICT_EXPECTED_CALL(mocks, VECTOR_destroy(IGNORED_PTR_ARG)) .IgnoreArgument(1); //Successfull Modules STRICT_EXPECTED_CALL(mocks, VECTOR_destroy(IGNORED_PTR_ARG)) .IgnoreArgument(1); //Successfull Links STRICT_EXPECTED_CALL(mocks, VECTOR_size(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, VECTOR_element(IGNORED_PTR_ARG, 0)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, DynamicModuleLoader_FreeEntrypoint(IGNORED_PTR_ARG, IGNORED_PTR_ARG)) .IgnoreArgument(1) .IgnoreArgument(2); STRICT_EXPECTED_CALL(mocks, json_free_serialized_string((char*)"[serialized string]")); STRICT_EXPECTED_CALL(mocks, VECTOR_element(IGNORED_PTR_ARG, 1)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, DynamicModuleLoader_FreeEntrypoint(IGNORED_PTR_ARG, IGNORED_PTR_ARG)) .IgnoreArgument(1) .IgnoreArgument(2); STRICT_EXPECTED_CALL(mocks, json_free_serialized_string((char*)"[serialized string]")); STRICT_EXPECTED_CALL(mocks, VECTOR_destroy(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, VECTOR_destroy(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, gballoc_free(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, json_value_free(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, EventSystem_ReportEvent(IGNORED_PTR_ARG, IGNORED_PTR_ARG, GATEWAY_MODULE_LIST_CHANGED)) .IgnoreArgument(1) .IgnoreArgument(2); //Act int result = Gateway_UpdateFromJson(gateway, (const char*)"validJsonContent"); //Assert ASSERT_ARE_EQUAL(int, 0, result); mocks.AssertActualAndExpectedCalls(); //Cleanup gateway_destroy_internal(gateway); } /* Tests_SRS_GATEWAY_JSON_04_011: [ The function shall be able to add just `modules`, just `links` or both. ] */ TEST_FUNCTION(Gateway_UpdateFromJson_Parses_JSON_WithJustModule_Configuration_File_Succeed) { //Arrange CGatewayMocks mocks; GATEWAY_HANDLE gateway = Gateway_Create(NULL); mocks.ResetAllCalls(); //Setup 2 Modules and No links. STRICT_EXPECTED_CALL(mocks, json_parse_string(VALID_JSON_CONTENT)); STRICT_EXPECTED_CALL(mocks, gballoc_malloc(sizeof(GATEWAY_PROPERTIES))); STRICT_EXPECTED_CALL(mocks, json_value_get_object(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, json_object_get_value(IGNORED_PTR_ARG, "loaders")) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, ModuleLoader_InitializeFromJson(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, json_object_get_array(IGNORED_PTR_ARG, "modules")) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, json_object_get_array(IGNORED_PTR_ARG, "links")) .IgnoreArgument(1) .SetFailReturn((JSON_Array *)NULL); STRICT_EXPECTED_CALL(mocks, VECTOR_create(sizeof(GATEWAY_MODULES_ENTRY))); STRICT_EXPECTED_CALL(mocks, json_array_get_count(IGNORED_PTR_ARG)) .IgnoreArgument(1) .SetReturn(2); //// modules array setup_parse_modules_entry(mocks, 0, "module1"); setup_parse_modules_entry(mocks, 1, "module2"); //Vector to track the successfull added link. STRICT_EXPECTED_CALL(mocks, VECTOR_create(sizeof(GATEWAY_MODULES_ENTRY))); STRICT_EXPECTED_CALL(mocks, VECTOR_create(sizeof(GATEWAY_LINK_ENTRY))); STRICT_EXPECTED_CALL(mocks, VECTOR_size(IGNORED_PTR_ARG)) .IgnoreArgument(1); //Adding module 1 (Success) add_a_module(mocks, 0); STRICT_EXPECTED_CALL(mocks, VECTOR_push_back(IGNORED_PTR_ARG, IGNORED_PTR_ARG, 1)) .IgnoreArgument(1) .IgnoreArgument(2); //Adding module 2 (Success) add_a_module(mocks, 1); STRICT_EXPECTED_CALL(mocks, VECTOR_push_back(IGNORED_PTR_ARG, IGNORED_PTR_ARG, 1)) .IgnoreArgument(1) .IgnoreArgument(2); STRICT_EXPECTED_CALL(mocks, VECTOR_destroy(IGNORED_PTR_ARG)) .IgnoreArgument(1); //Successfull Modules STRICT_EXPECTED_CALL(mocks, VECTOR_destroy(IGNORED_PTR_ARG)) .IgnoreArgument(1); //Successfull Links //Destroying Module1 from Properties STRICT_EXPECTED_CALL(mocks, VECTOR_size(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, VECTOR_element(IGNORED_PTR_ARG, 0)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, DynamicModuleLoader_FreeEntrypoint(IGNORED_PTR_ARG, IGNORED_PTR_ARG)) .IgnoreArgument(1) .IgnoreArgument(2); STRICT_EXPECTED_CALL(mocks, json_free_serialized_string((char*)"[serialized string]")); //Destroying Module2 from Properties STRICT_EXPECTED_CALL(mocks, VECTOR_element(IGNORED_PTR_ARG, 1)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, DynamicModuleLoader_FreeEntrypoint(IGNORED_PTR_ARG, IGNORED_PTR_ARG)) .IgnoreArgument(1) .IgnoreArgument(2); STRICT_EXPECTED_CALL(mocks, json_free_serialized_string((char*)"[serialized string]")); STRICT_EXPECTED_CALL(mocks, gballoc_free(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, json_value_free(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, VECTOR_destroy(IGNORED_PTR_ARG)) .IgnoreArgument(1); //Modules STRICT_EXPECTED_CALL(mocks, EventSystem_ReportEvent(IGNORED_PTR_ARG, IGNORED_PTR_ARG, GATEWAY_MODULE_LIST_CHANGED)) .IgnoreArgument(1) .IgnoreArgument(2); //Act int result = Gateway_UpdateFromJson(gateway, (const char*)"validJsonContent"); //Assert ASSERT_ARE_EQUAL(int, 0, result); mocks.AssertActualAndExpectedCalls(); //Cleanup gateway_destroy_internal(gateway); } /* Tests_SRS_GATEWAY_JSON_04_011: [ The function shall be able to add just `modules`, just `links` or both. ] */ TEST_FUNCTION(Gateway_UpdateFromJson_Parses_JSON_WithJustLinks_Configuration_File_Succeed) { //Arrange CGatewayMocks mocks; GATEWAY_HANDLE gateway = Gateway_Create(NULL); //Setup 2 Modules and No links. STRICT_EXPECTED_CALL(mocks, json_parse_string(VALID_JSON_CONTENT)); STRICT_EXPECTED_CALL(mocks, gballoc_malloc(sizeof(GATEWAY_PROPERTIES))); STRICT_EXPECTED_CALL(mocks, json_value_get_object(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, json_object_get_value(IGNORED_PTR_ARG, "loaders")) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, ModuleLoader_InitializeFromJson(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, json_object_get_array(IGNORED_PTR_ARG, "modules")) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, json_object_get_array(IGNORED_PTR_ARG, "links")) .IgnoreArgument(1) .SetFailReturn((JSON_Array *)NULL); STRICT_EXPECTED_CALL(mocks, VECTOR_create(sizeof(GATEWAY_MODULES_ENTRY))); STRICT_EXPECTED_CALL(mocks, json_array_get_count(IGNORED_PTR_ARG)) .IgnoreArgument(1) .SetReturn(2); //// modules array setup_parse_modules_entry(mocks, 0, "module1"); setup_parse_modules_entry(mocks, 1, "module2"); //Vector to track the successfull added link. STRICT_EXPECTED_CALL(mocks, VECTOR_create(sizeof(GATEWAY_MODULES_ENTRY))); STRICT_EXPECTED_CALL(mocks, VECTOR_create(sizeof(GATEWAY_LINK_ENTRY))); STRICT_EXPECTED_CALL(mocks, VECTOR_size(IGNORED_PTR_ARG)) .IgnoreArgument(1); //Adding module 1 (Success) add_a_module(mocks, 0); STRICT_EXPECTED_CALL(mocks, VECTOR_push_back(IGNORED_PTR_ARG, IGNORED_PTR_ARG, 1)) .IgnoreArgument(1) .IgnoreArgument(2); //Adding module 2 (Success) add_a_module(mocks, 1); STRICT_EXPECTED_CALL(mocks, VECTOR_push_back(IGNORED_PTR_ARG, IGNORED_PTR_ARG, 1)) .IgnoreArgument(1) .IgnoreArgument(2); STRICT_EXPECTED_CALL(mocks, VECTOR_destroy(IGNORED_PTR_ARG)) .IgnoreArgument(1); //Successfull Modules STRICT_EXPECTED_CALL(mocks, VECTOR_destroy(IGNORED_PTR_ARG)) .IgnoreArgument(1); //Successfull Links //Destroying Module1 from Properties STRICT_EXPECTED_CALL(mocks, VECTOR_size(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, VECTOR_element(IGNORED_PTR_ARG, 0)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, DynamicModuleLoader_FreeEntrypoint(IGNORED_PTR_ARG, IGNORED_PTR_ARG)) .IgnoreArgument(1) .IgnoreArgument(2); STRICT_EXPECTED_CALL(mocks, json_free_serialized_string((char*)"[serialized string]")); //Destroying Module2 from Properties STRICT_EXPECTED_CALL(mocks, VECTOR_element(IGNORED_PTR_ARG, 1)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, DynamicModuleLoader_FreeEntrypoint(IGNORED_PTR_ARG, IGNORED_PTR_ARG)) .IgnoreArgument(1) .IgnoreArgument(2); STRICT_EXPECTED_CALL(mocks, json_free_serialized_string((char*)"[serialized string]")); STRICT_EXPECTED_CALL(mocks, gballoc_free(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, json_value_free(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, VECTOR_destroy(IGNORED_PTR_ARG)) .IgnoreArgument(1); //Modules int result = Gateway_UpdateFromJson(gateway, (const char*)"validJsonContent"); ASSERT_ARE_EQUAL(int, 0, result); mocks.ResetAllCalls(); //Setup 2 Links (Gateway has already 2 modules). STRICT_EXPECTED_CALL(mocks, json_parse_string(VALID_JSON_CONTENT)); STRICT_EXPECTED_CALL(mocks, gballoc_malloc(sizeof(GATEWAY_PROPERTIES))); STRICT_EXPECTED_CALL(mocks, json_value_get_object(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, json_object_get_value(IGNORED_PTR_ARG, "loaders")) .IgnoreArgument(1) .SetFailReturn((JSON_Value *)NULL); STRICT_EXPECTED_CALL(mocks, json_object_get_array(IGNORED_PTR_ARG, "modules")) .IgnoreArgument(1) .SetFailReturn((JSON_Array *)NULL); STRICT_EXPECTED_CALL(mocks, json_object_get_array(IGNORED_PTR_ARG, "links")) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, VECTOR_create(sizeof(GATEWAY_LINK_ENTRY))); STRICT_EXPECTED_CALL(mocks, json_array_get_count(IGNORED_PTR_ARG)) .IgnoreArgument(1) .SetReturn(2); setup_links_entry(mocks, 0, "module1", "module2"); setup_links_entry(mocks, 1, "module2", "module1"); //Vector to track the successfull added link. STRICT_EXPECTED_CALL(mocks, VECTOR_create(sizeof(GATEWAY_MODULES_ENTRY))); STRICT_EXPECTED_CALL(mocks, VECTOR_create(sizeof(GATEWAY_LINK_ENTRY))); STRICT_EXPECTED_CALL(mocks, VECTOR_size(IGNORED_PTR_ARG)) .IgnoreArgument(1); add_a_link(mocks, 0); STRICT_EXPECTED_CALL(mocks, VECTOR_push_back(IGNORED_PTR_ARG, IGNORED_PTR_ARG, 1)) .IgnoreArgument(1) .IgnoreArgument(2); add_a_link(mocks, 1); STRICT_EXPECTED_CALL(mocks, VECTOR_push_back(IGNORED_PTR_ARG, IGNORED_PTR_ARG, 1)) .IgnoreArgument(1) .IgnoreArgument(2); STRICT_EXPECTED_CALL(mocks, VECTOR_destroy(IGNORED_PTR_ARG)) .IgnoreArgument(1); //Successfull Modules STRICT_EXPECTED_CALL(mocks, VECTOR_destroy(IGNORED_PTR_ARG)) .IgnoreArgument(1); //Successfull Links STRICT_EXPECTED_CALL(mocks, VECTOR_destroy(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, gballoc_free(IGNORED_PTR_ARG)) .IgnoreArgument(1); STRICT_EXPECTED_CALL(mocks, json_value_free(IGNORED_PTR_ARG)) .IgnoreArgument(1); //Act result = Gateway_UpdateFromJson(gateway, (const char*)"validJsonContent"); //Assert ASSERT_ARE_EQUAL(int, 0, result); mocks.AssertActualAndExpectedCalls(); //Cleanup gateway_destroy_internal(gateway); } END_TEST_SUITE(gateway_createfromjson_ut)
{ "pile_set_name": "Github" }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System.Linq; using Xunit.Abstractions; using Xunit.Sdk; namespace Test.Infrastructure { public static class TestMethodExtensions { public static string EvaluateSkipConditions(this ITestMethod testMethod) { var testClass = testMethod.TestClass.Class; var assembly = testMethod.TestClass.TestCollection.TestAssembly.Assembly; var conditionAttributes = testMethod.Method .GetCustomAttributes(typeof(ITestCondition)) .Concat(testClass.GetCustomAttributes(typeof(ITestCondition))) .Concat(assembly.GetCustomAttributes(typeof(ITestCondition))) .OfType<ReflectionAttributeInfo>() .Select(attributeInfo => attributeInfo.Attribute); foreach (ITestCondition condition in conditionAttributes) { if (!condition.IsMet) { return condition.SkipReason; } } return null!; } } }
{ "pile_set_name": "Github" }
package me.coley.recaf.workspace; import me.coley.recaf.util.IOUtil; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; /** * Importable resource from the file system. * * @author Matt */ public abstract class FileSystemResource extends JavaResource { private final Path path; /** * Constructs a file system resource. * * @param kind * The kind of resource implementation. * @param path * The reference to the file resource. * * @throws IOException * When the path does not exist. */ public FileSystemResource(ResourceKind kind, Path path) throws IOException { super(kind); this.path = path; verify(); } /** * Create a FileSystemResource from the given file. * * @param path * File to load as a resource. * * @return File resource. * * @throws IOException * When the file cannot be read. * @throws UnsupportedOperationException * When the file extension is not supported. */ public static FileSystemResource of(Path path) throws IOException { if (Files.isDirectory(path)) return new DirectoryResource(path); String ext = IOUtil.getExtension(path); switch(ext) { case "class": return new ClassResource(path); case "jar": return new JarResource(path); case "war": return new WarResource(path); default: throw new UnsupportedOperationException("File type '" + ext + "' is not " + "allowed for libraries"); } } /** * @return The path imported from. */ public Path getPath() { return path; } /** * Verify the file exists. * * @throws IOException * When the file does not exist. */ protected void verify() throws IOException { if (!Files.exists(path)) throw new IOException("The file \"" + path + "\" does not exist!"); } @Override public ResourceLocation getShortName() { return new FileSystemResourceLocation(getKind(), path.getFileName()); } @Override public ResourceLocation getName() { return new FileSystemResourceLocation(getKind(), path); } @Override public String toString() { return path.getFileName().toString(); } }
{ "pile_set_name": "Github" }
// // Tests for System.Web.Hosting.SimpleWorkerRequest.cs // // Author: // Miguel de Icaza ([email protected]) // // // Copyright (C) 2005 Novell, Inc (http://www.novell.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. // using NUnit.Framework; using System; using System.Globalization; using System.Web; using System.Web.Hosting; namespace MonoTests.System.Web { public class FakeHttpWorkerRequest : HttpWorkerRequest { public override string GetUriPath() { return "GetUriPath"; } public override string GetQueryString() { return "GetQueryString"; } public override string GetRawUrl() { return "GetRawUrl"; } public override string GetHttpVerbName() { return "GetVerbName"; } public override string GetHttpVersion() { return "GetHttpVersion"; } public override string GetRemoteAddress() { return "__GetRemoteAddress"; } public override int GetRemotePort() { return 1010; } public override string GetLocalAddress() { return "GetLocalAddress"; } public override int GetLocalPort() { return 2020; } public override void SendStatus(int s, string x) { } public override void SendKnownResponseHeader(int x, string j) { } public override void SendUnknownResponseHeader(string a, string b) { } public override void SendResponseFromMemory(byte[] arr, int x) { } public override void SendResponseFromFile(string a, long b , long c) { } public override void SendResponseFromFile (IntPtr a, long b, long c) { } public override void FlushResponse(bool x) { } public override void EndOfRequest() { } } [TestFixture] public class HttpWorkerTests { [Test] public void TestPublicValues () { Assert.AreEqual ( 0, HttpWorkerRequest.HeaderCacheControl, "V 0"); Assert.AreEqual ( 1, HttpWorkerRequest.HeaderConnection, "V 1"); Assert.AreEqual ( 2, HttpWorkerRequest.HeaderDate, "V 2"); Assert.AreEqual ( 3, HttpWorkerRequest.HeaderKeepAlive, "V 3"); Assert.AreEqual ( 4, HttpWorkerRequest.HeaderPragma, "V 4"); Assert.AreEqual ( 5, HttpWorkerRequest.HeaderTrailer, "V 5"); Assert.AreEqual ( 6, HttpWorkerRequest.HeaderTransferEncoding, "V 6"); Assert.AreEqual ( 7, HttpWorkerRequest.HeaderUpgrade, "V 7"); Assert.AreEqual ( 8, HttpWorkerRequest.HeaderVia, "V 8"); Assert.AreEqual ( 9, HttpWorkerRequest.HeaderWarning, "V 9"); Assert.AreEqual ( 10, HttpWorkerRequest.HeaderAllow, "V10"); Assert.AreEqual ( 11, HttpWorkerRequest.HeaderContentLength, "V11"); Assert.AreEqual ( 12, HttpWorkerRequest.HeaderContentType, "V12"); Assert.AreEqual ( 13, HttpWorkerRequest.HeaderContentEncoding, "V13"); Assert.AreEqual ( 14, HttpWorkerRequest.HeaderContentLanguage, "V14"); Assert.AreEqual ( 15, HttpWorkerRequest.HeaderContentLocation, "V15"); Assert.AreEqual ( 16, HttpWorkerRequest.HeaderContentMd5, "V16"); Assert.AreEqual ( 17, HttpWorkerRequest.HeaderContentRange, "V17"); Assert.AreEqual ( 18, HttpWorkerRequest.HeaderExpires, "V18"); Assert.AreEqual ( 19, HttpWorkerRequest.HeaderLastModified, "V19"); Assert.AreEqual ( 20, HttpWorkerRequest.HeaderAccept, "V20"); Assert.AreEqual ( 21, HttpWorkerRequest.HeaderAcceptCharset, "V21"); Assert.AreEqual ( 22, HttpWorkerRequest.HeaderAcceptEncoding, "V22"); Assert.AreEqual ( 23, HttpWorkerRequest.HeaderAcceptLanguage, "V23"); Assert.AreEqual ( 24, HttpWorkerRequest.HeaderAuthorization, "V24"); Assert.AreEqual ( 25, HttpWorkerRequest.HeaderCookie, "V25"); Assert.AreEqual ( 26, HttpWorkerRequest.HeaderExpect, "V26"); Assert.AreEqual ( 27, HttpWorkerRequest.HeaderFrom, "V27"); Assert.AreEqual ( 28, HttpWorkerRequest.HeaderHost, "V28"); Assert.AreEqual ( 29, HttpWorkerRequest.HeaderIfMatch, "V29"); Assert.AreEqual ( 30, HttpWorkerRequest.HeaderIfModifiedSince, "V30"); Assert.AreEqual ( 31, HttpWorkerRequest.HeaderIfNoneMatch, "V31"); Assert.AreEqual ( 32, HttpWorkerRequest.HeaderIfRange, "V32"); Assert.AreEqual ( 33, HttpWorkerRequest.HeaderIfUnmodifiedSince, "V33"); Assert.AreEqual ( 34, HttpWorkerRequest.HeaderMaxForwards, "V34"); Assert.AreEqual ( 35, HttpWorkerRequest.HeaderProxyAuthorization, "V35"); Assert.AreEqual ( 36, HttpWorkerRequest.HeaderReferer, "V36"); Assert.AreEqual ( 37, HttpWorkerRequest.HeaderRange, "V37"); Assert.AreEqual ( 38, HttpWorkerRequest.HeaderTe, "V38"); Assert.AreEqual ( 39, HttpWorkerRequest.HeaderUserAgent, "V39"); Assert.AreEqual ( 40, HttpWorkerRequest.RequestHeaderMaximum, "V40"); Assert.AreEqual ( 20, HttpWorkerRequest.HeaderAcceptRanges, "V41"); Assert.AreEqual ( 21, HttpWorkerRequest.HeaderAge, "V42"); Assert.AreEqual ( 22, HttpWorkerRequest.HeaderEtag, "V43"); Assert.AreEqual ( 23, HttpWorkerRequest.HeaderLocation, "V44"); Assert.AreEqual ( 24, HttpWorkerRequest.HeaderProxyAuthenticate, "V45"); Assert.AreEqual ( 25, HttpWorkerRequest.HeaderRetryAfter, "V46"); Assert.AreEqual ( 26, HttpWorkerRequest.HeaderServer, "V47"); Assert.AreEqual ( 27, HttpWorkerRequest.HeaderSetCookie, "V48"); Assert.AreEqual ( 28, HttpWorkerRequest.HeaderVary, "V49"); Assert.AreEqual ( 29, HttpWorkerRequest.HeaderWwwAuthenticate, "V50"); Assert.AreEqual ( 30, HttpWorkerRequest.ResponseHeaderMaximum, "V51"); Assert.AreEqual ( 1, HttpWorkerRequest.ReasonFileHandleCacheMiss, "R1"); Assert.AreEqual ( 2, HttpWorkerRequest.ReasonCachePolicy, "R2"); Assert.AreEqual ( 3, HttpWorkerRequest.ReasonCacheSecurity, "R3"); Assert.AreEqual ( 4, HttpWorkerRequest.ReasonClientDisconnect, "R4"); Assert.AreEqual ( 0, HttpWorkerRequest.ReasonDefault, "RR0"); } public class FakeHttpWorkerRequest : HttpWorkerRequest { public override string GetUriPath() { return "GetUriPath"; } public override string GetQueryString() { return "GetQueryString"; } public override string GetRawUrl() { return "GetRawUrl"; } public override string GetHttpVerbName() { return "GetVerbName"; } public override string GetHttpVersion() { return "GetHttpVersion"; } public override string GetRemoteAddress() { return "__GetRemoteAddress"; } public override int GetRemotePort() { return 1010; } public override string GetLocalAddress() { return "GetLocalAddress"; } public override string GetAppPath () { return "BLABA"; } public override int GetLocalPort() { return 2020; } public override void SendStatus(int s, string x) { } public override void SendKnownResponseHeader(int x, string j) { } public override void SendUnknownResponseHeader(string a, string b) { } public override void SendResponseFromMemory(byte[] arr, int x) { } public override void SendResponseFromFile(string a, long b , long c) { } public override void SendResponseFromFile (IntPtr a, long b, long c) { } public override void FlushResponse(bool x) { } public override void EndOfRequest() { } } [Test] public void TestDefaults () { FakeHttpWorkerRequest f = new FakeHttpWorkerRequest (); Assert.AreEqual (null, f.MachineConfigPath, "F1"); Assert.AreEqual (null, f.MapPath ("x"), "F2"); Assert.AreEqual (null, f.MachineConfigPath, "F3"); Assert.AreEqual (null, f.MachineInstallDirectory, "F4"); Assert.AreEqual ("BLABA", f.GetAppPath (), "F5"); Assert.AreEqual (null, f.GetAppPathTranslated (), "F5"); Assert.AreEqual (null, f.GetAppPoolID (), "F6"); Assert.AreEqual (0, f.GetBytesRead (), "F7"); Assert.AreEqual (new byte [0], f.GetClientCertificate (), "F8"); Assert.AreEqual (new byte [0], f.GetClientCertificateBinaryIssuer (), "F9"); Assert.AreEqual (0, f.GetClientCertificateEncoding (), "F10"); Assert.AreEqual (new byte [0], f.GetClientCertificatePublicKey (), "F11"); Assert.AreEqual (0, f.GetConnectionID (), "F14"); Assert.AreEqual (null, f.GetFilePathTranslated () , "F16"); Assert.AreEqual ("", f.GetPathInfo () , "F17"); Assert.AreEqual (null, f.GetPreloadedEntityBody () , "F18"); Assert.AreEqual ("http", f.GetProtocol () , "F19"); Assert.AreEqual (null, f.GetQueryStringRawBytes () , "F20"); Assert.AreEqual ("__GetRemoteAddress", f.GetRemoteName () , "F21"); Assert.AreEqual (0, f.GetRequestReason () , "F22"); Assert.AreEqual ("GetLocalAddress", f.GetServerName () , "F23"); Assert.AreEqual (null, f.GetServerVariable ("A") , "F24"); Assert.AreEqual (null, f.GetUnknownRequestHeader ("IAMTHEUKNOWNN"), "F25"); Assert.AreEqual (null, f.GetUnknownRequestHeaders (), "F26"); Assert.AreEqual (0, f.GetUrlContextID (), "F27"); Assert.AreEqual (IntPtr.Zero, f.GetUserToken (), "F28"); Assert.AreEqual (IntPtr.Zero, f.GetVirtualPathToken (), "F29"); Assert.AreEqual (false, f.HasEntityBody (), "F30"); Assert.AreEqual (true, f.HeadersSent (), "F31"); Assert.AreEqual (true, f.IsClientConnected (), "F32"); Assert.AreEqual (false, f.IsEntireEntityBodyIsPreloaded (), "F33"); Assert.AreEqual (false, f.IsSecure (), "F34"); Assert.AreEqual (0, f.ReadEntityBody (null, Int32.MaxValue), "ReadEntityBody(byte[],int)"); #if NET_2_0 Assert.AreEqual (Guid.Empty.ToString (), f.RequestTraceIdentifier.ToString (), "RequestTraceIdentifier"); Assert.IsNull (f.RootWebConfigPath, "RootWebConfigPath"); Assert.AreEqual (0, f.GetPreloadedEntityBody (null, Int32.MinValue), "GetPreloadedEntityBody(byte[],int)"); Assert.AreEqual (0, f.GetPreloadedEntityBodyLength (), "GetPreloadedEntityBodyLength"); Assert.AreEqual (0, f.GetTotalEntityBodyLength (), "GetTotalEntityBodyLength"); Assert.AreEqual (0, f.ReadEntityBody (null, 0, 0), "ReadEntityBody(byte[],int,int)"); #endif } [Test] public void Test_GetKnownHeaderName () { // // GetKnownRequestHeaderName // Assert.AreEqual ("Cache-Control", HttpWorkerRequest.GetKnownRequestHeaderName (0), "F17"); Assert.AreEqual ("Connection", HttpWorkerRequest.GetKnownRequestHeaderName (1), "F18"); Assert.AreEqual ("Date", HttpWorkerRequest.GetKnownRequestHeaderName (2), "F19"); Assert.AreEqual ("Keep-Alive", HttpWorkerRequest.GetKnownRequestHeaderName (3), "F20"); Assert.AreEqual ("Pragma", HttpWorkerRequest.GetKnownRequestHeaderName (4), "F21"); Assert.AreEqual ("Trailer", HttpWorkerRequest.GetKnownRequestHeaderName (5), "F22"); Assert.AreEqual ("Transfer-Encoding", HttpWorkerRequest.GetKnownRequestHeaderName (6), "F23"); Assert.AreEqual ("Upgrade", HttpWorkerRequest.GetKnownRequestHeaderName (7), "F24"); Assert.AreEqual ("Via", HttpWorkerRequest.GetKnownRequestHeaderName (8), "F25"); Assert.AreEqual ("Warning", HttpWorkerRequest.GetKnownRequestHeaderName (9), "F26"); Assert.AreEqual ("Allow", HttpWorkerRequest.GetKnownRequestHeaderName (10), "F27"); Assert.AreEqual ("Content-Length", HttpWorkerRequest.GetKnownRequestHeaderName (11), "F28"); Assert.AreEqual ("Content-Type", HttpWorkerRequest.GetKnownRequestHeaderName (12), "F29"); Assert.AreEqual ("Content-Encoding", HttpWorkerRequest.GetKnownRequestHeaderName (13), "F30"); Assert.AreEqual ("Content-Language", HttpWorkerRequest.GetKnownRequestHeaderName (14), "F31"); Assert.AreEqual ("Content-Location", HttpWorkerRequest.GetKnownRequestHeaderName (15), "F32"); Assert.AreEqual ("Content-MD5", HttpWorkerRequest.GetKnownRequestHeaderName (16), "F33"); Assert.AreEqual ("Content-Range", HttpWorkerRequest.GetKnownRequestHeaderName (17), "F34"); Assert.AreEqual ("Expires", HttpWorkerRequest.GetKnownRequestHeaderName (18), "F35"); Assert.AreEqual ("Last-Modified", HttpWorkerRequest.GetKnownRequestHeaderName (19), "F36"); Assert.AreEqual ("Accept", HttpWorkerRequest.GetKnownRequestHeaderName (20), "F37"); Assert.AreEqual ("Accept-Charset", HttpWorkerRequest.GetKnownRequestHeaderName (21), "F38"); Assert.AreEqual ("Accept-Encoding", HttpWorkerRequest.GetKnownRequestHeaderName (22), "F39"); Assert.AreEqual ("Accept-Language", HttpWorkerRequest.GetKnownRequestHeaderName (23), "F40"); Assert.AreEqual ("Authorization", HttpWorkerRequest.GetKnownRequestHeaderName (24), "F41"); Assert.AreEqual ("Cookie", HttpWorkerRequest.GetKnownRequestHeaderName (25), "F42"); Assert.AreEqual ("Expect", HttpWorkerRequest.GetKnownRequestHeaderName (26), "F43"); Assert.AreEqual ("From", HttpWorkerRequest.GetKnownRequestHeaderName (27), "F44"); Assert.AreEqual ("Host", HttpWorkerRequest.GetKnownRequestHeaderName (28), "F45"); Assert.AreEqual ("If-Match", HttpWorkerRequest.GetKnownRequestHeaderName (29), "F46"); Assert.AreEqual ("If-Modified-Since", HttpWorkerRequest.GetKnownRequestHeaderName (30), "F47"); Assert.AreEqual ("If-None-Match", HttpWorkerRequest.GetKnownRequestHeaderName (31), "F48"); Assert.AreEqual ("If-Range", HttpWorkerRequest.GetKnownRequestHeaderName (32), "F49"); Assert.AreEqual ("If-Unmodified-Since", HttpWorkerRequest.GetKnownRequestHeaderName (33), "F50"); Assert.AreEqual ("Max-Forwards", HttpWorkerRequest.GetKnownRequestHeaderName (34), "F51"); Assert.AreEqual ("Proxy-Authorization", HttpWorkerRequest.GetKnownRequestHeaderName (35), "F52"); Assert.AreEqual ("Referer", HttpWorkerRequest.GetKnownRequestHeaderName (36), "F53"); Assert.AreEqual ("Range", HttpWorkerRequest.GetKnownRequestHeaderName (37), "F54"); Assert.AreEqual ("TE", HttpWorkerRequest.GetKnownRequestHeaderName (38), "F55"); Assert.AreEqual ("User-Agent", HttpWorkerRequest.GetKnownRequestHeaderName (39), "F56"); } [ExpectedException (typeof (IndexOutOfRangeException))] [Test] public void Test_OutOfRangeHeaderName () { HttpWorkerRequest.GetKnownRequestHeaderName (HttpWorkerRequest.RequestHeaderMaximum); } [ExpectedException (typeof (IndexOutOfRangeException))] [Test] public void Test_OutOfRangeHeaderName2 () { HttpWorkerRequest.GetKnownRequestHeaderName (-1); } [Test] public void Test_GetKnownHeaderIndex () { Assert.AreEqual (0, HttpWorkerRequest.GetKnownRequestHeaderIndex ("Cache-Control"), "N0"); Assert.AreEqual (1, HttpWorkerRequest.GetKnownRequestHeaderIndex ("Connection"), "N1"); Assert.AreEqual (2, HttpWorkerRequest.GetKnownRequestHeaderIndex ("Date"), "N2"); Assert.AreEqual (3, HttpWorkerRequest.GetKnownRequestHeaderIndex ("Keep-Alive"), "N3"); Assert.AreEqual (4, HttpWorkerRequest.GetKnownRequestHeaderIndex ("Pragma"), "N4"); Assert.AreEqual (5, HttpWorkerRequest.GetKnownRequestHeaderIndex ("Trailer"), "N5"); Assert.AreEqual (6, HttpWorkerRequest.GetKnownRequestHeaderIndex ("Transfer-Encoding"), "N6"); Assert.AreEqual (7, HttpWorkerRequest.GetKnownRequestHeaderIndex ("Upgrade"), "N7"); Assert.AreEqual (8, HttpWorkerRequest.GetKnownRequestHeaderIndex ("Via"), "N8"); Assert.AreEqual (9, HttpWorkerRequest.GetKnownRequestHeaderIndex ("Warning"), "N9"); Assert.AreEqual (10, HttpWorkerRequest.GetKnownRequestHeaderIndex ("Allow"), "N10"); Assert.AreEqual (11, HttpWorkerRequest.GetKnownRequestHeaderIndex ("Content-Length"), "N11"); Assert.AreEqual (12, HttpWorkerRequest.GetKnownRequestHeaderIndex ("Content-Type"), "N12"); Assert.AreEqual (13, HttpWorkerRequest.GetKnownRequestHeaderIndex ("Content-Encoding"), "N13"); Assert.AreEqual (14, HttpWorkerRequest.GetKnownRequestHeaderIndex ("Content-Language"), "N14"); Assert.AreEqual (15, HttpWorkerRequest.GetKnownRequestHeaderIndex ("Content-Location"), "N15"); Assert.AreEqual (16, HttpWorkerRequest.GetKnownRequestHeaderIndex ("Content-MD5"), "N16"); Assert.AreEqual (17, HttpWorkerRequest.GetKnownRequestHeaderIndex ("Content-Range"), "N17"); Assert.AreEqual (18, HttpWorkerRequest.GetKnownRequestHeaderIndex ("Expires"), "N18"); Assert.AreEqual (19, HttpWorkerRequest.GetKnownRequestHeaderIndex ("Last-Modified"), "N19"); Assert.AreEqual (20, HttpWorkerRequest.GetKnownRequestHeaderIndex ("Accept"), "N20"); Assert.AreEqual (21, HttpWorkerRequest.GetKnownRequestHeaderIndex ("Accept-Charset"), "N21"); Assert.AreEqual (22, HttpWorkerRequest.GetKnownRequestHeaderIndex ("Accept-Encoding"), "N22"); Assert.AreEqual (23, HttpWorkerRequest.GetKnownRequestHeaderIndex ("Accept-Language"), "N23"); Assert.AreEqual (24, HttpWorkerRequest.GetKnownRequestHeaderIndex ("Authorization"), "N24"); Assert.AreEqual (25, HttpWorkerRequest.GetKnownRequestHeaderIndex ("Cookie"), "N25"); Assert.AreEqual (26, HttpWorkerRequest.GetKnownRequestHeaderIndex ("Expect"), "N26"); Assert.AreEqual (27, HttpWorkerRequest.GetKnownRequestHeaderIndex ("From"), "N27"); Assert.AreEqual (28, HttpWorkerRequest.GetKnownRequestHeaderIndex ("Host"), "N28"); Assert.AreEqual (29, HttpWorkerRequest.GetKnownRequestHeaderIndex ("If-Match"), "N29"); Assert.AreEqual (30, HttpWorkerRequest.GetKnownRequestHeaderIndex ("If-Modified-Since"), "N30"); Assert.AreEqual (31, HttpWorkerRequest.GetKnownRequestHeaderIndex ("If-None-Match"), "N31"); Assert.AreEqual (32, HttpWorkerRequest.GetKnownRequestHeaderIndex ("If-Range"), "N32"); Assert.AreEqual (33, HttpWorkerRequest.GetKnownRequestHeaderIndex ("If-Unmodified-Since"), "N33"); Assert.AreEqual (34, HttpWorkerRequest.GetKnownRequestHeaderIndex ("Max-Forwards"), "N34"); Assert.AreEqual (35, HttpWorkerRequest.GetKnownRequestHeaderIndex ("Proxy-Authorization"), "N35"); Assert.AreEqual (36, HttpWorkerRequest.GetKnownRequestHeaderIndex ("Referer"), "N36"); Assert.AreEqual (37, HttpWorkerRequest.GetKnownRequestHeaderIndex ("Range"), "N37"); Assert.AreEqual (38, HttpWorkerRequest.GetKnownRequestHeaderIndex ("TE"), "N38"); Assert.AreEqual (39, HttpWorkerRequest.GetKnownRequestHeaderIndex ("User-Agent"), "N39"); Assert.AreEqual (-1, HttpWorkerRequest.GetKnownRequestHeaderIndex ("Blablabla"), "N40"); } [Test] public void Test_GetKnownResponseIndex () { Assert.AreEqual (0, HttpWorkerRequest.GetKnownResponseHeaderIndex ("Cache-Control"), "M0"); Assert.AreEqual (1, HttpWorkerRequest.GetKnownResponseHeaderIndex ("Connection"), "M1"); Assert.AreEqual (2, HttpWorkerRequest.GetKnownResponseHeaderIndex ("Date"), "M2"); Assert.AreEqual (3, HttpWorkerRequest.GetKnownResponseHeaderIndex ("Keep-Alive"), "M3"); Assert.AreEqual (4, HttpWorkerRequest.GetKnownResponseHeaderIndex ("Pragma"), "M4"); Assert.AreEqual (5, HttpWorkerRequest.GetKnownResponseHeaderIndex ("Trailer"), "M5"); Assert.AreEqual (6, HttpWorkerRequest.GetKnownResponseHeaderIndex ("Transfer-Encoding"), "M6"); Assert.AreEqual (7, HttpWorkerRequest.GetKnownResponseHeaderIndex ("Upgrade"), "M7"); Assert.AreEqual (8, HttpWorkerRequest.GetKnownResponseHeaderIndex ("Via"), "M8"); Assert.AreEqual (9, HttpWorkerRequest.GetKnownResponseHeaderIndex ("Warning"), "M9"); Assert.AreEqual (10, HttpWorkerRequest.GetKnownResponseHeaderIndex ("Allow"), "M10"); Assert.AreEqual (11, HttpWorkerRequest.GetKnownResponseHeaderIndex ("Content-Length"), "M11"); Assert.AreEqual (12, HttpWorkerRequest.GetKnownResponseHeaderIndex ("Content-Type"), "M12"); Assert.AreEqual (13, HttpWorkerRequest.GetKnownResponseHeaderIndex ("Content-Encoding"), "M13"); Assert.AreEqual (14, HttpWorkerRequest.GetKnownResponseHeaderIndex ("Content-Language"), "M14"); Assert.AreEqual (15, HttpWorkerRequest.GetKnownResponseHeaderIndex ("Content-Location"), "M15"); Assert.AreEqual (16, HttpWorkerRequest.GetKnownResponseHeaderIndex ("Content-MD5"), "M16"); Assert.AreEqual (17, HttpWorkerRequest.GetKnownResponseHeaderIndex ("Content-Range"), "M17"); Assert.AreEqual (18, HttpWorkerRequest.GetKnownResponseHeaderIndex ("Expires"), "M18"); Assert.AreEqual (19, HttpWorkerRequest.GetKnownResponseHeaderIndex ("Last-Modified"), "M19"); Assert.AreEqual (20, HttpWorkerRequest.GetKnownResponseHeaderIndex ("Accept-Ranges"), "M20"); Assert.AreEqual (21, HttpWorkerRequest.GetKnownResponseHeaderIndex ("Age"), "M21"); Assert.AreEqual (22, HttpWorkerRequest.GetKnownResponseHeaderIndex ("ETag"), "M22"); Assert.AreEqual (23, HttpWorkerRequest.GetKnownResponseHeaderIndex ("Location"), "M23"); Assert.AreEqual (24, HttpWorkerRequest.GetKnownResponseHeaderIndex ("Proxy-Authenticate"), "M24"); Assert.AreEqual (25, HttpWorkerRequest.GetKnownResponseHeaderIndex ("Retry-After"), "M25"); Assert.AreEqual (26, HttpWorkerRequest.GetKnownResponseHeaderIndex ("Server"), "M26"); Assert.AreEqual (27, HttpWorkerRequest.GetKnownResponseHeaderIndex ("Set-Cookie"), "M27"); Assert.AreEqual (28, HttpWorkerRequest.GetKnownResponseHeaderIndex ("Vary"), "M28"); Assert.AreEqual (29, HttpWorkerRequest.GetKnownResponseHeaderIndex ("WWW-Authenticate"), "M29"); } [Test] public void Test_GetKnownResponseName () { Assert.AreEqual ("Cache-Control", HttpWorkerRequest.GetKnownResponseHeaderName (0), "P0"); Assert.AreEqual ("Connection", HttpWorkerRequest.GetKnownResponseHeaderName (1), "P1"); Assert.AreEqual ("Date", HttpWorkerRequest.GetKnownResponseHeaderName (2), "P2"); Assert.AreEqual ("Keep-Alive", HttpWorkerRequest.GetKnownResponseHeaderName (3), "P3"); Assert.AreEqual ("Pragma", HttpWorkerRequest.GetKnownResponseHeaderName (4), "P4"); Assert.AreEqual ("Trailer", HttpWorkerRequest.GetKnownResponseHeaderName (5), "P5"); Assert.AreEqual ("Transfer-Encoding", HttpWorkerRequest.GetKnownResponseHeaderName (6), "P6"); Assert.AreEqual ("Upgrade", HttpWorkerRequest.GetKnownResponseHeaderName (7), "P7"); Assert.AreEqual ("Via", HttpWorkerRequest.GetKnownResponseHeaderName (8), "P8"); Assert.AreEqual ("Warning", HttpWorkerRequest.GetKnownResponseHeaderName (9), "P9"); Assert.AreEqual ("Allow", HttpWorkerRequest.GetKnownResponseHeaderName (10), "P10"); Assert.AreEqual ("Content-Length", HttpWorkerRequest.GetKnownResponseHeaderName (11), "P11"); Assert.AreEqual ("Content-Type", HttpWorkerRequest.GetKnownResponseHeaderName (12), "P12"); Assert.AreEqual ("Content-Encoding", HttpWorkerRequest.GetKnownResponseHeaderName (13), "P13"); Assert.AreEqual ("Content-Language", HttpWorkerRequest.GetKnownResponseHeaderName (14), "P14"); Assert.AreEqual ("Content-Location", HttpWorkerRequest.GetKnownResponseHeaderName (15), "P15"); Assert.AreEqual ("Content-MD5", HttpWorkerRequest.GetKnownResponseHeaderName (16), "P16"); Assert.AreEqual ("Content-Range", HttpWorkerRequest.GetKnownResponseHeaderName (17), "P17"); Assert.AreEqual ("Expires", HttpWorkerRequest.GetKnownResponseHeaderName (18), "P18"); Assert.AreEqual ("Last-Modified", HttpWorkerRequest.GetKnownResponseHeaderName (19), "P19"); Assert.AreEqual ("Accept-Ranges", HttpWorkerRequest.GetKnownResponseHeaderName (20), "P20"); Assert.AreEqual ("Age", HttpWorkerRequest.GetKnownResponseHeaderName (21), "P21"); Assert.AreEqual ("ETag", HttpWorkerRequest.GetKnownResponseHeaderName (22), "P22"); Assert.AreEqual ("Location", HttpWorkerRequest.GetKnownResponseHeaderName (23), "P23"); Assert.AreEqual ("Proxy-Authenticate", HttpWorkerRequest.GetKnownResponseHeaderName (24), "P24"); Assert.AreEqual ("Retry-After", HttpWorkerRequest.GetKnownResponseHeaderName (25), "P25"); Assert.AreEqual ("Server", HttpWorkerRequest.GetKnownResponseHeaderName (26), "P26"); Assert.AreEqual ("Set-Cookie", HttpWorkerRequest.GetKnownResponseHeaderName (27), "P27"); Assert.AreEqual ("Vary", HttpWorkerRequest.GetKnownResponseHeaderName (28), "P28"); Assert.AreEqual ("WWW-Authenticate", HttpWorkerRequest.GetKnownResponseHeaderName (29), "P29"); } [ExpectedException (typeof (IndexOutOfRangeException))] [Test] public void Test_OutOfRangeHeaderResponseName () { HttpWorkerRequest.GetKnownResponseHeaderName (HttpWorkerRequest.ResponseHeaderMaximum); } [ExpectedException (typeof (IndexOutOfRangeException))] [Test] public void Test_OutOfRangeResponseName2 () { HttpWorkerRequest.GetKnownRequestHeaderName (-1); } [Test] public void Test_GetStatusDescription () { Console.WriteLine ("*****" + HttpWorkerRequest.GetStatusDescription (424)); Assert.AreEqual (true, HttpWorkerRequest.GetStatusDescription (100) != "", "D1"); Assert.AreEqual (true, HttpWorkerRequest.GetStatusDescription (101) != "", "D2"); Assert.AreEqual (true, HttpWorkerRequest.GetStatusDescription (102) != "", "D3"); Assert.AreEqual (true, HttpWorkerRequest.GetStatusDescription (200) != "", "D4"); Assert.AreEqual (true, HttpWorkerRequest.GetStatusDescription (201) != "", "D5"); Assert.AreEqual (true, HttpWorkerRequest.GetStatusDescription (202) != "", "D6"); Assert.AreEqual (true, HttpWorkerRequest.GetStatusDescription (203) != "", "D7"); Assert.AreEqual (true, HttpWorkerRequest.GetStatusDescription (204) != "", "D8"); Assert.AreEqual (true, HttpWorkerRequest.GetStatusDescription (205) != "", "D9"); Assert.AreEqual (true, HttpWorkerRequest.GetStatusDescription (206) != "", "D10"); Assert.AreEqual (true, HttpWorkerRequest.GetStatusDescription (207) != "", "D11"); Assert.AreEqual (true, HttpWorkerRequest.GetStatusDescription (300) != "", "D12"); Assert.AreEqual (true, HttpWorkerRequest.GetStatusDescription (301) != "", "D13"); Assert.AreEqual (true, HttpWorkerRequest.GetStatusDescription (302) != "", "D14"); Assert.AreEqual (true, HttpWorkerRequest.GetStatusDescription (303) != "", "D15"); Assert.AreEqual (true, HttpWorkerRequest.GetStatusDescription (304) != "", "D16"); Assert.AreEqual (true, HttpWorkerRequest.GetStatusDescription (305) != "", "D17"); Assert.AreEqual (true, HttpWorkerRequest.GetStatusDescription (307) != "", "D18"); Assert.AreEqual (true, HttpWorkerRequest.GetStatusDescription (400) != "", "D19"); Assert.AreEqual (true, HttpWorkerRequest.GetStatusDescription (401) != "", "D20"); Assert.AreEqual (true, HttpWorkerRequest.GetStatusDescription (402) != "", "D21"); Assert.AreEqual (true, HttpWorkerRequest.GetStatusDescription (403) != "", "D22"); Assert.AreEqual (true, HttpWorkerRequest.GetStatusDescription (404) != "", "D23"); Assert.AreEqual (true, HttpWorkerRequest.GetStatusDescription (405) != "", "D24"); Assert.AreEqual (true, HttpWorkerRequest.GetStatusDescription (406) != "", "D25"); Assert.AreEqual (true, HttpWorkerRequest.GetStatusDescription (407) != "", "D26"); Assert.AreEqual (true, HttpWorkerRequest.GetStatusDescription (408) != "", "D27"); Assert.AreEqual (true, HttpWorkerRequest.GetStatusDescription (409) != "", "D28"); Assert.AreEqual (true, HttpWorkerRequest.GetStatusDescription (410) != "", "D29"); Assert.AreEqual (true, HttpWorkerRequest.GetStatusDescription (411) != "", "D30"); Assert.AreEqual (true, HttpWorkerRequest.GetStatusDescription (412) != "", "D31"); Assert.AreEqual (true, HttpWorkerRequest.GetStatusDescription (413) != "", "D32"); Assert.AreEqual (true, HttpWorkerRequest.GetStatusDescription (414) != "", "D33"); Assert.AreEqual (true, HttpWorkerRequest.GetStatusDescription (415) != "", "D34"); Assert.AreEqual (true, HttpWorkerRequest.GetStatusDescription (416) != "", "D35"); Assert.AreEqual (true, HttpWorkerRequest.GetStatusDescription (417) != "", "D36"); Assert.AreEqual (true, HttpWorkerRequest.GetStatusDescription (422) != "", "D37"); Assert.AreEqual (true, HttpWorkerRequest.GetStatusDescription (423) != "", "D38"); Assert.AreEqual (true, HttpWorkerRequest.GetStatusDescription (424) != "", "D39"); Assert.AreEqual (true, HttpWorkerRequest.GetStatusDescription (500) != "", "D40"); Assert.AreEqual (true, HttpWorkerRequest.GetStatusDescription (501) != "", "D41"); Assert.AreEqual (true, HttpWorkerRequest.GetStatusDescription (502) != "", "D42"); Assert.AreEqual (true, HttpWorkerRequest.GetStatusDescription (503) != "", "D43"); Assert.AreEqual (true, HttpWorkerRequest.GetStatusDescription (504) != "", "D44"); Assert.AreEqual (true, HttpWorkerRequest.GetStatusDescription (505) != "", "D45"); Assert.AreEqual (true, HttpWorkerRequest.GetStatusDescription (507) != "", "D46"); } } }
{ "pile_set_name": "Github" }
/** * ae.ui.app.application * * License: * This Source Code Form is subject to the terms of * the Mozilla Public License, v. 2.0. If a copy of * the MPL was not distributed with this file, You * can obtain one at http://mozilla.org/MPL/2.0/. * * Authors: * Vladimir Panteleev <[email protected]> */ module ae.ui.app.application; import ae.sys.desktop; import ae.sys.config; import ae.ui.shell.shell; import ae.ui.shell.events; import ae.ui.video.renderer; /// The purpose of this class is to allow the application to provide app-specific information to the framework. // This class could theoretically be split up into more layers (ShellApplication, etc.) class Application { Config config; this() { config = new Config(getName(), getCompanyName()); } // ************************** Application information ************************** /// Returns a string containing the application name, as visible in the window caption and taskbar, and used in filesystem/registry paths. abstract string getName(); /// Returns the company name (used for Windows registry paths). abstract string getCompanyName(); // TODO: getIcon // ******************************** Entry point ******************************** /// The application "main" function. The application can create a shell here. abstract int run(string[] args); // ************************** Default screen settings ************************** ShellSettings getDefaultShellSettings() { ShellSettings settings; static if (is(typeof(getDesktopResolution))) getDesktopResolution(settings.fullScreenX, settings.fullScreenY); return settings; } ShellSettings getShellSettings() { return config.read("ShellSettings", getDefaultShellSettings()); } void setShellSettings(ShellSettings settings) { config.write("ShellSettings", settings); } bool isResizable() { return true; } bool needSound() { return false; } bool needJoystick() { return false; } // ****************************** Event handlers ******************************* //void handleMouseEnter() {} //void handleMouseLeave() {} //void handleKeyboardFocus() {} //void handleKeyboardBlur() {} //void handleMinimize() {} //void handleRestore() {} /// Called after video initialization. /// Video initialization currently also happens when the window is resized. /// The window size can be accessed via shell.video.getScreenSize. void handleInit() {} void handleKeyDown(Key key/*, modifiers? */, dchar character) {} void handleKeyUp(Key key/*, modifiers? */) {} void handleMouseDown(uint x, uint y, MouseButton button) {} void handleMouseUp(uint x, uint y, MouseButton button) {} void handleMouseMove(uint x, uint y, MouseButtons buttons) {} //void handleMouseRelMove(int dx, int dy) {} /// when cursor is clipped void handleJoyAxisMotion(int axis, short value) {} void handleJoyHatMotion (int hat, JoystickHatState state) {} void handleJoyButtonDown(int button) {} void handleJoyButtonUp (int button) {} //void handleResize(uint w, uint h) {} void handleQuit() {} // ********************************* Rendering ********************************* void render(Renderer r) {} } private __gshared Application application; /// The application must call this function with its own Application implementation in a static constructor. void createApplication(A : Application)() { assert(application is null, "Application already set"); application = new A; } // for use in ae.ui.app.* int runApplication(string[] args) { assert(application !is null, "Application object not set"); return application.run(args); } /// Wraps a delegate that is to be called only from the application thread context. struct AppCallbackEx(A...) { private void delegate(A) f; void bind(void delegate(A) f) { this.f = f; } /// Blocks. void call(A args) { assert(f, "Attempting to call unbound AppCallback"); synchronized(application) { f(args); } } bool opCast(T)() if (is(T == bool)) { return f !is null; } } alias AppCallbackEx!() AppCallback;
{ "pile_set_name": "Github" }
/** * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for * license information. * * Code generated by Microsoft (R) AutoRest Code Generator. */ package com.microsoft.azure.management.network.v2019_09_01.implementation; import com.microsoft.azure.arm.collection.InnerSupportsGet; import com.microsoft.azure.arm.collection.InnerSupportsDelete; import com.microsoft.azure.arm.collection.InnerSupportsListing; import retrofit2.Retrofit; import com.google.common.reflect.TypeToken; import com.microsoft.azure.AzureServiceFuture; import com.microsoft.azure.CloudException; import com.microsoft.azure.ListOperationCallback; import com.microsoft.azure.Page; import com.microsoft.azure.PagedList; import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceFuture; import com.microsoft.rest.ServiceResponse; import com.microsoft.rest.Validator; import java.io.IOException; import java.util.List; import okhttp3.ResponseBody; import retrofit2.http.Body; import retrofit2.http.GET; import retrofit2.http.Header; import retrofit2.http.Headers; import retrofit2.http.HTTP; import retrofit2.http.Path; import retrofit2.http.PUT; import retrofit2.http.Query; import retrofit2.http.Url; import retrofit2.Response; import rx.functions.Func1; import rx.Observable; /** * An instance of this class provides access to all the operations defined * in FirewallPolicies. */ public class FirewallPoliciesInner implements InnerSupportsGet<FirewallPolicyInner>, InnerSupportsDelete<Void>, InnerSupportsListing<FirewallPolicyInner> { /** The Retrofit service to perform REST calls. */ private FirewallPoliciesService service; /** The service client containing this operation class. */ private NetworkManagementClientImpl client; /** * Initializes an instance of FirewallPoliciesInner. * * @param retrofit the Retrofit instance built from a Retrofit Builder. * @param client the instance of the service client containing this operation class. */ public FirewallPoliciesInner(Retrofit retrofit, NetworkManagementClientImpl client) { this.service = retrofit.create(FirewallPoliciesService.class); this.client = client; } /** * The interface defining all the services for FirewallPolicies to be * used by Retrofit to perform actually REST calls. */ interface FirewallPoliciesService { @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.network.v2019_09_01.FirewallPolicies delete" }) @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/firewallPolicies/{firewallPolicyName}", method = "DELETE", hasBody = true) Observable<Response<ResponseBody>> delete(@Path("resourceGroupName") String resourceGroupName, @Path("firewallPolicyName") String firewallPolicyName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.network.v2019_09_01.FirewallPolicies beginDelete" }) @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/firewallPolicies/{firewallPolicyName}", method = "DELETE", hasBody = true) Observable<Response<ResponseBody>> beginDelete(@Path("resourceGroupName") String resourceGroupName, @Path("firewallPolicyName") String firewallPolicyName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.network.v2019_09_01.FirewallPolicies getByResourceGroup" }) @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/firewallPolicies/{firewallPolicyName}") Observable<Response<ResponseBody>> getByResourceGroup(@Path("resourceGroupName") String resourceGroupName, @Path("firewallPolicyName") String firewallPolicyName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Query("$expand") String expand, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.network.v2019_09_01.FirewallPolicies createOrUpdate" }) @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/firewallPolicies/{firewallPolicyName}") Observable<Response<ResponseBody>> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("firewallPolicyName") String firewallPolicyName, @Path("subscriptionId") String subscriptionId, @Body FirewallPolicyInner parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.network.v2019_09_01.FirewallPolicies beginCreateOrUpdate" }) @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/firewallPolicies/{firewallPolicyName}") Observable<Response<ResponseBody>> beginCreateOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("firewallPolicyName") String firewallPolicyName, @Path("subscriptionId") String subscriptionId, @Body FirewallPolicyInner parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.network.v2019_09_01.FirewallPolicies listByResourceGroup" }) @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/firewallPolicies") Observable<Response<ResponseBody>> listByResourceGroup(@Path("resourceGroupName") String resourceGroupName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.network.v2019_09_01.FirewallPolicies list" }) @GET("subscriptions/{subscriptionId}/providers/Microsoft.Network/firewallPolicies") Observable<Response<ResponseBody>> list(@Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.network.v2019_09_01.FirewallPolicies listByResourceGroupNext" }) @GET Observable<Response<ResponseBody>> listByResourceGroupNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.network.v2019_09_01.FirewallPolicies listNext" }) @GET Observable<Response<ResponseBody>> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); } /** * Deletes the specified Firewall Policy. * * @param resourceGroupName The name of the resource group. * @param firewallPolicyName The name of the Firewall Policy. * @throws IllegalArgumentException thrown if parameters fail the validation * @throws CloudException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent */ public void delete(String resourceGroupName, String firewallPolicyName) { deleteWithServiceResponseAsync(resourceGroupName, firewallPolicyName).toBlocking().last().body(); } /** * Deletes the specified Firewall Policy. * * @param resourceGroupName The name of the resource group. * @param firewallPolicyName The name of the Firewall Policy. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ public ServiceFuture<Void> deleteAsync(String resourceGroupName, String firewallPolicyName, final ServiceCallback<Void> serviceCallback) { return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, firewallPolicyName), serviceCallback); } /** * Deletes the specified Firewall Policy. * * @param resourceGroupName The name of the resource group. * @param firewallPolicyName The name of the Firewall Policy. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request */ public Observable<Void> deleteAsync(String resourceGroupName, String firewallPolicyName) { return deleteWithServiceResponseAsync(resourceGroupName, firewallPolicyName).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); } /** * Deletes the specified Firewall Policy. * * @param resourceGroupName The name of the resource group. * @param firewallPolicyName The name of the Firewall Policy. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request */ public Observable<ServiceResponse<Void>> deleteWithServiceResponseAsync(String resourceGroupName, String firewallPolicyName) { if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (firewallPolicyName == null) { throw new IllegalArgumentException("Parameter firewallPolicyName is required and cannot be null."); } if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } final String apiVersion = "2019-09-01"; Observable<Response<ResponseBody>> observable = service.delete(resourceGroupName, firewallPolicyName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()); return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken<Void>() { }.getType()); } /** * Deletes the specified Firewall Policy. * * @param resourceGroupName The name of the resource group. * @param firewallPolicyName The name of the Firewall Policy. * @throws IllegalArgumentException thrown if parameters fail the validation * @throws CloudException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent */ public void beginDelete(String resourceGroupName, String firewallPolicyName) { beginDeleteWithServiceResponseAsync(resourceGroupName, firewallPolicyName).toBlocking().single().body(); } /** * Deletes the specified Firewall Policy. * * @param resourceGroupName The name of the resource group. * @param firewallPolicyName The name of the Firewall Policy. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ public ServiceFuture<Void> beginDeleteAsync(String resourceGroupName, String firewallPolicyName, final ServiceCallback<Void> serviceCallback) { return ServiceFuture.fromResponse(beginDeleteWithServiceResponseAsync(resourceGroupName, firewallPolicyName), serviceCallback); } /** * Deletes the specified Firewall Policy. * * @param resourceGroupName The name of the resource group. * @param firewallPolicyName The name of the Firewall Policy. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */ public Observable<Void> beginDeleteAsync(String resourceGroupName, String firewallPolicyName) { return beginDeleteWithServiceResponseAsync(resourceGroupName, firewallPolicyName).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); } /** * Deletes the specified Firewall Policy. * * @param resourceGroupName The name of the resource group. * @param firewallPolicyName The name of the Firewall Policy. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */ public Observable<ServiceResponse<Void>> beginDeleteWithServiceResponseAsync(String resourceGroupName, String firewallPolicyName) { if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (firewallPolicyName == null) { throw new IllegalArgumentException("Parameter firewallPolicyName is required and cannot be null."); } if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } final String apiVersion = "2019-09-01"; return service.beginDelete(resourceGroupName, firewallPolicyName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Void>>>() { @Override public Observable<ServiceResponse<Void>> call(Response<ResponseBody> response) { try { ServiceResponse<Void> clientResponse = beginDeleteDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); } } }); } private ServiceResponse<Void> beginDeleteDelegate(Response<ResponseBody> response) throws CloudException, IOException, IllegalArgumentException { return this.client.restClient().responseBuilderFactory().<Void, CloudException>newInstance(this.client.serializerAdapter()) .register(200, new TypeToken<Void>() { }.getType()) .register(202, new TypeToken<Void>() { }.getType()) .register(204, new TypeToken<Void>() { }.getType()) .registerError(CloudException.class) .build(response); } /** * Gets the specified Firewall Policy. * * @param resourceGroupName The name of the resource group. * @param firewallPolicyName The name of the Firewall Policy. * @throws IllegalArgumentException thrown if parameters fail the validation * @throws CloudException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the FirewallPolicyInner object if successful. */ public FirewallPolicyInner getByResourceGroup(String resourceGroupName, String firewallPolicyName) { return getByResourceGroupWithServiceResponseAsync(resourceGroupName, firewallPolicyName).toBlocking().single().body(); } /** * Gets the specified Firewall Policy. * * @param resourceGroupName The name of the resource group. * @param firewallPolicyName The name of the Firewall Policy. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ public ServiceFuture<FirewallPolicyInner> getByResourceGroupAsync(String resourceGroupName, String firewallPolicyName, final ServiceCallback<FirewallPolicyInner> serviceCallback) { return ServiceFuture.fromResponse(getByResourceGroupWithServiceResponseAsync(resourceGroupName, firewallPolicyName), serviceCallback); } /** * Gets the specified Firewall Policy. * * @param resourceGroupName The name of the resource group. * @param firewallPolicyName The name of the Firewall Policy. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the FirewallPolicyInner object */ public Observable<FirewallPolicyInner> getByResourceGroupAsync(String resourceGroupName, String firewallPolicyName) { return getByResourceGroupWithServiceResponseAsync(resourceGroupName, firewallPolicyName).map(new Func1<ServiceResponse<FirewallPolicyInner>, FirewallPolicyInner>() { @Override public FirewallPolicyInner call(ServiceResponse<FirewallPolicyInner> response) { return response.body(); } }); } /** * Gets the specified Firewall Policy. * * @param resourceGroupName The name of the resource group. * @param firewallPolicyName The name of the Firewall Policy. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the FirewallPolicyInner object */ public Observable<ServiceResponse<FirewallPolicyInner>> getByResourceGroupWithServiceResponseAsync(String resourceGroupName, String firewallPolicyName) { if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (firewallPolicyName == null) { throw new IllegalArgumentException("Parameter firewallPolicyName is required and cannot be null."); } if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } final String apiVersion = "2019-09-01"; final String expand = null; return service.getByResourceGroup(resourceGroupName, firewallPolicyName, this.client.subscriptionId(), apiVersion, expand, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<FirewallPolicyInner>>>() { @Override public Observable<ServiceResponse<FirewallPolicyInner>> call(Response<ResponseBody> response) { try { ServiceResponse<FirewallPolicyInner> clientResponse = getByResourceGroupDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); } } }); } /** * Gets the specified Firewall Policy. * * @param resourceGroupName The name of the resource group. * @param firewallPolicyName The name of the Firewall Policy. * @param expand Expands referenced resources. * @throws IllegalArgumentException thrown if parameters fail the validation * @throws CloudException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the FirewallPolicyInner object if successful. */ public FirewallPolicyInner getByResourceGroup(String resourceGroupName, String firewallPolicyName, String expand) { return getByResourceGroupWithServiceResponseAsync(resourceGroupName, firewallPolicyName, expand).toBlocking().single().body(); } /** * Gets the specified Firewall Policy. * * @param resourceGroupName The name of the resource group. * @param firewallPolicyName The name of the Firewall Policy. * @param expand Expands referenced resources. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ public ServiceFuture<FirewallPolicyInner> getByResourceGroupAsync(String resourceGroupName, String firewallPolicyName, String expand, final ServiceCallback<FirewallPolicyInner> serviceCallback) { return ServiceFuture.fromResponse(getByResourceGroupWithServiceResponseAsync(resourceGroupName, firewallPolicyName, expand), serviceCallback); } /** * Gets the specified Firewall Policy. * * @param resourceGroupName The name of the resource group. * @param firewallPolicyName The name of the Firewall Policy. * @param expand Expands referenced resources. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the FirewallPolicyInner object */ public Observable<FirewallPolicyInner> getByResourceGroupAsync(String resourceGroupName, String firewallPolicyName, String expand) { return getByResourceGroupWithServiceResponseAsync(resourceGroupName, firewallPolicyName, expand).map(new Func1<ServiceResponse<FirewallPolicyInner>, FirewallPolicyInner>() { @Override public FirewallPolicyInner call(ServiceResponse<FirewallPolicyInner> response) { return response.body(); } }); } /** * Gets the specified Firewall Policy. * * @param resourceGroupName The name of the resource group. * @param firewallPolicyName The name of the Firewall Policy. * @param expand Expands referenced resources. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the FirewallPolicyInner object */ public Observable<ServiceResponse<FirewallPolicyInner>> getByResourceGroupWithServiceResponseAsync(String resourceGroupName, String firewallPolicyName, String expand) { if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (firewallPolicyName == null) { throw new IllegalArgumentException("Parameter firewallPolicyName is required and cannot be null."); } if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } final String apiVersion = "2019-09-01"; return service.getByResourceGroup(resourceGroupName, firewallPolicyName, this.client.subscriptionId(), apiVersion, expand, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<FirewallPolicyInner>>>() { @Override public Observable<ServiceResponse<FirewallPolicyInner>> call(Response<ResponseBody> response) { try { ServiceResponse<FirewallPolicyInner> clientResponse = getByResourceGroupDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); } } }); } private ServiceResponse<FirewallPolicyInner> getByResourceGroupDelegate(Response<ResponseBody> response) throws CloudException, IOException, IllegalArgumentException { return this.client.restClient().responseBuilderFactory().<FirewallPolicyInner, CloudException>newInstance(this.client.serializerAdapter()) .register(200, new TypeToken<FirewallPolicyInner>() { }.getType()) .registerError(CloudException.class) .build(response); } /** * Creates or updates the specified Firewall Policy. * * @param resourceGroupName The name of the resource group. * @param firewallPolicyName The name of the Firewall Policy. * @param parameters Parameters supplied to the create or update Firewall Policy operation. * @throws IllegalArgumentException thrown if parameters fail the validation * @throws CloudException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the FirewallPolicyInner object if successful. */ public FirewallPolicyInner createOrUpdate(String resourceGroupName, String firewallPolicyName, FirewallPolicyInner parameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, firewallPolicyName, parameters).toBlocking().last().body(); } /** * Creates or updates the specified Firewall Policy. * * @param resourceGroupName The name of the resource group. * @param firewallPolicyName The name of the Firewall Policy. * @param parameters Parameters supplied to the create or update Firewall Policy operation. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ public ServiceFuture<FirewallPolicyInner> createOrUpdateAsync(String resourceGroupName, String firewallPolicyName, FirewallPolicyInner parameters, final ServiceCallback<FirewallPolicyInner> serviceCallback) { return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, firewallPolicyName, parameters), serviceCallback); } /** * Creates or updates the specified Firewall Policy. * * @param resourceGroupName The name of the resource group. * @param firewallPolicyName The name of the Firewall Policy. * @param parameters Parameters supplied to the create or update Firewall Policy operation. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request */ public Observable<FirewallPolicyInner> createOrUpdateAsync(String resourceGroupName, String firewallPolicyName, FirewallPolicyInner parameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, firewallPolicyName, parameters).map(new Func1<ServiceResponse<FirewallPolicyInner>, FirewallPolicyInner>() { @Override public FirewallPolicyInner call(ServiceResponse<FirewallPolicyInner> response) { return response.body(); } }); } /** * Creates or updates the specified Firewall Policy. * * @param resourceGroupName The name of the resource group. * @param firewallPolicyName The name of the Firewall Policy. * @param parameters Parameters supplied to the create or update Firewall Policy operation. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request */ public Observable<ServiceResponse<FirewallPolicyInner>> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String firewallPolicyName, FirewallPolicyInner parameters) { if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (firewallPolicyName == null) { throw new IllegalArgumentException("Parameter firewallPolicyName is required and cannot be null."); } if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } if (parameters == null) { throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); } Validator.validate(parameters); final String apiVersion = "2019-09-01"; Observable<Response<ResponseBody>> observable = service.createOrUpdate(resourceGroupName, firewallPolicyName, this.client.subscriptionId(), parameters, apiVersion, this.client.acceptLanguage(), this.client.userAgent()); return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken<FirewallPolicyInner>() { }.getType()); } /** * Creates or updates the specified Firewall Policy. * * @param resourceGroupName The name of the resource group. * @param firewallPolicyName The name of the Firewall Policy. * @param parameters Parameters supplied to the create or update Firewall Policy operation. * @throws IllegalArgumentException thrown if parameters fail the validation * @throws CloudException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the FirewallPolicyInner object if successful. */ public FirewallPolicyInner beginCreateOrUpdate(String resourceGroupName, String firewallPolicyName, FirewallPolicyInner parameters) { return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, firewallPolicyName, parameters).toBlocking().single().body(); } /** * Creates or updates the specified Firewall Policy. * * @param resourceGroupName The name of the resource group. * @param firewallPolicyName The name of the Firewall Policy. * @param parameters Parameters supplied to the create or update Firewall Policy operation. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ public ServiceFuture<FirewallPolicyInner> beginCreateOrUpdateAsync(String resourceGroupName, String firewallPolicyName, FirewallPolicyInner parameters, final ServiceCallback<FirewallPolicyInner> serviceCallback) { return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, firewallPolicyName, parameters), serviceCallback); } /** * Creates or updates the specified Firewall Policy. * * @param resourceGroupName The name of the resource group. * @param firewallPolicyName The name of the Firewall Policy. * @param parameters Parameters supplied to the create or update Firewall Policy operation. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the FirewallPolicyInner object */ public Observable<FirewallPolicyInner> beginCreateOrUpdateAsync(String resourceGroupName, String firewallPolicyName, FirewallPolicyInner parameters) { return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, firewallPolicyName, parameters).map(new Func1<ServiceResponse<FirewallPolicyInner>, FirewallPolicyInner>() { @Override public FirewallPolicyInner call(ServiceResponse<FirewallPolicyInner> response) { return response.body(); } }); } /** * Creates or updates the specified Firewall Policy. * * @param resourceGroupName The name of the resource group. * @param firewallPolicyName The name of the Firewall Policy. * @param parameters Parameters supplied to the create or update Firewall Policy operation. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the FirewallPolicyInner object */ public Observable<ServiceResponse<FirewallPolicyInner>> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String firewallPolicyName, FirewallPolicyInner parameters) { if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (firewallPolicyName == null) { throw new IllegalArgumentException("Parameter firewallPolicyName is required and cannot be null."); } if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } if (parameters == null) { throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); } Validator.validate(parameters); final String apiVersion = "2019-09-01"; return service.beginCreateOrUpdate(resourceGroupName, firewallPolicyName, this.client.subscriptionId(), parameters, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<FirewallPolicyInner>>>() { @Override public Observable<ServiceResponse<FirewallPolicyInner>> call(Response<ResponseBody> response) { try { ServiceResponse<FirewallPolicyInner> clientResponse = beginCreateOrUpdateDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); } } }); } private ServiceResponse<FirewallPolicyInner> beginCreateOrUpdateDelegate(Response<ResponseBody> response) throws CloudException, IOException, IllegalArgumentException { return this.client.restClient().responseBuilderFactory().<FirewallPolicyInner, CloudException>newInstance(this.client.serializerAdapter()) .register(200, new TypeToken<FirewallPolicyInner>() { }.getType()) .register(201, new TypeToken<FirewallPolicyInner>() { }.getType()) .registerError(CloudException.class) .build(response); } /** * Lists all Firewall Policies in a resource group. * * @param resourceGroupName The name of the resource group. * @throws IllegalArgumentException thrown if parameters fail the validation * @throws CloudException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the PagedList&lt;FirewallPolicyInner&gt; object if successful. */ public PagedList<FirewallPolicyInner> listByResourceGroup(final String resourceGroupName) { ServiceResponse<Page<FirewallPolicyInner>> response = listByResourceGroupSinglePageAsync(resourceGroupName).toBlocking().single(); return new PagedList<FirewallPolicyInner>(response.body()) { @Override public Page<FirewallPolicyInner> nextPage(String nextPageLink) { return listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); } }; } /** * Lists all Firewall Policies in a resource group. * * @param resourceGroupName The name of the resource group. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ public ServiceFuture<List<FirewallPolicyInner>> listByResourceGroupAsync(final String resourceGroupName, final ListOperationCallback<FirewallPolicyInner> serviceCallback) { return AzureServiceFuture.fromPageResponse( listByResourceGroupSinglePageAsync(resourceGroupName), new Func1<String, Observable<ServiceResponse<Page<FirewallPolicyInner>>>>() { @Override public Observable<ServiceResponse<Page<FirewallPolicyInner>>> call(String nextPageLink) { return listByResourceGroupNextSinglePageAsync(nextPageLink); } }, serviceCallback); } /** * Lists all Firewall Policies in a resource group. * * @param resourceGroupName The name of the resource group. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the PagedList&lt;FirewallPolicyInner&gt; object */ public Observable<Page<FirewallPolicyInner>> listByResourceGroupAsync(final String resourceGroupName) { return listByResourceGroupWithServiceResponseAsync(resourceGroupName) .map(new Func1<ServiceResponse<Page<FirewallPolicyInner>>, Page<FirewallPolicyInner>>() { @Override public Page<FirewallPolicyInner> call(ServiceResponse<Page<FirewallPolicyInner>> response) { return response.body(); } }); } /** * Lists all Firewall Policies in a resource group. * * @param resourceGroupName The name of the resource group. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the PagedList&lt;FirewallPolicyInner&gt; object */ public Observable<ServiceResponse<Page<FirewallPolicyInner>>> listByResourceGroupWithServiceResponseAsync(final String resourceGroupName) { return listByResourceGroupSinglePageAsync(resourceGroupName) .concatMap(new Func1<ServiceResponse<Page<FirewallPolicyInner>>, Observable<ServiceResponse<Page<FirewallPolicyInner>>>>() { @Override public Observable<ServiceResponse<Page<FirewallPolicyInner>>> call(ServiceResponse<Page<FirewallPolicyInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(listByResourceGroupNextWithServiceResponseAsync(nextPageLink)); } }); } /** * Lists all Firewall Policies in a resource group. * ServiceResponse<PageImpl<FirewallPolicyInner>> * @param resourceGroupName The name of the resource group. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the PagedList&lt;FirewallPolicyInner&gt; object wrapped in {@link ServiceResponse} if successful. */ public Observable<ServiceResponse<Page<FirewallPolicyInner>>> listByResourceGroupSinglePageAsync(final String resourceGroupName) { if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } final String apiVersion = "2019-09-01"; return service.listByResourceGroup(resourceGroupName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Page<FirewallPolicyInner>>>>() { @Override public Observable<ServiceResponse<Page<FirewallPolicyInner>>> call(Response<ResponseBody> response) { try { ServiceResponse<PageImpl<FirewallPolicyInner>> result = listByResourceGroupDelegate(response); return Observable.just(new ServiceResponse<Page<FirewallPolicyInner>>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } } }); } private ServiceResponse<PageImpl<FirewallPolicyInner>> listByResourceGroupDelegate(Response<ResponseBody> response) throws CloudException, IOException, IllegalArgumentException { return this.client.restClient().responseBuilderFactory().<PageImpl<FirewallPolicyInner>, CloudException>newInstance(this.client.serializerAdapter()) .register(200, new TypeToken<PageImpl<FirewallPolicyInner>>() { }.getType()) .registerError(CloudException.class) .build(response); } /** * Gets all the Firewall Policies in a subscription. * * @throws IllegalArgumentException thrown if parameters fail the validation * @throws CloudException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the PagedList&lt;FirewallPolicyInner&gt; object if successful. */ public PagedList<FirewallPolicyInner> list() { ServiceResponse<Page<FirewallPolicyInner>> response = listSinglePageAsync().toBlocking().single(); return new PagedList<FirewallPolicyInner>(response.body()) { @Override public Page<FirewallPolicyInner> nextPage(String nextPageLink) { return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); } }; } /** * Gets all the Firewall Policies in a subscription. * * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ public ServiceFuture<List<FirewallPolicyInner>> listAsync(final ListOperationCallback<FirewallPolicyInner> serviceCallback) { return AzureServiceFuture.fromPageResponse( listSinglePageAsync(), new Func1<String, Observable<ServiceResponse<Page<FirewallPolicyInner>>>>() { @Override public Observable<ServiceResponse<Page<FirewallPolicyInner>>> call(String nextPageLink) { return listNextSinglePageAsync(nextPageLink); } }, serviceCallback); } /** * Gets all the Firewall Policies in a subscription. * * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the PagedList&lt;FirewallPolicyInner&gt; object */ public Observable<Page<FirewallPolicyInner>> listAsync() { return listWithServiceResponseAsync() .map(new Func1<ServiceResponse<Page<FirewallPolicyInner>>, Page<FirewallPolicyInner>>() { @Override public Page<FirewallPolicyInner> call(ServiceResponse<Page<FirewallPolicyInner>> response) { return response.body(); } }); } /** * Gets all the Firewall Policies in a subscription. * * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the PagedList&lt;FirewallPolicyInner&gt; object */ public Observable<ServiceResponse<Page<FirewallPolicyInner>>> listWithServiceResponseAsync() { return listSinglePageAsync() .concatMap(new Func1<ServiceResponse<Page<FirewallPolicyInner>>, Observable<ServiceResponse<Page<FirewallPolicyInner>>>>() { @Override public Observable<ServiceResponse<Page<FirewallPolicyInner>>> call(ServiceResponse<Page<FirewallPolicyInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); } }); } /** * Gets all the Firewall Policies in a subscription. * * @throws IllegalArgumentException thrown if parameters fail the validation * @return the PagedList&lt;FirewallPolicyInner&gt; object wrapped in {@link ServiceResponse} if successful. */ public Observable<ServiceResponse<Page<FirewallPolicyInner>>> listSinglePageAsync() { if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } final String apiVersion = "2019-09-01"; return service.list(this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Page<FirewallPolicyInner>>>>() { @Override public Observable<ServiceResponse<Page<FirewallPolicyInner>>> call(Response<ResponseBody> response) { try { ServiceResponse<PageImpl<FirewallPolicyInner>> result = listDelegate(response); return Observable.just(new ServiceResponse<Page<FirewallPolicyInner>>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } } }); } private ServiceResponse<PageImpl<FirewallPolicyInner>> listDelegate(Response<ResponseBody> response) throws CloudException, IOException, IllegalArgumentException { return this.client.restClient().responseBuilderFactory().<PageImpl<FirewallPolicyInner>, CloudException>newInstance(this.client.serializerAdapter()) .register(200, new TypeToken<PageImpl<FirewallPolicyInner>>() { }.getType()) .registerError(CloudException.class) .build(response); } /** * Lists all Firewall Policies in a resource group. * * @param nextPageLink The NextLink from the previous successful call to List operation. * @throws IllegalArgumentException thrown if parameters fail the validation * @throws CloudException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the PagedList&lt;FirewallPolicyInner&gt; object if successful. */ public PagedList<FirewallPolicyInner> listByResourceGroupNext(final String nextPageLink) { ServiceResponse<Page<FirewallPolicyInner>> response = listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single(); return new PagedList<FirewallPolicyInner>(response.body()) { @Override public Page<FirewallPolicyInner> nextPage(String nextPageLink) { return listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); } }; } /** * Lists all Firewall Policies in a resource group. * * @param nextPageLink The NextLink from the previous successful call to List operation. * @param serviceFuture the ServiceFuture object tracking the Retrofit calls * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ public ServiceFuture<List<FirewallPolicyInner>> listByResourceGroupNextAsync(final String nextPageLink, final ServiceFuture<List<FirewallPolicyInner>> serviceFuture, final ListOperationCallback<FirewallPolicyInner> serviceCallback) { return AzureServiceFuture.fromPageResponse( listByResourceGroupNextSinglePageAsync(nextPageLink), new Func1<String, Observable<ServiceResponse<Page<FirewallPolicyInner>>>>() { @Override public Observable<ServiceResponse<Page<FirewallPolicyInner>>> call(String nextPageLink) { return listByResourceGroupNextSinglePageAsync(nextPageLink); } }, serviceCallback); } /** * Lists all Firewall Policies in a resource group. * * @param nextPageLink The NextLink from the previous successful call to List operation. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the PagedList&lt;FirewallPolicyInner&gt; object */ public Observable<Page<FirewallPolicyInner>> listByResourceGroupNextAsync(final String nextPageLink) { return listByResourceGroupNextWithServiceResponseAsync(nextPageLink) .map(new Func1<ServiceResponse<Page<FirewallPolicyInner>>, Page<FirewallPolicyInner>>() { @Override public Page<FirewallPolicyInner> call(ServiceResponse<Page<FirewallPolicyInner>> response) { return response.body(); } }); } /** * Lists all Firewall Policies in a resource group. * * @param nextPageLink The NextLink from the previous successful call to List operation. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the PagedList&lt;FirewallPolicyInner&gt; object */ public Observable<ServiceResponse<Page<FirewallPolicyInner>>> listByResourceGroupNextWithServiceResponseAsync(final String nextPageLink) { return listByResourceGroupNextSinglePageAsync(nextPageLink) .concatMap(new Func1<ServiceResponse<Page<FirewallPolicyInner>>, Observable<ServiceResponse<Page<FirewallPolicyInner>>>>() { @Override public Observable<ServiceResponse<Page<FirewallPolicyInner>>> call(ServiceResponse<Page<FirewallPolicyInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(listByResourceGroupNextWithServiceResponseAsync(nextPageLink)); } }); } /** * Lists all Firewall Policies in a resource group. * ServiceResponse<PageImpl<FirewallPolicyInner>> * @param nextPageLink The NextLink from the previous successful call to List operation. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the PagedList&lt;FirewallPolicyInner&gt; object wrapped in {@link ServiceResponse} if successful. */ public Observable<ServiceResponse<Page<FirewallPolicyInner>>> listByResourceGroupNextSinglePageAsync(final String nextPageLink) { if (nextPageLink == null) { throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); } String nextUrl = String.format("%s", nextPageLink); return service.listByResourceGroupNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Page<FirewallPolicyInner>>>>() { @Override public Observable<ServiceResponse<Page<FirewallPolicyInner>>> call(Response<ResponseBody> response) { try { ServiceResponse<PageImpl<FirewallPolicyInner>> result = listByResourceGroupNextDelegate(response); return Observable.just(new ServiceResponse<Page<FirewallPolicyInner>>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } } }); } private ServiceResponse<PageImpl<FirewallPolicyInner>> listByResourceGroupNextDelegate(Response<ResponseBody> response) throws CloudException, IOException, IllegalArgumentException { return this.client.restClient().responseBuilderFactory().<PageImpl<FirewallPolicyInner>, CloudException>newInstance(this.client.serializerAdapter()) .register(200, new TypeToken<PageImpl<FirewallPolicyInner>>() { }.getType()) .registerError(CloudException.class) .build(response); } /** * Gets all the Firewall Policies in a subscription. * * @param nextPageLink The NextLink from the previous successful call to List operation. * @throws IllegalArgumentException thrown if parameters fail the validation * @throws CloudException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the PagedList&lt;FirewallPolicyInner&gt; object if successful. */ public PagedList<FirewallPolicyInner> listNext(final String nextPageLink) { ServiceResponse<Page<FirewallPolicyInner>> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); return new PagedList<FirewallPolicyInner>(response.body()) { @Override public Page<FirewallPolicyInner> nextPage(String nextPageLink) { return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); } }; } /** * Gets all the Firewall Policies in a subscription. * * @param nextPageLink The NextLink from the previous successful call to List operation. * @param serviceFuture the ServiceFuture object tracking the Retrofit calls * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ public ServiceFuture<List<FirewallPolicyInner>> listNextAsync(final String nextPageLink, final ServiceFuture<List<FirewallPolicyInner>> serviceFuture, final ListOperationCallback<FirewallPolicyInner> serviceCallback) { return AzureServiceFuture.fromPageResponse( listNextSinglePageAsync(nextPageLink), new Func1<String, Observable<ServiceResponse<Page<FirewallPolicyInner>>>>() { @Override public Observable<ServiceResponse<Page<FirewallPolicyInner>>> call(String nextPageLink) { return listNextSinglePageAsync(nextPageLink); } }, serviceCallback); } /** * Gets all the Firewall Policies in a subscription. * * @param nextPageLink The NextLink from the previous successful call to List operation. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the PagedList&lt;FirewallPolicyInner&gt; object */ public Observable<Page<FirewallPolicyInner>> listNextAsync(final String nextPageLink) { return listNextWithServiceResponseAsync(nextPageLink) .map(new Func1<ServiceResponse<Page<FirewallPolicyInner>>, Page<FirewallPolicyInner>>() { @Override public Page<FirewallPolicyInner> call(ServiceResponse<Page<FirewallPolicyInner>> response) { return response.body(); } }); } /** * Gets all the Firewall Policies in a subscription. * * @param nextPageLink The NextLink from the previous successful call to List operation. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the PagedList&lt;FirewallPolicyInner&gt; object */ public Observable<ServiceResponse<Page<FirewallPolicyInner>>> listNextWithServiceResponseAsync(final String nextPageLink) { return listNextSinglePageAsync(nextPageLink) .concatMap(new Func1<ServiceResponse<Page<FirewallPolicyInner>>, Observable<ServiceResponse<Page<FirewallPolicyInner>>>>() { @Override public Observable<ServiceResponse<Page<FirewallPolicyInner>>> call(ServiceResponse<Page<FirewallPolicyInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); } }); } /** * Gets all the Firewall Policies in a subscription. * ServiceResponse<PageImpl<FirewallPolicyInner>> * @param nextPageLink The NextLink from the previous successful call to List operation. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the PagedList&lt;FirewallPolicyInner&gt; object wrapped in {@link ServiceResponse} if successful. */ public Observable<ServiceResponse<Page<FirewallPolicyInner>>> listNextSinglePageAsync(final String nextPageLink) { if (nextPageLink == null) { throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); } String nextUrl = String.format("%s", nextPageLink); return service.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Page<FirewallPolicyInner>>>>() { @Override public Observable<ServiceResponse<Page<FirewallPolicyInner>>> call(Response<ResponseBody> response) { try { ServiceResponse<PageImpl<FirewallPolicyInner>> result = listNextDelegate(response); return Observable.just(new ServiceResponse<Page<FirewallPolicyInner>>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } } }); } private ServiceResponse<PageImpl<FirewallPolicyInner>> listNextDelegate(Response<ResponseBody> response) throws CloudException, IOException, IllegalArgumentException { return this.client.restClient().responseBuilderFactory().<PageImpl<FirewallPolicyInner>, CloudException>newInstance(this.client.serializerAdapter()) .register(200, new TypeToken<PageImpl<FirewallPolicyInner>>() { }.getType()) .registerError(CloudException.class) .build(response); } }
{ "pile_set_name": "Github" }
/*************************************************************************** * Copyright (C) 2003 by David Saxton * * [email protected] * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * ***************************************************************************/ #ifndef SEVENSEG_H #define SEVENSEG_H #include "flowpart.h" /** @short Allows a configurable output to a seven segment display @author David Saxton */ class SevenSeg : public FlowPart { public: SevenSeg(ICNDocument *icnDocument, bool newItem, const char *id = nullptr); ~SevenSeg() override; static Item *construct(ItemDocument *itemDocument, bool newItem, const char *id); static LibraryItem *libraryItem(); void generateMicrobe(FlowCode *code) override; protected: void dataChanged() override; }; #endif
{ "pile_set_name": "Github" }
400 Bad Request Date: Mon, 06 Apr 2020 13:54:27 GMT Content-Type: text/html Content-Length: 636 Retry-Count: 0
{ "pile_set_name": "Github" }
%w[ .ruby-version .rbenv-vars tmp/restart.txt tmp/caching-dev.txt ].each { |path| Spring.watch(path) }
{ "pile_set_name": "Github" }
/*------------------------------------------------------------------------------*/ /** * \file GW_Parameterization.inl * \brief Inlined methods for \c GW_Parameterization * \author Gabriel Peyré * \date 7-1-2003 */ /*------------------------------------------------------------------------------*/ #include "GW_Parameterization.h" namespace GW { GW_INLINE GW_Float GW_Parameterization::ComputeCenteringEnergy( GW_GeodesicVertex& Vert, GW_GeodesicVertex& StartVert, GW_GeodesicMesh& Mesh ) { /* compute a fast marching and confine it to local voronoi digram */ pCurVoronoiDiagram_ = &StartVert; Mesh.RegisterVertexInsersionCallbackFunction( FastMarchingCallbackFunction_Centering ); GW_VoronoiMesh::ResetOnlyVertexState( Mesh ); Mesh.PerformFastMarching( &Vert ); pCurVoronoiDiagram_ = NULL; Mesh.RegisterVertexInsersionCallbackFunction( NULL ); /* march on the voronoi diagram */ GW_Float rTotalEnergy = 0; T_FaceList FaceToProceed; FaceToProceed.push_back( Vert.GetFace() ); T_FaceMap FaceMap; FaceMap[ Vert.GetFace()->GetID() ] = Vert.GetFace(); while( !FaceToProceed.empty() ) { GW_Face* pFace = FaceToProceed.front(); GW_ASSERT( pFace!=NULL ); FaceToProceed.pop_front(); /* compute contribution, for the moment, simple method. Todo : use area define by previous voronoi regions. */ GW_Float rArea = pFace->GetArea(); GW_Float d[3]; for( GW_U32 i=0; i<3; ++i ) // retrieve distance { GW_GeodesicVertex* pVert = (GW_GeodesicVertex*) pFace->GetVertex(i); GW_ASSERT( pVert!=NULL ); d[i] = pVert->GetDistance(); } rTotalEnergy += rArea*(d[0]*d[0] + d[1]*d[1] + d[2]*d[2])/3; /* add neighbors */ for( GW_U32 i=0; i<3; ++i ) { GW_Face* pNewFace = pFace->GetFaceNeighbor(i); if( pNewFace!=NULL && FaceMap.find(pNewFace->GetID())==FaceMap.end() ) { GW_Bool bAddThisFace = GW_False; for( GW_U32 nVert=0; nVert<3; ++nVert ) { GW_GeodesicVertex* pVert = (GW_GeodesicVertex*) pNewFace->GetVertex(i); GW_ASSERT( pVert!=NULL ); if( pVert->GetFront()==&Vert ) { bAddThisFace = GW_True; break; } } if( bAddThisFace ) { FaceToProceed.push_back( pNewFace ); FaceMap[ pNewFace->GetID() ] = pNewFace; // so that it won't be added anymore } } } } return rTotalEnergy; } GW_INLINE void GW_Parameterization::CutEdge( GW_GeodesicVertex& Vert1, GW_GeodesicVertex& Vert2, GW_GeodesicVertex* &pInter_1, GW_GeodesicVertex* &pInter_2, GW_GeodesicMesh& Mesh ) { GW_Float eps = 0.0; GW_U32 nID = GW_Vertex::ComputeUniqueId( Vert1, Vert2 ); if( CutEdgeMap_.find(nID)==CutEdgeMap_.end() ) { GW_Float lambda; GW_Vector3D pos; /* this edge has not been previously cutted : do so ! */ GW_GeodesicVertex::ComputeFrontIntersection( Vert1, Vert2, &pos, &lambda ); if( lambda<eps ) lambda = 0; if( lambda>1-eps ) lambda = 1; pos = Vert1.GetPosition()*lambda + Vert2.GetPosition()*(1-lambda); GW_Float rNewDist = Vert1.GetDistance()*lambda + Vert2.GetDistance()*(1-lambda); GW_Vector3D Normal = Vert1.GetNormal()*lambda + Vert2.GetNormal()*(1-lambda); Normal.Normalize(); GW_Vector3D t1( Vert1.GetTexCoordU(), Vert1.GetTexCoordV(), 0 ); GW_Vector3D t2( Vert2.GetTexCoordU(), Vert2.GetTexCoordV(), 0 ); GW_Vector3D tex = t1*lambda + t2*(1-lambda); pInter_1 = (GW_GeodesicVertex*) &Mesh.CreateNewVertex(); Mesh.SetNbrVertex( Mesh.GetNbrVertex()+1 ); Mesh.SetVertex( Mesh.GetNbrVertex()-1, pInter_1 ); pInter_1->SetPosition( pos ); pInter_1->SetDistance( rNewDist ); pInter_1->SetFront( Vert1.GetFront() ); pInter_1->SetNormal( Normal ); pInter_1->SetTexCoords( tex[0],tex[1] ); pInter_2 = (GW_GeodesicVertex*) &Mesh.CreateNewVertex(); Mesh.SetNbrVertex( Mesh.GetNbrVertex()+1 ); Mesh.SetVertex( Mesh.GetNbrVertex()-1, pInter_2 ); pInter_2->SetPosition( pos ); pInter_2->SetDistance( rNewDist ); pInter_2->SetFront( Vert2.GetFront() ); pInter_2->SetNormal( Normal ); pInter_2->SetTexCoords( tex[0],tex[1] ); /* save the cut */ GW_EdgeCut Cut( Vert1, Vert2, *pInter_1, *pInter_2 ); CutEdgeMap_[nID] = Cut; } else { /* this edge has already been cut. Use this cut */ GW_EdgeCut& Cut = CutEdgeMap_[nID]; pInter_1 = Cut.GetNewVertex( Vert1 ); pInter_2 = Cut.GetNewVertex( Vert2 ); } } GW_INLINE GW_GeodesicFace* CreateNewFace( GW_GeodesicMesh& Mesh, GW_GeodesicVertex* pV1, GW_GeodesicVertex* pV2, GW_GeodesicVertex* pV3 ) { GW_GeodesicFace* pNewFace = (GW_GeodesicFace*) &Mesh.CreateNewFace(); pNewFace->SetVertex( *pV1, *pV2, *pV3); Mesh.SetNbrFace( Mesh.GetNbrFace()+1 ); Mesh.SetFace( Mesh.GetNbrFace()-1, pNewFace ); return pNewFace; } /*------------------------------------------------------------------------------*/ // Name : GW_Parameterization::CutFace /** * \param Face [GW_Face&] The face to cut. * \param BaseVert [GW_GeodesicVertex&] The origin of the voronoi region we are segmenting. * \author Gabriel Peyré * \date 7-1-2003 * * Cut a face according to voronoi diagrams. */ /*------------------------------------------------------------------------------*/ GW_INLINE void GW_Parameterization::CutFace( GW_Face& Face, GW_GeodesicVertex& BaseVert, GW_GeodesicMesh& Mesh, T_TrissectorInfoMap* pTrissectorInfoMap ) { GW_Vector3D pos; /* for each vertex see if there is a contribution */ GW_U32 nNumContrib = 0; GW_U32 nNumOther = 0; GW_GeodesicVertex* pVertContrib[3] = { NULL, NULL, NULL }; // the vertice contributing GW_Float d[3] = { -1, -1, -1 }; // the distance for( GW_U32 i=0; i<3; ++i ) { GW_GeodesicVertex* pVert = (GW_GeodesicVertex*) Face.GetVertex(i); GW_ASSERT( pVert!=NULL ); if( pVert->GetFront()==&BaseVert ) { pVertContrib[nNumContrib] = pVert; d[nNumContrib] = pVert->GetDistance(); nNumContrib++; } else { pVertContrib[2-nNumOther] = pVert; d[2-nNumOther] = pVert->GetDistance(); nNumOther++; } } /* for each special case, Compute the polygon */ switch(nNumContrib) { case 1: { /* the contributor is pVertContrib[0], and pVertContrib[1] & pVertContrib[2] are not contributing */ if( pVertContrib[1]->GetFront()==pVertContrib[2]->GetFront() ) { /* compute 1st intersection point. See if we can retrieve from neighbors */ GW_GeodesicVertex* pInter1_1 = NULL; GW_GeodesicVertex* pInter1_2 = NULL; this->CutEdge( *pVertContrib[0], *pVertContrib[1], pInter1_1, pInter1_2, Mesh ); /* compute 2nd intersection point */ GW_GeodesicVertex* pInter2_1 = NULL; GW_GeodesicVertex* pInter2_2 = NULL; this->CutEdge( *pVertContrib[0], *pVertContrib[2], pInter2_1, pInter2_2, Mesh ); /* build the faces. For the moment, don't bother with neighbor relations. */ Face.SetVertex( *pVertContrib[0], *pInter1_1, *pInter2_1 ); GW_GeodesicFace* pNewFace1 = CreateNewFace( Mesh, pVertContrib[1], pVertContrib[2], pInter1_2 ); GW_GeodesicFace* pNewFace2 = CreateNewFace( Mesh, pVertContrib[2], pInter2_2, pInter1_2 ); /* the face belonging of the old vertices can change ! */ if( pVertContrib[1]->GetFace()==&Face ) pVertContrib[1]->SetFace( *pNewFace1 ); if( pVertContrib[2]->GetFace()==&Face ) pVertContrib[2]->SetFace( *pNewFace2 ); } else { /* compute 1st intersection point. See if we can retrieve from neighbors */ GW_GeodesicVertex* pInter1_1 = NULL; GW_GeodesicVertex* pInter1_2 = NULL; this->CutEdge( *pVertContrib[0], *pVertContrib[1], pInter1_1, pInter1_2, Mesh ); /* compute 2nd intersection point */ GW_GeodesicVertex* pInter2_1 = NULL; GW_GeodesicVertex* pInter2_2 = NULL; this->CutEdge( *pVertContrib[0], *pVertContrib[2], pInter2_1, pInter2_2, Mesh ); /* compute 3nd intersection point */ GW_GeodesicVertex* pInter3_1 = NULL; GW_GeodesicVertex* pInter3_2 = NULL; this->CutEdge( *pVertContrib[1], *pVertContrib[2], pInter3_1, pInter3_2, Mesh ); /* compute center vertices */ GW_Float rNewDist = (pInter1_1->GetDistance()+pInter2_1->GetDistance()+pInter3_1->GetDistance())/3; GW_Vector3D pos = (pInter1_1->GetPosition()+pInter2_1->GetPosition()+pInter3_1->GetPosition())/3; GW_Vector3D Normal = (pInter1_1->GetNormal()+pInter2_1->GetNormal()+pInter3_1->GetNormal())/3; GW_GeodesicVertex* pCenter1 = (GW_GeodesicVertex*) &Mesh.CreateNewVertex(); Mesh.SetNbrVertex( Mesh.GetNbrVertex()+1 ); Mesh.SetVertex( Mesh.GetNbrVertex()-1, pCenter1 ); pCenter1->SetDistance(rNewDist); pCenter1->SetPosition(pos); pCenter1->SetNormal(Normal); pCenter1->SetFront( pVertContrib[0]->GetFront() ); GW_GeodesicVertex* pCenter2 = (GW_GeodesicVertex*) &Mesh.CreateNewVertex(); Mesh.SetNbrVertex( Mesh.GetNbrVertex()+1 ); Mesh.SetVertex( Mesh.GetNbrVertex()-1, pCenter2 ); pCenter2->SetDistance(rNewDist); pCenter2->SetPosition(pos); pCenter2->SetNormal(Normal); pCenter2->SetFront( pVertContrib[1]->GetFront() ); GW_GeodesicVertex* pCenter3 = (GW_GeodesicVertex*) &Mesh.CreateNewVertex(); Mesh.SetNbrVertex( Mesh.GetNbrVertex()+1 ); Mesh.SetVertex( Mesh.GetNbrVertex()-1, pCenter3 ); pCenter3->SetDistance(rNewDist); pCenter3->SetPosition(pos); pCenter3->SetNormal(Normal); pCenter3->SetFront( pVertContrib[2]->GetFront() ); /* add trissector information */ if( pTrissectorInfoMap!=NULL ) { GW_TrissectorInfo trisec1(pVertContrib[0]->GetFront()->GetID(), pVertContrib[1]->GetFront()->GetID(), pVertContrib[2]->GetFront()->GetID()); GW_TrissectorInfo trisec2(pVertContrib[1]->GetFront()->GetID(), pVertContrib[0]->GetFront()->GetID(), pVertContrib[2]->GetFront()->GetID()); GW_TrissectorInfo trisec3(pVertContrib[2]->GetFront()->GetID(), pVertContrib[0]->GetFront()->GetID(), pVertContrib[1]->GetFront()->GetID()); (*pTrissectorInfoMap)[pCenter1->GetID()] = trisec1; (*pTrissectorInfoMap)[pCenter2->GetID()] = trisec2; (*pTrissectorInfoMap)[pCenter3->GetID()] = trisec3; } /* Build the faces. For the moment, don't bother with neighbor relations. */ Face.SetVertex( *pVertContrib[0], *pInter1_1, *pCenter1 ); CreateNewFace( Mesh, pVertContrib[0], pCenter1, pInter2_1 ); GW_GeodesicFace* pNewFace1 = CreateNewFace( Mesh, pVertContrib[1], pCenter2, pInter1_2 ); CreateNewFace( Mesh, pVertContrib[1], pInter3_1, pCenter2 ); if( pVertContrib[1]->GetFace()==&Face ) pVertContrib[1]->SetFace( *pNewFace1 ); GW_GeodesicFace* pNewFace2 = CreateNewFace( Mesh, pVertContrib[2], pCenter3, pInter3_2 ); CreateNewFace( Mesh, pVertContrib[2], pInter2_2, pCenter3 ); if( pVertContrib[2]->GetFace()==&Face ) pVertContrib[2]->SetFace( *pNewFace2 ); } } break; case 2: { /* compute 1st intersection point. See if we can retrieve from neighbors */ GW_GeodesicVertex* pInter1_1 = NULL; GW_GeodesicVertex* pInter1_2 = NULL; this->CutEdge( *pVertContrib[0], *pVertContrib[2], pInter1_1, pInter1_2, Mesh ); /* compute 2nd intersection point */ GW_GeodesicVertex* pInter2_1 = NULL; GW_GeodesicVertex* pInter2_2 = NULL; this->CutEdge( *pVertContrib[1], *pVertContrib[2], pInter2_1, pInter2_2, Mesh ); /* build the faces. For the moment, don't bother with neighbor relations. */ Face.SetVertex( *pVertContrib[0], *pInter2_1, *pVertContrib[1] ); CreateNewFace( Mesh, pVertContrib[0], pInter1_1, pInter2_1 ); GW_GeodesicFace* pNewFace2 = CreateNewFace( Mesh, pInter1_2, pVertContrib[2], pInter2_2 ); if( pVertContrib[2]->GetFace()==&Face ) pVertContrib[2]->SetFace( *pNewFace2 ); } break; case 3: /* no cut should be performed */ break; default: GW_ASSERT(GW_False); return; } } } // End namespace GW /////////////////////////////////////////////////////////////////////////////// // Copyright (c) Gabriel Peyré /////////////////////////////////////////////////////////////////////////////// // END OF FILE // ///////////////////////////////////////////////////////////////////////////////
{ "pile_set_name": "Github" }
// Copyright 2009 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // +build 386,openbsd package unix func setTimespec(sec, nsec int64) Timespec { return Timespec{Sec: sec, Nsec: int32(nsec)} } func setTimeval(sec, usec int64) Timeval { return Timeval{Sec: sec, Usec: int32(usec)} } func SetKevent(k *Kevent_t, fd, mode, flags int) { k.Ident = uint32(fd) k.Filter = int16(mode) k.Flags = uint16(flags) } func (iov *Iovec) SetLen(length int) { iov.Len = uint32(length) } func (msghdr *Msghdr) SetControllen(length int) { msghdr.Controllen = uint32(length) } func (cmsg *Cmsghdr) SetLen(length int) { cmsg.Len = uint32(length) }
{ "pile_set_name": "Github" }
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!-- NewPage --> <html lang="de"> <head> <!-- Generated by javadoc (1.8.0_231) on Sun Nov 17 02:10:20 CET 2019 --> <title>org.deidentifier.arx.framework.lattice Class Hierarchy</title> <meta name="date" content="2019-11-17"> <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="org.deidentifier.arx.framework.lattice Class Hierarchy"; } } 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>Class</li> <li>Use</li> <li class="navBarCell1Rev">Tree</li> <li><a href="../../../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../../../index-files/index-1.html">Index</a></li> <li><a href="../../../../../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li><a href="../../../../../org/deidentifier/arx/framework/data/package-tree.html">Prev</a></li> <li><a href="../../../../../org/deidentifier/arx/gui/package-tree.html">Next</a></li> </ul> <ul class="navList"> <li><a href="../../../../../index.html?org/deidentifier/arx/framework/lattice/package-tree.html" target="_top">Frames</a></li> <li><a href="package-tree.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"> <h1 class="title">Hierarchy For Package org.deidentifier.arx.framework.lattice</h1> <span class="packageHierarchyLabel">Package Hierarchies:</span> <ul class="horizontal"> <li><a href="../../../../../overview-tree.html">All Packages</a></li> </ul> </div> <div class="contentContainer"> <h2 title="Class Hierarchy">Class Hierarchy</h2> <ul> <li type="circle">java.lang.Object <ul> <li type="circle">org.deidentifier.arx.framework.lattice.<a href="../../../../../org/deidentifier/arx/framework/lattice/DependentAction.html" title="class in org.deidentifier.arx.framework.lattice"><span class="typeNameLink">DependentAction</span></a> <ul> <li type="circle">org.deidentifier.arx.framework.lattice.<a href="../../../../../org/deidentifier/arx/framework/lattice/DependentAction.NodeActionConstant.html" title="class in org.deidentifier.arx.framework.lattice"><span class="typeNameLink">DependentAction.NodeActionConstant</span></a></li> <li type="circle">org.deidentifier.arx.framework.lattice.<a href="../../../../../org/deidentifier/arx/framework/lattice/DependentAction.NodeActionInverse.html" title="class in org.deidentifier.arx.framework.lattice"><span class="typeNameLink">DependentAction.NodeActionInverse</span></a></li> </ul> </li> <li type="circle">org.deidentifier.arx.framework.lattice.<a href="../../../../../org/deidentifier/arx/framework/lattice/ObjectIterator.html" title="class in org.deidentifier.arx.framework.lattice"><span class="typeNameLink">ObjectIterator</span></a>&lt;T&gt; <ul> <li type="circle">org.deidentifier.arx.framework.lattice.<a href="../../../../../org/deidentifier/arx/framework/lattice/ObjectIterator.ObjectIteratorIntArray.html" title="class in org.deidentifier.arx.framework.lattice"><span class="typeNameLink">ObjectIterator.ObjectIteratorIntArray</span></a></li> <li type="circle">org.deidentifier.arx.framework.lattice.<a href="../../../../../org/deidentifier/arx/framework/lattice/ObjectIterator.ObjectIteratorLong.html" title="class in org.deidentifier.arx.framework.lattice"><span class="typeNameLink">ObjectIterator.ObjectIteratorLong</span></a></li> </ul> </li> <li type="circle">org.deidentifier.arx.framework.lattice.<a href="../../../../../org/deidentifier/arx/framework/lattice/SolutionSpace.html" title="class in org.deidentifier.arx.framework.lattice"><span class="typeNameLink">SolutionSpace</span></a>&lt;T&gt; <ul> <li type="circle">org.deidentifier.arx.framework.lattice.<a href="../../../../../org/deidentifier/arx/framework/lattice/SolutionSpaceIntArray.html" title="class in org.deidentifier.arx.framework.lattice"><span class="typeNameLink">SolutionSpaceIntArray</span></a></li> <li type="circle">org.deidentifier.arx.framework.lattice.<a href="../../../../../org/deidentifier/arx/framework/lattice/SolutionSpaceLong.html" title="class in org.deidentifier.arx.framework.lattice"><span class="typeNameLink">SolutionSpaceLong</span></a></li> </ul> </li> <li type="circle">org.deidentifier.arx.framework.lattice.<a href="../../../../../org/deidentifier/arx/framework/lattice/Transformation.html" title="class in org.deidentifier.arx.framework.lattice"><span class="typeNameLink">Transformation</span></a>&lt;T&gt; <ul> <li type="circle">org.deidentifier.arx.framework.lattice.<a href="../../../../../org/deidentifier/arx/framework/lattice/TransformationIntArray.html" title="class in org.deidentifier.arx.framework.lattice"><span class="typeNameLink">TransformationIntArray</span></a></li> <li type="circle">org.deidentifier.arx.framework.lattice.<a href="../../../../../org/deidentifier/arx/framework/lattice/TransformationLong.html" title="class in org.deidentifier.arx.framework.lattice"><span class="typeNameLink">TransformationLong</span></a></li> </ul> </li> <li type="circle">org.deidentifier.arx.framework.lattice.<a href="../../../../../org/deidentifier/arx/framework/lattice/TransformationList.html" title="class in org.deidentifier.arx.framework.lattice"><span class="typeNameLink">TransformationList</span></a>&lt;T&gt;</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>Class</li> <li>Use</li> <li class="navBarCell1Rev">Tree</li> <li><a href="../../../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../../../index-files/index-1.html">Index</a></li> <li><a href="../../../../../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li><a href="../../../../../org/deidentifier/arx/framework/data/package-tree.html">Prev</a></li> <li><a href="../../../../../org/deidentifier/arx/gui/package-tree.html">Next</a></li> </ul> <ul class="navList"> <li><a href="../../../../../index.html?org/deidentifier/arx/framework/lattice/package-tree.html" target="_top">Frames</a></li> <li><a href="package-tree.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 ======= --> </body> </html>
{ "pile_set_name": "Github" }
/* * DDP: An implementation of the AppleTalk DDP protocol for * Ethernet 'ELAP'. * * Alan Cox <[email protected]> * * With more than a little assistance from * * Wesley Craig <[email protected]> * * Fixes: * Neil Horman : Added missing device ioctls * Michael Callahan : Made routing work * Wesley Craig : Fix probing to listen to a * passed node id. * Alan Cox : Added send/recvmsg support * Alan Cox : Moved at. to protinfo in * socket. * Alan Cox : Added firewall hooks. * Alan Cox : Supports new ARPHRD_LOOPBACK * Christer Weinigel : Routing and /proc fixes. * Bradford Johnson : LocalTalk. * Tom Dyas : Module support. * Alan Cox : Hooks for PPP (based on the * LocalTalk hook). * Alan Cox : Posix bits * Alan Cox/Mike Freeman : Possible fix to NBP problems * Bradford Johnson : IP-over-DDP (experimental) * Jay Schulist : Moved IP-over-DDP to its own * driver file. (ipddp.c & ipddp.h) * Jay Schulist : Made work as module with * AppleTalk drivers, cleaned it. * Rob Newberry : Added proxy AARP and AARP * procfs, moved probing to AARP * module. * Adrian Sun/ * Michael Zuelsdorff : fix for net.0 packets. don't * allow illegal ether/tokentalk * port assignment. we lose a * valid localtalk port as a * result. * Arnaldo C. de Melo : Cleanup, in preparation for * shared skb support 8) * Arnaldo C. de Melo : Move proc stuff to atalk_proc.c, * use seq_file * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. * */ #include <linux/capability.h> #include <linux/module.h> #include <linux/if_arp.h> #include <linux/termios.h> /* For TIOCOUTQ/INQ */ #include <linux/compat.h> #include <linux/slab.h> #include <net/datalink.h> #include <net/psnap.h> #include <net/sock.h> #include <net/tcp_states.h> #include <net/route.h> #include <linux/atalk.h> #include "../core/kmap_skb.h" struct datalink_proto *ddp_dl, *aarp_dl; static const struct proto_ops atalk_dgram_ops; /**************************************************************************\ * * * Handlers for the socket list. * * * \**************************************************************************/ HLIST_HEAD(atalk_sockets); DEFINE_RWLOCK(atalk_sockets_lock); static inline void __atalk_insert_socket(struct sock *sk) { sk_add_node(sk, &atalk_sockets); } static inline void atalk_remove_socket(struct sock *sk) { write_lock_bh(&atalk_sockets_lock); sk_del_node_init(sk); write_unlock_bh(&atalk_sockets_lock); } static struct sock *atalk_search_socket(struct sockaddr_at *to, struct atalk_iface *atif) { struct sock *s; struct hlist_node *node; read_lock_bh(&atalk_sockets_lock); sk_for_each(s, node, &atalk_sockets) { struct atalk_sock *at = at_sk(s); if (to->sat_port != at->src_port) continue; if (to->sat_addr.s_net == ATADDR_ANYNET && to->sat_addr.s_node == ATADDR_BCAST) goto found; if (to->sat_addr.s_net == at->src_net && (to->sat_addr.s_node == at->src_node || to->sat_addr.s_node == ATADDR_BCAST || to->sat_addr.s_node == ATADDR_ANYNODE)) goto found; /* XXXX.0 -- we got a request for this router. make sure * that the node is appropriately set. */ if (to->sat_addr.s_node == ATADDR_ANYNODE && to->sat_addr.s_net != ATADDR_ANYNET && atif->address.s_node == at->src_node) { to->sat_addr.s_node = atif->address.s_node; goto found; } } s = NULL; found: read_unlock_bh(&atalk_sockets_lock); return s; } /** * atalk_find_or_insert_socket - Try to find a socket matching ADDR * @sk - socket to insert in the list if it is not there already * @sat - address to search for * * Try to find a socket matching ADDR in the socket list, if found then return * it. If not, insert SK into the socket list. * * This entire operation must execute atomically. */ static struct sock *atalk_find_or_insert_socket(struct sock *sk, struct sockaddr_at *sat) { struct sock *s; struct hlist_node *node; struct atalk_sock *at; write_lock_bh(&atalk_sockets_lock); sk_for_each(s, node, &atalk_sockets) { at = at_sk(s); if (at->src_net == sat->sat_addr.s_net && at->src_node == sat->sat_addr.s_node && at->src_port == sat->sat_port) goto found; } s = NULL; __atalk_insert_socket(sk); /* Wheee, it's free, assign and insert. */ found: write_unlock_bh(&atalk_sockets_lock); return s; } static void atalk_destroy_timer(unsigned long data) { struct sock *sk = (struct sock *)data; if (sk_has_allocations(sk)) { sk->sk_timer.expires = jiffies + SOCK_DESTROY_TIME; add_timer(&sk->sk_timer); } else sock_put(sk); } static inline void atalk_destroy_socket(struct sock *sk) { atalk_remove_socket(sk); skb_queue_purge(&sk->sk_receive_queue); if (sk_has_allocations(sk)) { setup_timer(&sk->sk_timer, atalk_destroy_timer, (unsigned long)sk); sk->sk_timer.expires = jiffies + SOCK_DESTROY_TIME; add_timer(&sk->sk_timer); } else sock_put(sk); } /**************************************************************************\ * * * Routing tables for the AppleTalk socket layer. * * * \**************************************************************************/ /* Anti-deadlock ordering is atalk_routes_lock --> iface_lock -DaveM */ struct atalk_route *atalk_routes; DEFINE_RWLOCK(atalk_routes_lock); struct atalk_iface *atalk_interfaces; DEFINE_RWLOCK(atalk_interfaces_lock); /* For probing devices or in a routerless network */ struct atalk_route atrtr_default; /* AppleTalk interface control */ /* * Drop a device. Doesn't drop any of its routes - that is the caller's * problem. Called when we down the interface or delete the address. */ static void atif_drop_device(struct net_device *dev) { struct atalk_iface **iface = &atalk_interfaces; struct atalk_iface *tmp; write_lock_bh(&atalk_interfaces_lock); while ((tmp = *iface) != NULL) { if (tmp->dev == dev) { *iface = tmp->next; dev_put(dev); kfree(tmp); dev->atalk_ptr = NULL; } else iface = &tmp->next; } write_unlock_bh(&atalk_interfaces_lock); } static struct atalk_iface *atif_add_device(struct net_device *dev, struct atalk_addr *sa) { struct atalk_iface *iface = kzalloc(sizeof(*iface), GFP_KERNEL); if (!iface) goto out; dev_hold(dev); iface->dev = dev; dev->atalk_ptr = iface; iface->address = *sa; iface->status = 0; write_lock_bh(&atalk_interfaces_lock); iface->next = atalk_interfaces; atalk_interfaces = iface; write_unlock_bh(&atalk_interfaces_lock); out: return iface; } /* Perform phase 2 AARP probing on our tentative address */ static int atif_probe_device(struct atalk_iface *atif) { int netrange = ntohs(atif->nets.nr_lastnet) - ntohs(atif->nets.nr_firstnet) + 1; int probe_net = ntohs(atif->address.s_net); int probe_node = atif->address.s_node; int netct, nodect; /* Offset the network we start probing with */ if (probe_net == ATADDR_ANYNET) { probe_net = ntohs(atif->nets.nr_firstnet); if (netrange) probe_net += jiffies % netrange; } if (probe_node == ATADDR_ANYNODE) probe_node = jiffies & 0xFF; /* Scan the networks */ atif->status |= ATIF_PROBE; for (netct = 0; netct <= netrange; netct++) { /* Sweep the available nodes from a given start */ atif->address.s_net = htons(probe_net); for (nodect = 0; nodect < 256; nodect++) { atif->address.s_node = (nodect + probe_node) & 0xFF; if (atif->address.s_node > 0 && atif->address.s_node < 254) { /* Probe a proposed address */ aarp_probe_network(atif); if (!(atif->status & ATIF_PROBE_FAIL)) { atif->status &= ~ATIF_PROBE; return 0; } } atif->status &= ~ATIF_PROBE_FAIL; } probe_net++; if (probe_net > ntohs(atif->nets.nr_lastnet)) probe_net = ntohs(atif->nets.nr_firstnet); } atif->status &= ~ATIF_PROBE; return -EADDRINUSE; /* Network is full... */ } /* Perform AARP probing for a proxy address */ static int atif_proxy_probe_device(struct atalk_iface *atif, struct atalk_addr* proxy_addr) { int netrange = ntohs(atif->nets.nr_lastnet) - ntohs(atif->nets.nr_firstnet) + 1; /* we probe the interface's network */ int probe_net = ntohs(atif->address.s_net); int probe_node = ATADDR_ANYNODE; /* we'll take anything */ int netct, nodect; /* Offset the network we start probing with */ if (probe_net == ATADDR_ANYNET) { probe_net = ntohs(atif->nets.nr_firstnet); if (netrange) probe_net += jiffies % netrange; } if (probe_node == ATADDR_ANYNODE) probe_node = jiffies & 0xFF; /* Scan the networks */ for (netct = 0; netct <= netrange; netct++) { /* Sweep the available nodes from a given start */ proxy_addr->s_net = htons(probe_net); for (nodect = 0; nodect < 256; nodect++) { proxy_addr->s_node = (nodect + probe_node) & 0xFF; if (proxy_addr->s_node > 0 && proxy_addr->s_node < 254) { /* Tell AARP to probe a proposed address */ int ret = aarp_proxy_probe_network(atif, proxy_addr); if (ret != -EADDRINUSE) return ret; } } probe_net++; if (probe_net > ntohs(atif->nets.nr_lastnet)) probe_net = ntohs(atif->nets.nr_firstnet); } return -EADDRINUSE; /* Network is full... */ } struct atalk_addr *atalk_find_dev_addr(struct net_device *dev) { struct atalk_iface *iface = dev->atalk_ptr; return iface ? &iface->address : NULL; } static struct atalk_addr *atalk_find_primary(void) { struct atalk_iface *fiface = NULL; struct atalk_addr *retval; struct atalk_iface *iface; /* * Return a point-to-point interface only if * there is no non-ptp interface available. */ read_lock_bh(&atalk_interfaces_lock); for (iface = atalk_interfaces; iface; iface = iface->next) { if (!fiface && !(iface->dev->flags & IFF_LOOPBACK)) fiface = iface; if (!(iface->dev->flags & (IFF_LOOPBACK | IFF_POINTOPOINT))) { retval = &iface->address; goto out; } } if (fiface) retval = &fiface->address; else if (atalk_interfaces) retval = &atalk_interfaces->address; else retval = NULL; out: read_unlock_bh(&atalk_interfaces_lock); return retval; } /* * Find a match for 'any network' - ie any of our interfaces with that * node number will do just nicely. */ static struct atalk_iface *atalk_find_anynet(int node, struct net_device *dev) { struct atalk_iface *iface = dev->atalk_ptr; if (!iface || iface->status & ATIF_PROBE) goto out_err; if (node != ATADDR_BCAST && iface->address.s_node != node && node != ATADDR_ANYNODE) goto out_err; out: return iface; out_err: iface = NULL; goto out; } /* Find a match for a specific network:node pair */ static struct atalk_iface *atalk_find_interface(__be16 net, int node) { struct atalk_iface *iface; read_lock_bh(&atalk_interfaces_lock); for (iface = atalk_interfaces; iface; iface = iface->next) { if ((node == ATADDR_BCAST || node == ATADDR_ANYNODE || iface->address.s_node == node) && iface->address.s_net == net && !(iface->status & ATIF_PROBE)) break; /* XXXX.0 -- net.0 returns the iface associated with net */ if (node == ATADDR_ANYNODE && net != ATADDR_ANYNET && ntohs(iface->nets.nr_firstnet) <= ntohs(net) && ntohs(net) <= ntohs(iface->nets.nr_lastnet)) break; } read_unlock_bh(&atalk_interfaces_lock); return iface; } /* * Find a route for an AppleTalk packet. This ought to get cached in * the socket (later on...). We know about host routes and the fact * that a route must be direct to broadcast. */ static struct atalk_route *atrtr_find(struct atalk_addr *target) { /* * we must search through all routes unless we find a * host route, because some host routes might overlap * network routes */ struct atalk_route *net_route = NULL; struct atalk_route *r; read_lock_bh(&atalk_routes_lock); for (r = atalk_routes; r; r = r->next) { if (!(r->flags & RTF_UP)) continue; if (r->target.s_net == target->s_net) { if (r->flags & RTF_HOST) { /* * if this host route is for the target, * the we're done */ if (r->target.s_node == target->s_node) goto out; } else /* * this route will work if there isn't a * direct host route, so cache it */ net_route = r; } } /* * if we found a network route but not a direct host * route, then return it */ if (net_route) r = net_route; else if (atrtr_default.dev) r = &atrtr_default; else /* No route can be found */ r = NULL; out: read_unlock_bh(&atalk_routes_lock); return r; } /* * Given an AppleTalk network, find the device to use. This can be * a simple lookup. */ struct net_device *atrtr_get_dev(struct atalk_addr *sa) { struct atalk_route *atr = atrtr_find(sa); return atr ? atr->dev : NULL; } /* Set up a default router */ static void atrtr_set_default(struct net_device *dev) { atrtr_default.dev = dev; atrtr_default.flags = RTF_UP; atrtr_default.gateway.s_net = htons(0); atrtr_default.gateway.s_node = 0; } /* * Add a router. Basically make sure it looks valid and stuff the * entry in the list. While it uses netranges we always set them to one * entry to work like netatalk. */ static int atrtr_create(struct rtentry *r, struct net_device *devhint) { struct sockaddr_at *ta = (struct sockaddr_at *)&r->rt_dst; struct sockaddr_at *ga = (struct sockaddr_at *)&r->rt_gateway; struct atalk_route *rt; struct atalk_iface *iface, *riface; int retval = -EINVAL; /* * Fixme: Raise/Lower a routing change semaphore for these * operations. */ /* Validate the request */ if (ta->sat_family != AF_APPLETALK || (!devhint && ga->sat_family != AF_APPLETALK)) goto out; /* Now walk the routing table and make our decisions */ write_lock_bh(&atalk_routes_lock); for (rt = atalk_routes; rt; rt = rt->next) { if (r->rt_flags != rt->flags) continue; if (ta->sat_addr.s_net == rt->target.s_net) { if (!(rt->flags & RTF_HOST)) break; if (ta->sat_addr.s_node == rt->target.s_node) break; } } if (!devhint) { riface = NULL; read_lock_bh(&atalk_interfaces_lock); for (iface = atalk_interfaces; iface; iface = iface->next) { if (!riface && ntohs(ga->sat_addr.s_net) >= ntohs(iface->nets.nr_firstnet) && ntohs(ga->sat_addr.s_net) <= ntohs(iface->nets.nr_lastnet)) riface = iface; if (ga->sat_addr.s_net == iface->address.s_net && ga->sat_addr.s_node == iface->address.s_node) riface = iface; } read_unlock_bh(&atalk_interfaces_lock); retval = -ENETUNREACH; if (!riface) goto out_unlock; devhint = riface->dev; } if (!rt) { rt = kzalloc(sizeof(*rt), GFP_ATOMIC); retval = -ENOBUFS; if (!rt) goto out_unlock; rt->next = atalk_routes; atalk_routes = rt; } /* Fill in the routing entry */ rt->target = ta->sat_addr; dev_hold(devhint); rt->dev = devhint; rt->flags = r->rt_flags; rt->gateway = ga->sat_addr; retval = 0; out_unlock: write_unlock_bh(&atalk_routes_lock); out: return retval; } /* Delete a route. Find it and discard it */ static int atrtr_delete(struct atalk_addr * addr) { struct atalk_route **r = &atalk_routes; int retval = 0; struct atalk_route *tmp; write_lock_bh(&atalk_routes_lock); while ((tmp = *r) != NULL) { if (tmp->target.s_net == addr->s_net && (!(tmp->flags&RTF_GATEWAY) || tmp->target.s_node == addr->s_node)) { *r = tmp->next; dev_put(tmp->dev); kfree(tmp); goto out; } r = &tmp->next; } retval = -ENOENT; out: write_unlock_bh(&atalk_routes_lock); return retval; } /* * Called when a device is downed. Just throw away any routes * via it. */ static void atrtr_device_down(struct net_device *dev) { struct atalk_route **r = &atalk_routes; struct atalk_route *tmp; write_lock_bh(&atalk_routes_lock); while ((tmp = *r) != NULL) { if (tmp->dev == dev) { *r = tmp->next; dev_put(dev); kfree(tmp); } else r = &tmp->next; } write_unlock_bh(&atalk_routes_lock); if (atrtr_default.dev == dev) atrtr_set_default(NULL); } /* Actually down the interface */ static inline void atalk_dev_down(struct net_device *dev) { atrtr_device_down(dev); /* Remove all routes for the device */ aarp_device_down(dev); /* Remove AARP entries for the device */ atif_drop_device(dev); /* Remove the device */ } /* * A device event has occurred. Watch for devices going down and * delete our use of them (iface and route). */ static int ddp_device_event(struct notifier_block *this, unsigned long event, void *ptr) { struct net_device *dev = ptr; if (!net_eq(dev_net(dev), &init_net)) return NOTIFY_DONE; if (event == NETDEV_DOWN) /* Discard any use of this */ atalk_dev_down(dev); return NOTIFY_DONE; } /* ioctl calls. Shouldn't even need touching */ /* Device configuration ioctl calls */ static int atif_ioctl(int cmd, void __user *arg) { static char aarp_mcast[6] = { 0x09, 0x00, 0x00, 0xFF, 0xFF, 0xFF }; struct ifreq atreq; struct atalk_netrange *nr; struct sockaddr_at *sa; struct net_device *dev; struct atalk_iface *atif; int ct; int limit; struct rtentry rtdef; int add_route; if (copy_from_user(&atreq, arg, sizeof(atreq))) return -EFAULT; dev = __dev_get_by_name(&init_net, atreq.ifr_name); if (!dev) return -ENODEV; sa = (struct sockaddr_at *)&atreq.ifr_addr; atif = atalk_find_dev(dev); switch (cmd) { case SIOCSIFADDR: if (!capable(CAP_NET_ADMIN)) return -EPERM; if (sa->sat_family != AF_APPLETALK) return -EINVAL; if (dev->type != ARPHRD_ETHER && dev->type != ARPHRD_LOOPBACK && dev->type != ARPHRD_LOCALTLK && dev->type != ARPHRD_PPP) return -EPROTONOSUPPORT; nr = (struct atalk_netrange *)&sa->sat_zero[0]; add_route = 1; /* * if this is a point-to-point iface, and we already * have an iface for this AppleTalk address, then we * should not add a route */ if ((dev->flags & IFF_POINTOPOINT) && atalk_find_interface(sa->sat_addr.s_net, sa->sat_addr.s_node)) { printk(KERN_DEBUG "AppleTalk: point-to-point " "interface added with " "existing address\n"); add_route = 0; } /* * Phase 1 is fine on LocalTalk but we don't do * EtherTalk phase 1. Anyone wanting to add it go ahead. */ if (dev->type == ARPHRD_ETHER && nr->nr_phase != 2) return -EPROTONOSUPPORT; if (sa->sat_addr.s_node == ATADDR_BCAST || sa->sat_addr.s_node == 254) return -EINVAL; if (atif) { /* Already setting address */ if (atif->status & ATIF_PROBE) return -EBUSY; atif->address.s_net = sa->sat_addr.s_net; atif->address.s_node = sa->sat_addr.s_node; atrtr_device_down(dev); /* Flush old routes */ } else { atif = atif_add_device(dev, &sa->sat_addr); if (!atif) return -ENOMEM; } atif->nets = *nr; /* * Check if the chosen address is used. If so we * error and atalkd will try another. */ if (!(dev->flags & IFF_LOOPBACK) && !(dev->flags & IFF_POINTOPOINT) && atif_probe_device(atif) < 0) { atif_drop_device(dev); return -EADDRINUSE; } /* Hey it worked - add the direct routes */ sa = (struct sockaddr_at *)&rtdef.rt_gateway; sa->sat_family = AF_APPLETALK; sa->sat_addr.s_net = atif->address.s_net; sa->sat_addr.s_node = atif->address.s_node; sa = (struct sockaddr_at *)&rtdef.rt_dst; rtdef.rt_flags = RTF_UP; sa->sat_family = AF_APPLETALK; sa->sat_addr.s_node = ATADDR_ANYNODE; if (dev->flags & IFF_LOOPBACK || dev->flags & IFF_POINTOPOINT) rtdef.rt_flags |= RTF_HOST; /* Routerless initial state */ if (nr->nr_firstnet == htons(0) && nr->nr_lastnet == htons(0xFFFE)) { sa->sat_addr.s_net = atif->address.s_net; atrtr_create(&rtdef, dev); atrtr_set_default(dev); } else { limit = ntohs(nr->nr_lastnet); if (limit - ntohs(nr->nr_firstnet) > 4096) { printk(KERN_WARNING "Too many routes/" "iface.\n"); return -EINVAL; } if (add_route) for (ct = ntohs(nr->nr_firstnet); ct <= limit; ct++) { sa->sat_addr.s_net = htons(ct); atrtr_create(&rtdef, dev); } } dev_mc_add_global(dev, aarp_mcast); return 0; case SIOCGIFADDR: if (!atif) return -EADDRNOTAVAIL; sa->sat_family = AF_APPLETALK; sa->sat_addr = atif->address; break; case SIOCGIFBRDADDR: if (!atif) return -EADDRNOTAVAIL; sa->sat_family = AF_APPLETALK; sa->sat_addr.s_net = atif->address.s_net; sa->sat_addr.s_node = ATADDR_BCAST; break; case SIOCATALKDIFADDR: case SIOCDIFADDR: if (!capable(CAP_NET_ADMIN)) return -EPERM; if (sa->sat_family != AF_APPLETALK) return -EINVAL; atalk_dev_down(dev); break; case SIOCSARP: if (!capable(CAP_NET_ADMIN)) return -EPERM; if (sa->sat_family != AF_APPLETALK) return -EINVAL; /* * for now, we only support proxy AARP on ELAP; * we should be able to do it for LocalTalk, too. */ if (dev->type != ARPHRD_ETHER) return -EPROTONOSUPPORT; /* * atif points to the current interface on this network; * we aren't concerned about its current status (at * least for now), but it has all the settings about * the network we're going to probe. Consequently, it * must exist. */ if (!atif) return -EADDRNOTAVAIL; nr = (struct atalk_netrange *)&(atif->nets); /* * Phase 1 is fine on Localtalk but we don't do * Ethertalk phase 1. Anyone wanting to add it go ahead. */ if (dev->type == ARPHRD_ETHER && nr->nr_phase != 2) return -EPROTONOSUPPORT; if (sa->sat_addr.s_node == ATADDR_BCAST || sa->sat_addr.s_node == 254) return -EINVAL; /* * Check if the chosen address is used. If so we * error and ATCP will try another. */ if (atif_proxy_probe_device(atif, &(sa->sat_addr)) < 0) return -EADDRINUSE; /* * We now have an address on the local network, and * the AARP code will defend it for us until we take it * down. We don't set up any routes right now, because * ATCP will install them manually via SIOCADDRT. */ break; case SIOCDARP: if (!capable(CAP_NET_ADMIN)) return -EPERM; if (sa->sat_family != AF_APPLETALK) return -EINVAL; if (!atif) return -EADDRNOTAVAIL; /* give to aarp module to remove proxy entry */ aarp_proxy_remove(atif->dev, &(sa->sat_addr)); return 0; } return copy_to_user(arg, &atreq, sizeof(atreq)) ? -EFAULT : 0; } /* Routing ioctl() calls */ static int atrtr_ioctl(unsigned int cmd, void __user *arg) { struct rtentry rt; if (copy_from_user(&rt, arg, sizeof(rt))) return -EFAULT; switch (cmd) { case SIOCDELRT: if (rt.rt_dst.sa_family != AF_APPLETALK) return -EINVAL; return atrtr_delete(&((struct sockaddr_at *) &rt.rt_dst)->sat_addr); case SIOCADDRT: { struct net_device *dev = NULL; if (rt.rt_dev) { char name[IFNAMSIZ]; if (copy_from_user(name, rt.rt_dev, IFNAMSIZ-1)) return -EFAULT; name[IFNAMSIZ-1] = '\0'; dev = __dev_get_by_name(&init_net, name); if (!dev) return -ENODEV; } return atrtr_create(&rt, dev); } } return -EINVAL; } /**************************************************************************\ * * * Handling for system calls applied via the various interfaces to an * * AppleTalk socket object. * * * \**************************************************************************/ /* * Checksum: This is 'optional'. It's quite likely also a good * candidate for assembler hackery 8) */ static unsigned long atalk_sum_partial(const unsigned char *data, int len, unsigned long sum) { /* This ought to be unwrapped neatly. I'll trust gcc for now */ while (len--) { sum += *data++; sum = rol16(sum, 1); } return sum; } /* Checksum skb data -- similar to skb_checksum */ static unsigned long atalk_sum_skb(const struct sk_buff *skb, int offset, int len, unsigned long sum) { int start = skb_headlen(skb); struct sk_buff *frag_iter; int i, copy; /* checksum stuff in header space */ if ( (copy = start - offset) > 0) { if (copy > len) copy = len; sum = atalk_sum_partial(skb->data + offset, copy, sum); if ( (len -= copy) == 0) return sum; offset += copy; } /* checksum stuff in frags */ for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) { int end; const skb_frag_t *frag = &skb_shinfo(skb)->frags[i]; WARN_ON(start > offset + len); end = start + skb_frag_size(frag); if ((copy = end - offset) > 0) { u8 *vaddr; if (copy > len) copy = len; vaddr = kmap_skb_frag(frag); sum = atalk_sum_partial(vaddr + frag->page_offset + offset - start, copy, sum); kunmap_skb_frag(vaddr); if (!(len -= copy)) return sum; offset += copy; } start = end; } skb_walk_frags(skb, frag_iter) { int end; WARN_ON(start > offset + len); end = start + frag_iter->len; if ((copy = end - offset) > 0) { if (copy > len) copy = len; sum = atalk_sum_skb(frag_iter, offset - start, copy, sum); if ((len -= copy) == 0) return sum; offset += copy; } start = end; } BUG_ON(len > 0); return sum; } static __be16 atalk_checksum(const struct sk_buff *skb, int len) { unsigned long sum; /* skip header 4 bytes */ sum = atalk_sum_skb(skb, 4, len-4, 0); /* Use 0xFFFF for 0. 0 itself means none */ return sum ? htons((unsigned short)sum) : htons(0xFFFF); } static struct proto ddp_proto = { .name = "DDP", .owner = THIS_MODULE, .obj_size = sizeof(struct atalk_sock), }; /* * Create a socket. Initialise the socket, blank the addresses * set the state. */ static int atalk_create(struct net *net, struct socket *sock, int protocol, int kern) { struct sock *sk; int rc = -ESOCKTNOSUPPORT; if (!net_eq(net, &init_net)) return -EAFNOSUPPORT; /* * We permit SOCK_DGRAM and RAW is an extension. It is trivial to do * and gives you the full ELAP frame. Should be handy for CAP 8) */ if (sock->type != SOCK_RAW && sock->type != SOCK_DGRAM) goto out; rc = -ENOMEM; sk = sk_alloc(net, PF_APPLETALK, GFP_KERNEL, &ddp_proto); if (!sk) goto out; rc = 0; sock->ops = &atalk_dgram_ops; sock_init_data(sock, sk); /* Checksums on by default */ sock_set_flag(sk, SOCK_ZAPPED); out: return rc; } /* Free a socket. No work needed */ static int atalk_release(struct socket *sock) { struct sock *sk = sock->sk; if (sk) { sock_hold(sk); lock_sock(sk); sock_orphan(sk); sock->sk = NULL; atalk_destroy_socket(sk); release_sock(sk); sock_put(sk); } return 0; } /** * atalk_pick_and_bind_port - Pick a source port when one is not given * @sk - socket to insert into the tables * @sat - address to search for * * Pick a source port when one is not given. If we can find a suitable free * one, we insert the socket into the tables using it. * * This whole operation must be atomic. */ static int atalk_pick_and_bind_port(struct sock *sk, struct sockaddr_at *sat) { int retval; write_lock_bh(&atalk_sockets_lock); for (sat->sat_port = ATPORT_RESERVED; sat->sat_port < ATPORT_LAST; sat->sat_port++) { struct sock *s; struct hlist_node *node; sk_for_each(s, node, &atalk_sockets) { struct atalk_sock *at = at_sk(s); if (at->src_net == sat->sat_addr.s_net && at->src_node == sat->sat_addr.s_node && at->src_port == sat->sat_port) goto try_next_port; } /* Wheee, it's free, assign and insert. */ __atalk_insert_socket(sk); at_sk(sk)->src_port = sat->sat_port; retval = 0; goto out; try_next_port:; } retval = -EBUSY; out: write_unlock_bh(&atalk_sockets_lock); return retval; } static int atalk_autobind(struct sock *sk) { struct atalk_sock *at = at_sk(sk); struct sockaddr_at sat; struct atalk_addr *ap = atalk_find_primary(); int n = -EADDRNOTAVAIL; if (!ap || ap->s_net == htons(ATADDR_ANYNET)) goto out; at->src_net = sat.sat_addr.s_net = ap->s_net; at->src_node = sat.sat_addr.s_node = ap->s_node; n = atalk_pick_and_bind_port(sk, &sat); if (!n) sock_reset_flag(sk, SOCK_ZAPPED); out: return n; } /* Set the address 'our end' of the connection */ static int atalk_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) { struct sockaddr_at *addr = (struct sockaddr_at *)uaddr; struct sock *sk = sock->sk; struct atalk_sock *at = at_sk(sk); int err; if (!sock_flag(sk, SOCK_ZAPPED) || addr_len != sizeof(struct sockaddr_at)) return -EINVAL; if (addr->sat_family != AF_APPLETALK) return -EAFNOSUPPORT; lock_sock(sk); if (addr->sat_addr.s_net == htons(ATADDR_ANYNET)) { struct atalk_addr *ap = atalk_find_primary(); err = -EADDRNOTAVAIL; if (!ap) goto out; at->src_net = addr->sat_addr.s_net = ap->s_net; at->src_node = addr->sat_addr.s_node= ap->s_node; } else { err = -EADDRNOTAVAIL; if (!atalk_find_interface(addr->sat_addr.s_net, addr->sat_addr.s_node)) goto out; at->src_net = addr->sat_addr.s_net; at->src_node = addr->sat_addr.s_node; } if (addr->sat_port == ATADDR_ANYPORT) { err = atalk_pick_and_bind_port(sk, addr); if (err < 0) goto out; } else { at->src_port = addr->sat_port; err = -EADDRINUSE; if (atalk_find_or_insert_socket(sk, addr)) goto out; } sock_reset_flag(sk, SOCK_ZAPPED); err = 0; out: release_sock(sk); return err; } /* Set the address we talk to */ static int atalk_connect(struct socket *sock, struct sockaddr *uaddr, int addr_len, int flags) { struct sock *sk = sock->sk; struct atalk_sock *at = at_sk(sk); struct sockaddr_at *addr; int err; sk->sk_state = TCP_CLOSE; sock->state = SS_UNCONNECTED; if (addr_len != sizeof(*addr)) return -EINVAL; addr = (struct sockaddr_at *)uaddr; if (addr->sat_family != AF_APPLETALK) return -EAFNOSUPPORT; if (addr->sat_addr.s_node == ATADDR_BCAST && !sock_flag(sk, SOCK_BROADCAST)) { #if 1 printk(KERN_WARNING "%s is broken and did not set " "SO_BROADCAST. It will break when 2.2 is " "released.\n", current->comm); #else return -EACCES; #endif } lock_sock(sk); err = -EBUSY; if (sock_flag(sk, SOCK_ZAPPED)) if (atalk_autobind(sk) < 0) goto out; err = -ENETUNREACH; if (!atrtr_get_dev(&addr->sat_addr)) goto out; at->dest_port = addr->sat_port; at->dest_net = addr->sat_addr.s_net; at->dest_node = addr->sat_addr.s_node; sock->state = SS_CONNECTED; sk->sk_state = TCP_ESTABLISHED; err = 0; out: release_sock(sk); return err; } /* * Find the name of an AppleTalk socket. Just copy the right * fields into the sockaddr. */ static int atalk_getname(struct socket *sock, struct sockaddr *uaddr, int *uaddr_len, int peer) { struct sockaddr_at sat; struct sock *sk = sock->sk; struct atalk_sock *at = at_sk(sk); int err; lock_sock(sk); err = -ENOBUFS; if (sock_flag(sk, SOCK_ZAPPED)) if (atalk_autobind(sk) < 0) goto out; *uaddr_len = sizeof(struct sockaddr_at); memset(&sat.sat_zero, 0, sizeof(sat.sat_zero)); if (peer) { err = -ENOTCONN; if (sk->sk_state != TCP_ESTABLISHED) goto out; sat.sat_addr.s_net = at->dest_net; sat.sat_addr.s_node = at->dest_node; sat.sat_port = at->dest_port; } else { sat.sat_addr.s_net = at->src_net; sat.sat_addr.s_node = at->src_node; sat.sat_port = at->src_port; } err = 0; sat.sat_family = AF_APPLETALK; memcpy(uaddr, &sat, sizeof(sat)); out: release_sock(sk); return err; } #if defined(CONFIG_IPDDP) || defined(CONFIG_IPDDP_MODULE) static __inline__ int is_ip_over_ddp(struct sk_buff *skb) { return skb->data[12] == 22; } static int handle_ip_over_ddp(struct sk_buff *skb) { struct net_device *dev = __dev_get_by_name(&init_net, "ipddp0"); struct net_device_stats *stats; /* This needs to be able to handle ipddp"N" devices */ if (!dev) { kfree_skb(skb); return NET_RX_DROP; } skb->protocol = htons(ETH_P_IP); skb_pull(skb, 13); skb->dev = dev; skb_reset_transport_header(skb); stats = netdev_priv(dev); stats->rx_packets++; stats->rx_bytes += skb->len + 13; return netif_rx(skb); /* Send the SKB up to a higher place. */ } #else /* make it easy for gcc to optimize this test out, i.e. kill the code */ #define is_ip_over_ddp(skb) 0 #define handle_ip_over_ddp(skb) 0 #endif static int atalk_route_packet(struct sk_buff *skb, struct net_device *dev, struct ddpehdr *ddp, __u16 len_hops, int origlen) { struct atalk_route *rt; struct atalk_addr ta; /* * Don't route multicast, etc., packets, or packets sent to "this * network" */ if (skb->pkt_type != PACKET_HOST || !ddp->deh_dnet) { /* * FIXME: * * Can it ever happen that a packet is from a PPP iface and * needs to be broadcast onto the default network? */ if (dev->type == ARPHRD_PPP) printk(KERN_DEBUG "AppleTalk: didn't forward broadcast " "packet received from PPP iface\n"); goto free_it; } ta.s_net = ddp->deh_dnet; ta.s_node = ddp->deh_dnode; /* Route the packet */ rt = atrtr_find(&ta); /* increment hops count */ len_hops += 1 << 10; if (!rt || !(len_hops & (15 << 10))) goto free_it; /* FIXME: use skb->cb to be able to use shared skbs */ /* * Route goes through another gateway, so set the target to the * gateway instead. */ if (rt->flags & RTF_GATEWAY) { ta.s_net = rt->gateway.s_net; ta.s_node = rt->gateway.s_node; } /* Fix up skb->len field */ skb_trim(skb, min_t(unsigned int, origlen, (rt->dev->hard_header_len + ddp_dl->header_length + (len_hops & 1023)))); /* FIXME: use skb->cb to be able to use shared skbs */ ddp->deh_len_hops = htons(len_hops); /* * Send the buffer onwards * * Now we must always be careful. If it's come from LocalTalk to * EtherTalk it might not fit * * Order matters here: If a packet has to be copied to make a new * headroom (rare hopefully) then it won't need unsharing. * * Note. ddp-> becomes invalid at the realloc. */ if (skb_headroom(skb) < 22) { /* 22 bytes - 12 ether, 2 len, 3 802.2 5 snap */ struct sk_buff *nskb = skb_realloc_headroom(skb, 32); kfree_skb(skb); skb = nskb; } else skb = skb_unshare(skb, GFP_ATOMIC); /* * If the buffer didn't vanish into the lack of space bitbucket we can * send it. */ if (skb == NULL) goto drop; if (aarp_send_ddp(rt->dev, skb, &ta, NULL) == NET_XMIT_DROP) return NET_RX_DROP; return NET_RX_SUCCESS; free_it: kfree_skb(skb); drop: return NET_RX_DROP; } /** * atalk_rcv - Receive a packet (in skb) from device dev * @skb - packet received * @dev - network device where the packet comes from * @pt - packet type * * Receive a packet (in skb) from device dev. This has come from the SNAP * decoder, and on entry skb->transport_header is the DDP header, skb->len * is the DDP header, skb->len is the DDP length. The physical headers * have been extracted. PPP should probably pass frames marked as for this * layer. [ie ARPHRD_ETHERTALK] */ static int atalk_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt, struct net_device *orig_dev) { struct ddpehdr *ddp; struct sock *sock; struct atalk_iface *atif; struct sockaddr_at tosat; int origlen; __u16 len_hops; if (!net_eq(dev_net(dev), &init_net)) goto drop; /* Don't mangle buffer if shared */ if (!(skb = skb_share_check(skb, GFP_ATOMIC))) goto out; /* Size check and make sure header is contiguous */ if (!pskb_may_pull(skb, sizeof(*ddp))) goto drop; ddp = ddp_hdr(skb); len_hops = ntohs(ddp->deh_len_hops); /* Trim buffer in case of stray trailing data */ origlen = skb->len; skb_trim(skb, min_t(unsigned int, skb->len, len_hops & 1023)); /* * Size check to see if ddp->deh_len was crap * (Otherwise we'll detonate most spectacularly * in the middle of atalk_checksum() or recvmsg()). */ if (skb->len < sizeof(*ddp) || skb->len < (len_hops & 1023)) { pr_debug("AppleTalk: dropping corrupted frame (deh_len=%u, " "skb->len=%u)\n", len_hops & 1023, skb->len); goto drop; } /* * Any checksums. Note we don't do htons() on this == is assumed to be * valid for net byte orders all over the networking code... */ if (ddp->deh_sum && atalk_checksum(skb, len_hops & 1023) != ddp->deh_sum) /* Not a valid AppleTalk frame - dustbin time */ goto drop; /* Check the packet is aimed at us */ if (!ddp->deh_dnet) /* Net 0 is 'this network' */ atif = atalk_find_anynet(ddp->deh_dnode, dev); else atif = atalk_find_interface(ddp->deh_dnet, ddp->deh_dnode); if (!atif) { /* Not ours, so we route the packet via the correct * AppleTalk iface */ return atalk_route_packet(skb, dev, ddp, len_hops, origlen); } /* if IP over DDP is not selected this code will be optimized out */ if (is_ip_over_ddp(skb)) return handle_ip_over_ddp(skb); /* * Which socket - atalk_search_socket() looks for a *full match* * of the <net, node, port> tuple. */ tosat.sat_addr.s_net = ddp->deh_dnet; tosat.sat_addr.s_node = ddp->deh_dnode; tosat.sat_port = ddp->deh_dport; sock = atalk_search_socket(&tosat, atif); if (!sock) /* But not one of our sockets */ goto drop; /* Queue packet (standard) */ skb->sk = sock; if (sock_queue_rcv_skb(sock, skb) < 0) goto drop; return NET_RX_SUCCESS; drop: kfree_skb(skb); out: return NET_RX_DROP; } /* * Receive a LocalTalk frame. We make some demands on the caller here. * Caller must provide enough headroom on the packet to pull the short * header and append a long one. */ static int ltalk_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt, struct net_device *orig_dev) { if (!net_eq(dev_net(dev), &init_net)) goto freeit; /* Expand any short form frames */ if (skb_mac_header(skb)[2] == 1) { struct ddpehdr *ddp; /* Find our address */ struct atalk_addr *ap = atalk_find_dev_addr(dev); if (!ap || skb->len < sizeof(__be16) || skb->len > 1023) goto freeit; /* Don't mangle buffer if shared */ if (!(skb = skb_share_check(skb, GFP_ATOMIC))) return 0; /* * The push leaves us with a ddephdr not an shdr, and * handily the port bytes in the right place preset. */ ddp = (struct ddpehdr *) skb_push(skb, sizeof(*ddp) - 4); /* Now fill in the long header */ /* * These two first. The mac overlays the new source/dest * network information so we MUST copy these before * we write the network numbers ! */ ddp->deh_dnode = skb_mac_header(skb)[0]; /* From physical header */ ddp->deh_snode = skb_mac_header(skb)[1]; /* From physical header */ ddp->deh_dnet = ap->s_net; /* Network number */ ddp->deh_snet = ap->s_net; ddp->deh_sum = 0; /* No checksum */ /* * Not sure about this bit... */ /* Non routable, so force a drop if we slip up later */ ddp->deh_len_hops = htons(skb->len + (DDP_MAXHOPS << 10)); } skb_reset_transport_header(skb); return atalk_rcv(skb, dev, pt, orig_dev); freeit: kfree_skb(skb); return 0; } static int atalk_sendmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *msg, size_t len) { struct sock *sk = sock->sk; struct atalk_sock *at = at_sk(sk); struct sockaddr_at *usat = (struct sockaddr_at *)msg->msg_name; int flags = msg->msg_flags; int loopback = 0; struct sockaddr_at local_satalk, gsat; struct sk_buff *skb; struct net_device *dev; struct ddpehdr *ddp; int size; struct atalk_route *rt; int err; if (flags & ~(MSG_DONTWAIT|MSG_CMSG_COMPAT)) return -EINVAL; if (len > DDP_MAXSZ) return -EMSGSIZE; lock_sock(sk); if (usat) { err = -EBUSY; if (sock_flag(sk, SOCK_ZAPPED)) if (atalk_autobind(sk) < 0) goto out; err = -EINVAL; if (msg->msg_namelen < sizeof(*usat) || usat->sat_family != AF_APPLETALK) goto out; err = -EPERM; /* netatalk didn't implement this check */ if (usat->sat_addr.s_node == ATADDR_BCAST && !sock_flag(sk, SOCK_BROADCAST)) { goto out; } } else { err = -ENOTCONN; if (sk->sk_state != TCP_ESTABLISHED) goto out; usat = &local_satalk; usat->sat_family = AF_APPLETALK; usat->sat_port = at->dest_port; usat->sat_addr.s_node = at->dest_node; usat->sat_addr.s_net = at->dest_net; } /* Build a packet */ SOCK_DEBUG(sk, "SK %p: Got address.\n", sk); /* For headers */ size = sizeof(struct ddpehdr) + len + ddp_dl->header_length; if (usat->sat_addr.s_net || usat->sat_addr.s_node == ATADDR_ANYNODE) { rt = atrtr_find(&usat->sat_addr); } else { struct atalk_addr at_hint; at_hint.s_node = 0; at_hint.s_net = at->src_net; rt = atrtr_find(&at_hint); } err = ENETUNREACH; if (!rt) goto out; dev = rt->dev; SOCK_DEBUG(sk, "SK %p: Size needed %d, device %s\n", sk, size, dev->name); size += dev->hard_header_len; release_sock(sk); skb = sock_alloc_send_skb(sk, size, (flags & MSG_DONTWAIT), &err); lock_sock(sk); if (!skb) goto out; skb->sk = sk; skb_reserve(skb, ddp_dl->header_length); skb_reserve(skb, dev->hard_header_len); skb->dev = dev; SOCK_DEBUG(sk, "SK %p: Begin build.\n", sk); ddp = (struct ddpehdr *)skb_put(skb, sizeof(struct ddpehdr)); ddp->deh_len_hops = htons(len + sizeof(*ddp)); ddp->deh_dnet = usat->sat_addr.s_net; ddp->deh_snet = at->src_net; ddp->deh_dnode = usat->sat_addr.s_node; ddp->deh_snode = at->src_node; ddp->deh_dport = usat->sat_port; ddp->deh_sport = at->src_port; SOCK_DEBUG(sk, "SK %p: Copy user data (%Zd bytes).\n", sk, len); err = memcpy_fromiovec(skb_put(skb, len), msg->msg_iov, len); if (err) { kfree_skb(skb); err = -EFAULT; goto out; } if (sk->sk_no_check == 1) ddp->deh_sum = 0; else ddp->deh_sum = atalk_checksum(skb, len + sizeof(*ddp)); /* * Loopback broadcast packets to non gateway targets (ie routes * to group we are in) */ if (ddp->deh_dnode == ATADDR_BCAST && !(rt->flags & RTF_GATEWAY) && !(dev->flags & IFF_LOOPBACK)) { struct sk_buff *skb2 = skb_copy(skb, GFP_KERNEL); if (skb2) { loopback = 1; SOCK_DEBUG(sk, "SK %p: send out(copy).\n", sk); /* * If it fails it is queued/sent above in the aarp queue */ aarp_send_ddp(dev, skb2, &usat->sat_addr, NULL); } } if (dev->flags & IFF_LOOPBACK || loopback) { SOCK_DEBUG(sk, "SK %p: Loop back.\n", sk); /* loop back */ skb_orphan(skb); if (ddp->deh_dnode == ATADDR_BCAST) { struct atalk_addr at_lo; at_lo.s_node = 0; at_lo.s_net = 0; rt = atrtr_find(&at_lo); if (!rt) { kfree_skb(skb); err = -ENETUNREACH; goto out; } dev = rt->dev; skb->dev = dev; } ddp_dl->request(ddp_dl, skb, dev->dev_addr); } else { SOCK_DEBUG(sk, "SK %p: send out.\n", sk); if (rt->flags & RTF_GATEWAY) { gsat.sat_addr = rt->gateway; usat = &gsat; } /* * If it fails it is queued/sent above in the aarp queue */ aarp_send_ddp(dev, skb, &usat->sat_addr, NULL); } SOCK_DEBUG(sk, "SK %p: Done write (%Zd).\n", sk, len); out: release_sock(sk); return err ? : len; } static int atalk_recvmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *msg, size_t size, int flags) { struct sock *sk = sock->sk; struct sockaddr_at *sat = (struct sockaddr_at *)msg->msg_name; struct ddpehdr *ddp; int copied = 0; int offset = 0; int err = 0; struct sk_buff *skb; skb = skb_recv_datagram(sk, flags & ~MSG_DONTWAIT, flags & MSG_DONTWAIT, &err); lock_sock(sk); if (!skb) goto out; /* FIXME: use skb->cb to be able to use shared skbs */ ddp = ddp_hdr(skb); copied = ntohs(ddp->deh_len_hops) & 1023; if (sk->sk_type != SOCK_RAW) { offset = sizeof(*ddp); copied -= offset; } if (copied > size) { copied = size; msg->msg_flags |= MSG_TRUNC; } err = skb_copy_datagram_iovec(skb, offset, msg->msg_iov, copied); if (!err) { if (sat) { sat->sat_family = AF_APPLETALK; sat->sat_port = ddp->deh_sport; sat->sat_addr.s_node = ddp->deh_snode; sat->sat_addr.s_net = ddp->deh_snet; } msg->msg_namelen = sizeof(*sat); } skb_free_datagram(sk, skb); /* Free the datagram. */ out: release_sock(sk); return err ? : copied; } /* * AppleTalk ioctl calls. */ static int atalk_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) { int rc = -ENOIOCTLCMD; struct sock *sk = sock->sk; void __user *argp = (void __user *)arg; switch (cmd) { /* Protocol layer */ case TIOCOUTQ: { long amount = sk->sk_sndbuf - sk_wmem_alloc_get(sk); if (amount < 0) amount = 0; rc = put_user(amount, (int __user *)argp); break; } case TIOCINQ: { /* * These two are safe on a single CPU system as only * user tasks fiddle here */ struct sk_buff *skb = skb_peek(&sk->sk_receive_queue); long amount = 0; if (skb) amount = skb->len - sizeof(struct ddpehdr); rc = put_user(amount, (int __user *)argp); break; } case SIOCGSTAMP: rc = sock_get_timestamp(sk, argp); break; case SIOCGSTAMPNS: rc = sock_get_timestampns(sk, argp); break; /* Routing */ case SIOCADDRT: case SIOCDELRT: rc = -EPERM; if (capable(CAP_NET_ADMIN)) rc = atrtr_ioctl(cmd, argp); break; /* Interface */ case SIOCGIFADDR: case SIOCSIFADDR: case SIOCGIFBRDADDR: case SIOCATALKDIFADDR: case SIOCDIFADDR: case SIOCSARP: /* proxy AARP */ case SIOCDARP: /* proxy AARP */ rtnl_lock(); rc = atif_ioctl(cmd, argp); rtnl_unlock(); break; } return rc; } #ifdef CONFIG_COMPAT static int atalk_compat_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) { /* * SIOCATALKDIFADDR is a SIOCPROTOPRIVATE ioctl number, so we * cannot handle it in common code. The data we access if ifreq * here is compatible, so we can simply call the native * handler. */ if (cmd == SIOCATALKDIFADDR) return atalk_ioctl(sock, cmd, (unsigned long)compat_ptr(arg)); return -ENOIOCTLCMD; } #endif static const struct net_proto_family atalk_family_ops = { .family = PF_APPLETALK, .create = atalk_create, .owner = THIS_MODULE, }; static const struct proto_ops atalk_dgram_ops = { .family = PF_APPLETALK, .owner = THIS_MODULE, .release = atalk_release, .bind = atalk_bind, .connect = atalk_connect, .socketpair = sock_no_socketpair, .accept = sock_no_accept, .getname = atalk_getname, .poll = datagram_poll, .ioctl = atalk_ioctl, #ifdef CONFIG_COMPAT .compat_ioctl = atalk_compat_ioctl, #endif .listen = sock_no_listen, .shutdown = sock_no_shutdown, .setsockopt = sock_no_setsockopt, .getsockopt = sock_no_getsockopt, .sendmsg = atalk_sendmsg, .recvmsg = atalk_recvmsg, .mmap = sock_no_mmap, .sendpage = sock_no_sendpage, }; static struct notifier_block ddp_notifier = { .notifier_call = ddp_device_event, }; static struct packet_type ltalk_packet_type __read_mostly = { .type = cpu_to_be16(ETH_P_LOCALTALK), .func = ltalk_rcv, }; static struct packet_type ppptalk_packet_type __read_mostly = { .type = cpu_to_be16(ETH_P_PPPTALK), .func = atalk_rcv, }; static unsigned char ddp_snap_id[] = { 0x08, 0x00, 0x07, 0x80, 0x9B }; /* Export symbols for use by drivers when AppleTalk is a module */ EXPORT_SYMBOL(atrtr_get_dev); EXPORT_SYMBOL(atalk_find_dev_addr); static const char atalk_err_snap[] __initconst = KERN_CRIT "Unable to register DDP with SNAP.\n"; /* Called by proto.c on kernel start up */ static int __init atalk_init(void) { int rc = proto_register(&ddp_proto, 0); if (rc != 0) goto out; (void)sock_register(&atalk_family_ops); ddp_dl = register_snap_client(ddp_snap_id, atalk_rcv); if (!ddp_dl) printk(atalk_err_snap); dev_add_pack(&ltalk_packet_type); dev_add_pack(&ppptalk_packet_type); register_netdevice_notifier(&ddp_notifier); aarp_proto_init(); atalk_proc_init(); atalk_register_sysctl(); out: return rc; } module_init(atalk_init); /* * No explicit module reference count manipulation is needed in the * protocol. Socket layer sets module reference count for us * and interfaces reference counting is done * by the network device layer. * * Ergo, before the AppleTalk module can be removed, all AppleTalk * sockets be closed from user space. */ static void __exit atalk_exit(void) { #ifdef CONFIG_SYSCTL atalk_unregister_sysctl(); #endif /* CONFIG_SYSCTL */ atalk_proc_exit(); aarp_cleanup_module(); /* General aarp clean-up. */ unregister_netdevice_notifier(&ddp_notifier); dev_remove_pack(&ltalk_packet_type); dev_remove_pack(&ppptalk_packet_type); unregister_snap_client(ddp_dl); sock_unregister(PF_APPLETALK); proto_unregister(&ddp_proto); } module_exit(atalk_exit); MODULE_LICENSE("GPL"); MODULE_AUTHOR("Alan Cox <[email protected]>"); MODULE_DESCRIPTION("AppleTalk 0.20\n"); MODULE_ALIAS_NETPROTO(PF_APPLETALK);
{ "pile_set_name": "Github" }
Business Layer (BL) =================== Sometimes also called the Business Logic Layer (BLL), the BL contains entitiy definitions and business logic. Business Entities ----------------- Business entites are classes that represent real-world objects. They're the core of Object-Oriented-Programming (OOP). Manager Classes --------------- In this particular architecture, we're using the façade pattern (like we did with the DAL) which is represented by static Manager classes. The manager classes are an abstraction on the DAL and SAL layers and perform any business logic.
{ "pile_set_name": "Github" }
// Protocol Buffers - Google's data interchange format // Copyright 2008 Google Inc. All rights reserved. // https://developers.google.com/protocol-buffers/ // // 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 Google Inc. 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. // Code generated by protoc-gen-go. DO NOT EDIT. // source: google/protobuf/timestamp.proto package timestamppb import ( protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" sync "sync" ) // A Timestamp represents a point in time independent of any time zone or local // calendar, encoded as a count of seconds and fractions of seconds at // nanosecond resolution. The count is relative to an epoch at UTC midnight on // January 1, 1970, in the proleptic Gregorian calendar which extends the // Gregorian calendar backwards to year one. // // All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap // second table is needed for interpretation, using a [24-hour linear // smear](https://developers.google.com/time/smear). // // The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By // restricting to that range, we ensure that we can convert to and from [RFC // 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings. // // # Examples // // Example 1: Compute Timestamp from POSIX `time()`. // // Timestamp timestamp; // timestamp.set_seconds(time(NULL)); // timestamp.set_nanos(0); // // Example 2: Compute Timestamp from POSIX `gettimeofday()`. // // struct timeval tv; // gettimeofday(&tv, NULL); // // Timestamp timestamp; // timestamp.set_seconds(tv.tv_sec); // timestamp.set_nanos(tv.tv_usec * 1000); // // Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`. // // FILETIME ft; // GetSystemTimeAsFileTime(&ft); // UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime; // // // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z // // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z. // Timestamp timestamp; // timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL)); // timestamp.set_nanos((INT32) ((ticks % 10000000) * 100)); // // Example 4: Compute Timestamp from Java `System.currentTimeMillis()`. // // long millis = System.currentTimeMillis(); // // Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) // .setNanos((int) ((millis % 1000) * 1000000)).build(); // // // Example 5: Compute Timestamp from current time in Python. // // timestamp = Timestamp() // timestamp.GetCurrentTime() // // # JSON Mapping // // In JSON format, the Timestamp type is encoded as a string in the // [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the // format is "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z" // where {year} is always expressed using four digits while {month}, {day}, // {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional // seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution), // are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone // is required. A proto3 JSON serializer should always use UTC (as indicated by // "Z") when printing the Timestamp type and a proto3 JSON parser should be // able to accept both UTC and other timezones (as indicated by an offset). // // For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past // 01:30 UTC on January 15, 2017. // // In JavaScript, one can convert a Date object to this format using the // standard // [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString) // method. In Python, a standard `datetime.datetime` object can be converted // to this format using // [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with // the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use // the Joda Time's [`ISODateTimeFormat.dateTime()`]( // http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime%2D%2D // ) to obtain a formatter capable of generating timestamps in this format. // // type Timestamp struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields // Represents seconds of UTC time since Unix epoch // 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to // 9999-12-31T23:59:59Z inclusive. Seconds int64 `protobuf:"varint,1,opt,name=seconds,proto3" json:"seconds,omitempty"` // Non-negative fractions of a second at nanosecond resolution. Negative // second values with fractions must still have non-negative nanos values // that count forward in time. Must be from 0 to 999,999,999 // inclusive. Nanos int32 `protobuf:"varint,2,opt,name=nanos,proto3" json:"nanos,omitempty"` } func (x *Timestamp) Reset() { *x = Timestamp{} if protoimpl.UnsafeEnabled { mi := &file_google_protobuf_timestamp_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } func (x *Timestamp) String() string { return protoimpl.X.MessageStringOf(x) } func (*Timestamp) ProtoMessage() {} func (x *Timestamp) ProtoReflect() protoreflect.Message { mi := &file_google_protobuf_timestamp_proto_msgTypes[0] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) } return ms } return mi.MessageOf(x) } // Deprecated: Use Timestamp.ProtoReflect.Descriptor instead. func (*Timestamp) Descriptor() ([]byte, []int) { return file_google_protobuf_timestamp_proto_rawDescGZIP(), []int{0} } func (x *Timestamp) GetSeconds() int64 { if x != nil { return x.Seconds } return 0 } func (x *Timestamp) GetNanos() int32 { if x != nil { return x.Nanos } return 0 } var File_google_protobuf_timestamp_proto protoreflect.FileDescriptor var file_google_protobuf_timestamp_proto_rawDesc = []byte{ 0x0a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x22, 0x3b, 0x0a, 0x09, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x6e, 0x61, 0x6e, 0x6f, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x6e, 0x61, 0x6e, 0x6f, 0x73, 0x42, 0x7e, 0x0a, 0x13, 0x63, 0x6f, 0x6d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x42, 0x0e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x70, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0xf8, 0x01, 0x01, 0xa2, 0x02, 0x03, 0x47, 0x50, 0x42, 0xaa, 0x02, 0x1e, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x57, 0x65, 0x6c, 0x6c, 0x4b, 0x6e, 0x6f, 0x77, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( file_google_protobuf_timestamp_proto_rawDescOnce sync.Once file_google_protobuf_timestamp_proto_rawDescData = file_google_protobuf_timestamp_proto_rawDesc ) func file_google_protobuf_timestamp_proto_rawDescGZIP() []byte { file_google_protobuf_timestamp_proto_rawDescOnce.Do(func() { file_google_protobuf_timestamp_proto_rawDescData = protoimpl.X.CompressGZIP(file_google_protobuf_timestamp_proto_rawDescData) }) return file_google_protobuf_timestamp_proto_rawDescData } var file_google_protobuf_timestamp_proto_msgTypes = make([]protoimpl.MessageInfo, 1) var file_google_protobuf_timestamp_proto_goTypes = []interface{}{ (*Timestamp)(nil), // 0: google.protobuf.Timestamp } var file_google_protobuf_timestamp_proto_depIdxs = []int32{ 0, // [0:0] is the sub-list for method output_type 0, // [0:0] is the sub-list for method input_type 0, // [0:0] is the sub-list for extension type_name 0, // [0:0] is the sub-list for extension extendee 0, // [0:0] is the sub-list for field type_name } func init() { file_google_protobuf_timestamp_proto_init() } func file_google_protobuf_timestamp_proto_init() { if File_google_protobuf_timestamp_proto != nil { return } if !protoimpl.UnsafeEnabled { file_google_protobuf_timestamp_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Timestamp); i { case 0: return &v.state case 1: return &v.sizeCache case 2: return &v.unknownFields default: return nil } } } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_google_protobuf_timestamp_proto_rawDesc, NumEnums: 0, NumMessages: 1, NumExtensions: 0, NumServices: 0, }, GoTypes: file_google_protobuf_timestamp_proto_goTypes, DependencyIndexes: file_google_protobuf_timestamp_proto_depIdxs, MessageInfos: file_google_protobuf_timestamp_proto_msgTypes, }.Build() File_google_protobuf_timestamp_proto = out.File file_google_protobuf_timestamp_proto_rawDesc = nil file_google_protobuf_timestamp_proto_goTypes = nil file_google_protobuf_timestamp_proto_depIdxs = nil }
{ "pile_set_name": "Github" }
``` USAGE: RUST_LOG=info pdfutil [OPTIONS] [SUBCOMMAND] FLAGS: -h, --help Prints help information -V, --version Prints version information OPTIONS: -i, --input <input file> -o, --output <output file> SUBCOMMANDS: compress Compress PDF document decompress Decompress PDF document delete_objects Delete objects delete_pages Delete pages delete_zero_length_streams Delete zero length stream objects help Prints this message or the help of the given subcommand(s) process Process PDF document with specified operations prune_objects Prune unused objects renumber_objects Renumber objects ```
{ "pile_set_name": "Github" }
<div class="intro-left"> <div class="tips blue"> <h1> <span>rikas toiminnallisuus</span> </h1> <p> Koodi kehottaa automaattisesti </p> <p> Multi-teema: Valitse suosikki ohjelmointityyli </p> <p> Custom Font: käytettäväksi kohtaus </p> <p> Multi kursori editointi, lohko editointi verkossa ohjelmointi kokemusta verrattavissa ylevää </p> <p> Block taitto, laajentaa; kietoa </p> <p> Tuki useita välilehtiä vetämällä kytkentäjärjestys </p> <p> Ylläpito useita asiakirjoja, etsiä ja korvata, historia; </p> <p> Automaattinen täydennys [], {}, (), &#39;&#39; &#39;&#39; </p> <p> Online reaaliaikainen esikatselu, jonka avulla voit rakastua verkossa ohjelmointi! </p> <p> zendcodeing tukea, kirjoittaa koodia kahdeksankymmentä </p> <p> Enemmän ominaisuuksia odottavat löytäjäänsä ...... </p> </div> <div class="tips orange"> <h1> <span>150 erilaista koodia korostus</span> </h1> <p> Vihje: html, JavaScript, CSS, vähemmän, sass, SCSS </p> <p> web-kehitys: PHP, Perl, Python, Ruby, Elang, mene ... </p> <p> Perinteiset kielet: Java, C, C ++, C #, Actionscript, VBScript ... </p> <p> Muut: markdown, kuori, sql, Lua, xml, YAML ... </p> </div> </div> <div class="intro-right"> <div class="tips green"> <h1> <span>Oikotie Action</span> </h1> <pre> Yleisesti käytetty pikanäppäimet: ctrl + s säästää ctrl + valikoidulle kaikki ctrl + x Cut ctrl + c ctrl + v tahna kopio ctrl + z Kumoa Kumoa Anti ctrl + y ctrl + f löytää korvaavaa ctrl + f + f win + alt + 0 romahtaa kaikki win + alt + shift + 0 Laajenna kaikki esc [Lopeta haku peruuntuu automaattisesti kysyy ...] ctrl-shift-s esikatselu ctrl-shift-e esittävät &amp; Close toiminto </pre> <pre> Valitse: Hiiri teltta - drag shift + home / end / ylös / vasemmalle / alas / oikealle shift + PageUp / PageDown läppä ylös ja alas ja valitse ctrl + shift + home / pää kohdistimen alkuun ja loppuun alt + hiirellä vetämällä lohkon valinta ctrl + alt + g erä valita ja anna nykyinen multi-välilehti editor </pre> <pre> Cursor: home / end / ylös / vasemmalle / alas / oikealle ctrl + home / end siirrä kohdistin asiakirjan pään / hännän ctrl + p Siirry matching tag PageUp / PageDown kohdistin ylös ja alas alt + vasen / oikea kursori siirtyy huippuluokan shift + vasen / oikea kursori rivin loppuun &amp; ctrl + l siirtyä tietylle riville ctrl + alt + ylös / alas (alla) lisäävät kursori </pre> <pre> Edit: ctrl + / Kommentti ja seur ctrl + alt + perusteltu taulukko välilehti linjaus shift + pöytä yleistä etenemistä taulukko poista poista koko rivi ctrl + d ctrl + Delete poistaa rivin oikea sana ctrl / shift + askelpalautin poistaa sana vasemmalle alt + shift + ylös / alas ja lisätään kopion linja (alla) tason alt + delete poistaa sisällön oikealle puolelle alt + ylös / alas nykyisen rivin ja linja (seuraava rivi exchange) ctrl + shift + d riviä kopioitu ja lisätä seuraaviin ctrl + Delete poistaa oikealle sanan ctrl + shift + u muunnetaan pieniksi kirjaimiksi Ctrl + U valitun tekstin isoiksi </pre> </div> </div>
{ "pile_set_name": "Github" }
// ------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool Xbim.CodeGeneration // // Changes to this file may cause incorrect behaviour and will be lost if // the code is regenerated. // </auto-generated> // ------------------------------------------------------------------------------ using System; using System.Collections.Generic; using System.Linq; using Xbim.Common; using Xbim.Common.Exceptions; using Xbim.Ifc4.Interfaces; using Xbim.Ifc4.ProductExtension; //## Custom using statements //## namespace Xbim.Ifc4.Interfaces { /// <summary> /// Readonly interface for IfcFeatureElementAddition /// </summary> // ReSharper disable once PartialTypeWithSinglePart public partial interface @IIfcFeatureElementAddition : IIfcFeatureElement { IIfcRelProjectsElement @ProjectsElements { get; } } } namespace Xbim.Ifc4.ProductExtension { [ExpressType("IfcFeatureElementAddition", 385)] // ReSharper disable once PartialTypeWithSinglePart public abstract partial class @IfcFeatureElementAddition : IfcFeatureElement, IIfcFeatureElementAddition, IEquatable<@IfcFeatureElementAddition> { #region IIfcFeatureElementAddition explicit implementation IIfcRelProjectsElement IIfcFeatureElementAddition.ProjectsElements { get { return @ProjectsElements; } } #endregion //internal constructor makes sure that objects are not created outside of the model/ assembly controlled area internal IfcFeatureElementAddition(IModel model, int label, bool activated) : base(model, label, activated) { } #region Inverse attributes [InverseProperty("RelatedFeatureElement")] [EntityAttribute(-1, EntityAttributeState.Mandatory, EntityAttributeType.Set, EntityAttributeType.Class, null, null, 33)] public IfcRelProjectsElement @ProjectsElements { get { return Model.Instances.FirstOrDefault<IfcRelProjectsElement>(e => Equals(e.RelatedFeatureElement), "RelatedFeatureElement", this); } } #endregion #region IPersist implementation public override void Parse(int propIndex, IPropertyValue value, int[] nestedIndex) { switch (propIndex) { case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7: base.Parse(propIndex, value, nestedIndex); return; default: throw new XbimParserException(string.Format("Attribute index {0} is out of range for {1}", propIndex + 1, GetType().Name.ToUpper())); } } #endregion #region Equality comparers and operators public bool Equals(@IfcFeatureElementAddition other) { return this == other; } #endregion #region Custom code (will survive code regeneration) //## Custom code //## #endregion } }
{ "pile_set_name": "Github" }
# Taiwan, Taipei gw1.tpe1 # host/port of vpn server remote gw1.tpe1.frostvpn.com 8080 # file containing username and password auth-user-pass /config/openvpn-credentials.txt # equivalent to pull, tls-client client # redirect all outgoing traffic to the vpn gateway redirect-gateway # verify the server certificate for authenticity remote-cert-tls server #cipher cipher AES-256-CBC proto udp dev tun nobind <ca> -----BEGIN CERTIFICATE----- MIIDQDCCAqmgAwIBAgIJAM8Brk2pUr0KMA0GCSqGSIb3DQEBBQUAMHQxCzAJBgNV BAYTAlVTMQswCQYDVQQIEwJDQTEMMAoGA1UEBxMDVlBOMQwwCgYDVQQKEwNWUE4x DDAKBgNVBAsTA1ZQTjEMMAoGA1UEAxMDVlBOMQwwCgYDVQQpEwNWUE4xEjAQBgkq hkiG9w0BCQEWA1ZQTjAeFw0xMjAzMDMwMjExNDJaFw0yMjAzMDEwMjExNDJaMHQx CzAJBgNVBAYTAlVTMQswCQYDVQQIEwJDQTEMMAoGA1UEBxMDVlBOMQwwCgYDVQQK EwNWUE4xDDAKBgNVBAsTA1ZQTjEMMAoGA1UEAxMDVlBOMQwwCgYDVQQpEwNWUE4x EjAQBgkqhkiG9w0BCQEWA1ZQTjCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA wY2K08N7or1Br/EsD9XBon7gs7dKflWYuymgMLJfeMFWuJloNdsn+3GARIhYBbN6 zhvFGFE214qKPqAydW1WmIIK7KoC0sgndr+Vk/au9gssFzVmmvr6+WN/nfo2L9Kv vBMoYLrMAiyw/D4cRapZi2pXJLcMDfC+p1VWAX8TYWkCAwEAAaOB2TCB1jAdBgNV HQ4EFgQUmyvO4rTnu5/ABnp0FngU+SdR8WAwgaYGA1UdIwSBnjCBm4AUmyvO4rTn u5/ABnp0FngU+SdR8WCheKR2MHQxCzAJBgNVBAYTAlVTMQswCQYDVQQIEwJDQTEM MAoGA1UEBxMDVlBOMQwwCgYDVQQKEwNWUE4xDDAKBgNVBAsTA1ZQTjEMMAoGA1UE AxMDVlBOMQwwCgYDVQQpEwNWUE4xEjAQBgkqhkiG9w0BCQEWA1ZQToIJAM8Brk2p Ur0KMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADgYEAoB0kOuGvrzPBTIRX IDHCCxBMdny+3sKAOllmH4+51j2aWhAJ4Pyc/yBTYyQGNoriABjmNzp+R05oiaxA D3vTgR80juKDPtQb8LoGLBF18gL7Vtc3+hJXcJasXZaDSSoyh5f+TtGvytIT+ece JWIrKnFXzlHOvKlyLkcZn15gwKQ= -----END CERTIFICATE----- </ca>
{ "pile_set_name": "Github" }
sounds.txt # Sample players are used for sound effects (.WAV) # Add your sounds to Sample Library(. You can play sounds on top of each other by changing the "Voices" property. # Usage: play(sound) # Stream players are used for music (OGG,MPC) # Avoid mp3. you have to pay to use this format # Audacity can be used to convert to the prefered formats # Usage: play() Voice: Welcome On Off Game Over Continue? I see it I hear it I feel it I smell it I taste it Wrong way You are under attack Your inventory is empty Your inventory is full Go Stop
{ "pile_set_name": "Github" }
<!DOCTYPE html> <html lang="en" data-navbar="/account/navbar-profiles.html"> <head> <meta charset="utf-8" /> <title translate="yes">Направите профил</title> <link href="/public/pure-min.css" rel="stylesheet"> <link href="/public/content.css" rel="stylesheet"> <link href="/public/content-additional.css" rel="stylesheet"> <base target="_top" href="/"> </head> <body> <h1 translate="yes">Направите профил</h1> <p translate="yes">Профили садрже ваше личне податке у административне и друге сврхе.</p> <div id="message-container"></div> <form id="submit-form" method="post" class="pure-form pure-form-stacked" action="/account/create-profile" name="submit-form"> <div class="pure-checkbox"> <label for="default"><input required="required" id="default" name="default" value="true" type="checkbox"> <span translate="yes">Нека буде задана</span></label> </div> <div id="display-name-container" class="pure-control-group"> <label for="display-name" translate="yes">Показати име</label> <input required="required" id="display-name" name="display-name" type="text" maxlength="1000"> </div> <div id="display-email-container" class="pure-control-group"> <label for="display-email" translate="yes">Прикажи емаил</label> <input required="required" id="display-email" name="display-email" type="text" maxlength="1000" size="50"> </div> <div id="contact-email-container" class="pure-control-group"> <label for="contact-email" translate="yes">Контакт имејл</label> <input required="required" id="contact-email" name="contact-email" type="text" maxlength="1000" size="50"> </div> <div id="full-name-container"> <div class="pure-control-group"> <label for="first-name" translate="yes">Име</label> <input required="required" id="first-name" name="first-name" type="text" maxlength="1000"> </div> <div class="pure-control-group"> <label for="last-name" translate="yes">Презиме</label> <input required="required" id="last-name" name="last-name" type="text" maxlength="1000"> </div> </div> <div id="dob-container"> <div class="pure-control-group"> <label for="dob" translate="yes">Датум рођења</label> <input required="required" id="dob" name="dob" type="text" maxlength="11"> </div> </div> <div id="phone-container" class="pure-control-group"> <label for="phone" translate="yes">Телефон</label> <input required="required" id="phone" name="phone" type="text" maxlength="1000"> </div> <div id="occupation-container" class="pure-control-group"> <label for="occupation" translate="yes">Занимање</label> <input required="required" id="occupation" name="occupation" type="text" maxlength="1000"> </div> <div id="location-container" class="pure-control-group"> <label for="location" translate="yes">Локација</label> <input required="required" id="location" name="location" type="text" maxlength="1000"> </div> <div id="company-name-container" class="pure-control-group"> <label for="company-name" translate="yes">Име компаније</label> <input required="required" id="company-name" name="company-name" type="text" maxlength="1000"> </div> <div id="website-container" class="pure-control-group"> <label for="website" translate="yes">Веб сајт</label> <input required="required" id="website" name="website" type="text" maxlength="1000"> </div> <div id="submit-container" class="pure-controls"> <button id="submit-button" class="pure-button pure-button-primary" translate="yes">Направите профил</button> </div> </form> <template id="success"> <div class="success message" translate="yes"> Успех! Ваше нове информације о профилу су сачуване </div> </template> <template id="unknown-error"> <div class="error message" translate="yes"> Грешка! Дошло је до непознате грешке </div> </template> <template id="invalid-first-name"> <div class="error message" translate="yes"> Грешка! Наведено недостаје или неисправно име </div> </template> <template id="invalid-first-name-length"> <div class="error message" translate="yes"> Грешка! Наведено је неважеће име </div> </template> <template id="invalid-last-name"> <div class="error message" translate="yes"> Грешка! Наведено је нестало или неважеће презиме </div> </template> <template id="invalid-last-name-length"> <div class="error message" translate="yes"> Грешка! Наведено је неважеће презиме </div> </template> <template id="invalid-contact-email"> <div class="error message" translate="yes"> Грешка! Неважећа адреса е-поште за контакт </div> </template> <template id="invalid-display-email"> <div class="error message" translate="yes"> Грешка! Неважећа адреса е-поште за приказ </div> </template> <template id="invalid-display-name"> <div class="error message" translate="yes"> Грешка! Наведено је недостајуће или неважеће приказно име </div> </template> <template id="invalid-dob"> <div class="error message" translate="yes"> Грешка! Наведен је нестали или неважећи датум рођења </div> </template> <template id="invalid-phone"> <div class="error message" translate="yes"> Грешка! Дао је недостајући или неважећи телефон. </div> </template> <template id="invalid-occupation"> <div class="error message" translate="yes"> Грешка! Осигурано је нестало или неважеће занимање. </div> </template> <template id="invalid-location"> <div class="error message" translate="yes"> Грешка! Наведена је локација која недостаје или није важећа. </div> </template> <template id="invalid-company-name"> <div class="error message" translate="yes"> Грешка! Наведено је нестало или неважеће име компаније. </div> </template> <template id="invalid-website"> <div class="error message" translate="yes"> Грешка! Пружена је веб страница која недостаје или није важећа. </div> </template> <template id="invalid-display-name-length"> <div class="error message" translate="yes"> Грешка! Наведено је недостајуће или неважеће приказно име </div> </template> </body> </html>
{ "pile_set_name": "Github" }
<div> Bu se&#231;ene&#287;i, yap&#305;land&#305;rmalar&#305;n&#305;z&#305;, &#246;zel tan&#305;mlanm&#305;&#351; bir URL arac&#305;l&#305;&#287;&#305; ile tetiklemek istiyorsan&#305;z devreye al&#305;n. <p>Bu &#246;zelli&#287;in en g&#252;zel &#246;rneklerinden bir tanesi, kaynak kontrol sistemine hook scripti yaz&#305;p, herhangi bir de&#287;i&#351;iklik an&#305;nda URL arac&#305;l&#305;&#287;&#305; ile yap&#305;lan&#305;rmay&#305; ba&#351;latabilmektir</p> <p>Bu &#246;zelli&#287;i kullanabilmek i&#231;in bir yetkilendirme token'&#305; (string) tan&#305;mlamal&#305;s&#305;n&#305;z, b&#246;ylece bu token'&#305; bilenler uzaktan bu projenin yap&#305;land&#305;rmalar&#305;n&#305; tetikleyebilirler.</p> </div>
{ "pile_set_name": "Github" }