mirror of
https://github.com/Alfresco/SearchServices.git
synced 2025-09-17 14:21:20 +00:00
TAS-188 add autowired capability and parallel execution
This commit is contained in:
30
e2e-test/java/org/alfresco/rest/SampleATest.java
Normal file
30
e2e-test/java/org/alfresco/rest/SampleATest.java
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
package org.alfresco.rest;
|
||||||
|
|
||||||
|
import org.alfresco.rest.v1.Sites;
|
||||||
|
import org.alfresco.tester.model.UserModel;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.testng.Assert;
|
||||||
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
|
public class SampleATest extends BaseRestTest
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
Sites onSites;
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void sampleATestMethod1()
|
||||||
|
{
|
||||||
|
UserModel admin = new UserModel("admin", "admin");
|
||||||
|
Assert.assertFalse(onSites.withAuthUser(admin).getSites().getEntries().isEmpty(), "We have sites");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void sampleATestMethod2()
|
||||||
|
{
|
||||||
|
UserModel admin = new UserModel("admin", "a");
|
||||||
|
Assert.assertTrue(onSites.withAuthUser(admin).getSites().getEntries().isEmpty(), "We have sites");
|
||||||
|
|
||||||
|
Assert.assertEquals(onSites.usingRestWrapper().getLastStatus().getName(), HttpStatus.ACCEPTED.name(), "Status Code Name");
|
||||||
|
}
|
||||||
|
}
|
31
e2e-test/java/org/alfresco/rest/SampleBTest.java
Normal file
31
e2e-test/java/org/alfresco/rest/SampleBTest.java
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
package org.alfresco.rest;
|
||||||
|
|
||||||
|
import org.alfresco.rest.v1.Sites;
|
||||||
|
import org.alfresco.tester.model.UserModel;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.testng.Assert;
|
||||||
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
|
public class SampleBTest extends BaseRestTest
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
Sites onSites;
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void sampleBTestMethod1()
|
||||||
|
{
|
||||||
|
UserModel admin = new UserModel("admin", "admin");
|
||||||
|
Assert.assertFalse(onSites.withAuthUser(admin).getSites().getEntries().isEmpty(), "We have sites");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void sampleBTestMethod2()
|
||||||
|
{
|
||||||
|
UserModel admin = new UserModel("admin", "a");
|
||||||
|
Assert.assertTrue(onSites.withAuthUser(admin).getSites().getEntries().isEmpty(), "We have sites");
|
||||||
|
|
||||||
|
Assert.assertEquals(onSites.usingRestWrapper().getLastStatus().getName().toLowerCase(), HttpStatus.UNAUTHORIZED.name().toLowerCase(), "Status Code Name");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@@ -1,33 +0,0 @@
|
|||||||
package org.alfresco.rest.v1;
|
|
||||||
|
|
||||||
import static org.alfresco.rest.RestWrapper.onRestAPI;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import org.alfresco.rest.BaseRestTest;
|
|
||||||
import org.alfresco.tester.model.UserModel;
|
|
||||||
import org.testng.Assert;
|
|
||||||
import org.testng.annotations.Test;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.core.JsonParseException;
|
|
||||||
import com.fasterxml.jackson.databind.JsonMappingException;
|
|
||||||
|
|
||||||
public class SitesTest extends BaseRestTest
|
|
||||||
{
|
|
||||||
@Test
|
|
||||||
public void getSite()
|
|
||||||
{
|
|
||||||
UserModel admin = new UserModel("admin", "admin");
|
|
||||||
System.out.println(onRestAPI().withAuthUser(admin).onSites().getSite("SiteName1470151654495").getTitle());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void getSites() throws JsonParseException, JsonMappingException, IOException
|
|
||||||
{
|
|
||||||
UserModel admin = new UserModel("admin", "admin");
|
|
||||||
|
|
||||||
Assert.assertEquals(onRestAPI().withAuthUser(admin).onSites().getSites().getPagination().getTotalItems(), 281);
|
|
||||||
|
|
||||||
Assert.assertEquals(onRestAPI().withAuthUser(admin).onSites().getSites().getEntries().get(0).onModel().getTitle(), "0-C2291-1470255221170");
|
|
||||||
}
|
|
||||||
}
|
|
11
e2e-test/resources/smoke-rest.xml
Normal file
11
e2e-test/resources/smoke-rest.xml
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
|
||||||
|
<suite name="Suite" parallel="classes">
|
||||||
|
<test name="Test">
|
||||||
|
<classes>
|
||||||
|
<class name="org.alfresco.rest.SampleATest"></class>
|
||||||
|
<class name="org.alfresco.rest.SampleBTest"></class>
|
||||||
|
</classes>
|
||||||
|
|
||||||
|
</test> <!-- Test -->
|
||||||
|
</suite> <!-- Suite -->
|
Reference in New Issue
Block a user