當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。