Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.ipswitch.automation.ft.central.webadmin.tests;
- import static com.ipswitch.automation.ft.central.webadmin.utils.SessionContainer.getCentralApi;
- import static com.ipswitch.automation.ft.central.webadmin.utils.SessionContainer.putCentralApi;
- import com.ipswitch.automation.ft.central.webadmin.api.GeneralApiHelper;
- import com.stdnet.moveit.MICentralAPIInternal;
- import org.testng.annotations.BeforeTest;
- import org.testng.annotations.Test;
- public class Generator {
- String sftpTemplate = "<SSHFTP Host=\"1.1.1.1\" ID=\"%s\" Name=\"SFTP_%s\"></SSHFTP>";
- String tasktesmplate = "<Task Active=\"0\" AR=\"0\" CacheNames=\"random\" NextEID=\"12\" TT=\"\" UseDefStateCaching=\"1\" ID=\"%s\" Name=\"%s\">\n" +
- " <Schedules/>\n" +
- " <NextActions/>\n" +
- " <Info>\n" +
- " <Description></Description>\n" +
- " <Notes></Notes>\n" +
- " </Info>\n" +
- " <Source DeleteOrig=\"0\" DelRename=\"1\" ExFile=\"\" ExFo=\"\" FileMask=\"*.*\" NewFilesOnly=\"0\" RenameTo=\"\" Unzip=\"0\" BlindDL=\"0\" ClientKeyID=\"0\" ConnTimeoutSecs=\"120\" HostID=\"%s\" MxBy=\"0\" MxFi=\"0\" MD5File=\"MD5SUM\" MD5Get=\"Never\" Path=\"\" RescanSecs=\"0\" RetryIfNoFiles=\"0\" Rsm=\"0\" SearchSubdirs=\"0\" Type=\"SSHFTP\" UDMxBy=\"1\" UDMxFi=\"1\" UseDefBlindDL=\"1\" UseDefClientKey=\"1\" UseDefConnTimeoutSecs=\"1\" UseDefMD5File=\"1\" UseDefMD5Get=\"1\" UseDefRescanSecs=\"1\" UseDefRetryCount=\"1\" UseDefRetryTimeoutSecs=\"1\" UseDefRsm=\"1\" UseDefUser=\"1\" Username=\"\" Password=\"\" ID=\"11\" RetryCount=\"0\" RetryTimeoutSecs=\"30\"/>\n" +
- " </Task>";
- GeneralApiHelper generalApiHelper;
- @BeforeTest
- public void setUp() {
- putCentralApi(new MICentralAPIInternal());
- generalApiHelper = GeneralApiHelper.getInstance();
- generalApiHelper.connect();
- }
- @Test
- public void createSftpHosts() {
- int initHostId = 320000000;
- boolean result;
- for (int i = initHostId; i < initHostId + 100; i++) {
- String id = String.valueOf(i);
- String host = String.format(sftpTemplate, id, id);
- result = getCentralApi().createItem("Host", id, host);
- if (result) {
- System.out.println(id + " created");
- } else {
- System.out.println(id + " failed");
- }
- }
- // int initTaskId = 220000000;
- //
- // for (int i = initTaskId; i < initTaskId + 99; i++) {
- //
- // String id = String.valueOf(i);
- // String task = String.format(tasktesmplate, id, id, i - 100000000);
- // result = getCentralApi().createItem("Task", id, task);
- //
- // if (result) {
- // System.out.println(id + " created");
- // } else {
- // System.out.println(id + " failed");
- // }
- // }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement