本文整理汇总了Java中org.testng.annotations.Optional类的典型用法代码示例。如果您正苦于以下问题:Java Optional类的具体用法?Java Optional怎么用?Java Optional使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Optional类属于org.testng.annotations包,在下文中一共展示了Optional类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setUp
import org.testng.annotations.Optional; //导入依赖的package包/类
/**
* Setup TestNG method to create Rapture login object and objects.
*
* @param RaptureURL
* Passed in from <env>_testng.xml suite file
* @param RaptureUser
* Passed in from <env>_testng.xml suite file
* @param RapturePassword
* Passed in from <env>_testng.xml suite file
* @return none
*/
@BeforeMethod
@BeforeClass(groups = { "mongo" })
@Parameters({ "RaptureURL", "RaptureUser", "RapturePassword" })
public void setUp(@Optional("http://localhost:8665/rapture") String url, @Optional("rapture") String username, @Optional("rapture") String password) {
// If running from eclipse set env var -Penv=docker or use the following
// url variable settings:
// url="http://192.168.99.101:8665/rapture"; //docker
// url="http://localhost:8665/rapture";
System.out.println("Using url " + url);
raptureLogin = new HttpLoginApi(url, new SimpleCredentialsProvider(username, password));
raptureLogin.login();
series = new HttpSeriesApi(raptureLogin);
document = new HttpDocApi(raptureLogin);
script = new HttpScriptApi(raptureLogin);
event = new HttpEventApi(raptureLogin);
fountain = new HttpIdGenApi(raptureLogin);
blobApi = new HttpBlobApi(raptureLogin);
Kernel.initBootstrap();
context = ContextFactory.getKernelUser();
}
示例2: setUp
import org.testng.annotations.Optional; //导入依赖的package包/类
/**
* Setup TestNG method to create Rapture login object and objects.
*
* @param RaptureURL Passed in from <env>_testng.xml suite file
* @param RaptureUser Passed in from <env>_testng.xml suite file
* @param RapturePassword Passed in from <env>_testng.xml suite file
* @return none
*/
@BeforeClass(groups={"smoke"})
@Parameters({"RaptureURL","RaptureUser","RapturePassword"})
public void setUp(@Optional("http://localhost:8665/rapture")String url,
@Optional("rapture")String username, @Optional("rapture")String password ) {
//If running from eclipse set env var -Penv=docker or use the following url variable settings:
//url="http://192.168.99.101:8665/rapture"; //docker
//url="http://localhost:8665/rapture";
System.out.println("Using url " + url);
raptureLogin = new HttpLoginApi(url, new SimpleCredentialsProvider(username, password));
raptureLogin.login();
series = new HttpSeriesApi(raptureLogin);
document = new HttpDocApi(raptureLogin);
script = new HttpScriptApi(raptureLogin);
event = new HttpEventApi(raptureLogin);
fountain = new HttpIdGenApi(raptureLogin);
}
示例3: setUp
import org.testng.annotations.Optional; //导入依赖的package包/类
/**
* Setup TestNG method to create Rapture login object and objects.
*
* @param RaptureURL Passed in from <env>_testng.xml suite file
* @param RaptureUser Passed in from <env>_testng.xml suite file
* @param RapturePassword Passed in from <env>_testng.xml suite file
*
* @return none
*/
@BeforeClass(groups={"document"})
@Parameters({"RaptureURL","RaptureUser","RapturePassword"})
public void setUp(@Optional("http://localhost:8665/rapture")String url,
@Optional("rapture")String username, @Optional("rapture")String password ) {
///If running from eclipse set environment variable -Penv=docker
//or use the following:
// url="http://localhost:8665/rapture";
// url="http://192.168.99.101:8665/rapture"; //docker
Reporter.log("Using URL: " + url,true);
raptureLogin = new HttpLoginApi(url, new SimpleCredentialsProvider(username, password));
try{
raptureLogin.login();
document = new HttpDocApi(raptureLogin);
} catch (RaptureException re) {
Reporter.log(re.getFormattedMessage(),true);
}
}
示例4: setUp
import org.testng.annotations.Optional; //导入依赖的package包/类
/**
* Setup TestNG method to create Rapture login object and objects.
*
* @param RaptureURL
* Passed in from <env>_testng.xml suite file
* @param RaptureUser
* Passed in from <env>_testng.xml suite file
* @param RapturePassword
* Passed in from <env>_testng.xml suite file
* @return none
*/
@BeforeClass(groups = { "nightly" })
@Parameters({ "RaptureURL", "RaptureUser", "RapturePassword" })
public void setUp(@Optional("http://localhost:8665/rapture") String url, @Optional("rapture") String username, @Optional("rapture") String password) {
// If running from eclipse set env var -Penv=docker or use the following
// url variable settings:
// url="http://192.168.99.101:8665/rapture"; //docker
// url="http://localhost:8665/rapture";
helper = new IntegrationTestHelper(url, username, password);
raptureLogin = helper.getRaptureLogin();
docApi = helper.getDocApi();
operationApi = helper.getOperationApi();
callingContext = raptureLogin.getContext();
repo = helper.getRandomAuthority(Scheme.DOCUMENT);
helper.configureTestRepo(repo, "MEMORY");
}
示例5: setUp
import org.testng.annotations.Optional; //导入依赖的package包/类
/**
* Setup TestNG method to create Rapture login object and objects.
*
* @param RaptureURL
* Passed in from <env>_testng.xml suite file
* @param RaptureUser
* Passed in from <env>_testng.xml suite file
* @param RapturePassword
* Passed in from <env>_testng.xml suite file
* @return none
*/
@BeforeMethod
@BeforeClass(groups = { "mongo" })
@Parameters({ "RaptureURL", "RaptureUser", "RapturePassword" })
public void setUp(@Optional("http://localhost:8665/rapture") String url, @Optional("rapture") String username, @Optional("rapture") String password) {
// If running from eclipse set env var -Penv=docker or use the following
// url variable settings:
// url="http://192.168.99.101:8665/rapture"; //docker
// url="http://localhost:8665/rapture";
// System.out.println("Using url " + url);
// raptureLogin = new HttpLoginApi(url, new SimpleCredentialsProvider(username, password));
// raptureLogin.login();
// seriesApi = new HttpSeriesApi(raptureLogin);
// docApi = new HttpDocApi(raptureLogin);
// scriptApi = new HttpScriptApi(raptureLogin);
// eventApi = new HttpEventApi(raptureLogin);
// fountainApi = new HttpIdGenApi(raptureLogin);
// blobApi = new HttpBlobApi(raptureLogin);
// callingContext = raptureLogin.getContext();
//
}
示例6: setUp
import org.testng.annotations.Optional; //导入依赖的package包/类
/**
* Setup TestNG method to create Rapture login object and objects.
*
* @param RaptureURL
* Passed in from <env>_testng.xml suite file
* @param RaptureUser
* Passed in from <env>_testng.xml suite file
* @param RapturePassword
* Passed in from <env>_testng.xml suite file
* @return none
*/
@BeforeClass(groups = { "nightly", "search" })
@Parameters({ "RaptureURL", "RaptureUser", "RapturePassword" })
public void setUp(@Optional("http://localhost:8665/rapture") String url, @Optional("rapture") String username, @Optional("rapture") String password) {
// If running from eclipse set env var -Penv=docker or use the following
// url variable settings:
// url="http://192.168.99.101:8665/rapture"; //docker
// url="http://localhost:8665/rapture";
helper = new IntegrationTestHelper(url, username, password);
raptureLogin = helper.getRaptureLogin();
seriesApi = helper.getSeriesApi();
scriptApi = helper.getScriptApi();
docApi = helper.getDocApi();
blobApi = helper.getBlobApi();
searchApi = new HttpSearchApi(raptureLogin);
callingContext = raptureLogin.getContext();
forceCleanUp(username);
if (!username.equals("rapture")) forceCleanUp("rapture");
}
示例7: setUp
import org.testng.annotations.Optional; //导入依赖的package包/类
/**
* Setup TestNG method to create Rapture login object and objects.
*
* @param RaptureURL
* Passed in from <env>_testng.xml suite file
* @param RaptureUser
* Passed in from <env>_testng.xml suite file
* @param RapturePassword
* Passed in from <env>_testng.xml suite file
* @return none
*/
@BeforeClass(groups = { "structured", "postgres","nightly" })
@Parameters({ "RaptureURL", "RaptureUser", "RapturePassword" })
public void setUp(@Optional("http://localhost:8665/rapture") String url, @Optional("rapture") String username, @Optional("rapture") String password) {
// If running from eclipse set env var -Penv=docker or use the following
// url variable settings:
// url = "http://192.168.99.100:8665/rapture"; // docker
// url="http://localhost:8665/rapture";
try {
helper = new IntegrationTestHelper(url, username, password);
} catch (Exception e) {
throw new SkipException("Cannot connect to IntegrationTestHelper " + e.getMessage());
}
structApi = helper.getStructApi();
admin = helper.getAdminApi();
pluginApi = helper.getPluginApi();
if (!admin.doesUserExist(user)) {
admin.addUser(user, "Another User", MD5Utils.hash16(user), "[email protected]");
}
repoUri = helper.getRandomAuthority(Scheme.DOCUMENT);
helper.configureTestRepo(repoUri, "MONGODB"); // TODO Make this configurable
}
示例8: setUp
import org.testng.annotations.Optional; //导入依赖的package包/类
@BeforeClass(groups = { "nightly", "lock" })
@Parameters({ "RaptureURL", "RaptureUser", "RapturePassword" })
public void setUp(@Optional("http://localhost:8665/rapture") String url, @Optional("rapture") String username, @Optional("rapture") String password) {
helper = new IntegrationTestHelper(url, username, password);
lockApi = helper.getLockApi();
admin = helper.getAdminApi();
if (!admin.doesUserExist(user)) {
admin.addUser(user, "Another User", MD5Utils.hash16(user), "[email protected]");
}
helper2 = new IntegrationTestHelper(url, user, user);
lockApi2 = helper2.getLockApi();
repoUri = helper.getRandomAuthority(Scheme.DOCUMENT);
helper.configureTestRepo(repoUri, "MONGODB"); // TODO Make this configurable
}
示例9: setupDatabase
import org.testng.annotations.Optional; //导入依赖的package包/类
/**
* Drop and recreates the databaseName from the template files.
*
* @param skipDatabaseCreation
* If set to true, the databaseName creation will be skipped (Default: false).
*
* @throws Exception
* Exception.
*/
@Parameters({ "skipDatabaseCreation" })
@BeforeClass(dependsOnMethods = { "setupIntegrationTest" }, groups = GROUP_INTEGRATION_TEST_SETUP)
public void setupDatabase(@Optional("false") String skipDatabaseCreation) throws Exception {
if (BooleanUtils.toBoolean(skipDatabaseCreation)) {
return;
}
LOGGER.info("Using the following JDBC URL for the test database: " + jdbcURL);
try {
DatabaseUtils.recreateDatabase(jdbcTempURL, suUsername, suPassword, databaseName,
databaseType, username);
initializeDatabaseSchemaAndContent();
} catch (Exception e) {
LOGGER.error(e.getMessage(), e);
throw e;
}
}
示例10: setupDatabaseUser
import org.testng.annotations.Optional; //导入依赖的package包/类
/**
* Setup credentials for DB access.
*
* @param dbUsername
* The username to use. (Default: communote).
* @param dbPassword
* The passwort to use for the given user (Default: communote).
* @param dbSuUsername
* name of the user to use for dropping an existing databaseName and creating a new
* databaseName. This user also needs to have access to the temp databaseName. If
* unset, username will be used.
* @param dbSuPassword
* password of the user identified by suUsername. Will be the password parameter if
* suUsername is blank.
*/
@Parameters({ "dbUsername", "dbPassword", "dbSuUsername", "dbSuPassword" })
@BeforeClass(groups = GROUP_INTEGRATION_TEST_SETUP)
public void setupDatabaseUser(@Optional("communote") String dbUsername,
@Optional("communote") String dbPassword, @Optional("") String dbSuUsername,
@Optional("") String dbSuPassword) {
this.username = dbUsername;
this.password = dbPassword;
if (StringUtils.isBlank(dbSuUsername)) {
this.suUsername = dbUsername;
this.suPassword = dbPassword;
} else {
this.suUsername = dbSuUsername;
this.suPassword = dbSuPassword;
}
}
示例11: setup
import org.testng.annotations.Optional; //导入依赖的package包/类
/**
* Setup.
*
* @param ldifFile
* ldif file as classpath or file URL. Default is to load from classpath.
* @throws Exception
* Exception.
*/
@Parameters({ "ldifFile" })
@BeforeClass(groups = "ldap-test-setup")
public void setup(
@Optional("classpath:/com/communote/server/test/ldap/test_ldap.ldif") String ldifFile)
throws Exception {
server.setPort(getNextFreePort());
server.start();
LOG.info("Load ldif from: " + ldifFile);
URL url;
if (ldifFile.startsWith("classpath:")) {
ldifFile = ldifFile.substring(10);
url = getClass().getResource(ldifFile);
} else {
url = new URL(ldifFile);
}
try (InputStream in = url.openStream()) {
server.importLdifFromStream(in);
}
}
示例12: installationStep3StoreMailOutSettings
import org.testng.annotations.Optional; //导入依赖的package包/类
/**
* Installation step that stores the mail-out settings.
*
* <p>
* Note: whether the configuration refers to an working SMTP server or not doesn't matter
* because the FileSystemMimeMessageSender is used which won't send emails
* </p>
*
* @param mailOutHost
* the host name of the mail out server
* @param mailOutPort
* the port of the mail out server
* @param fromAddress
* the from address to be set
* @throws Exception
* in case the test fails
*/
@Parameters({ "mailOutHost", "mailOutPort", "mailOutFromAddress" })
@BeforeSuite(dependsOnMethods = "installationStep2CreateGlobalClient")
public void installationStep3StoreMailOutSettings(@Optional("localhost") String mailOutHost,
@Optional("25") String mailOutPort,
@Optional("[email protected]") String fromAddress) throws Exception {
ConfigurationManager conf = CommunoteRuntime.getInstance().getConfigurationManager();
Map<ApplicationConfigurationPropertyConstant, String> settings;
settings = new HashMap<ApplicationConfigurationPropertyConstant, String>();
settings.put(ApplicationPropertyMailing.HOST, mailOutHost);
settings.put(ApplicationPropertyMailing.PORT, mailOutPort);
settings.put(ApplicationPropertyMailing.FROM_ADDRESS, fromAddress);
String fromName = "[Local Test] Communote-Team";
settings.put(ApplicationPropertyMailing.FROM_ADDRESS_NAME, fromName);
conf.updateApplicationConfigurationProperties(settings);
Assert.assertEquals(conf.getApplicationConfigurationProperties()
.getProperty(ApplicationPropertyMailing.HOST), mailOutHost);
Assert.assertEquals(conf.getApplicationConfigurationProperties()
.getProperty(ApplicationPropertyMailing.PORT), mailOutPort);
Assert.assertEquals(conf.getApplicationConfigurationProperties()
.getProperty(ApplicationPropertyMailing.FROM_ADDRESS), fromAddress);
Assert.assertEquals(conf.getApplicationConfigurationProperties()
.getProperty(ApplicationPropertyMailing.FROM_ADDRESS_NAME), fromName);
}
示例13: setup
import org.testng.annotations.Optional; //导入依赖的package包/类
/**
* Setup.
*
* @param numberOfMessages
* The number of messages to generate.
*
* @throws Exception
* Exception.
*/
@Parameters({ "numberOfMessages" })
@BeforeClass(dependsOnGroups = "integration-test-setup")
public void setup(@Optional("1000") String numberOfMessages) throws Exception {
user = TestUtils.createRandomUser(false);
blogForDeletion = TestUtils.createRandomBlog(true, true, user);
blogForMovingFrom = TestUtils.createRandomBlog(true, true, user);
blogForMovingTo = TestUtils.createRandomBlog(true, true, user);
this.numberOfMessages = Integer.parseInt(numberOfMessages);
for (int i = 1; i <= this.numberOfMessages; i++) {
TestUtils.createAndStoreCommonNote(blogForDeletion, user.getId(), "Message " + i);
TestUtils.createAndStoreCommonNote(blogForMovingFrom, user.getId(), "Message " + i);
}
blogManagement = ServiceLocator.instance().getService(BlogManagement.class);
noteDao = ServiceLocator.findService(NoteDao.class);
Assert.assertEquals(noteDao.getNotesForBlog(blogForDeletion.getId(), null, null).size(),
this.numberOfMessages);
Assert.assertEquals(noteDao.getNotesForBlog(blogForMovingFrom.getId(), null, null).size(),
this.numberOfMessages);
}
示例14: setupGroupSearch
import org.testng.annotations.Optional; //导入依赖的package包/类
/**
* Setups the group search.
*
* @param searchFilter
* The search filter for groups.
* @param searchBase
* The search base for groups.
* @param searchSubtree
* True, when subtrees should be search too.
* @param propertyMapping
* Mapping of properties as String.
* @param isMemberMode
* True, if the mode is "member", false if "memberOf"
*/
@BeforeMethod(groups = "setupSearchBase")
@Parameters({ "groupSearchFilter", "groupSearchBase", "groupSearchSubtree",
"groupPropertyMapping", "isMemberMode" })
public void setupGroupSearch(
@Optional("(objectClass=group)") String searchFilter,
String searchBase,
@Optional("true") String searchSubtree,
@Optional("name=name,alias=cn,membership=memberOf,description=name,uid=cn") String propertyMapping,
@Optional("false") String isMemberMode) {
groupSyncConfig = LdapGroupSyncConfiguration.Factory.newInstance();
groupSyncConfig.setMemberMode(Boolean.parseBoolean(isMemberMode));
groupSyncConfig.setGroupIdentifierIsBinary(false);
LdapSearchConfiguration groupSearchConfiguration = LdapSearchConfiguration.Factory
.newInstance();
groupSearchConfiguration.setSearchFilter(searchFilter);
LdapSearchBaseDefinition searchBaseDefinition = LdapSearchBaseDefinition.Factory
.newInstance(searchBase, Boolean.parseBoolean(searchSubtree));
groupSearchConfiguration.setSearchBases(new ArrayList<LdapSearchBaseDefinition>());
groupSearchConfiguration.getSearchBases().add(searchBaseDefinition);
groupSearchConfiguration.setPropertyMapping(propertyMapping);
groupSyncConfig.setGroupSearch(groupSearchConfiguration);
}
开发者ID:Communote,项目名称:communote-server,代码行数:37,代码来源:ADTrackingIncrementalRepositoryChangeTrackerTest.java
示例15: setupCommunoteParameters
import org.testng.annotations.Optional; //导入依赖的package包/类
@BeforeClass
@Parameters({ "cntAuthenticationUsername", "cntAuthenticationPassword", "cntManagerAlias",
"cntUserAlias", "cntManagerId", "externalGroupId" })
public void setupCommunoteParameters(
@Optional("sharepoint.system") String cntAuthenticationUsername,
@Optional("123456") String cntAuthenticationPassword,
@Optional("kenmei") String communoteManagerAlias,
@Optional("kenmei") String communoteUserAlias, @Optional String communoteManagerId,
@Optional("mqTestExternalGroup") String externalGroupId) {
this.cntAuthenticationUsername = cntAuthenticationUsername;
this.cntAuthenticationPassword = cntAuthenticationPassword;
this.setCommunoteManagerAlias(communoteManagerAlias);
this.setCommunoteUserAlias(communoteUserAlias);
if (communoteManagerId == null || communoteManagerId.length() == 0) {
this.setCommunoteManagerId(1L);
} else {
this.setCommunoteManagerId(Long.parseLong(communoteManagerId));
}
this.externalGroupId = externalGroupId;
}