cloudstack/test/src-not-used/main/java/com/cloud/test/ui/AddAndDeleteAISO.java
João Jandre 49cecaed06
Normalize loggers and upgrade log4j 1.2 to log4j 2.19 (#7131)
* Normalize logs

All classes that could have their loggers inherited from their fathers had their own loggers deleted;
Most loggers didn't have to be static, so most of them were normalized so that they wouldn't be;
All loggers are protected now;
Static logger's name are now 'LOGGER';
Non-static logger's name are now 'logger';
New class DbUpgradeAbstractImpl created so that all Upgraders extend it and inherit its logger

* Upgrade log4j

* fix errors caused by the merge

* Refactor cglibThrowableRenderer functionality to log4j2 and upgrade the last configuration files

* fix sonarcloud bug

* Fix errors caused by merge, remove some unused loggers, and rename a variable that was mistakenly renamed on the normalization commit

* Readd snmpTrapAppender, remove TestAppender

* Regenerate changes

* regenerate changes

* refactor last custom appender

* fix systemvm configuration xml

* Regenerate changes

* Regenerate changes

* regenerate changes

* Regenerate changes

* regenerate changes

* regenerate changes

* regenerate changes

* Fix utils pom

* fix some tests

* regenerate changes

* Fix jar being printed on exception

* fix logging in system VMs, fix commands not having log4j2 classpath.

* regenerate changes

* Fix some unwanted renomeations

* fix end of file

* regenerate changes

* regenerate changes

* fix merge error

* regenerate changes

* fix tests

* regenerate changes

* regenerate changes

* regenerate changes

* regenerate changes

* regenerate changes

* regenerate changes

* regenerate changes

* readd reload4j to tungsten as juniper depends on it

* Regenerate changes

* regenerate changes

* regenerate changes

* regenerate changes

* regenerate changes

* re-add reload4j dependency to network-contrail, as juniper depends on it

* regenerate changes

* regenerate changes

* regenerate changes

* fix typo

* regenerate changes

* regenerate changes

* Fix end of files

* regenerate changes

* add logj42 to cloud-utils-SHADED.jar

* regenerate changes

* regenerate changes

* regenerate changes

* regenerate changes

* regenerate changes

* regenerate changes

* regenerate changes

* regenerate changes

* Regenerate changes

* Regenerate changes

* Regenerate changes

* regenerate changes

* Regenerate changes

* regenerate changes

* Regenerate changes

* Regenerate changes

* Regenerate changes

* regenerate changes

* Regenerate changes

* Regenerate changes

* fix some tests

* Regenerate changes

* Regenerate changes

* fix test

* Regenerate changes

* Regenerate changes
2024-02-08 09:55:41 -03:00

128 lines
5.0 KiB
Java

// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you 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
//
// http://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 com.cloud.test.ui;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import org.junit.Test;
import com.thoughtworks.selenium.SeleniumException;
public class AddAndDeleteAISO extends AbstractSeleniumTestCase {
@Test
public void testAddAndDeleteISO() throws Exception {
try {
selenium.open("/client/");
selenium.type("account_username", "admin");
selenium.type("account_password", "password");
selenium.click("loginbutton");
Thread.sleep(3000);
assertTrue(selenium.isTextPresent("admin"));
selenium.click("//div[@id='leftmenu_templates']/div");
selenium.click("//div[@id='leftmenu_submenu_my_iso']/div/div[2]");
Thread.sleep(3000);
selenium.click("label");
selenium.type("add_iso_name", "abc");
selenium.type("add_iso_display_text", "abc");
String iso_url = System.getProperty("add_iso_url", "http://10.91.28.6/ISO/Fedora-11-i386-DVD.iso");
selenium.type("add_iso_url", iso_url);
String iso_zone = System.getProperty("add_iso_zone", "All Zones");
selenium.select("add_iso_zone", "label=" + iso_zone);
String iso_os_type = System.getProperty("add_iso_os_type", "Fedora 11");
selenium.select("add_iso_os_type", "label=" + iso_os_type);
selenium.click("//div[28]/div[11]/button[1]");
Thread.sleep(3000);
int i = 1;
try {
for (;; i++) {
System.out.println("i= " + i);
selenium.click("//div[" + i + "]/div/div[2]/span/span");
}
} catch (Exception ex) {
logger.info("[ignored]"
+ "error during clicking test on iso: " + e.getLocalizedMessage());
}
for (int second = 0;; second++) {
if (second >= 60)
fail("timeout");
try {
if (selenium.isVisible("//div[@id='after_action_info_container_on_top']"))
break;
} catch (Exception e) {
logger.info("[ignored]"
+ "error during visibility test of iso: " + e.getLocalizedMessage());
}
Thread.sleep(10000);
}
assertTrue(selenium.isTextPresent("Adding succeeded"));
Thread.sleep(3000);
int status = 1;
while (!selenium.isTextPresent("Ready")) {
for (int j = 1; j <= i; j++)
{
if (selenium.isTextPresent("Ready")) {
status = 0;
break;
}
selenium.click("//div[" + j + "]/div/div[2]/span/span");
}
if (status == 0) {
break;
} else {
selenium.click("//div[@id='leftmenu_submenu_featured_iso']/div/div[2]");
Thread.sleep(3000);
selenium.click("//div[@id='leftmenu_submenu_my_iso']/div/div[2]");
Thread.sleep(3000);
}
}
selenium.click("link=Delete ISO");
selenium.click("//div[28]/div[11]/button[1]");
for (int second = 0;; second++) {
if (second >= 60)
fail("timeout");
try {
if (selenium.isVisible("after_action_info_container_on_top"))
break;
} catch (Exception e) {
logger.info("[ignored]"
+ "error checking visibility after test completion for iso: " + e.getLocalizedMessage());
}
Thread.sleep(1000);
}
assertTrue(selenium.isTextPresent("Delete ISO action succeeded"));
selenium.click("main_logout");
selenium.waitForPageToLoad("30000");
assertTrue(selenium.isTextPresent("Welcome to Management Console"));
} catch (SeleniumException ex) {
System.err.println(ex.getMessage());
fail(ex.getMessage());
throw ex;
}
}
}