// Path: sonar-plugin-server/src/main/java/jetbrains/buildserver/sonarplugin/manager/projectsettings/XMLBasedSQSInfoHelper.java
// public class XMLBasedSQSInfoHelper {
//     private XMLBasedSQSInfoHelper() {
//     }
// 
//     public static SQSInfo createServerInfo(@Nullable final String id,
//                                            @Nullable final String name,
//                                            @Nullable final String url,
//                                            @Nullable final String login,
//                                            @Nullable final String password,
//                                            @Nullable final String dbUrl,
//                                            @Nullable final String dbUsername,
//                                            @Nullable final String dbPassword) {
//         return new XMLBasedSQSInfo(id == null ? UUID.randomUUID().toString() : id, name, url, login, password, dbUrl, dbUsername, dbPassword);
//     }
// 
//     public static SQSInfo createServerInfo(@Nullable final String id) {
//         return new XMLBasedSQSInfo(id == null ? UUID.randomUUID().toString() : id, null, null, null, null, null, null, null);
//     }
// }
// 
// Path: sonar-plugin-server/src/main/java/jetbrains/buildserver/sonarplugin/manager/projectsettings/SQSProjectSettings.java
// public class SQSProjectSettings implements ProjectSettings {
//     public static final String SONARQUBE_SERVER = "sonarqube-server";
// 
//     @Nullable
//     private Map<String, XMLBasedSQSInfo> mySQSInfos = null;
// 
//     @Nullable
//     public SQSInfo getInfo(@NotNull final String serverId) {
//         return mySQSInfos != null ? mySQSInfos.get(serverId) : null;
//     }
// 
//     public void setInfo(@NotNull final String serverId, @NotNull final SQSInfo modifiedServer) {
//         if (mySQSInfos == null) {
//             mySQSInfos = new HashMap<>();
//         }
//         mySQSInfos.put(serverId, cast(modifiedServer));
//     }
// 
//     public boolean remove(String serverId) {
//         return mySQSInfos != null && mySQSInfos.remove(serverId) != null;
//     }
// 
//     public void dispose() {
//         // do nothing
//     }
// 
//     public void readFrom(Element element) {
//         final List children = element.getChildren(SONARQUBE_SERVER);
//         if (mySQSInfos == null && !children.isEmpty()) {
//             mySQSInfos = new HashMap<>(children.size());
//         }
//         for (Object o : children) {
//             Element child = (Element)o;
//             final XMLBasedSQSInfo info = new XMLBasedSQSInfo();
//             info.readFrom(child);
//             mySQSInfos.put(info.getId(), info);
//         }
//     }
// 
//     public void writeTo(Element element) {
//         if (mySQSInfos != null) {
//             for (final XMLBasedSQSInfo info : mySQSInfos.values()) {
//                 Element serverElement = new Element(SONARQUBE_SERVER);
//                 info.writeTo(serverElement);
//                 element.addContent(serverElement);
//             }
//         }
//     }
// 
//     @NotNull
//     private XMLBasedSQSInfo cast(@NotNull final SQSInfo info) {
//         if (info instanceof XMLBasedSQSInfo) {
//             return (XMLBasedSQSInfo) info;
//         } else {
//             return new XMLBasedSQSInfo(info.getId(), info.getName(), info.getUrl(), info.getLogin(), info.getPassword(), info.getJDBCUrl(), info.getJDBCUsername(), info.getJDBCPassword());
//         }
//     }
// 
//     public Collection<? extends SQSInfo> getAll() {
//         if (mySQSInfos == null) {
//             return Collections.emptyList();
//         } else {
//             return mySQSInfos.values();
//         }
//     }
// }


import jetbrains.buildserver.sonarplugin.manager.projectsettings.XMLBasedSQSInfoHelper;
import jetbrains.buildserver.sonarplugin.manager.projectsettings.SQSProjectSettings;
import org.assertj.core.api.BDDAssertions;
import org.testng.annotations.Test;
/*
 * Copyright 2000-2022 JetBrains s.r.o.
 *
 * 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
 *
 * 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 jetbrains.buildserver.sonarplugin.sqrunner.manager;


/**
 * Created by linfar on 03.10.16.
 */
@Test
public class SQSProjectSettingsTest {
    public void test() {
        final SQSProjectSettings holder = new SQSProjectSettings();
        BDDAssertions.then(holder.getInfo("serverId")).isNull();

// Path: sonar-plugin-server/src/main/java/jetbrains/buildserver/sonarplugin/manager/projectsettings/XMLBasedSQSInfoHelper.java
// public class XMLBasedSQSInfoHelper {
//     private XMLBasedSQSInfoHelper() {
//     }
// 
//     public static SQSInfo createServerInfo(@Nullable final String id,
//                                            @Nullable final String name,
//                                            @Nullable final String url,
//                                            @Nullable final String login,
//                                            @Nullable final String password,
//                                            @Nullable final String dbUrl,
//                                            @Nullable final String dbUsername,
//                                            @Nullable final String dbPassword) {
//         return new XMLBasedSQSInfo(id == null ? UUID.randomUUID().toString() : id, name, url, login, password, dbUrl, dbUsername, dbPassword);
//     }
// 
//     public static SQSInfo createServerInfo(@Nullable final String id) {
//         return new XMLBasedSQSInfo(id == null ? UUID.randomUUID().toString() : id, null, null, null, null, null, null, null);
//     }
// }
// 
// Path: sonar-plugin-server/src/main/java/jetbrains/buildserver/sonarplugin/manager/projectsettings/SQSProjectSettings.java
// public class SQSProjectSettings implements ProjectSettings {
//     public static final String SONARQUBE_SERVER = "sonarqube-server";
// 
//     @Nullable
//     private Map<String, XMLBasedSQSInfo> mySQSInfos = null;
// 
//     @Nullable
//     public SQSInfo getInfo(@NotNull final String serverId) {
//         return mySQSInfos != null ? mySQSInfos.get(serverId) : null;
//     }
// 
//     public void setInfo(@NotNull final String serverId, @NotNull final SQSInfo modifiedServer) {
//         if (mySQSInfos == null) {
//             mySQSInfos = new HashMap<>();
//         }
//         mySQSInfos.put(serverId, cast(modifiedServer));
//     }
// 
//     public boolean remove(String serverId) {
//         return mySQSInfos != null && mySQSInfos.remove(serverId) != null;
//     }
// 
//     public void dispose() {
//         // do nothing
//     }
// 
//     public void readFrom(Element element) {
//         final List children = element.getChildren(SONARQUBE_SERVER);
//         if (mySQSInfos == null && !children.isEmpty()) {
//             mySQSInfos = new HashMap<>(children.size());
//         }
//         for (Object o : children) {
//             Element child = (Element)o;
//             final XMLBasedSQSInfo info = new XMLBasedSQSInfo();
//             info.readFrom(child);
//             mySQSInfos.put(info.getId(), info);
//         }
//     }
// 
//     public void writeTo(Element element) {
//         if (mySQSInfos != null) {
//             for (final XMLBasedSQSInfo info : mySQSInfos.values()) {
//                 Element serverElement = new Element(SONARQUBE_SERVER);
//                 info.writeTo(serverElement);
//                 element.addContent(serverElement);
//             }
//         }
//     }
// 
//     @NotNull
//     private XMLBasedSQSInfo cast(@NotNull final SQSInfo info) {
//         if (info instanceof XMLBasedSQSInfo) {
//             return (XMLBasedSQSInfo) info;
//         } else {
//             return new XMLBasedSQSInfo(info.getId(), info.getName(), info.getUrl(), info.getLogin(), info.getPassword(), info.getJDBCUrl(), info.getJDBCUsername(), info.getJDBCPassword());
//         }
//     }
// 
//     public Collection<? extends SQSInfo> getAll() {
//         if (mySQSInfos == null) {
//             return Collections.emptyList();
//         } else {
//             return mySQSInfos.values();
//         }
//     }
// }


// Path: sonar-plugin-server/src/test/java/jetbrains/buildserver/sonarplugin/sqrunner/manager/SQSProjectSettingsTest.java
import jetbrains.buildserver.sonarplugin.manager.projectsettings.XMLBasedSQSInfoHelper;
import jetbrains.buildserver.sonarplugin.manager.projectsettings.SQSProjectSettings;
import org.assertj.core.api.BDDAssertions;
import org.testng.annotations.Test;

/*
 * Copyright 2000-2022 JetBrains s.r.o.
 *
 * 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
 *
 * 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 jetbrains.buildserver.sonarplugin.sqrunner.manager;


/**
 * Created by linfar on 03.10.16.
 */
@Test
public class SQSProjectSettingsTest {
    public void test() {
        final SQSProjectSettings holder = new SQSProjectSettings();
        BDDAssertions.then(holder.getInfo("serverId")).isNull();

        holder.setInfo("serverId", XMLBasedSQSInfoHelper.createServerInfo("serverId"));