gluu
公開メンバ関数 | 静的公開メンバ関数 | 静的公開変数類 | 非公開変数類 | 全メンバ一覧
org.gluu.oxtrust.service.test.CleanUpTest クラス
org.gluu.oxtrust.service.test.CleanUpTest の継承関係図
Inheritance graph
org.gluu.oxtrust.service.test.CleanUpTest 連携図
Collaboration graph

公開メンバ関数

void cleanUpPersons (String usedPersons) throws Exception
 
void cleanUpGroups (String usedGroups) throws Exception
 
void showTitle (String title)
 
void showResponse (String title, Response response)
 
void initTestSuite (ITestContext context) throws FileNotFoundException, IOException
 

静的公開メンバ関数

static void showResponse (String title, Response response, Object entity)
 
static void fails (Throwable e)
 
static void output (String p_msg)
 
static Archive<?> createDeployment ()
 

静的公開変数類

static FileConfiguration testData
 

非公開変数類

IGroupService groupsService
 
IPersonService personService
 
MemberService memberService
 

詳解

著者
Yuriy Movchan
バージョン
0.1, 03/24/2014

関数詳解

◆ cleanUpGroups()

void org.gluu.oxtrust.service.test.CleanUpTest.cleanUpGroups ( String  usedGroups) throws Exception
inline

Test search

例外
Exception
92  {
93  System.out.println("cleanup person Test initialted ");
94  assertNotNull(usedGroups);
95  List<String> usedGroupsList = Arrays.asList(StringHelper.split(usedGroups, ",", true, false));
96  System.out.println("Used Groups: " + usedGroupsList);
97 
98  int groupsResultSetSize = 50;
99 
100  int countResults = 0;
101  int countRemoved = 0;
102  boolean existsMoreGroups = true;
103  while (existsMoreGroups && countResults < 10000) {
104  List<GluuGroup> groups = groupsService.getAllGroups();
105 
106  existsMoreGroups = groups.size() == groupsResultSetSize;
107  countResults += groups.size();
108 
109  assertNotNull(groups);
110  System.out.println("Found groups: " + groups.size());
111  System.out.println("Total groups: " + countResults);
112 
113  for (GluuGroup group : groups) {
114  // String clientId = person.getClientId();
115  if (!usedGroupsList.contains(group.getInum())) {
116  try {
117  groupsService.removeGroup(group);
118  countRemoved++;
119  } catch (EntryPersistenceException ex) {
120  System.out.println("Failed to remove group: " + ex.getMessage());
121  }
122  }
123  }
124  }
125 
126  System.out.println("Removed Persons: " + countRemoved);
127  }
IGroupService groupsService
Definition: CleanUpTest.java:34
abstract void removeGroup(GluuGroup group)
abstract List< GluuGroup > getAllGroups()

◆ cleanUpPersons()

void org.gluu.oxtrust.service.test.CleanUpTest.cleanUpPersons ( String  usedPersons) throws Exception
inline

Test search

例外
Exception
48  {
49  System.out.println("cleanup person Test initialted ");
50  assertNotNull(usedPersons);
51  List<String> usedPersonsList = Arrays.asList(StringHelper.split(usedPersons, ",", true, false));
52  System.out.println("Used persons: " + usedPersonsList);
53 
54  int personsResultSetSize = 50;
55 
56  int countResults = 0;
57  int countRemoved = 0;
58  boolean existsMorePersons = true;
59  while (existsMorePersons && countResults < 10000) {
60  List<GluuCustomPerson> persons = personService.findAllPersons(new String[] { "inum" });
61 
62  existsMorePersons = persons.size() == personsResultSetSize;
63  countResults += persons.size();
64 
65  assertNotNull(persons);
66  System.out.println("Found persons: " + persons.size());
67  System.out.println("Total persons: " + countResults);
68 
69  for (GluuCustomPerson person : persons) {
70  // String clientId = person.getClientId();
71  if (!usedPersonsList.contains(person.getInum())) {
72  try {
74  countRemoved++;
75  } catch (EntryPersistenceException ex) {
76  System.out.println("Failed to remove person: " + ex.getMessage());
77  }
78  }
79  }
80  }
81 
82  System.out.println("Removed Persons: " + countRemoved);
83  }
abstract List< GluuCustomPerson > findAllPersons(String[] returnAttributes)
void removePerson(GluuCustomPerson person)
Definition: MemberService.java:30
IPersonService personService
Definition: CleanUpTest.java:37
MemberService memberService
Definition: CleanUpTest.java:40

◆ createDeployment()

static Archive<?> org.gluu.oxtrust.action.test.ConfigurableTest.createDeployment ( )
inlinestaticinherited
41  {
42  return Deployments.createDeployment();
43  }

◆ fails()

static void org.gluu.oxtrust.action.test.BaseTest.fails ( Throwable  e)
inlinestaticinherited
49  {
50  Assert.fail(e.getMessage(), e);
51  }

◆ initTestSuite()

void org.gluu.oxtrust.action.test.ConfigurableTest.initTestSuite ( ITestContext  context) throws FileNotFoundException, IOException
inlineinherited
46  {
47  Reporter.log("Invoked init test suite method", true);
48 
49  String propertiesFile = context.getCurrentXmlTest().getParameter("propertiesFile");
50  if (StringHelper.isEmpty(propertiesFile)) {
51  propertiesFile = "target/test-classes/testng.properties";
52  }
53 
54  // Load test parameters
55  FileInputStream conf = new FileInputStream(propertiesFile);
56  Properties prop;
57  try {
58  prop = new Properties();
59  prop.load(conf);
60  } finally {
61  IOUtils.closeQuietly(conf);
62  }
63 
64  Map<String, String> parameters = new HashMap<String, String>();
65  for (Entry<Object, Object> entry : prop.entrySet()) {
66  Object key = entry.getKey();
67  Object value = entry.getValue();
68 
69  if (StringHelper.isEmptyString(key) || StringHelper.isEmptyString(value)) {
70  continue;
71  }
72  parameters.put(key.toString(), value.toString());
73  }
74 
75  // Override test parameters
76  context.getSuite().getXmlSuite().setParameters(parameters);
77  }

◆ output()

static void org.gluu.oxtrust.action.test.BaseTest.output ( String  p_msg)
inlinestaticinherited
53  {
54  System.out.println(p_msg);
55  }

◆ showResponse() [1/2]

void org.gluu.oxtrust.action.test.BaseTest.showResponse ( String  title,
Response  response 
)
inlineinherited
29  {
30  showResponse(title, response, null);
31  }
void showResponse(String title, Response response)
Definition: BaseTest.java:29

◆ showResponse() [2/2]

static void org.gluu.oxtrust.action.test.BaseTest.showResponse ( String  title,
Response  response,
Object  entity 
)
inlinestaticinherited
33  {
34  System.out.println(" ");
35  System.out.println("RESPONSE FOR: " + title);
36  System.out.println(response.getStatus());
37  for (Entry<String, List<Object>> headers : response.getHeaders().entrySet()) {
38  String headerName = headers.getKey();
39  System.out.println(headerName + ": " + headers.getValue());
40  }
41 
42  if (entity != null) {
43  System.out.println(entity.toString().replace("\\n", "\n"));
44  }
45  System.out.println(" ");
46  System.out.println("Status message: " + response.getStatus());
47  }

◆ showTitle()

void org.gluu.oxtrust.action.test.BaseTest.showTitle ( String  title)
inlineinherited
21  {
22  title = "TEST: " + title;
23 
24  System.out.println("#######################################################");
25  System.out.println(title);
26  System.out.println("#######################################################");
27  }

メンバ詳解

◆ groupsService

IGroupService org.gluu.oxtrust.service.test.CleanUpTest.groupsService
private

◆ memberService

MemberService org.gluu.oxtrust.service.test.CleanUpTest.memberService
private

◆ personService

IPersonService org.gluu.oxtrust.service.test.CleanUpTest.personService
private

◆ testData

FileConfiguration org.gluu.oxtrust.action.test.ConfigurableTest.testData
staticinherited

このクラス詳解は次のファイルから抽出されました: