pact-ffi 0.0.2-x64-mingw-ucrt → 0.4.22-x64-mingw-ucrt

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,150 @@
1
+ # require 'pact-ffi/version'
2
+ require 'ffi'
3
+ require 'pact/detect_os'
4
+
5
+ module PactFfi
6
+ module Utils
7
+ extend FFI::Library
8
+ ffi_lib DetectOS.get_bin_path
9
+
10
+ # DetectOS.windows? || DetectOS.linux_arm? ? (typedef :uint32, :uint32_type) : (typedef :uint32_t, :uint32_type)
11
+ (typedef :uint32, :uint32_type)
12
+ FfiSpecificationVersion = Hash[
13
+ 'SPECIFICATION_VERSION_UNKNOWN' => 0,
14
+ 'SPECIFICATION_VERSION_V1' => 1,
15
+ 'SPECIFICATION_VERSION_V1_1' => 2,
16
+ 'SPECIFICATION_VERSION_V2' => 3,
17
+ 'SPECIFICATION_VERSION_V3' => 4,
18
+ 'SPECIFICATION_VERSION_V4' => 5,
19
+ ]
20
+ FfiWritePactResponse = Hash[
21
+ 'SUCCESS' => 0,
22
+ 'GENERAL_PANIC' => 1,
23
+ 'UNABLE_TO_WRITE_PACT_FILE' => 2,
24
+ 'MOCK_SERVER_NOT_FOUND' => 3,
25
+ ]
26
+ FfiWriteMessagePactResponse = Hash[
27
+ 'SUCCESS' => 0,
28
+ 'UNABLE_TO_WRITE_PACT_FILE' => 1,
29
+ 'MESSAGE_HANDLE_INVALID' => 2,
30
+ 'MOCK_SERVER_NOT_FOUND' => 3,
31
+ ]
32
+ FfiConfigurePluginResponse = Hash[
33
+ 'SUCCESS' => 0,
34
+ 'GENERAL_PANIC' => 1,
35
+ 'FAILED_TO_LOAD_PLUGIN' => 2,
36
+ 'PACT_HANDLE_INVALID' => 3,
37
+ ]
38
+ FfiPluginInteractionResponse = Hash[
39
+ 'SUCCESS' => 0,
40
+ 'A_GENERAL_PANIC_WAS_CAUGHT' => 1,
41
+ 'MOCK_SERVER_HAS_ALREADY_BEEN_STARTED' => 2,
42
+ 'INTERACTION_HANDLE_IS_INVALID' => 3,
43
+ 'CONTENT_TYPE_IS_NOT_VALID' => 4,
44
+ 'CONTENTS_JSON_IS_NOT_VALID_JSON' => 5,
45
+ 'PLUGIN_RETURNED_AN_ERROR' => 6,
46
+ ]
47
+ FfiInteractionPart = Hash[
48
+ 'INTERACTION_PART_REQUEST' => 0,
49
+ 'INTERACTION_PART_RESPONSE' => 1,
50
+ ]
51
+ # /*
52
+ # -1 A null pointer was received
53
+ # -2 The pact JSON could not be parsed
54
+ # -3 The mock server could not be started
55
+ # -4 The method panicked
56
+ # -5 The address is not valid
57
+ # -6 Could not create the TLS configuration with the self-signed certificate
58
+ # */
59
+ FfiPluginCreateMockServerErrors = Hash[
60
+ 'NULL_POINTER' => -1,
61
+ 'JSON_PARSE_ERROR' => -2,
62
+ 'MOCK_SERVER_START_FAIL' => -3,
63
+ 'CORE_PANIC' => -4,
64
+ 'ADDRESS_NOT_VALID' => -5,
65
+ 'TLS_CONFIG' => -6,
66
+ ]
67
+
68
+ FfiPluginFunctionResult = Hash[
69
+ 'RESULT_OK' => 0,
70
+ 'RESULT_FAILED' => 1,
71
+ ]
72
+
73
+ attach_function :add_text_comment, :pactffi_add_text_comment, %i[uint32_type string], :bool
74
+ attach_function :set_comment, :pactffi_set_comment, %i[uint32_type string string], :bool
75
+ attach_function :set_pending, :pactffi_set_pending, %i[uint32_type bool], :bool
76
+ attach_function :set_key, :pactffi_set_key, %i[uint32_type string], :bool
77
+ attach_function :match_message, :pactffi_match_message, %i[pointer pointer], :pointer
78
+ attach_function :mismatches_get_iter, :pactffi_mismatches_get_iter, %i[pointer], :pointer
79
+ attach_function :mismatches_delete, :pactffi_mismatches_delete, %i[pointer], :void
80
+ attach_function :mismatches_iter_next, :pactffi_mismatches_iter_next, %i[pointer], :pointer
81
+ attach_function :mismatches_iter_delete, :pactffi_mismatches_iter_delete, %i[pointer], :void
82
+ attach_function :mismatch_to_json, :pactffi_mismatch_to_json, %i[pointer], :string
83
+ attach_function :mismatch_type, :pactffi_mismatch_type, %i[pointer], :string
84
+ attach_function :mismatch_summary, :pactffi_mismatch_summary, %i[pointer], :string
85
+ attach_function :mismatch_description, :pactffi_mismatch_description, %i[pointer], :string
86
+ attach_function :mismatch_ansi_description, :pactffi_mismatch_ansi_description, %i[pointer], :string
87
+ attach_function :get_error_message, :pactffi_get_error_message, %i[string int32], :int32
88
+ attach_function :parse_pact_json, :pactffi_parse_pact_json, %i[string], :pointer
89
+ attach_function :pact_model_delete, :pactffi_pact_model_delete, %i[pointer], :void
90
+ attach_function :pact_model_interaction_iterator, :pactffi_pact_model_interaction_iterator, %i[pointer], :pointer
91
+ attach_function :pact_spec_version, :pactffi_pact_spec_version, %i[pointer], :int32
92
+ attach_function :pact_interaction_delete, :pactffi_pact_interaction_delete, %i[pointer], :void
93
+ attach_function :consumer_get_name, :pactffi_consumer_get_name, %i[pointer], :string
94
+ attach_function :pact_get_consumer, :pactffi_pact_get_consumer, %i[pointer], :pointer
95
+ attach_function :pact_consumer_delete, :pactffi_pact_consumer_delete, %i[pointer], :void
96
+ attach_function :parse_matcher_definition, :pactffi_parse_matcher_definition, %i[string], :pointer
97
+ attach_function :matcher_definition_error, :pactffi_matcher_definition_error, %i[pointer], :string
98
+ attach_function :matcher_definition_value, :pactffi_matcher_definition_value, %i[pointer], :string
99
+ attach_function :matcher_definition_delete, :pactffi_matcher_definition_delete, %i[pointer], :void
100
+ attach_function :matcher_definition_generator, :pactffi_matcher_definition_generator, %i[pointer], :pointer
101
+ attach_function :matcher_definition_value_type, :pactffi_matcher_definition_value_type, %i[pointer], :int32
102
+ attach_function :matching_rule_iter_delete, :pactffi_matching_rule_iter_delete, %i[pointer], :void
103
+ attach_function :matcher_definition_iter, :pactffi_matcher_definition_iter, %i[pointer], :pointer
104
+ attach_function :matching_rule_iter_next, :pactffi_matching_rule_iter_next, %i[pointer], :pointer
105
+ attach_function :matching_rule_id, :pactffi_matching_rule_id, %i[pointer], :uint16
106
+ attach_function :matching_rule_value, :pactffi_matching_rule_value, %i[pointer], :string
107
+ attach_function :matching_rule_pointer, :pactffi_matching_rule_pointer, %i[pointer], :pointer
108
+ attach_function :matching_rule_reference_name, :pactffi_matching_rule_reference_name, %i[pointer], :string
109
+ attach_function :validate_datetime, :pactffi_validate_datetime, %i[string string], :int32
110
+ attach_function :generator_to_json, :pactffi_generator_to_json, %i[pointer], :string
111
+ attach_function :generator_generate_string, :pactffi_generator_generate_string, %i[pointer string], :string
112
+ attach_function :generator_generate_integer, :pactffi_generator_generate_integer, %i[pointer string], :uint16
113
+ attach_function :generators_iter_delete, :pactffi_generators_iter_delete, %i[pointer], :void
114
+ attach_function :generators_iter_next, :pactffi_generators_iter_next, %i[pointer], :pointer
115
+ attach_function :generators_iter_pair_delete, :pactffi_generators_iter_pair_delete, %i[pointer], :void
116
+ attach_function :matching_rule_to_json, :pactffi_matching_rule_to_json, %i[pointer], :string
117
+ attach_function :matching_rules_iter_delete, :pactffi_matching_rules_iter_delete, %i[pointer], :void
118
+ attach_function :matching_rules_iter_next, :pactffi_matching_rules_iter_next, %i[pointer], :pointer
119
+ attach_function :matching_rules_iter_pair_delete, :pactffi_matching_rules_iter_pair_delete, %i[pointer], :void
120
+ attach_function :provider_state_iter_next, :pactffi_provider_state_iter_next, %i[pointer], :pointer
121
+ attach_function :provider_state_iter_delete, :pactffi_provider_state_iter_delete, %i[pointer], :void
122
+ attach_function :provider_get_name, :pactffi_provider_get_name, %i[pointer], :string
123
+ attach_function :pact_get_provider, :pactffi_pact_get_provider, %i[pointer], :pointer
124
+ attach_function :pact_provider_delete, :pactffi_pact_provider_delete, %i[pointer], :void
125
+ attach_function :provider_state_get_name, :pactffi_provider_state_get_name, %i[pointer], :string
126
+ attach_function :provider_state_get_param_iter, :pactffi_provider_state_get_param_iter, %i[pointer], :pointer
127
+ attach_function :provider_state_param_iter_next, :pactffi_provider_state_param_iter_next, %i[pointer], :pointer
128
+ attach_function :provider_state_delete, :pactffi_provider_state_delete, %i[pointer], :void
129
+ attach_function :provider_state_param_iter_delete, :pactffi_provider_state_param_iter_delete, %i[pointer], :void
130
+ attach_function :provider_state_param_pair_delete, :pactffi_provider_state_param_pair_delete, %i[pointer], :void
131
+ attach_function :string_delete, :pactffi_string_delete, %i[string], :void
132
+ attach_function :generate_datetime_string, :pactffi_generate_datetime_string, %i[string], :pointer
133
+ attach_function :check_regex, :pactffi_check_regex, %i[string string], :bool
134
+ attach_function :generate_regex_value, :pactffi_generate_regex_value, %i[string], :pointer
135
+ attach_function :free_string, :pactffi_free_string, %i[string], :void
136
+ attach_function :new_pact, :pactffi_new_pact, %i[string string], :uint16
137
+ attach_function :interaction_contents, :pactffi_interaction_contents, %i[uint32_type int32 string string],
138
+ :uint32_type
139
+ attach_function :matches_string_value, :pactffi_matches_string_value, %i[pointer string string uint8], :string
140
+ attach_function :matches_u64_value, :pactffi_matches_u64_value, %i[pointer ulong_long ulong_long uint8], :string
141
+ attach_function :matches_i64_value, :pactffi_matches_i64_value, %i[pointer int64 int64 uint8], :string
142
+ attach_function :matches_f64_value, :pactffi_matches_f64_value, %i[pointer double double uint8], :string
143
+ attach_function :matches_bool_value, :pactffi_matches_bool_value, %i[pointer uint8 uint8 uint8], :string
144
+ attach_function :matches_binary_value, :pactffi_matches_binary_value,
145
+ %i[pointer pointer ulong_long pointer ulong_long uint8], :string
146
+ attach_function :matches_json_value, :pactffi_matches_json_value, %i[pointer string string uint8], :string
147
+ attach_function :pact_handle_to_pointer, :pactffi_pact_handle_to_pointer, %i[uint16], :pointer
148
+ attach_function :handle_get_pact_spec_version, :pactffi_handle_get_pact_spec_version, %i[uint16], :int32
149
+ end
150
+ end
@@ -0,0 +1,62 @@
1
+ # require 'pact/native_verifier/version'
2
+ # require 'pact/native_verifier/app'
3
+
4
+ # require 'pact-ffi/version'
5
+ require 'ffi'
6
+ require 'pact/detect_os'
7
+
8
+ module PactFfi
9
+ module Verifier
10
+ extend FFI::Library
11
+ ffi_lib DetectOS.get_bin_path
12
+ # DetectOS.windows? || DetectOS.linux_arm? ? (typedef :uint32, :uint32_type) : (typedef :uint32_t, :uint32_type)
13
+ (typedef :uint32, :uint32_type)
14
+
15
+ # /*
16
+ # * | Error | Description |
17
+ # * |-------|-------------|
18
+ # * | 1 | The verification process failed, see output for errors |
19
+ # * | 2 | A null pointer was received |
20
+ # * | 3 | The method panicked |
21
+ # * | 4 | Invalid arguments were provided to the verification process |
22
+ # */
23
+ Response = Hash[
24
+ 'VERIFICATION_SUCCESSFUL' => 0,
25
+ 'VERIFICATION_FAILED' => 1,
26
+ 'NULL_POINTER_RECEIVED' => 2,
27
+ 'METHOD_PANICKED' => 3,
28
+ 'INVALID_ARGUMENTS' => 4,
29
+ ]
30
+
31
+ attach_function :verify, :pactffi_verify, %i[string], :int32
32
+ attach_function :new, :pactffi_verifier_new, %i[], :pointer
33
+ attach_function :new_for_application, :pactffi_verifier_new_for_application, %i[string string], :pointer
34
+ attach_function :shutdown, :pactffi_verifier_shutdown, %i[pointer], :void
35
+ attach_function :set_provider_info, :pactffi_verifier_set_provider_info,
36
+ %i[pointer string string string uint16 string], :void
37
+ attach_function :add_provider_transport, :pactffi_verifier_add_provider_transport,
38
+ %i[pointer string uint16 string string], :void
39
+ attach_function :set_filter_info, :pactffi_verifier_set_filter_info, %i[pointer string string uint8], :void
40
+ attach_function :set_provider_state, :pactffi_verifier_set_provider_state, %i[pointer string uint8 uint8], :void
41
+ attach_function :set_verification_options, :pactffi_verifier_set_verification_options, %i[pointer uint8 ulong_long],
42
+ :int32
43
+ attach_function :set_coloured_output, :pactffi_verifier_set_coloured_output, %i[pointer uint8], :int32
44
+ attach_function :set_no_pacts_is_error, :pactffi_verifier_set_no_pacts_is_error, %i[pointer uint8], :int32
45
+ attach_function :set_publish_options, :pactffi_verifier_set_publish_options,
46
+ %i[pointer string string pointer uint16 string], :int32
47
+ attach_function :set_consumer_filters, :pactffi_verifier_set_consumer_filters, %i[pointer pointer uint16], :void
48
+ attach_function :add_custom_header, :pactffi_verifier_add_custom_header, %i[pointer string string], :void
49
+ attach_function :add_file_source, :pactffi_verifier_add_file_source, %i[pointer string], :void
50
+ attach_function :add_directory_source, :pactffi_verifier_add_directory_source, %i[pointer string], :void
51
+ attach_function :url_source, :pactffi_verifier_url_source, %i[pointer string string string string], :void
52
+ attach_function :broker_source, :pactffi_verifier_broker_source, %i[pointer string string string string], :void
53
+ attach_function :broker_source_with_selectors, :pactffi_verifier_broker_source_with_selectors,
54
+ %i[pointer string string string string uint8 string pointer uint16 string pointer uint16 pointer uint16], :void
55
+ attach_function :execute, :pactffi_verifier_execute, %i[pointer], :int32
56
+ attach_function :cli_args, :pactffi_verifier_cli_args, %i[], :string
57
+ attach_function :logs, :pactffi_verifier_logs, %i[pointer], :string
58
+ attach_function :logs_for_provider, :pactffi_verifier_logs_for_provider, %i[string], :string
59
+ attach_function :output, :pactffi_verifier_output, %i[pointer uint8], :string
60
+ attach_function :json, :pactffi_verifier_json, %i[pointer], :string
61
+ end
62
+ end
@@ -0,0 +1,5 @@
1
+ module Pact
2
+ module Version
3
+ VERSION = '0.4.22'
4
+ end
5
+ end