1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.jboss.hal.testsuite.test.configuration.interfce;
17
18 import org.jboss.arquillian.core.api.annotation.Inject;
19 import org.jboss.arquillian.graphene.page.Page;
20 import org.jboss.hal.testsuite.Console;
21 import org.jboss.hal.testsuite.CrudOperations;
22 import org.jboss.hal.testsuite.container.WildFlyContainer;
23 import org.jboss.hal.testsuite.fragment.FormFragment;
24 import org.jboss.hal.testsuite.fragment.HeaderBreadcrumbFragment;
25 import org.jboss.hal.testsuite.page.configuration.InterfacePage;
26 import org.jboss.hal.testsuite.test.Manatoko;
27 import org.junit.jupiter.api.BeforeAll;
28 import org.junit.jupiter.api.BeforeEach;
29 import org.junit.jupiter.api.Test;
30 import org.testcontainers.junit.jupiter.Container;
31 import org.testcontainers.junit.jupiter.Testcontainers;
32 import org.wildfly.extras.creaper.core.online.OnlineManagementClient;
33 import org.wildfly.extras.creaper.core.online.operations.Operations;
34 import org.wildfly.extras.creaper.core.online.operations.Values;
35
36 import static org.jboss.hal.dmr.ModelDescriptionConstants.INET_ADDRESS;
37 import static org.jboss.hal.dmr.ModelDescriptionConstants.NAME;
38 import static org.jboss.hal.testsuite.container.WildFlyConfiguration.DEFAULT;
39 import static org.jboss.hal.testsuite.fixtures.InterfaceFixtures.LOCALHOST;
40 import static org.jboss.hal.testsuite.fixtures.InterfaceFixtures.UPDATE;
41 import static org.jboss.hal.testsuite.fixtures.InterfaceFixtures.interfaceAddress;
42 import static org.junit.jupiter.api.Assertions.assertEquals;
43
44 @Manatoko
45 @Testcontainers
46 class InterfaceApplicationTest {
47
48 @Container static WildFlyContainer wildFly = WildFlyContainer.standalone(DEFAULT);
49
50 @BeforeAll
51 static void setupModel() throws Exception {
52 OnlineManagementClient client = wildFly.managementClient();
53 Operations operations = new Operations(client);
54 operations.add(interfaceAddress(UPDATE), Values.empty().and(INET_ADDRESS, LOCALHOST));
55 }
56
57 @Inject Console console;
58 @Inject CrudOperations crud;
59 @Page InterfacePage page;
60 FormFragment form;
61
62 @BeforeEach
63 void prepare() {
64 page.navigate(NAME, UPDATE);
65 form = page.getForm();
66 }
67
68 @Test
69 void read() {
70 assertEquals(HeaderBreadcrumbFragment.abbreviate(UPDATE), console.header().breadcrumb().lastValue());
71 assertEquals(UPDATE, form.value(NAME));
72 }
73
74 @Test
75 void update() throws Exception {
76 crud.update(interfaceAddress(UPDATE), form, INET_ADDRESS, "127.0.0.2");
77 }
78 }