当前位置: 首页>>代码示例>>Java>>正文


Java Parameters类代码示例

本文整理汇总了Java中org.testng.annotations.Parameters的典型用法代码示例。如果您正苦于以下问题:Java Parameters类的具体用法?Java Parameters怎么用?Java Parameters使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Parameters类属于org.testng.annotations包,在下文中一共展示了Parameters类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testSpecificConsumerRetrieval

import org.testng.annotations.Parameters; //导入依赖的package包/类
@Parameters({"admin-username", "admin-password", "broker-hostname", "broker-port"})
@Test
public void testSpecificConsumerRetrieval(String username, String password,
                                          String hostname, String port) throws Exception {
    String queueName = "testSpecificConsumerRetrieval";

    // Create a durable queue using a JMS client
    InitialContext initialContextForQueue = ClientHelper
            .getInitialContextBuilder(username, password, hostname, port)
            .withQueue(queueName)
            .build();

    QueueConnectionFactory connectionFactory
            = (QueueConnectionFactory) initialContextForQueue.lookup(ClientHelper.CONNECTION_FACTORY);
    QueueConnection connection = connectionFactory.createQueueConnection();
    connection.start();

    QueueSession queueSession = connection.createQueueSession(false, QueueSession.AUTO_ACKNOWLEDGE);
    Queue queue = queueSession.createQueue(queueName);
    QueueReceiver receiver = queueSession.createReceiver(queue);

    HttpGet getAllConsumers = new HttpGet(apiBasePath + QueuesApiDelegate.QUEUES_API_PATH
                                          + "/" + queueName + "/consumers");

    CloseableHttpResponse response = client.execute(getAllConsumers);
    Assert.assertEquals(response.getStatusLine().getStatusCode(), HttpStatus.SC_OK);
    String body = EntityUtils.toString(response.getEntity());

    ConsumerMetadata[] consumers = objectMapper.readValue(body, ConsumerMetadata[].class);

    Assert.assertTrue(consumers.length > 0, "Number of consumers returned is incorrect.");

    int id = consumers[0].getId();
    HttpGet getConsumer = new HttpGet(apiBasePath + QueuesApiDelegate.QUEUES_API_PATH + "/"
                                              + queueName + "/consumers/" + id);

    response = client.execute(getConsumer);
    Assert.assertEquals(response.getStatusLine().getStatusCode(), HttpStatus.SC_OK);
    String consumerString = EntityUtils.toString(response.getEntity());
    ConsumerMetadata consumerMetadata = objectMapper.readValue(consumerString, ConsumerMetadata.class);

    Assert.assertEquals(consumerMetadata.getId().intValue(), id, "incorrect message id");

    receiver.close();
    queueSession.close();
    connection.close();
}
 
开发者ID:wso2,项目名称:message-broker,代码行数:48,代码来源:ConsumersRestApiTest.java

示例2: findANewFlight

import org.testng.annotations.Parameters; //导入依赖的package包/类
@Parameters({ "username", "password", "tripType", "noOfPassengers", "departFrom", "departmonth", "departDay",
		"arrivingIn", "arrivingMonth", "arrivingDay", "serviceClass", "airlineName" })
@Test(description = "Mercury Flight Reservation - Find a flight")
public void findANewFlight(String username, String password, String tripType, String noOfPassengers,
		String departFrom, String departmonth, String departDay, String arrivingIn, String arrivingMonth,
		String arrivingDay, String serviceClass, String airlineName, Method method) {

	try {
		initialize();

		boolean testStatus = false;
		String homePageTitle = "Find a Flight: Mercury Tours:";
		boolean loginStatus = loginPage.loginToApplication(username, password, homePageTitle);

		if (loginStatus) {

			testStatus = flightFinderPage.findANewFlight(tripType, noOfPassengers, departFrom, departmonth,
					departDay, arrivingIn, arrivingMonth, arrivingDay, serviceClass, airlineName);
		}

		BaseClass.reportTestCaseStatus(driver, logger, method.getName(), testStatus);
	} catch (Exception e) {
		BaseClass.reportTestCaseStatus(driver, logger, method.getName(), false);
	}

}
 
开发者ID:anilpandeykiet,项目名称:POM_HYBRID_FRAMEOWRK,代码行数:27,代码来源:FlightReservation_FindFlight_Tests.java

示例3: beforeSuite

import org.testng.annotations.Parameters; //导入依赖的package包/类
@Parameters({"baseURL"})
@BeforeSuite
public void beforeSuite(String baseURL) {
	try {

		rpr = ReadPropertyFile.getInstance("./TestResources/TestConfig/test.properties");

		reportFile = rpr.getKey("reportFile");
		emailConfigFile = rpr.getKey("emailConfigFile");
		sendEmail = rpr.getKey("sendEmail");
		
		// If the we are testing single Web Application. Mention the same in 
		//test.properties file and uncomment below line.
		
		//baseURL = rpr.getKey("baseURL");
		
		// Commnet this line if previous line is uncommented
		BaseClass.baseURL = baseURL;
		browserName = rpr.getKey("browserName");
		reporter = ReportManager.getReporter(reportFile, true);
		
	} catch (Exception e) {
		e.printStackTrace();
		System.out.println("Error occured in @BeforeSuite");
	}
}
 
开发者ID:anilpandeykiet,项目名称:POM_HYBRID_FRAMEOWRK,代码行数:27,代码来源:BaseClass.java

示例4: setUp

import org.testng.annotations.Parameters; //导入依赖的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();
}
 
开发者ID:RapturePlatform,项目名称:Rapture,代码行数:33,代码来源:MongoTests.java

示例5: setUp

import org.testng.annotations.Parameters; //导入依赖的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);
}
 
开发者ID:RapturePlatform,项目名称:Rapture,代码行数:26,代码来源:SmokeTests.java

示例6: setUp

import org.testng.annotations.Parameters; //导入依赖的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);
    }
}
 
开发者ID:RapturePlatform,项目名称:Rapture,代码行数:29,代码来源:TutorialTests.java

示例7: setUp

import org.testng.annotations.Parameters; //导入依赖的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");

}
 
开发者ID:RapturePlatform,项目名称:Rapture,代码行数:31,代码来源:OperationApiIntegrationTest.java

示例8: setUp

import org.testng.annotations.Parameters; //导入依赖的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();
    //

}
 
开发者ID:RapturePlatform,项目名称:Rapture,代码行数:35,代码来源:ConsistencyTest.java

示例9: setUp

import org.testng.annotations.Parameters; //导入依赖的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");
}
 
开发者ID:RapturePlatform,项目名称:Rapture,代码行数:32,代码来源:SearchApiIntegrationTest.java

示例10: setUp

import org.testng.annotations.Parameters; //导入依赖的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
}
 
开发者ID:RapturePlatform,项目名称:Rapture,代码行数:35,代码来源:StructuredApiIntegrationTests.java

示例11: setUp

import org.testng.annotations.Parameters; //导入依赖的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
}
 
开发者ID:RapturePlatform,项目名称:Rapture,代码行数:17,代码来源:LockApiTest.java

示例12: createAnnotationParameters

import org.testng.annotations.Parameters; //导入依赖的package包/类
/**
 * Process testResult to create parameters provided via {@link Parameters}
 *
 * @param testResult           TestNG's testResult context
 * @param parametersAnnotation Annotation with parameters
 * @return Step Parameters being sent to Report Portal
 */
private List<ParameterResource> createAnnotationParameters(ITestResult testResult, Parameters parametersAnnotation) {
	List<ParameterResource> params = Lists.newArrayList();
	String[] keys = parametersAnnotation.value();
	Object[] parameters = testResult.getParameters();
	if (parameters.length != keys.length) {
		return params;
	}
	for (int i = 0; i < keys.length; i++) {
		ParameterResource parameter = new ParameterResource();
		parameter.setKey(keys[i]);
		parameter.setValue(parameters[i] != null ? parameters[i].toString() : null);
		params.add(parameter);
	}
	return params;
}
 
开发者ID:reportportal,项目名称:agent-java-testNG,代码行数:23,代码来源:TestNGService.java

示例13: postTestMessageToSpace

import org.testng.annotations.Parameters; //导入依赖的package包/类
@Test(enabled = true)
@Parameters({ "appId", "appSecret", "spaceId" })
public void postTestMessageToSpace(String appId, String appSecret, String spaceId)
		throws UnsupportedEncodingException, WWException {
	WWClient client = WWClient.buildClientApplicationAccess(appId, appSecret, new WWAuthenticationEndpoint());
	assert !client.isAuthenticated();
	client.authenticate();
	assert client.isAuthenticated();

	AppMessageBuilder builder = new AppMessageBuilder();
	builder.setActorAvatar("http://gravatar.com/cgu")
			.setActorName("CGU")
			.setActorUrl("http://openntf.org")
			.setColor("#FF0000");
	builder.setMessage("Message from *build process* - Integration Testing").setMessageTitle("IT-Testing");
	AppMessage message = builder.build();
	MessageResponse response = client.postMessageToSpace(message, spaceId);
	assert (response != null);
	assert (!"".equals(response.getId()));
}
 
开发者ID:OpenCode4Workspace,项目名称:Watson-Work-Services-Java-SDK,代码行数:21,代码来源:ITPostMessage.java

示例14: testGetConversationGenericMessagesOnly

import org.testng.annotations.Parameters; //导入依赖的package包/类
@Test(enabled = true)
@Parameters({ "appId", "appSecret", "conversationId" })
public void testGetConversationGenericMessagesOnly(String appId, String appSecret, String conversationId)
		throws UnsupportedEncodingException, WWException {
	WWClient client = WWClient.buildClientApplicationAccess(appId, appSecret, new WWAuthenticationEndpoint());
	assert !client.isAuthenticated();
	client.authenticate();
	assert client.isAuthenticated();

	ObjectDataSenderBuilder messages = new ObjectDataSenderBuilder(ConversationChildren.MESSAGES.getLabel(), true)
			.addAttribute(ConversationMessageAttributes.ANNOTATION_TYPE, AnnotationType.GENERIC.getLabel())
			.addField(MessageFields.CONTENT);
	ObjectDataSenderBuilder query = new ObjectDataSenderBuilder(Conversation.CONVERSATION_QUERY_OBJECT_NAME)
			.addAttribute(ConversationAttributes.ID, conversationId)
			.addField(ConversationFields.ID)
			.addChild(messages);
	Conversation conversation = client.getConversationWithQuery(new ConversationGraphQLQuery(query));
	assert (conversation != null);
	assert (conversation.getMessages().size() > 0);
}
 
开发者ID:OpenCode4Workspace,项目名称:Watson-Work-Services-Java-SDK,代码行数:21,代码来源:ITgraphQL.java

示例15: testGetConversationTimestampMessages

import org.testng.annotations.Parameters; //导入依赖的package包/类
@Test(enabled = true)
@Parameters({ "appId", "appSecret", "conversationId", "oldestTimestamp", "mostRecentTimestamp" })
public void testGetConversationTimestampMessages(String appId, String appSecret, String conversationId, Long oldestTimestamp, Long mostRecentTimestamp)
		throws UnsupportedEncodingException, WWException {
	WWClient client = WWClient.buildClientApplicationAccess(appId, appSecret, new WWAuthenticationEndpoint());
	assert !client.isAuthenticated();
	client.authenticate();
	assert client.isAuthenticated();

	ObjectDataSenderBuilder messages = new ObjectDataSenderBuilder(ConversationChildren.MESSAGES.getLabel(), true)
			.addAttribute(ConversationMessageAttributes.OLDEST_TIMESTAMP, oldestTimestamp)
			.addAttribute(ConversationMessageAttributes.MOST_RECENT_TIMESTAMP, mostRecentTimestamp)
			.addField(MessageFields.CONTENT);
	ObjectDataSenderBuilder query = new ObjectDataSenderBuilder(Conversation.CONVERSATION_QUERY_OBJECT_NAME)
			.addAttribute(ConversationAttributes.ID, conversationId)
			.addField(ConversationFields.ID)
			.addChild(messages);
	Conversation conversation = client.getConversationWithQuery(new ConversationGraphQLQuery(query));
	assert (conversation != null);
	assert (conversation.getMessages().size() > 0);
}
 
开发者ID:OpenCode4Workspace,项目名称:Watson-Work-Services-Java-SDK,代码行数:22,代码来源:ITgraphQL.java


注:本文中的org.testng.annotations.Parameters类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。