-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #25 from JuliaComputing/tan/misc
use constructors where possible instead of `convert` methods, updates logging, add Project.toml
- Loading branch information
Showing
14 changed files
with
130 additions
and
108 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,36 @@ | ||
# Documentation: http://docs.travis-ci.com/user/languages/julia/ | ||
language: julia | ||
sudo: required | ||
|
||
os: | ||
- linux | ||
|
||
# this lets us have more RAM that we need to run multiple parallel julia processes | ||
sudo: required | ||
dist: xenial | ||
|
||
julia: | ||
- 1.0 | ||
- 1.1 | ||
- 1.2 | ||
- 1.3 | ||
- nightly | ||
services: | ||
- rabbitmq | ||
|
||
addons: | ||
apt: | ||
packages: | ||
- rabbitmq-server | ||
|
||
matrix: | ||
allow_failures: | ||
- julia: nightly | ||
|
||
notifications: | ||
email: false | ||
|
||
# uncomment the following lines to override the default test script | ||
script: | ||
- if [[ -a .git/shallow ]]; then git fetch --unshallow; fi | ||
- julia --inline=no -e 'using Pkg; Pkg.clone(pwd()); Pkg.build("AMQPClient"); Pkg.test("AMQPClient"; coverage=true)' | ||
#script: | ||
# - if [[ -a .git/shallow ]]; then git fetch --unshallow; fi | ||
# - julia --inline=no -e 'using Pkg; Pkg.clone(pwd()); Pkg.build("AMQPClient"); Pkg.test("AMQPClient"; coverage=true)' | ||
|
||
after_success: | ||
# push coverage results to Coveralls | ||
- julia -e 'cd(using Pkg; Pkg.dir("AMQPClient")); Pkg.add("Coverage"); using Coverage; Coveralls.submit(Coveralls.process_folder())' | ||
# push coverage results to Codecov | ||
- julia -e 'cd(using Pkg; Pkg.dir("AMQPClient")); Pkg.add("Coverage"); using Coverage; Codecov.submit(Codecov.process_folder())' | ||
- julia -e 'using Pkg; Pkg.add("Coverage"); using Coverage; Coveralls.submit(Coveralls.process_folder())'; | ||
# - julia -e 'using Pkg; Pkg.add("Coverage"); using Coverage; Codecov.submit(Codecov.process_folder())'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
name = "AMQPClient" | ||
uuid = "79c8b4cd-a41a-55fa-907c-fab5288e1383" | ||
keywords = ["amqpclient", "rabbitmq", "amqp", "amqp-client", "message-queue"] | ||
license = "MIT" | ||
desc = "A Julia AMQP (Advanced Message Queuing Protocol) / RabbitMQ Client." | ||
version = "0.3.0" | ||
|
||
[deps] | ||
Logging = "56ddb016-857b-54e1-b83d-db4d58db5568" | ||
Sockets = "6462fe0b-24de-5631-8697-dd941f90decc" | ||
|
||
[compat] | ||
julia = "1" | ||
|
||
[extras] | ||
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" | ||
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" | ||
|
||
[targets] | ||
test = ["Test", "Random"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
function auth_resp_amqplain(auth_params::Dict{String,Any}) | ||
params = Dict{String,Any}("LOGIN" => auth_params["LOGIN"], "PASSWORD" => auth_params["PASSWORD"]) | ||
iob = IOBuffer() | ||
write(iob, convert(TAMQPFieldTable, params)) | ||
write(iob, TAMQPFieldTable(params)) | ||
bytes = take!(iob) | ||
skipbytes = sizeof(fieldtype(TAMQPFieldTable, :len)) | ||
bytes = bytes[(skipbytes+1):end] | ||
convert(TAMQPLongStr, bytes) | ||
TAMQPLongStr(bytes) | ||
end | ||
|
||
const AUTH_PROVIDERS = Dict{String,Function}("AMQPLAIN" => auth_resp_amqplain) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,8 @@ | ||
convert(::Type{Any}, s::T) where {T<:Union{TAMQPShortStr,TAMQPLongStr,TAMQPByteArray}} = convert(String, s) | ||
convert(::Type{String}, s::T) where {T<:Union{TAMQPShortStr,TAMQPLongStr,TAMQPByteArray}} = String(copy(convert(Vector{UInt8}, s.data))) | ||
convert(::Type{T}, s::AbstractString) where {T<:Union{TAMQPShortStr,TAMQPLongStr,TAMQPByteArray}} = T(length(s), Vector{UInt8}(codeunits(String(s)))) | ||
convert(::Type{TAMQPLongStr}, d::Vector{UInt8}) = TAMQPLongStr(length(d), d) | ||
convert(::Type{TAMQPByteArray}, d::Vector{UInt8}) = TAMQPByteArray(length(d), d) | ||
|
||
convert(::Type{TAMQPFieldValue{T}}, v::T) where {T} = TAMQPFieldValue{T}(FieldIndicatorMap[T], v) | ||
|
||
as_fval(v::T) where {T} = convert(TAMQPFieldValue{T}, v) | ||
as_fval(v::Dict{String,Any}) = convert(TAMQPFieldValue{TAMQPFieldTable}, convert(TAMQPFieldTable, v)) | ||
as_fval(v::String) = convert(TAMQPFieldValue{TAMQPLongStr}, convert(TAMQPLongStr, v)) | ||
|
||
convert(::Type{Any}, t::TAMQPFieldTable) = convert(Dict{Any,Any}, t) | ||
convert(::Type{Dict{K,V}}, t::TAMQPFieldTable) where {K, V} = Dict{K,V}(f.name => f.val for f in t.data) | ||
convert(::Type{Dict{String, String}}, t::TAMQPFieldTable) = Dict{String, String}(String(copy(f.name.data)) => String(copy(f.val.fld.data)) for f in t.data) | ||
function convert(::Type{TAMQPFieldTable}, d::Dict{String,Any}) | ||
data = TAMQPFieldValuePair[] | ||
for (n,v) in d | ||
push!(data, TAMQPFieldValuePair(convert(TAMQPShortStr,n), as_fval(v))) | ||
end | ||
TAMQPFieldTable(length(data), data) | ||
end | ||
|
||
convert(::Type{Any}, t::TAMQPFieldArray) = convert(Vector, t) | ||
convert(::Type{Vector{T}}, t::TAMQPFieldArray) where {T} = convert(Vector{T}, t.data) | ||
|
||
convert(::Type{String}, s::T) where {T<:Union{TAMQPShortStr,TAMQPLongStr,TAMQPByteArray}} = String(copy(s.data)) | ||
convert(::Type{Bool}, b::TAMQPBit) = Bool(b.val & 0x1) | ||
convert(::Type{TAMQPBit}, b::Bool) = TAMQPBit(convert(UInt8, b)) | ||
convert(::Type{TAMQPBit}, b::T) where {T<:Integer} = convert(TAMQPBit, Bool(b)) | ||
|
||
simplify(val::T) where {T <: Union{TAMQPShortStr,TAMQPLongStr,TAMQPByteArray}} = String(copy(val.data)) | ||
simplify(val::TAMQPFieldArray) = [simplify(elem) for elem in val.data] | ||
simplify(table::TAMQPFieldTable) = Dict{String,Any}(simplify(f.name)=>simplify(f.val) for f in table.data) | ||
simplify(val::TAMQPFieldValue) = simplify(val.fld) | ||
simplify(x) = x |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
beb6f34
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JuliaRegistrator register
beb6f34
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Registration pull request created: JuliaRegistries/General/5862
After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.
This will be done automatically if Julia TagBot is installed, or can be done manually through the github interface, or via: