本文整理汇总了Java中com.sun.jersey.api.client.GenericType类的典型用法代码示例。如果您正苦于以下问题:Java GenericType类的具体用法?Java GenericType怎么用?Java GenericType使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
GenericType类属于com.sun.jersey.api.client包,在下文中一共展示了GenericType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testRoleNames
import com.sun.jersey.api.client.GenericType; //导入依赖的package包/类
/**
* Tests the getRoleNames operation.
*/
@Test
public void testRoleNames() {
// Execute
ServiceRequest<RoleQuery> request = new ServiceRequest<>();
request.setRequester(vms_admin_com);
request.setBody(new RoleQuery());
ClientResponse response = client.getRoleNames(ClientResponse.class,
request);
GenericType<ServiceArrayResponse<String>> gType = new GenericType<ServiceArrayResponse<String>>() {
};
ServiceArrayResponse<String> sar = response.getEntity(gType);
// Verify
assertNotNull("Unexpected null result", response);
List<String> roleNames = sar.getResults();
assertNotNull("Expected Role " + USER_BROWSER + " not found",
getRoleName(roleNames, USER_BROWSER));
assertNotNull("Expected Role " + ADMINISTRATOR + "not found",
getRoleName(roleNames, ADMINISTRATOR));
assertNotNull("Expected Role " + SUPER_USER + "not found",
getRoleName(roleNames, SUPER_USER));
}
示例2: testFindRoles
import com.sun.jersey.api.client.GenericType; //导入依赖的package包/类
/**
* Tests the findRoleNames operation.
*/
@Test
public void testFindRoles()
{
// Execute
ServiceRequest<FindRolesQuery> request = new ServiceRequest<>();
request.setRequester(vms_admin_com);
FindRolesQuery query = new FindRolesQuery();
query.setPaginator(getDefaultPaginator());
query.getPaginator().setLimit(50);
query.setApplicationName("USM");
request.setBody(query);
ClientResponse response = client.findRoles(ClientResponse.class,
request);
GenericType<PaginationResponse<ComprehensiveRole>> gType = new GenericType<PaginationResponse<ComprehensiveRole>>() {
};
PaginationResponse<ComprehensiveRole> sar = response.getEntity(gType);
// Verify
assertNotNull("Unexpected null result", response);
List<ComprehensiveRole> roles = sar.getResults();
assertNotNull("Expected Role " + USER_BROWSER + " not found",
getRole(roles, USER_BROWSER));
}
示例3: testGetPermissions
import com.sun.jersey.api.client.GenericType; //导入依赖的package包/类
@Test
public void testGetPermissions(){
ServiceRequest<FindPermissionsQuery> request=new ServiceRequest<>();
request.setRequester(vms_admin_com);
FindPermissionsQuery query=new FindPermissionsQuery();
query.setApplication("USM");
query.setGroup(null);
ClientResponse retrievedGroups=client.findPermissions(ClientResponse.class, request);
GenericType<ServiceArrayResponse<Feature>> gtype=new GenericType<ServiceArrayResponse<Feature>>(){};
ServiceArrayResponse<Feature> features=retrievedGroups.getEntity(gtype);
assertNotNull("Response is not null",features);
assertTrue("The list is bigger than 0", features.getResults().size()>0);
}
示例4: testRoles
import com.sun.jersey.api.client.GenericType; //导入依赖的package包/类
/**
* Tests the getRoles operation.
*/
@Test
public void testRoles() {
// Execute
ServiceRequest<RoleQuery> request = new ServiceRequest<>();
request.setRequester(vms_admin_com);
request.setBody(new RoleQuery());
ClientResponse response = client.getRoles(ClientResponse.class,
request);
GenericType<ServiceArrayResponse<ComprehensiveRole>> gType = new GenericType<ServiceArrayResponse<ComprehensiveRole>>() {
};
ServiceArrayResponse<ComprehensiveRole> sar = response
.getEntity(gType);
// Verify
assertNotNull("Unexpected null result", response);
List<ComprehensiveRole> scopeNames = sar.getResults();
assertNotNull("Expected Role " + USER_BROWSER + " not found",
getRole(scopeNames, USER_BROWSER));
assertNotNull("Expected Role " + ADMINISTRATOR + "not found",
getRole(scopeNames, ADMINISTRATOR));
assertNotNull("Expected Role " + SUPER_USER + "not found",
getRole(scopeNames, SUPER_USER));
}
示例5: testFindApplications
import com.sun.jersey.api.client.GenericType; //导入依赖的package包/类
/**
* Tests the findApplications operation.
*/
@Test
public void testFindApplications() {
// Execute
ServiceRequest<FindApplicationQuery> request = new ServiceRequest<>();
request.setRequester(vms_admin_com);
FindApplicationQuery query = new FindApplicationQuery();
query.setName(APPLICATION_USM);
query.setPaginator(getDefaultPaginator());
request.setBody(query);
ClientResponse response = client.findApplications(ClientResponse.class, request);
GenericType<PaginationResponse<Application>> gType = new GenericType<PaginationResponse<Application>>() {
};
PaginationResponse<Application> sar = response.getEntity(gType);
// Verify
assertNotNull("Unexpected null result", response);
List<Application> applications = sar.getResults();
assertNotNull("Expected Scope " + APPLICATION_USM + " not found", getApplication(applications, APPLICATION_USM));
}
示例6: testApplicationNames
import com.sun.jersey.api.client.GenericType; //导入依赖的package包/类
/**
* Tests the getApplicationNames operation.
*/
@Test
public void testApplicationNames() {
// Execute
ServiceRequest<ApplicationQuery> request = new ServiceRequest<>();
request.setRequester(vms_admin_com);
request.setBody(new ApplicationQuery());
ClientResponse response = client.getApplicationNames(ClientResponse.class, request);
GenericType<ServiceArrayResponse<String>> gType = new GenericType<ServiceArrayResponse<String>>() {
};
ServiceArrayResponse<String> sar = response.getEntity(gType);
// Verify
assertNotNull("Unexpected null result", response);
List<String> appNames = sar.getResults();
assertEquals("Unexpected 'orgName' value", APPLICATION_USM,
getAppName(appNames, APPLICATION_USM));
assertEquals("Unexpected 'orgName' value", APPLICATION_QUOTA,
getAppName(appNames, APPLICATION_QUOTA));
assertEquals("Unexpected 'orgName' value", APPLICATION_UVMS,
getAppName(appNames, APPLICATION_UVMS));
}
示例7: setMaxSessionAnySite
import com.sun.jersey.api.client.GenericType; //导入依赖的package包/类
public void setMaxSessionAnySite(int newValue)
{
ServiceRequest<FindPoliciesQuery> findReq = new ServiceRequest<>();
findReq.setRequester(usm_admin);
FindPoliciesQuery q = new FindPoliciesQuery();
q.setName("account.maxSessionAnySite");
q.setSubject("Account");
findReq.setBody(q);
ClientResponse findResp = client.findPolicies(ClientResponse.class, findReq);
GenericType<List<Policy>> gtype = new GenericType<List<Policy>>(){};
List<Policy> policiesFound = findResp.getEntity(gtype);
ServiceRequest<Policy> req = new ServiceRequest<>();
req.setRequester(usm_admin);
Policy uPolicy = policiesFound.get(0);
uPolicy.setValue(""+newValue);
req.setBody(uPolicy);
ClientResponse resp = client.updatePolicy(ClientResponse.class, req);
}
示例8: testSubjects
import com.sun.jersey.api.client.GenericType; //导入依赖的package包/类
/**
* Tests the getSubjects operation.
*/
@Test
public void testSubjects() {
// Execute
ServiceRequest<NoBody> request = new ServiceRequest<>();
request.setRequester(usm_admin);
ClientResponse response = client.getSubjects(ClientResponse.class, request);
GenericType<ServiceArrayResponse<String>> gType = new GenericType<ServiceArrayResponse<String>>() {
};
ServiceArrayResponse<String> sar = response.getEntity(gType);
// Verify
assertNotNull("Unexpected null result", sar);
List<String> subjects = sar.getResults();
assertNotNull("Expected Subject " + POL_PASSWORD + " not found",
getSubject(subjects, POL_PASSWORD));
assertNotNull("Expected Subject " + POL_ACCOUNT + "not found",
getSubject(subjects, POL_ACCOUNT));
assertNotNull("Expected Subject " + POL_FEATURE + "not found",
getSubject(subjects, POL_FEATURE));
assertNotNull("Expected Subject " + POL_ADMINISTRATION + "not found",
getSubject(subjects, POL_ADMINISTRATION));
assertNotNull("Expected Subject " + POL_AUTHENTICATION + "not found",
getSubject(subjects, POL_AUTHENTICATION));
}
示例9: testGetNames
import com.sun.jersey.api.client.GenericType; //导入依赖的package包/类
@Test
public void testGetNames()
{
ServiceRequest<String> request = new ServiceRequest<>();
request.setRequester(usmAdmin);
request.setBody("");
// Execute
ClientResponse response = manageUserClient.getUserNames(request);
// Verify
assertEquals("Unexpected http response status", 200, response.getStatus());
GenericType<ServiceArrayResponse<String>> gType = new GenericType<ServiceArrayResponse<String>>() {
};
ServiceArrayResponse<String> sar = response.getEntity(gType);
assertNotNull("Unexpected null service-response", response);
List<String> result = sar.getResults();
assertNotNull("Unexpected null result", result);
assertFalse("Unexpected empty result", result.isEmpty());
}
示例10: testGetChallenges
import com.sun.jersey.api.client.GenericType; //导入依赖的package包/类
@Test
public void testGetChallenges() {
ServiceRequest<String> request = new ServiceRequest<String>();
request.setRequester(vms_admin_com);
String userName = "vms_admin_com";
// Execute
ClientResponse response = manageUserClient.getChallenges(ClientResponse.class, userName, request);
GenericType<ChallengeInformationResponse> gType = new GenericType<ChallengeInformationResponse>() {
};
;
// Verify
String expectedRoleName = "User";
assertNotNull("Unexpected null response", response);
ChallengeInformationResponse challengeInformationResponse = response.getEntity(gType);
assertNotNull("Unexpected null UserContextResponse", challengeInformationResponse);
assertNotNull("Unexpected null UserContextResponse.results", challengeInformationResponse.getResults());
}
示例11: testFindScopes
import com.sun.jersey.api.client.GenericType; //导入依赖的package包/类
/**
* Tests the findScopes operation.
*/
@Test
public void testFindScopes()
{
// Execute
ServiceRequest<FindScopesQuery> request = new ServiceRequest<>();
request.setRequester(vms_admin_com);
FindScopesQuery query = new FindScopesQuery();
query.setScopeName(GRC_QUOTAS);
query.setPaginator(getDefaultPaginator());
request.setBody(query);
ClientResponse response = client.findScopes(ClientResponse.class,request);
GenericType<PaginationResponse<Scope>> gType = new GenericType<PaginationResponse<Scope>>() {
};
PaginationResponse<Scope> sar = response.getEntity(gType);
// Verify
assertNotNull("Unexpected null result", response);
List<Scope> scopes = sar.getResults();
assertNotNull("Expected Scope " + GRC_QUOTAS + " not found",
getScope(scopes, GRC_QUOTAS));
}
示例12: findScope
import com.sun.jersey.api.client.GenericType; //导入依赖的package包/类
public Long findScope(String scopeName)
{
// Set-up
ServiceRequest<FindScopesQuery> request = new ServiceRequest<>();
request.setRequester(vms_admin_com);
FindScopesQuery query = new FindScopesQuery();
query.setScopeName(scopeName);
query.setPaginator(getDefaultPaginator());
request.setBody(query);
// Execute
ClientResponse response = client.findScopes(ClientResponse.class,
request);
GenericType<PaginationResponse<Scope>> gType = new GenericType<PaginationResponse<Scope>>() {
};
PaginationResponse<Scope> sar = response.getEntity(gType);
// Verify
assertNotNull("Unexpected null result", response);
List<Scope> scopes = sar.getResults();
assertEquals("Unexpected result size", 1, scopes.size());
return scopes.get(0).getScopeId();
}
示例13: addDatasets
import com.sun.jersey.api.client.GenericType; //导入依赖的package包/类
private void addDatasets(Scope scope){
ServiceRequest<FindDataSetQuery> datasetReq=new ServiceRequest<FindDataSetQuery>();
datasetReq.setRequester(vms_admin_com);
FindDataSetQuery bodyReq=new FindDataSetQuery();
bodyReq.setApplicationName("Quota");
bodyReq.setCategory("all");
datasetReq.setBody(bodyReq);
ClientResponse datasetRet=client.findDatasets(ClientResponse.class, datasetReq);
//if no datasets are found prevent creating useless variables
if (datasetRet.getStatus()!=204){
GenericType<ServiceArrayResponse<DataSet>> gtype=new GenericType<ServiceArrayResponse<DataSet>>(){};
ServiceArrayResponse<DataSet> retrievedDataSets=datasetRet.getEntity(gtype);
scope.setDataSets(retrievedDataSets.getResults());
}
}
示例14: testScopes
import com.sun.jersey.api.client.GenericType; //导入依赖的package包/类
/**
* Tests the getScopeNames operation.
*/
@Test
public void testScopes() {
// Execute
ServiceRequest<ScopeQuery> request = new ServiceRequest<>();
request.setRequester(vms_admin_com);
request.setBody(new ScopeQuery());
ClientResponse response = client.getScopes(ClientResponse.class,
request);
GenericType<ServiceArrayResponse<ComprehensiveScope>> gType = new GenericType<ServiceArrayResponse<ComprehensiveScope>>() {
};
ServiceArrayResponse<ComprehensiveScope> sar = response.getEntity(gType);
// Verify
assertNotNull("Unexpected null result", response);
List<ComprehensiveScope> scopeNames = sar.getResults();
assertNotNull("Expected Scope " + FRA_QUOTAS + " not found",
getScopeName(scopeNames, FRA_QUOTAS));
assertNotNull("Expected Scope " + GRC_QUOTAS + "not found",
getScopeName(scopeNames, GRC_QUOTAS));
assertNotNull("Expected Scope " + SOME_REPORTS + "not found",
getScopeName(scopeNames, SOME_REPORTS));
}
示例15: testGetOrganisation
import com.sun.jersey.api.client.GenericType; //导入依赖的package包/类
@Test
public void testGetOrganisation() {
// Set-up
Long organisationId = findOrganisation(ORGANISATION_GRC);
// Execute
ServiceRequest<Long> request = new ServiceRequest<>();
request.setRequester(vms_admin_com);
request.setBody(organisationId);
ClientResponse response = client.getOrganisation(ClientResponse.class, request);
GenericType<Organisation> gType = new GenericType<Organisation>() {
};
Organisation organisation = response.getEntity(gType);
// Verify
assertNotNull("Unexpected null result", response);
assertEquals("Unexpected 'scopeName' value", ORGANISATION_GRC, organisation.getName());
}