syncope-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ilgro...@apache.org
Subject [16/40] syncope git commit: Merge from 1_2_X
Date Tue, 21 Apr 2015 07:49:31 GMT
Merge from 1_2_X


Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/5c049cdf
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/5c049cdf
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/5c049cdf

Branch: refs/heads/SYNCOPE-119
Commit: 5c049cdf4777a1126b657a28fdb8682e42a179a7
Parents: 6736d4e 5e31bab
Author: Francesco Chicchiriccò <ilgrosso@apache.org>
Authored: Thu Apr 16 08:43:02 2015 +0200
Committer: Francesco Chicchiriccò <ilgrosso@apache.org>
Committed: Thu Apr 16 08:43:02 2015 +0200

----------------------------------------------------------------------
 .../java/org/apache/syncope/client/lib/ConcurrencyTest.java    | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/syncope/blob/5c049cdf/client/lib/src/test/java/org/apache/syncope/client/lib/ConcurrencyTest.java
----------------------------------------------------------------------
diff --cc client/lib/src/test/java/org/apache/syncope/client/lib/ConcurrencyTest.java
index cbd7793,0000000..a20cb59
mode 100644,000000..100644
--- a/client/lib/src/test/java/org/apache/syncope/client/lib/ConcurrencyTest.java
+++ b/client/lib/src/test/java/org/apache/syncope/client/lib/ConcurrencyTest.java
@@@ -1,73 -1,0 +1,77 @@@
 +/*
 + * Licensed to the Apache Software Foundation (ASF) under one
 + * or more contributor license agreements.  See the NOTICE file
 + * distributed with this work for additional information
 + * regarding copyright ownership.  The ASF licenses this file
 + * to you under the Apache License, Version 2.0 (the
 + * "License"); you may not use this file except in compliance
 + * with the License.  You may obtain a copy of the License at
 + *
 + *   http://www.apache.org/licenses/LICENSE-2.0
 + *
 + * Unless required by applicable law or agreed to in writing,
 + * software distributed under the License is distributed on an
 + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 + * KIND, either express or implied.  See the License for the
 + * specific language governing permissions and limitations
 + * under the License.
 + */
 +package org.apache.syncope.client.lib;
 +
 +import static org.junit.Assert.fail;
 +
 +import org.apache.commons.lang3.StringUtils;
 +import org.apache.syncope.common.rest.api.service.ResourceService;
 +import org.junit.Test;
 +import org.slf4j.Logger;
 +import org.slf4j.LoggerFactory;
 +
 +public class ConcurrencyTest {
 +
 +    private static final Logger LOG = LoggerFactory.getLogger(ConcurrencyTest.class);
 +
 +    private static final int THREAD_NUMBER = 1000;
 +
 +    private static final SyncopeClient client =
 +            new SyncopeClientFactoryBean().setAddress("http://url").create("username", "password");
 +
 +    @Test
 +    public void multiThreadTest()
 +            throws InterruptedException {
 +
 +        for (int i = 0; i < THREAD_NUMBER; i++) {
 +            Thread execution = new Thread("Th-" + StringUtils.leftPad(String.valueOf(i),
5, '0')) {
 +
 +                @Override
 +                public void run() {
 +
 +                    try {
 +                        client.getService(ResourceService.class);
 +
 +                        LOG.info(getName() + " completed successfully!");
 +                    } catch (Exception e) {
 +                        LOG.error(getName() + " did not complete", e);
 +                    }
 +                }
 +            };
-             execution.start();
++	    try {
++		execution.start();
++	    } catch(OutOfMemoryError e) {
++		// ignore
++	    }
 +        }
 +
 +        Thread.sleep(THREAD_NUMBER);
 +    }
 +
 +    @Test
 +    public void multiCallTest() {
 +        try {
 +            for (int i = 0; i < THREAD_NUMBER; i++) {
 +                client.getService(ResourceService.class);
 +            }
 +        } catch (Exception e) {
 +            fail(e.getMessage());
 +        }
 +    }
 +}


Mime
View raw message