Skip to content

Commit 915b588

Browse files
Merge pull request #58 from diffo-dev/57-incorrect-domain-label
fix incorrect domain label
2 parents 75cdbfd + 161664a commit 915b588

8 files changed

Lines changed: 45 additions & 42 deletions

File tree

mix.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ defmodule Diffo.MixProject do
9494
{:ash_outstanding, "~> 0.2.3"},
9595
{:ash_jason, "~> 3.0"},
9696
{:ash_state_machine, "~> 0.2.12"},
97-
{:ash_neo4j, ash_neo4j_version("~> 0.2.14")},
97+
{:ash_neo4j, ash_neo4j_version("~> 0.2.15")},
9898
{:ash, ash_version("~> 3.0 and >= 3.19.1")},
9999
{:uuid, "~> 1.1"},
100100
{:igniter, ">= 0.6.29 and < 1.0.0-0",

mix.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
%{
22
"ash": {:hex, :ash, "3.19.3", "58b1bb3aea3d1d45d1c990059ffd0753409cc92fc4afe387376cb155e2a8c2a0", [:mix], [{:crux, ">= 0.1.2 and < 1.0.0-0", [hex: :crux, repo: "hexpm", optional: false]}, {:decimal, "~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}, {:ecto, "~> 3.7", [hex: :ecto, repo: "hexpm", optional: false]}, {:ets, "~> 0.8", [hex: :ets, repo: "hexpm", optional: false]}, {:igniter, ">= 0.6.29 and < 1.0.0-0", [hex: :igniter, repo: "hexpm", optional: true]}, {:jason, ">= 1.0.0", [hex: :jason, repo: "hexpm", optional: false]}, {:picosat_elixir, "~> 0.2", [hex: :picosat_elixir, repo: "hexpm", optional: true]}, {:plug, ">= 0.0.0", [hex: :plug, repo: "hexpm", optional: true]}, {:reactor, "~> 1.0", [hex: :reactor, repo: "hexpm", optional: false]}, {:simple_sat, ">= 0.1.1 and < 1.0.0-0", [hex: :simple_sat, repo: "hexpm", optional: true]}, {:spark, ">= 2.3.14 and < 3.0.0-0", [hex: :spark, repo: "hexpm", optional: false]}, {:splode, "~> 0.3", [hex: :splode, repo: "hexpm", optional: false]}, {:stream_data, "~> 1.0", [hex: :stream_data, repo: "hexpm", optional: false]}, {:telemetry, "~> 1.1", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "94b628319f2e144affaf1f8008277bad3340a198d48e6d2ed372990ac1643f9b"},
33
"ash_jason": {:hex, :ash_jason, "3.1.0", "84a88dfe5e25a20d55cf2d2664885cd086fa45871e8777aedc3ad96a282e2a6f", [:mix], [{:ash, ">= 3.6.2 and < 4.0.0-0", [hex: :ash, repo: "hexpm", optional: false]}, {:jason, "~> 1.4", [hex: :jason, repo: "hexpm", optional: false]}, {:spark, ">= 2.1.21 and < 3.0.0", [hex: :spark, repo: "hexpm", optional: false]}], "hexpm", "71e6bbc421fb2cf7079f8804814145cca458116c839fc798f9606b806e07eb2b"},
4-
"ash_neo4j": {:hex, :ash_neo4j, "0.2.14", "c6bb1b895510ab423afc4225840d4c4e94716490316bf75aa8da1da464f53e0a", [:mix], [{:ash, ">= 3.19.1 and < 4.0.0-0", [hex: :ash, repo: "hexpm", optional: false]}, {:bolty, ">= 0.0.7", [hex: :bolty, repo: "hexpm", optional: false]}, {:igniter, ">= 0.6.29 and < 1.0.0-0", [hex: :igniter, repo: "hexpm", optional: true]}, {:jason, "~> 1.4", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "888bd4a9fcc3c231642dfb4cb9110d9aef8a57ff61f16f078bfd278cde17cd69"},
4+
"ash_neo4j": {:hex, :ash_neo4j, "0.2.15", "1380f3a3f6b43fb346308808d621bd19b891b859431fd4b1ac26472fcee5b372", [:mix], [{:ash, ">= 3.19.1 and < 4.0.0-0", [hex: :ash, repo: "hexpm", optional: false]}, {:bolty, ">= 0.0.7", [hex: :bolty, repo: "hexpm", optional: false]}, {:igniter, ">= 0.6.29 and < 1.0.0-0", [hex: :igniter, repo: "hexpm", optional: true]}, {:jason, "~> 1.4", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "8be0a84e02ce70d691b3619c1f7cb7c8e1d9daf001673a227b27762f3690ac40"},
55
"ash_outstanding": {:hex, :ash_outstanding, "0.2.4", "c72b91f1b8e4859fb033eddf66d0ba36cfd8af0c2a9748c7ef9e6ccfdb5d093d", [:mix], [{:ash, ">= 3.6.2 and < 4.0.0-0", [hex: :ash, repo: "hexpm", optional: false]}, {:outstanding, "~> 0.2.4", [hex: :outstanding, repo: "hexpm", optional: false]}], "hexpm", "64ba8f582ce69c9050352c75f0895db186c7a56f35039dab34c8e1ab7516f9ce"},
66
"ash_state_machine": {:hex, :ash_state_machine, "0.2.12", "c0f7ebb8a176584f70c6ed196b7d0118c930d73e0590ade705d2dddc48aa7311", [:mix], [{:ash, ">= 3.4.66 and < 4.0.0-0", [hex: :ash, repo: "hexpm", optional: false]}], "hexpm", "394ce761ce82358e3c715e1cae6c5cf1390be27c03a8b661f2e5a2fda849873d"},
77
"bolty": {:hex, :bolty, "0.0.7", "257889f71bd16a9291bda8290c1018123c4084c8761f905b97d7176e65d8b111", [:mix], [{:db_connection, "~> 2.7.0", [hex: :db_connection, repo: "hexpm", optional: false]}, {:jason, "~> 1.4", [hex: :jason, repo: "hexpm", optional: true]}, {:poison, "~> 6.0", [hex: :poison, repo: "hexpm", optional: true]}], "hexpm", "fc8f88b86d292ad1336f9e246a6c0452e64774b38fac0351c141549420946e5e"},

test/assigner/assigner_test.exs

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ defmodule Diffo.Test.AssignerTest do
1010
alias Diffo.Provider.Assignment
1111

1212
alias Diffo.Test.Characteristics
13-
alias Diffo.Test.Domain
13+
alias Diffo.Test.Servo
1414
alias Diffo.Test.Card
1515

1616
setup_all do
@@ -25,7 +25,7 @@ defmodule Diffo.Test.AssignerTest do
2525

2626
describe "build card" do
2727
test "create a card" do
28-
{:ok, card} = Domain.build_card(%{})
28+
{:ok, card} = Servo.build_card(%{})
2929

3030
# check the instance is a Card
3131
assert is_struct(card, Card)
@@ -67,14 +67,14 @@ defmodule Diffo.Test.AssignerTest do
6767
end
6868

6969
test "define card" do
70-
{:ok, card} = Domain.build_card(%{})
70+
{:ok, card} = Servo.build_card(%{})
7171

7272
updates = [
7373
card: [family: :ISAM, model: "EBLT48", technology: :adsl2Plus],
7474
ports: [first: 1, last: 48, free: 48, type: "ADSL2+"]
7575
]
7676

77-
{:ok, card} = Domain.define_card(card, %{characteristic_value_updates: updates})
77+
{:ok, card} = Servo.define_card(card, %{characteristic_value_updates: updates})
7878

7979
encoding = Jason.encode!(card) |> Diffo.Util.summarise_dates()
8080

@@ -83,19 +83,19 @@ defmodule Diffo.Test.AssignerTest do
8383
end
8484

8585
test "auto assign port to resource" do
86-
{:ok, assignee} = Domain.build_shelf()
86+
{:ok, assignee} = Servo.build_shelf()
8787

88-
{:ok, card} = Domain.build_card(%{})
88+
{:ok, card} = Servo.build_card(%{})
8989

9090
updates = [
9191
card: [family: :ISAM, model: "EBLT48", technology: :adsl2Plus],
9292
ports: [first: 1, last: 48, free: 48, type: "ADSL2+"]
9393
]
9494

95-
{:ok, card} = Domain.define_card(card, %{characteristic_value_updates: updates})
95+
{:ok, card} = Servo.define_card(card, %{characteristic_value_updates: updates})
9696

9797
{:ok, card} =
98-
Domain.assign_port(card, %{
98+
Servo.assign_port(card, %{
9999
assignment: %Assignment{assignee_id: assignee.id, operation: :auto_assign}
100100
})
101101

@@ -108,24 +108,24 @@ defmodule Diffo.Test.AssignerTest do
108108
end
109109

110110
test "auto assign two ports to same resource" do
111-
{:ok, assignee} = Domain.build_shelf()
111+
{:ok, assignee} = Servo.build_shelf()
112112

113-
{:ok, card} = Domain.build_card(%{})
113+
{:ok, card} = Servo.build_card(%{})
114114

115115
updates = [
116116
card: [family: :ISAM, model: "EBLT48", technology: :adsl2Plus],
117117
ports: [first: 1, last: 48, free: 48, type: "ADSL2+"]
118118
]
119119

120-
{:ok, card} = Domain.define_card(card, %{characteristic_value_updates: updates})
120+
{:ok, card} = Servo.define_card(card, %{characteristic_value_updates: updates})
121121

122122
{:ok, card} =
123-
Domain.assign_port(card, %{
123+
Servo.assign_port(card, %{
124124
assignment: %Assignment{assignee_id: assignee.id, operation: :auto_assign}
125125
})
126126

127127
{:ok, card} =
128-
Domain.assign_port(card, %{
128+
Servo.assign_port(card, %{
129129
assignment: %Assignment{assignee_id: assignee.id, operation: :auto_assign}
130130
})
131131

@@ -138,24 +138,24 @@ defmodule Diffo.Test.AssignerTest do
138138
end
139139

140140
test "specific assignment rejects duplicate request" do
141-
{:ok, assignee} = Domain.build_shelf()
141+
{:ok, assignee} = Servo.build_shelf()
142142

143-
{:ok, card} = Domain.build_card(%{})
143+
{:ok, card} = Servo.build_card(%{})
144144

145145
updates = [
146146
card: [family: :ISAM, model: "EBLT48", technology: :adsl2Plus],
147147
ports: [first: 1, last: 48, free: 48, type: "ADSL2+"]
148148
]
149149

150-
{:ok, card} = Domain.define_card(card, %{characteristic_value_updates: updates})
150+
{:ok, card} = Servo.define_card(card, %{characteristic_value_updates: updates})
151151

152152
{:ok, card} =
153-
Domain.assign_port(card, %{
153+
Servo.assign_port(card, %{
154154
assignment: %Assignment{id: 5, assignee_id: assignee.id, operation: :assign}
155155
})
156156

157157
{:error, _error} =
158-
Domain.assign_port(card, %{
158+
Servo.assign_port(card, %{
159159
assignment: %Assignment{id: 5, assignee_id: assignee.id, operation: :assign}
160160
})
161161

@@ -168,19 +168,19 @@ defmodule Diffo.Test.AssignerTest do
168168
end
169169

170170
test "unassign an auto-assigned port from a resource" do
171-
{:ok, assignee} = Domain.build_shelf()
171+
{:ok, assignee} = Servo.build_shelf()
172172

173-
{:ok, card} = Domain.build_card(%{})
173+
{:ok, card} = Servo.build_card(%{})
174174

175175
updates = [
176176
card: [family: :ISAM, model: "EBLT48", technology: :adsl2Plus],
177177
ports: [first: 1, last: 48, free: 48, type: "ADSL2+"]
178178
]
179179

180-
{:ok, card} = Domain.define_card(card, %{characteristic_value_updates: updates})
180+
{:ok, card} = Servo.define_card(card, %{characteristic_value_updates: updates})
181181

182182
{:ok, card} =
183-
Domain.assign_port(card, %{
183+
Servo.assign_port(card, %{
184184
assignment: %Assignment{assignee_id: assignee.id, operation: :auto_assign}
185185
})
186186

@@ -193,7 +193,7 @@ defmodule Diffo.Test.AssignerTest do
193193
|> Map.get(:value)
194194

195195
{:ok, card} =
196-
Domain.assign_port(card, %{
196+
Servo.assign_port(card, %{
197197
assignment: %Assignment{
198198
id: assigned_port,
199199
assignee_id: assignee.id,

test/provider/instance_test.exs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ defmodule Diffo.Provider.InstanceTest do
1212
end
1313

1414
setup do
15-
on_exit(fn ->
15+
on_exit(fn ->
1616
AshNeo4j.Neo4jHelper.delete_all()
1717
end)
1818
end
@@ -80,6 +80,10 @@ defmodule Diffo.Provider.InstanceTest do
8080
refute instance.service_operating_status
8181
assert instance.specification.id == specification.id
8282
assert instance.href == "serviceInventoryManagement/v4/service/fibreAccess/#{instance.id}"
83+
84+
# both specification and instance nodes are labelled :Provider
85+
{:ok, response} = AshNeo4j.Neo4jHelper.read_nodes(:Provider)
86+
assert length(response.results) == 2
8387
end
8488

8589
test "create a service instance with a supplied id - success" do

test/provider/specification_test.exs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,6 @@ defmodule Diffo.Provider.SpecificationTest do
247247
assert is_struct(error, Ash.Error.Invalid)
248248
end
249249

250-
@tag debug: true
251250
test "delete specification - failure, related instance" do
252251
specification = Diffo.Provider.create_specification!(%{name: "bdslAccess"})
253252
instance = Diffo.Provider.create_instance!(%{specified_by: specification.id})

test/support/resource/card.ex

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ defmodule Diffo.Test.Card do
1515
alias Diffo.Provider.Assigner
1616
alias Diffo.Provider.Assignment
1717
alias Diffo.Provider.AssignableValue
18-
alias Diffo.Test.Domain
18+
alias Diffo.Test.Servo
1919
alias Diffo.Test.CardValue
2020

2121
use Ash.Resource,
2222
fragments: [BaseInstance],
23-
domain: Domain
23+
domain: Servo
2424

2525
resource do
2626
description "An Ash Resource representing a Card"
@@ -58,7 +58,7 @@ defmodule Diffo.Test.Card do
5858
end)
5959

6060
change after_action(fn changeset, result, _context ->
61-
ActionHelper.build_after(changeset, result, Domain, :get_card_by_id)
61+
ActionHelper.build_after(changeset, result, Servo, :get_card_by_id)
6262
end)
6363

6464
change load [:href]
@@ -71,7 +71,7 @@ defmodule Diffo.Test.Card do
7171

7272
change after_action(fn changeset, result, _context ->
7373
with {:ok, result} <- Characteristic.update_values(result, changeset),
74-
{:ok, result} <- Domain.get_card_by_id(result.id),
74+
{:ok, result} <- Servo.get_card_by_id(result.id),
7575
do: {:ok, result}
7676
end)
7777
end
@@ -82,7 +82,7 @@ defmodule Diffo.Test.Card do
8282

8383
change after_action(fn changeset, result, _context ->
8484
with {:ok, result} <- Relationship.relate_instance(result, changeset),
85-
{:ok, result} <- Domain.get_card_by_id(result.id),
85+
{:ok, result} <- Servo.get_card_by_id(result.id),
8686
do: {:ok, result}
8787
end)
8888
end
@@ -93,7 +93,7 @@ defmodule Diffo.Test.Card do
9393

9494
change after_action(fn changeset, result, _context ->
9595
with {:ok, result} <- Assigner.assign(result, changeset, :ports, :port),
96-
{:ok, result} <- Domain.get_card_by_id(result.id),
96+
{:ok, result} <- Servo.get_card_by_id(result.id),
9797
do: {:ok, result}
9898
end)
9999
end

test/support/resource/shelf.ex

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ defmodule Diffo.Test.Shelf do
1717
alias Diffo.Provider.Assignment
1818
alias Diffo.Provider.AssignableValue
1919

20-
alias Diffo.Test.Domain
20+
alias Diffo.Test.Servo
2121
alias Diffo.Test.ShelfValue
2222

2323
use Ash.Resource,
2424
fragments: [BaseInstance],
25-
domain: Domain
25+
domain: Servo
2626

2727
resource do
2828
description "An Ash Resource representing a Shelf"
@@ -60,7 +60,7 @@ defmodule Diffo.Test.Shelf do
6060
end)
6161

6262
change after_action(fn changeset, result, _context ->
63-
ActionHelper.build_after(changeset, result, Domain, :get_shelf_by_id)
63+
ActionHelper.build_after(changeset, result, Servo, :get_shelf_by_id)
6464
end)
6565

6666
change load [:href]
@@ -73,7 +73,7 @@ defmodule Diffo.Test.Shelf do
7373

7474
change after_action(fn changeset, result, _context ->
7575
with {:ok, result} <- Characteristic.update_values(result, changeset),
76-
{:ok, result} <- Domain.get_shelf_by_id(result.id),
76+
{:ok, result} <- Servo.get_shelf_by_id(result.id),
7777
do: {:ok, result}
7878
end)
7979
end
@@ -84,7 +84,7 @@ defmodule Diffo.Test.Shelf do
8484

8585
change after_action(fn changeset, result, _context ->
8686
with {:ok, result} <- Relationship.relate_instance(result, changeset),
87-
{:ok, result} <- Domain.get_shelf_by_id(result.id),
87+
{:ok, result} <- Servo.get_shelf_by_id(result.id),
8888
do: {:ok, result}
8989
end)
9090
end
@@ -95,7 +95,7 @@ defmodule Diffo.Test.Shelf do
9595

9696
change after_action(fn changeset, result, _context ->
9797
with {:ok, result} <- Assigner.assign(result, changeset, :slots, :slot),
98-
{:ok, result} <- Domain.get_shelf_by_id(result.id),
98+
{:ok, result} <- Servo.get_shelf_by_id(result.id),
9999
do: {:ok, result}
100100
end)
101101
end
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
#
33
# SPDX-License-Identifier: MIT
44

5-
defmodule Diffo.Test.Domain do
5+
defmodule Diffo.Test.Servo do
66
@moduledoc """
77
Diffo - TMF Service and Resource Management with a difference
88
9-
Domain - domain for testing
9+
Servo - a service and resource management domain
1010
"""
1111
use Ash.Domain,
1212
otp_app: :diffo,
@@ -16,7 +16,7 @@ defmodule Diffo.Test.Domain do
1616
alias Diffo.Test.Card
1717

1818
domain do
19-
description "A domain for testing"
19+
description "service and resource management"
2020
end
2121

2222
resources do

0 commit comments

Comments
 (0)