{
"coverage_options": {
- "minimum_coverage": 80
+ "minimum_coverage": 78.9
},
"skip_files": [
"test/support"
:not_found ->
{db, {keyspace, key}, acc}
- l ->
- {db, {keyspace, key}, acc ++ Enum.flat_map(l, fn {_, subscribers} -> subscribers end)}
+ subscribers ->
+ {db, {keyspace, key}, acc ++ Enum.flat_map(subscribers, fn {_, subscribers} -> subscribers end)}
end
end
{:states_language, "~> 0.2"},
{:wampex,
git: "https://gitlab.com/entropealabs/wampex.git",
- tag: "92648dd6f1a4a9ed24b10eec3533d29108b31852",
+ tag: "591a03f9ed1585942afc043fe4a73beb7641e1e3",
override: true},
{:wampex_client,
git: "https://gitlab.com/entropealabs/wampex_client.git",
- tag: "5842014aa550977e859656d193583d022254b1fd",
+ tag: "6861b782ce61df0d12b94953a0fb39281ce499e2",
only: [:dev, :test]}
]
end
"states_language": {:hex, :states_language, "0.2.8", "f9dfd3c0bd9a9d7bda25ef315f2d90944cd6b2022a7f3c403deb1d4ec451825e", [:mix], [{:elixpath, "~> 0.1.0", [hex: :elixpath, repo: "hexpm", optional: false]}, {:jason, "~> 1.1", [hex: :jason, repo: "hexpm", optional: false]}, {:json_xema, "~> 0.4.0", [hex: :json_xema, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4.0", [hex: :telemetry, repo: "hexpm", optional: false]}, {:xema, "~> 0.11.0", [hex: :xema, repo: "hexpm", optional: false]}], "hexpm", "a5231691e7cb37fe32dc7de54c2dc86d1d60e84c4f0379f3246e55be2a85ec78"},
"telemetry": {:hex, :telemetry, "0.4.1", "ae2718484892448a24470e6aa341bc847c3277bfb8d4e9289f7474d752c09c7f", [:rebar3], [], "hexpm", "4738382e36a0a9a2b6e25d67c960e40e1a2c95560b9f936d8e29de8cd858480f"},
"unicode_util_compat": {:hex, :unicode_util_compat, "0.4.1", "d869e4c68901dd9531385bb0c8c40444ebf624e60b6962d95952775cac5e90cd", [:rebar3], [], "hexpm", "1d1848c40487cdb0b30e8ed975e34e025860c02e419cb615d255849f3427439d"},
- "wampex": {:git, "https://gitlab.com/entropealabs/wampex.git", "92648dd6f1a4a9ed24b10eec3533d29108b31852", [tag: "92648dd6f1a4a9ed24b10eec3533d29108b31852"]},
- "wampex_client": {:git, "https://gitlab.com/entropealabs/wampex_client.git", "5842014aa550977e859656d193583d022254b1fd", [tag: "5842014aa550977e859656d193583d022254b1fd"]},
+ "wampex": {:git, "https://gitlab.com/entropealabs/wampex.git", "591a03f9ed1585942afc043fe4a73beb7641e1e3", [tag: "591a03f9ed1585942afc043fe4a73beb7641e1e3"]},
+ "wampex_client": {:git, "https://gitlab.com/entropealabs/wampex_client.git", "6861b782ce61df0d12b94953a0fb39281ce499e2", [tag: "6861b782ce61df0d12b94953a0fb39281ce499e2"]},
"websockex": {:hex, :websockex, "0.4.2", "9a3b7dc25655517ecd3f8ff7109a77fce94956096b942836cdcfbc7c86603ecc", [:mix], [], "hexpm", "803cd76e91544b56f0e655e36790be797fa6436db9224f7c303db9b9df2a3df4"},
"xema": {:hex, :xema, "0.11.0", "7b5118418633cffc27092110d02d4faeea938149dd3f6c64299e41e747067e80", [:mix], [{:conv_case, "~> 0.2.2", [hex: :conv_case, repo: "hexpm", optional: false]}, {:decimal, "~> 1.7", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "51491c9a953d65069d4b30aa2f70bc45ff99fd1bc3345bc72ce4e644d01ea14e"},
}
def authenticate(signature, realm, authid, %{
challenge: challenge
}) do
- authid
- |> get_secret(realm)
- |> Crypto.hash_challenge(challenge)
- |> :pbkdf2.compare_secure(signature)
+ authed =
+ authid
+ |> get_secret(realm)
+ |> Crypto.hash_challenge(challenge)
+ |> :pbkdf2.compare_secure(signature)
+
+ {authed, %{}}
end
defp get_secret(_authid, _uri), do: Crypto.pbkdf2(@auth_password, @salt, @iterations, @keylen)
--- /dev/null
+defmodule Wampex.Router.AuthorizationImpl do
+ @moduledoc false
+ @behaviour Wampex.Router.Authorization
+
+ @impl true
+ def authorized?(_, _, _), do: true
+end
require Logger
alias Wampex.Client
alias Wampex.Roles.{Callee, Dealer}
- alias Callee.{Register, Unregister, Yield}
+ alias Callee.{Register, Yield}
alias Dealer.Invocation
def start_link(test, name, device) do
send(test, invocation)
- Client.cast_send_request(
+ Client.yield(
name,
- Callee.yield(%Yield{
+ %Yield{
request_id: id,
arg_list: [:ok],
arg_kw: %{color: Map.get(arg_kw, "color")}
- })
+ }
)
{:noreply, state}
end
-
- def terminate(_r, {_test, name, id}) do
- Client.send_request(
- name,
- Callee.unregister(%Unregister{registration_id: id})
- )
-
- :ok
- end
end
use GenServer
require Logger
alias Wampex.Client
- alias Wampex.Roles.Subscriber
- alias Subscriber.{Subscribe, Unsubscribe}
+ alias Wampex.Roles.Subscriber.Subscribe
def start_link(test, name, topic) do
GenServer.start_link(__MODULE__, {test, name, topic})
send(test, event)
{:noreply, state}
end
-
- def terminate(_r, {_test, name, subs}) do
- Enum.each(subs, fn sub ->
- Client.send_request(
- name,
- Subscriber.unsubscribe(%Unsubscribe{subscription_id: sub})
- )
- end)
-
- :ok
- end
end
alias Wampex.Roles.{Callee, Caller, Peer, Publisher, Subscriber}
alias Wampex.Roles.Caller.Call
alias Wampex.Roles.Dealer.{Invocation, Result}
- alias Wampex.Roles.Peer.Hello
+ alias Wampex.Roles.Peer.{Error, Hello}
alias Wampex.Roles.Publisher.Publish
alias Wampex.Router
alias Wampex.Router.AuthenticationImpl
+ alias Wampex.Router.AuthorizationImpl
require Logger
@url "ws://localhost:4000/ws"
replicas: 1,
quorum: 1,
authentication_module: AuthenticationImpl,
- authorization_module: nil
+ authorization_module: AuthorizationImpl
)
]
end
Process.flag(:trap_exit, true)
callee_name = TestAbort
{:ok, pid} = Client.start_link(name: callee_name, session: @session)
- Client.cast_send_request(callee_name, Peer.hello(%Hello{realm: "test", roles: [Callee]}))
+ Client.cast(callee_name, Peer.hello(%Hello{realm: "test", roles: [Callee]}))
assert_receive {:EXIT, ^pid, :shutdown}, 1000
end
caller_name = TestExistCaller
Client.start_link(name: caller_name, session: @session)
- assert {:error, 48, "wamp.error.no_registration", %{"procedure" => "this.should.not.exist"}, [], %{}} =
- Client.send_request(
+ assert %Error{error: "wamp.error.no_registration"} =
+ Client.call(
caller_name,
- Caller.call(%Call{
+ %Call{
procedure: "this.should.not.exist",
arg_list: [1],
arg_kw: %{color: "#FFFFFF"}
- })
+ }
)
end
Client.start_link(name: caller_name, session: @session)
%Result{arg_list: ["ok"], arg_kw: %{"color" => "#FFFFFF"}} =
- Client.send_request(
+ Client.call(
caller_name,
- Caller.call(%Call{
+ %Call{
procedure: "com.actuator.#{@device}.light",
arg_list: [1],
arg_kw: %{color: "#FFFFFF"}
- })
+ }
)
assert_receive %Invocation{}
Client.start_link(name: TestPublisher, session: @session)
- Client.cast_send_request(
+ Client.publish(
TestPublisher,
- Publisher.publish(%Publish{
+ %Publish{
topic: "no.subscribers",
arg_list: [12.5, 45.6, 87.5],
arg_kw: %{loc: "60645"}
- })
+ }
)
- Client.cast_send_request(
+ Client.publish(
TestPublisher,
- Publisher.publish(%Publish{
+ %Publish{
topic: "com.data.test.temp",
arg_list: [12.5, 45.6, 87.5],
arg_kw: %{loc: "60645"}
- })
+ }
)
assert_receive %Event{}, 2000