Skip to content

Commit

Permalink
Merge pull request #121 from hpehl/HAL-1891
Browse files Browse the repository at this point in the history
HAL-1891: Fix JGroups tests
  • Loading branch information
hpehl authored Sep 19, 2023
2 parents 0b8c173 + 2ca4c44 commit 3e0ea5e
Show file tree
Hide file tree
Showing 4 changed files with 191 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public final class JGroupsFixtures {
public static final String TCP = "tcp";
public static final String JGROUPS_TCP = "jgroups-tcp";
public static final String CLUSTER = "cluster";
public static final String RELAY2 = "relay.RELAY2";
public static final String SITE = "site";
public static final String KEEPALIVE_TIME = "keepalive-time";
public static final String REMOTE_SITE = "remote-site";
Expand All @@ -54,7 +55,7 @@ public static Address stackAddress(String name) {
// ------------------------------------------------------ stack / relay

public static Address relayAddress(String stack) {
return stackAddress(stack).and(RELAY, RELAY.toUpperCase());
return stackAddress(stack).and(RELAY, RELAY2);
}

// ------------------------------------------------------ stack / remote site
Expand Down Expand Up @@ -113,7 +114,7 @@ public static Address forkAddress(String channel, String name) {
// protocol names are specific to jgroups domain
public static final String FORK_PROTOCOL_CREATE = "COUNTER";
public static final String FORK_PROTOCOL_UPDATE = "CENTRAL_LOCK";
public static final String FORK_PROTOCOL_DELETE = "S3_PING";
public static final String FORK_PROTOCOL_DELETE = "TCP";

public static Address forkProtocolAddress(String channel, String fork, String protocol) {
return forkAddress(channel, fork).and(PROTOCOL, protocol);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
/*
* Copyright 2022 Red Hat
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jboss.hal.testsuite.test.configuration.jgroups;

import org.jboss.arquillian.core.api.annotation.Inject;
import org.jboss.arquillian.graphene.page.Page;
import org.jboss.hal.resources.Names;
import org.jboss.hal.testsuite.Console;
import org.jboss.hal.testsuite.CrudOperations;
import org.jboss.hal.testsuite.container.WildFlyContainer;
import org.jboss.hal.testsuite.fragment.FormFragment;
import org.jboss.hal.testsuite.fragment.TableFragment;
import org.jboss.hal.testsuite.page.configuration.JGroupsPage;
import org.jboss.hal.testsuite.test.Manatoko;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.testcontainers.junit.jupiter.Container;
import org.testcontainers.junit.jupiter.Testcontainers;
import org.wildfly.extras.creaper.core.online.OnlineManagementClient;
import org.wildfly.extras.creaper.core.online.operations.Operations;
import org.wildfly.extras.creaper.core.online.operations.Values;

import static org.jboss.arquillian.graphene.Graphene.waitGui;
import static org.jboss.hal.dmr.ModelDescriptionConstants.STACK;
import static org.jboss.hal.testsuite.container.WildFlyConfiguration.HA;
import static org.jboss.hal.testsuite.fixtures.JGroupsFixtures.CHANNEL_CREATE;
import static org.jboss.hal.testsuite.fixtures.JGroupsFixtures.FORK_CREATE;
import static org.jboss.hal.testsuite.fixtures.JGroupsFixtures.FORK_PROTOCOL_CREATE;
import static org.jboss.hal.testsuite.fixtures.JGroupsFixtures.TCP;
import static org.jboss.hal.testsuite.fixtures.JGroupsFixtures.channelAddress;
import static org.jboss.hal.testsuite.fixtures.JGroupsFixtures.forkAddress;
import static org.jboss.hal.testsuite.fixtures.JGroupsFixtures.forkProtocolAddress;

@Manatoko
@Testcontainers
class ChannelForkProtocolCreateTest {

@Container static WildFlyContainer wildFly = WildFlyContainer.standalone(HA);

@BeforeAll
static void setupModel() throws Exception {
OnlineManagementClient client = wildFly.managementClient();
Operations operations = new Operations(client);
operations.add(channelAddress(CHANNEL_CREATE), Values.of(STACK, TCP));
operations.add(forkAddress(CHANNEL_CREATE, FORK_CREATE));
}

@Inject Console console;
@Inject CrudOperations crud;
@Page JGroupsPage page;
TableFragment channelTable;
TableFragment forkTable;
TableFragment forkProtocolTable;
FormFragment forkProtocolForm;

@BeforeEach
void setUp() {
page.navigate();
console.verticalNavigation().selectPrimary("jgroups-channel-item");

channelTable = page.getChannelTable();
forkTable = page.getChannelForkTable();
forkProtocolTable = page.getForkProtocolTable();
forkProtocolForm = page.getForkProtocolForm();
}

@Test
void create() throws Exception {
channelTable.action(CHANNEL_CREATE, Names.FORK);
waitGui().until().element(forkTable.getRoot()).is().visible();

forkTable.select(FORK_CREATE);
forkTable.action(FORK_CREATE, Names.PROTOCOL);
waitGui().until().element(forkProtocolTable.getRoot()).is().visible();

crud.create(forkProtocolAddress(CHANNEL_CREATE, FORK_CREATE, FORK_PROTOCOL_CREATE), forkProtocolTable,
FORK_PROTOCOL_CREATE);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@
import static org.jboss.hal.testsuite.container.WildFlyConfiguration.HA;
import static org.jboss.hal.testsuite.fixtures.JGroupsFixtures.CHANNEL_CREATE;
import static org.jboss.hal.testsuite.fixtures.JGroupsFixtures.FORK_CREATE;
import static org.jboss.hal.testsuite.fixtures.JGroupsFixtures.FORK_PROTOCOL_CREATE;
import static org.jboss.hal.testsuite.fixtures.JGroupsFixtures.FORK_PROTOCOL_DELETE;
import static org.jboss.hal.testsuite.fixtures.JGroupsFixtures.FORK_PROTOCOL_UPDATE;
import static org.jboss.hal.testsuite.fixtures.JGroupsFixtures.TCP;
import static org.jboss.hal.testsuite.fixtures.JGroupsFixtures.channelAddress;
Expand All @@ -51,7 +49,7 @@

@Manatoko
@Testcontainers
class ChannelForkProtocolTest {
class ChannelForkProtocolEditTest {

@Container static WildFlyContainer wildFly = WildFlyContainer.standalone(HA);

Expand All @@ -62,7 +60,6 @@ static void setupModel() throws Exception {
operations.add(channelAddress(CHANNEL_CREATE), Values.of(STACK, TCP));
operations.add(forkAddress(CHANNEL_CREATE, FORK_CREATE));
operations.add(forkProtocolAddress(CHANNEL_CREATE, FORK_CREATE, FORK_PROTOCOL_UPDATE));
operations.add(forkProtocolAddress(CHANNEL_CREATE, FORK_CREATE, FORK_PROTOCOL_DELETE));
}

@Inject Console console;
Expand All @@ -84,19 +81,6 @@ void setUp() {
forkProtocolForm = page.getForkProtocolForm();
}

@Test
void create() throws Exception {
channelTable.action(CHANNEL_CREATE, Names.FORK);
waitGui().until().element(forkTable.getRoot()).is().visible();

forkTable.select(FORK_CREATE);
forkTable.action(FORK_CREATE, Names.PROTOCOL);
waitGui().until().element(forkProtocolTable.getRoot()).is().visible();

crud.create(forkProtocolAddress(CHANNEL_CREATE, FORK_CREATE, FORK_PROTOCOL_CREATE), forkProtocolTable,
FORK_PROTOCOL_CREATE);
}

@Test
void update() throws Exception {
channelTable.action(CHANNEL_CREATE, Names.FORK);
Expand All @@ -110,17 +94,4 @@ void update() throws Exception {
crud.update(forkProtocolAddress(CHANNEL_CREATE, FORK_CREATE, FORK_PROTOCOL_UPDATE), forkProtocolForm,
PROPERTIES, Random.properties());
}

@Test
void remove() throws Exception {
channelTable.action(CHANNEL_CREATE, Names.FORK);
waitGui().until().element(forkTable.getRoot()).is().visible();

forkTable.select(FORK_CREATE);
forkTable.action(FORK_CREATE, Names.PROTOCOL);
waitGui().until().element(forkProtocolTable.getRoot()).is().visible();

crud.delete(forkProtocolAddress(CHANNEL_CREATE, FORK_CREATE, FORK_PROTOCOL_DELETE), forkProtocolTable,
FORK_PROTOCOL_DELETE);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
/*
* Copyright 2022 Red Hat
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jboss.hal.testsuite.test.configuration.jgroups;

import org.jboss.arquillian.core.api.annotation.Inject;
import org.jboss.arquillian.graphene.page.Page;
import org.jboss.hal.resources.Names;
import org.jboss.hal.testsuite.Console;
import org.jboss.hal.testsuite.CrudOperations;
import org.jboss.hal.testsuite.container.WildFlyContainer;
import org.jboss.hal.testsuite.fragment.FormFragment;
import org.jboss.hal.testsuite.fragment.TableFragment;
import org.jboss.hal.testsuite.page.configuration.JGroupsPage;
import org.jboss.hal.testsuite.test.Manatoko;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.testcontainers.junit.jupiter.Container;
import org.testcontainers.junit.jupiter.Testcontainers;
import org.wildfly.extras.creaper.core.online.OnlineManagementClient;
import org.wildfly.extras.creaper.core.online.operations.Operations;
import org.wildfly.extras.creaper.core.online.operations.Values;

import static org.jboss.arquillian.graphene.Graphene.waitGui;
import static org.jboss.hal.dmr.ModelDescriptionConstants.STACK;
import static org.jboss.hal.testsuite.container.WildFlyConfiguration.HA;
import static org.jboss.hal.testsuite.fixtures.JGroupsFixtures.CHANNEL_CREATE;
import static org.jboss.hal.testsuite.fixtures.JGroupsFixtures.FORK_CREATE;
import static org.jboss.hal.testsuite.fixtures.JGroupsFixtures.FORK_PROTOCOL_DELETE;
import static org.jboss.hal.testsuite.fixtures.JGroupsFixtures.TCP;
import static org.jboss.hal.testsuite.fixtures.JGroupsFixtures.channelAddress;
import static org.jboss.hal.testsuite.fixtures.JGroupsFixtures.forkAddress;
import static org.jboss.hal.testsuite.fixtures.JGroupsFixtures.forkProtocolAddress;

@Manatoko
@Testcontainers
class ChannelForkProtocolRemoveTest {

@Container static WildFlyContainer wildFly = WildFlyContainer.standalone(HA);

@BeforeAll
static void setupModel() throws Exception {
OnlineManagementClient client = wildFly.managementClient();
Operations operations = new Operations(client);
operations.add(channelAddress(CHANNEL_CREATE), Values.of(STACK, TCP));
operations.add(forkAddress(CHANNEL_CREATE, FORK_CREATE));
operations.add(forkProtocolAddress(CHANNEL_CREATE, FORK_CREATE, FORK_PROTOCOL_DELETE));
}

@Inject Console console;
@Inject CrudOperations crud;
@Page JGroupsPage page;
TableFragment channelTable;
TableFragment forkTable;
TableFragment forkProtocolTable;
FormFragment forkProtocolForm;

@BeforeEach
void setUp() {
page.navigate();
console.verticalNavigation().selectPrimary("jgroups-channel-item");

channelTable = page.getChannelTable();
forkTable = page.getChannelForkTable();
forkProtocolTable = page.getForkProtocolTable();
forkProtocolForm = page.getForkProtocolForm();
}

@Test
void remove() throws Exception {
channelTable.action(CHANNEL_CREATE, Names.FORK);
waitGui().until().element(forkTable.getRoot()).is().visible();

forkTable.select(FORK_CREATE);
forkTable.action(FORK_CREATE, Names.PROTOCOL);
waitGui().until().element(forkProtocolTable.getRoot()).is().visible();

crud.delete(forkProtocolAddress(CHANNEL_CREATE, FORK_CREATE, FORK_PROTOCOL_DELETE), forkProtocolTable,
FORK_PROTOCOL_DELETE);
}
}

0 comments on commit 3e0ea5e

Please sign in to comment.