Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add EAP and Wildfly to allowed types for MW topology #2724

Merged
merged 2 commits into from
Dec 4, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion app/services/middleware_topology_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,19 @@ class MiddlewareTopologyService < TopologyService
]
]

@kinds = %i(MiddlewareDeployment MiddlewareDatasource MiddlewareDomain MiddlewareManager Vm Container MiddlewareServer MiddlewareServerGroup MiddlewareMessaging)
@kinds = %i(
MiddlewareDeployment
MiddlewareDatasource
MiddlewareDomain
MiddlewareManager
Vm
Container
MiddlewareServer
MiddlewareServerEap
MiddlewareServerWildfly
MiddlewareServerGroup
MiddlewareMessaging
)

def build_topology
topology = super
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,28 @@ describe('middlewareTopologyController', function () {
}
};

var mw_server_wildfly = {
id: "MiddlewareServerWildfly1", item: {
"name": "Local DMR",
"kind": "MiddlewareServerWildfly",
"miq_id": 1,
"status": "Running",
"display_kind": "MiddlewareServerWildfly",
"icon": "vendor-wildfly"
}
};

var mw_server_eap = {
id: "MiddlewareServerEap1", item: {
"name": "Local DMR",
"kind": "MiddlewareServerEap",
"miq_id": 1,
"status": "Running",
"display_kind": "MiddlewareServerEap",
"icon": "vendor-jboss-eap"
}
};

var mw_server_starting = {
id: "MiddlewareServer1", item: {
"status": "Starting"
Expand Down Expand Up @@ -162,9 +184,11 @@ describe('middlewareTopologyController', function () {

describe('kinds contains all expected mw kinds', function () {
it('in all main objects', function () {
expect(Object.keys(scope.kinds).length).toBe(8);
expect(Object.keys(scope.kinds).length).toBe(10);
expect(ctrl.kinds["MiddlewareManager"]).toBeDefined();
expect(ctrl.kinds["MiddlewareServer"]).toBeDefined();
expect(ctrl.kinds["MiddlewareServerEap"]).toBeDefined();
expect(ctrl.kinds["MiddlewareServerWildfly"]).toBeDefined();
expect(ctrl.kinds["MiddlewareDeployment"]).toBeDefined();
expect(ctrl.kinds["MiddlewareDatasource"]).toBeDefined();
expect(ctrl.kinds["Vm"]).toBeDefined();
Expand All @@ -179,6 +203,8 @@ describe('middlewareTopologyController', function () {
it('in graph elements', function () {
expect(ctrl.getIcon(mw_manager).icon).toContain("vendor-hawkular");
expect(ctrl.getIcon(mw_server).icon).toContain("vendor-wildfly");
expect(ctrl.getIcon(mw_server_wildfly).icon).toContain("vendor-wildfly");
expect(ctrl.getIcon(mw_server_eap).icon).toContain("vendor-jboss-eap");
expect(ctrl.getIcon(mw_deployment).fontfamily).toEqual("font-fabulous");
expect(ctrl.getIcon(mw_datasource).fontfamily).toEqual("FontAwesome");
expect(ctrl.getIcon(vm).fontfamily).toEqual("PatternFlyIcons-webfont");
Expand All @@ -192,6 +218,8 @@ describe('middlewareTopologyController', function () {
it('for all objects', function () {
expect(ctrl.getCircleDimensions(mw_manager)).toEqual({x: -20, y: -20, height: 40, width: 40, r: 28});
expect(ctrl.getCircleDimensions(mw_server)).toEqual({x: -12, y: -12, height: 23, width: 23, r: 19});
expect(ctrl.getCircleDimensions(mw_server_eap)).toEqual({x: -9, y: -9, height: 18, width: 18, r: 17});
expect(ctrl.getCircleDimensions(mw_server_wildfly)).toEqual({x: -9, y: -9, height: 18, width: 18, r: 17});
expect(ctrl.getCircleDimensions(mw_deployment)).toEqual({x: -9, y: -9, height: 18, width: 18, r: 17});
expect(ctrl.getCircleDimensions(mw_datasource)).toEqual({x: -9, y: -9, height: 18, width: 18, r: 17});
expect(ctrl.getCircleDimensions(vm)).toEqual({ x: 0, y: 9, height: 40, width: 40, r: 21 });
Expand All @@ -205,6 +233,8 @@ describe('middlewareTopologyController', function () {
it('for all objects', function () {
expect(ctrl.getIcon(mw_manager).type).toEqual("image");
expect(ctrl.getIcon(mw_server).type).toEqual("image");
expect(ctrl.getIcon(mw_server_wildfly).type).toEqual("image");
expect(ctrl.getIcon(mw_server_eap).type).toEqual("image");
expect(ctrl.getIcon(mw_deployment).type).toEqual("glyph");
expect(ctrl.getIcon(mw_datasource).type).toEqual("glyph");
expect(ctrl.getIcon(vm).type).toEqual("glyph");
Expand All @@ -222,6 +252,8 @@ describe('middlewareTopologyController', function () {
});
it('for servers', function() {
expect(topologyService.getItemStatusClass(mw_server)).toEqual('success');
expect(topologyService.getItemStatusClass(mw_server_wildfly)).toEqual('success');
expect(topologyService.getItemStatusClass(mw_server_eap)).toEqual('success');
expect(topologyService.getItemStatusClass(mw_server_down)).toEqual('error');
expect(topologyService.getItemStatusClass(mw_server_starting)).toEqual('information');
expect(topologyService.getItemStatusClass(mw_server_reload)).toEqual('warning');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,22 @@
"display_kind": "MiddlewareServer",
"icon": "vendor-wildfly"
},
"MiddlewareServerWildfly1": {
"name": "Local DMR",
"kind": "MiddlewareServerWildfly",
"miq_id": 1,
"status": "Unknown",
"display_kind": "MiddlewareServerWildfly",
"icon": "vendor-wildfly"
},
"MiddlewareServerEap1": {
"name": "Local DMR",
"kind": "MiddlewareServerEap",
"miq_id": 1,
"status": "Unknown",
"display_kind": "MiddlewareServerEap",
"icon": "vendor-jboss-eap"
},
"MiddlewareDeployment1": {
"name": "hawkular-command-gateway-war.war",
"kind": "MiddlewareDeployment",
Expand Down Expand Up @@ -79,6 +95,14 @@
"source": "MiddlewareManager1",
"target": "MiddlewareServer1"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this link still relevant in the current architecture with eap/wildfly? I mean will we get it on real env? Won't we get only wildfly/eap objects in the json, no?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well I am not against removing these, however we still use MiddlewareServer for Hawkular server. So Whenever I spin hawkular standalone the server inside it will be of type MiddlewareServer. I tested this with hawkinit and it was still present.
However if you'd were to run hawkular provider on wildfly/eap solely by installing some packages and such (kinda hard to do) it will be of type wildfly/eap.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, as long as it appears then it should be present. the point here is to make sure this reflects a real env.

},
{
"source": "MiddlewareManager1",
"target": "MiddlewareServerEap1"
},
{
"source": "MiddlewareManager1",
"target": "MiddlewareServerWildfly1"
},
{
"source": "MiddlewareServer1",
"target": "MiddlewareDeployment1"
Expand Down Expand Up @@ -119,6 +143,8 @@
"MiddlewareManager": true,
"Vm": true,
"MiddlewareServer": true,
"MiddlewareServerEap": true,
"MiddlewareServerWildfly": true,
"MiddlewareServerGroup": true,
"MiddlewareMessaging": true
},
Expand Down
85 changes: 74 additions & 11 deletions spec/services/middleware_topology_service_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
let(:long_id_5) { "Local~/deployment=hawkular-command-gateway-war.war" }
let(:long_id_6) { "Local~/subsystem=datasources/data-source=ExampleDS" }
let(:long_id_7) { "Local~/subsystem=messaging-activemq/server=default/jms-topic=HawkularMetricData" }
let(:long_id_8) { "/t;28026b36-8fe4-4332-84c8-524e173a68bf/f;fabf8d822986/r;Local%20DMR~~" }
let(:long_id_9) { "/t;28026b36-8fe4-4332-84c8-524e173a68bf/f;unused-4-252.brq.redhat.com/r;Local%20DMR~~" }

describe "#build_topology" do
subject { middleware_topology_service.build_topology }
Expand All @@ -23,6 +25,27 @@
:properties => { 'Calculated Server State' => 'running' })
end

let!(:mw_server_wildfly) do
FactoryGirl.create(:hawkular_middleware_server_wildfly,
:name => 'Local DMR',
:feed => 'fabf8d822986',
:ems_ref => long_id_0,
:nativeid => 'Local DMR~~',
:ext_management_system => ems_hawkular,
:properties => { 'Calculated Server State' => 'running' })
end

let!(:mw_server_eap) do
FactoryGirl.create(:hawkular_middleware_server_eap,
:name => 'Local DMR',
:feed => 'unused-4-252.brq.redhat.com',
:ems_ref => long_id_0,
:nativeid => 'Local DMR~~',
:ext_management_system => ems_hawkular,
:product => 'EAP',
:properties => { 'Calculated Server State' => 'running', 'product' => 'EAP' })
end

before do
allow(middleware_topology_service).to receive(:retrieve_providers).and_return([ems_hawkular])
end
Expand Down Expand Up @@ -76,6 +99,28 @@
:key => "MiddlewareServer" + mw_server.compressed_id.to_s}
)

expect(subject[:items]).to include(
"MiddlewareServerEap" + mw_server_eap.compressed_id.to_s => {:name => mw_server_eap.name,
:status => "Running",
:kind => "MiddlewareServerEap",
:display_kind => "MiddlewareServerEap",
:miq_id => mw_server_eap.id,
:icon => match(/vendor-jboss-eap/),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this the same as above?
https://github.com/ManageIQ/manageiq-ui-classic/pull/2724/files#diff-f32f59cd3f168fe8e6bb029d5b543f20R34
here it's vendor-jboss-eap and there it's just vendor-eap

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, you are correct!

:model => mw_server_eap.class.name,
:key => "MiddlewareServerEap" + mw_server_eap.compressed_id.to_s}
)

expect(subject[:items]).to include(
"MiddlewareServerWildfly" + mw_server_wildfly.compressed_id.to_s => {:name => mw_server_wildfly.name,
:status => "Running",
:kind => "MiddlewareServerWildfly",
:display_kind => "MiddlewareServerWildfly",
:miq_id => mw_server_wildfly.id,
:icon => match(/vendor-wildfly/),
:model => mw_server_wildfly.class.name,
:key => "MiddlewareServerWildfly" + mw_server_wildfly.compressed_id.to_s}
)

expect(subject[:items]).to include(
"MiddlewareDeployment" + mw_deployment1.compressed_id.to_s => {:name => mw_deployment1.name,
:status => "Enabled",
Expand Down Expand Up @@ -116,18 +161,36 @@
:key => "MiddlewareMessaging" + mw_messaging.compressed_id.to_s}
)

expect(subject[:relations].size).to eq(5)
expect(subject[:relations].size).to eq(7)
expect(subject[:relations]).to include(
{:source => "MiddlewareManager" + ems_hawkular.compressed_id.to_s,
:target => "MiddlewareServer" + mw_server.compressed_id.to_s},
{:source => "MiddlewareServer" + mw_server.compressed_id.to_s,
:target => "MiddlewareDeployment" + mw_deployment1.compressed_id.to_s},
{:source => "MiddlewareServer" + mw_server.compressed_id.to_s,
:target => "MiddlewareDeployment" + mw_deployment2.compressed_id.to_s},
{:source => "MiddlewareServer" + mw_server.compressed_id.to_s,
:target => "MiddlewareDatasource" + mw_datasource.compressed_id.to_s},
{:source => "MiddlewareServer" + mw_server.compressed_id.to_s,
:target => "MiddlewareMessaging" + mw_messaging.compressed_id.to_s}
{
:source => "MiddlewareManager" + ems_hawkular.compressed_id.to_s,
:target => "MiddlewareServer" + mw_server.compressed_id.to_s
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is not relevant atm, we'll get only eap/wildfly types

},
{
:source => "MiddlewareManager" + ems_hawkular.compressed_id.to_s,
:target => "MiddlewareServerEap" + mw_server_eap.compressed_id.to_s
},
{
:source => "MiddlewareManager" + ems_hawkular.compressed_id.to_s,
:target => "MiddlewareServerWildfly" + mw_server_wildfly.compressed_id.to_s
},
{
:source => "MiddlewareServer" + mw_server.compressed_id.to_s,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

like above, I think all MiddlewareServer is not going to appear anymore, unless I got it wrong

:target => "MiddlewareDeployment" + mw_deployment1.compressed_id.to_s
},
{
:source => "MiddlewareServer" + mw_server.compressed_id.to_s,
:target => "MiddlewareDeployment" + mw_deployment2.compressed_id.to_s
},
{
:source => "MiddlewareServer" + mw_server.compressed_id.to_s,
:target => "MiddlewareDatasource" + mw_datasource.compressed_id.to_s
},
{
:source => "MiddlewareServer" + mw_server.compressed_id.to_s,
:target => "MiddlewareMessaging" + mw_messaging.compressed_id.to_s
}
)
end

Expand Down