本文整理匯總了Java中edu.emory.mathcs.backport.java.util.Arrays類的典型用法代碼示例。如果您正苦於以下問題:Java Arrays類的具體用法?Java Arrays怎麽用?Java Arrays使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
Arrays類屬於edu.emory.mathcs.backport.java.util包,在下文中一共展示了Arrays類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: testIntrospectPropertyForItemsConnectedTo
import edu.emory.mathcs.backport.java.util.Arrays; //導入依賴的package包/類
@Test
public void testIntrospectPropertyForItemsConnectedTo()
throws InvalidPropertyException, InvocationTargetException, IllegalAccessException {
String logicalId = "/myitem/myid";
MyItemType myItemType = new MyItemType();
String logicalId1 = logicalId + "1";
String logicalId2 = logicalId + "2";
MyItem myItem1 = new MyItem(logicalId1, myItemType);
MyItem myItem2 = new MyItem(logicalId2, myItemType);
myItem1.addConnectedRelationships(myItem2, "");
MyItem[] myItemArray = {myItem1, myItem2};
List<Fibre> items = Arrays.asList(myItemArray);
String propertyName = RelationshipUtil.getRelationshipNameBetweenItems(myItem1, myItem2, "");
List<Object> properties = FibreIntrospectionUtils.introspectPropertyForFibres(propertyName, items, null);
assertNotNull("Returned properties was null", properties);
assertEquals("Returned properties incorrect size", 2, properties.size());
for (int count = 0; count < properties.size(); count++) {
assertNotNull("Returned property was null at " + count, properties.get(count));
}
assertEquals("First property incorrect", myItem2, properties.get(0));
assertEquals("Second property incorrect", myItem1, properties.get(1));
}
示例2: successCreate
import edu.emory.mathcs.backport.java.util.Arrays; //導入依賴的package包/類
@Test
public void successCreate() throws Exception {
BundleMetadata bundle = new BundleMetadata.Builder().name("test").tag("test").build();
bundleService.save(bundle);
// Simply create a new feed and check its model
MvcResult result = mockMvc.perform(postAuthenticated(("/feed"))
.content(toJson(FeedDto.builder().name("test").bundleTags(Arrays.asList(new String[]{bundle.getTag()})).build()))
.contentType(MediaType.APPLICATION_JSON_UTF8))
.andExpect(status().isOk())
.andReturn();
FeedDto feed = fromJson(result.getResponse().getContentAsString(), FeedDto.class);
assertEquals("test", feed.getName());
assertNotNull(feed.getBundleTags());
assertEquals(1, feed.getBundleTags().size());
assertEquals(bundle.getTag(), feed.getBundleTags().get(0));
}
示例3: test_queryCommandCallback
import edu.emory.mathcs.backport.java.util.Arrays; //導入依賴的package包/類
@Test
public void test_queryCommandCallback() {
QueryLoadsCallback callback = Mockito.mock(QueryLoadsCallback.class);
Interpreter interpreter = Mockito.mock(Interpreter.class);
Mockito.when(interpreter.processActiveLoadsResponse(Mockito.anyString()))
.thenReturn(new HashMap<Integer, Executor.LoadStatus>());
Gateway gateway = getGatewayForSystem(1);
Executor e = Mockito.spy(Executor.createForGateway(gateway));
e.getCommandCallbackForQueryingLoads(interpreter, Arrays.asList(new Integer[] {1}), callback)
.onResponse(null, "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF");
Mockito.verify(callback).onResponse(Mockito.anyMap());
}
示例4: test_loadQueryMap_multiMcp
import edu.emory.mathcs.backport.java.util.Arrays; //導入依賴的package包/類
@Test
public void test_loadQueryMap_multiMcp() {
String response96Chars = "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" +
"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"; // iterations through the map
Interpreter interpreter = Mockito.mock(Interpreter.class);
Mockito.when(interpreter.processActiveLoadsResponse(Mockito.anyString()))
.thenReturn(new HashMap<Integer, Executor.LoadStatus>());
Map<Integer, Map<Integer, Executor.LoadStatus>> map = new HashMap();
List<Integer> controllers = Arrays.asList(new Integer[] {1, 2});
Gateway gateway = getGatewayForSystem(1);
Executor e = Mockito.spy(Executor.createForGateway(gateway));
e.loadMapFromResponse(map, controllers, interpreter, response96Chars);
assertNotNull(map.get(Integer.valueOf(1)));
assertNotNull(map.get(Integer.valueOf(2)));
assertNull(map.get(Integer.valueOf(Interpreter.SINGLE_MCP_SYSTEM)));
assertNull(map.get(Integer.valueOf(3)));
}
示例5: test_loadQueryMap_singleMcp
import edu.emory.mathcs.backport.java.util.Arrays; //導入依賴的package包/類
@Test
public void test_loadQueryMap_singleMcp() {
String response96Chars = "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF";
Interpreter interpreter = Mockito.mock(Interpreter.class);
Mockito.when(interpreter.processActiveLoadsResponse(Mockito.anyString()))
.thenReturn(new HashMap<Integer, Executor.LoadStatus>());
Map<Integer, Map<Integer, Executor.LoadStatus>> map = new HashMap();
List<Integer> controllers = Arrays.asList(new Integer[] {Interpreter.SINGLE_MCP_SYSTEM});
Gateway gateway = getGatewayForSystem(1);
Executor e = Mockito.spy(Executor.createForGateway(gateway));
e.loadMapFromResponse(map, controllers, interpreter, response96Chars);
// map should hold value for the single mcp system, since that is the controller number we passed in
assertNotNull(map.get(Integer.valueOf(Interpreter.SINGLE_MCP_SYSTEM)));
assertNull(map.get(Integer.valueOf(1)));
assertNull(map.get(Integer.valueOf(2)));
}
示例6: setUp
import edu.emory.mathcs.backport.java.util.Arrays; //導入依賴的package包/類
@BeforeClass
public void setUp() throws Exception {
initMocks(this);
requestPathBasedSequenceHandler = new DefaultRequestPathBasedSequenceHandler();
// Mock authentication context and sequence config for request path authentication
context = new AuthenticationContext();
authenticatorConfig = spy(new AuthenticatorConfig());
doReturn(requestPathAuthenticator).when(authenticatorConfig).getApplicationAuthenticator();
sequenceConfig = spy(new SequenceConfig());
doReturn(Arrays.asList(new AuthenticatorConfig[]{authenticatorConfig}))
.when(sequenceConfig).getReqPathAuthenticators();
context.setSequenceConfig(sequenceConfig);
}
開發者ID:wso2,項目名稱:carbon-identity-framework,代碼行數:18,代碼來源:DefaultRequestPathBasedSequenceHandlerTest.java
示例7: removeTopic
import edu.emory.mathcs.backport.java.util.Arrays; //導入依賴的package包/類
private String removeTopic(String whitelist, String topicToRemove) {
List<String> topicList = new ArrayList<String>();
List<String> newTopicList = new ArrayList<String>();
if (whitelist.contains(",")) {
topicList = Arrays.asList(whitelist.split(","));
}
if (topicList.contains(topicToRemove)) {
for (String topic : topicList) {
if (!topic.equals(topicToRemove)) {
newTopicList.add(topic);
}
}
}
String newWhitelist = StringUtils.join(newTopicList, ",");
return newWhitelist;
}
示例8: getWhitelistByNamespace
import edu.emory.mathcs.backport.java.util.Arrays; //導入依賴的package包/類
private String getWhitelistByNamespace(String originalWhitelist, String namespace) {
String whitelist = null;
List<String> resultList = new ArrayList<String>();
List<String> whitelistList = new ArrayList<String>();
whitelistList = Arrays.asList(originalWhitelist.split(","));
for (String topic : whitelistList) {
if (StringUtils.isNotBlank(originalWhitelist) && getNamespace(topic).equals(namespace)) {
resultList.add(topic);
}
}
if (resultList.size() > 0) {
whitelist = StringUtils.join(resultList, ",");
}
return whitelist;
}
示例9: inviteUsers
import edu.emory.mathcs.backport.java.util.Arrays; //導入依賴的package包/類
@Override
public void inviteUsers(String appId, String tenantId, int groupId, String message, Integer... inviteeIds)
throws ImException {
Group group = groupDao.getById(groupId);
ImParamExceptionAssert.isNotNull(group, "群組不存在,請檢查參數");
int count = userDao.findUsersCountInUserIds(appId, tenantId, inviteeIds);
ImParamExceptionAssert.check(count == inviteeIds.length, "傳入的用戶在數據庫中不存在");
doInviteUserInDB(appId, tenantId, groupId, inviteeIds);
TopicRequest topicReq = TopicRequest.build(groupId, appId, tenantId, TopicOwnerType.GROUP, TopicType.values());
topicRpcService.subscribeTopic(topicReq, inviteeIds);
Map<TopicType,TopicInfo> map = topicRpcService.getTopicInfo(topicReq);
sendSystemOperaterMessage(appId, tenantId, Arrays.asList(inviteeIds),
TopicOperaterType.SUBSCRIBE, map.values());
}
示例10: removeUsersFromGroup
import edu.emory.mathcs.backport.java.util.Arrays; //導入依賴的package包/類
@Override
public void removeUsersFromGroup(int groupId, String appId, String tenantId, Integer... userIds)
throws ImException {
Group group = groupDao.getById(groupId);
ImParamExceptionAssert.isNotNull(group, "群組不存在,請檢查參數");
int count = userDao.findUsersCountInUserIds(appId, tenantId, userIds);
ImParamExceptionAssert.check(count == userIds.length, "傳入的用戶在數據庫中不存在");
doRemoveUserInDB(appId, tenantId, groupId, userIds);
TopicRequest topicReq = TopicRequest.build(groupId, appId, tenantId, TopicOwnerType.GROUP, TopicType.values());
topicRpcService.unSubscribeTopic(topicReq, userIds);
Map<TopicType,TopicInfo> map = topicRpcService.getTopicInfo(topicReq);
sendSystemOperaterMessage(appId, tenantId, Arrays.asList(userIds),
TopicOperaterType.UNSUBSCRIBER, map.values());
}
示例11: enterStructType
import edu.emory.mathcs.backport.java.util.Arrays; //導入依賴的package包/類
@Override
public final void enterStructType(StructTypeContext ctx) {
if (lastParsedTypeIdentifier != null) {
if (componentStackContainsMethod()) {
// skip over structs defined within methods.
exitStructType(ctx);
} else {
Component cmp = createComponent(ComponentType.STRUCT, ctx.getStart().getLine());
String comments = AntlrUtil.goLangComments(ctx.getStart().getLine(),
Arrays.asList(file.content().split("\n")));
cmp.setComment(comments);
cmp.setName(lastParsedTypeIdentifier);
cmp.setComponentName(generateComponentName(lastParsedTypeIdentifier));
cmp.setImports(currentImports);
pointParentsToGivenChild(cmp);
cmp.insertAccessModifier(visibility(cmp.name()));
componentStack.push(cmp);
}
}
}
示例12: enterInterfaceType
import edu.emory.mathcs.backport.java.util.Arrays; //導入依賴的package包/類
@Override
public final void enterInterfaceType(InterfaceTypeContext ctx) {
if (!componentStackContainsMethod()) {
if (lastParsedTypeIdentifier != null) {
Component cmp = createComponent(ComponentType.INTERFACE, ctx.getStart().getLine());
String comments = AntlrUtil.goLangComments(ctx.getStart().getLine(),
Arrays.asList(file.content().split("\n")));
cmp.setComment(comments);
cmp.setName(lastParsedTypeIdentifier);
cmp.setComponentName(generateComponentName(lastParsedTypeIdentifier));
cmp.setImports(currentImports);
pointParentsToGivenChild(cmp);
cmp.insertAccessModifier(visibility(cmp.name()));
componentStack.push(cmp);
}
} else {
exitInterfaceType(ctx);
}
}
示例13: enterMethodSpec
import edu.emory.mathcs.backport.java.util.Arrays; //導入依賴的package包/類
@Override
public final void enterMethodSpec(MethodSpecContext ctx) {
if (ctx.IDENTIFIER() != null) {
Component cmp = createComponent(ComponentType.METHOD, ctx.getStart().getLine());
String comments = AntlrUtil.goLangComments(ctx.getStart().getLine(),
Arrays.asList(file.content().split("\n")));
cmp.setComment(comments);
cmp.setName(ctx.IDENTIFIER().getText());
cmp.setCodeFragment(cmp.name() + "(");
cmp.insertAccessModifier(visibility(cmp.name()));
if (ctx.signature().parameters() != null) {
setCodeFragmentFromParameters(ctx.signature().parameters(), cmp);
}
if (ctx.signature().result() != null) {
processResult(ctx.signature().result(), cmp);
}
cmp.setName(cmp.codeFragment());
cmp.setComponentName(generateComponentName(cmp.name()));
pointParentsToGivenChild(cmp);
componentStack.push(cmp);
processParameters(ctx.signature().parameters(), cmp);
} else if (ctx.typeName() != null) {
insertExtensionIntoStackBaseComponent(ctx.typeName().getText());
}
}
示例14: enterMethodDecl
import edu.emory.mathcs.backport.java.util.Arrays; //導入依賴的package包/類
@Override
public final void enterMethodDecl(MethodDeclContext ctx) {
if (ctx.IDENTIFIER() != null) {
Component cmp = createComponent(ComponentType.METHOD, ctx.getStart().getLine());
String comments = AntlrUtil.goLangComments(ctx.getStart().getLine(),
Arrays.asList(file.content().split("\n")));
cmp.setComment(comments);
cmp.setName(ctx.IDENTIFIER().getText());
pointParentsToGivenChild(cmp);
cmp.setCodeFragment(cmp.name() + "(");
cmp.insertAccessModifier(visibility(cmp.name()));
if (ctx.function().signature().parameters() != null) {
setCodeFragmentFromParameters(ctx.function().signature().parameters(), cmp);
}
if (ctx.function().signature().result() != null) {
processResult(ctx.function().signature().result(), cmp);
}
cmp.setName(cmp.codeFragment());
cmp.setComponentName(generateComponentName(cmp.name()));
componentStack.push(cmp);
processParameters(ctx.function().signature().parameters(), cmp);
}
}
示例15: value
import edu.emory.mathcs.backport.java.util.Arrays; //導入依賴的package包/類
/**
* @see {@link ResolvedRelativePath#ResolvedRelativePath(String, String)}
*/
public String value() throws Exception {
String absolutePath = preprocessedPath(this.absPath);
String relativePath = preprocessedPath(this.unresolvedRelativePath);
// build absolute path representing the given relative path
List<String> absoluteParts = new ArrayList<String>(Arrays.asList(absolutePath.split("/")));
String[] relativeParts = relativePath.split("/");
for (String relativePart : relativeParts) {
if (relativePart.equals(".")) {
// means current directory, do nothing
continue;
} else if (relativePart.equalsIgnoreCase("..")) {
// mean move up a level
absoluteParts.remove(absoluteParts.size() - 1);
} else {
absoluteParts.add(relativePart);
}
}
return "/" + String.join("/", absoluteParts);
}