Changeset 1861


Ignore:
Timestamp:
04/05/12 14:22:00 (12 years ago)
Author:
twagoo
Message:

ConcurrentRestService?: limited number of profiles and components to register, previous numbers were causing requests to be rejected by server

File:
1 edited

Legend:

Unmodified
Added
Removed
  • ComponentRegistry/trunk/ComponentRegistry/src/test/java/clarin/cmdi/componentregistry/rest/ConcurrentRestServiceTest.java

    r1603 r1861  
    33import clarin.cmdi.componentregistry.impl.database.ComponentRegistryTestDatabase;
    44import clarin.cmdi.componentregistry.model.AbstractDescription;
    5 import static clarin.cmdi.componentregistry.rest.ComponentRegistryRestService.USERSPACE_PARAM;
    6 import static org.junit.Assert.assertEquals;
    7 import static org.junit.Assert.fail;
    8 
     5import clarin.cmdi.componentregistry.model.ComponentDescription;
     6import clarin.cmdi.componentregistry.model.ProfileDescription;
     7import clarin.cmdi.componentregistry.model.RegisterResponse;
     8import com.sun.jersey.api.client.ClientResponse;
     9import com.sun.jersey.multipart.FormDataMultiPart;
    910import java.io.InputStream;
    1011import java.util.ArrayList;
    1112import java.util.Arrays;
     13import java.util.Collections;
     14import java.util.Comparator;
    1215import java.util.List;
    13 
    1416import javax.ws.rs.core.MediaType;
    15 
    1617import org.junit.Before;
    1718import org.junit.Test;
    1819import org.junit.runner.RunWith;
    19 
    20 import clarin.cmdi.componentregistry.model.ComponentDescription;
    21 import clarin.cmdi.componentregistry.model.ProfileDescription;
    22 import clarin.cmdi.componentregistry.model.RegisterResponse;
    23 
    24 import com.sun.jersey.api.client.ClientResponse;
    25 import com.sun.jersey.multipart.FormDataMultiPart;
    26 import java.util.Collections;
    27 import java.util.Comparator;
    2820import org.slf4j.Logger;
    2921import org.slf4j.LoggerFactory;
     
    3325import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
    3426
     27import static clarin.cmdi.componentregistry.rest.ComponentRegistryRestService.USERSPACE_PARAM;
     28import static org.junit.Assert.*;
     29
    3530@RunWith(SpringJUnit4ClassRunner.class)
    36 @ContextConfiguration(locations = { "/applicationContext.xml" })
     31@ContextConfiguration(locations = {"/applicationContext.xml"})
    3732public class ConcurrentRestServiceTest extends ComponentRegistryRestServiceTestCase {
    3833
    3934    private final static Logger LOG = LoggerFactory.getLogger(ConcurrentRestServiceTest.class);
    40     private int NR_OF_PROFILES = 50;
    41     private int NR_OF_COMPONENTS = 50;
    42 
     35    private int NR_OF_PROFILES = 20;
     36    private int NR_OF_COMPONENTS = 20;
    4337    @Autowired
    4438    private JdbcTemplate jdbcTemplate;
     
    5448        return "classpath:applicationContext.xml";
    5549    }
    56    
     50
    5751    @Test
    5852    public void testConcurrentRegisterProfile() throws Exception {
     
    125119        for (int i = 0; i < size; i++) {
    126120            final boolean shouldDelete = (i % 2) == 1;
     121            LOG.debug("Profile {} should be registered in {} and {}", new Object[]{i + 1000, Boolean.parseBoolean(userSpace) ? "user space" : "public space", shouldDelete ? "ALSO DELETED" : "not deleted"});
    127122            Thread thread = createThread("/registry/profiles/", userSpace, "Test Profile" + (i + 1000), shouldDelete, RegistryTestHelper.getTestProfileContent(), errors);
    128123            ts.add(thread);
     
    133128        for (int i = 0; i < size; i++) {
    134129            final boolean shouldDelete = (i % 2) == 1;
     130            LOG.debug("Component {} should be registered in {} and {}", new Object[]{i + 1000, Boolean.parseBoolean(userSpace) ? "user space" : "public space", shouldDelete ? "ALSO DELETED" : "not deleted"});
    135131            Thread thread = createThread("/registry/components/", userSpace, "Test Component" + (i + 1000), shouldDelete,
    136132                    RegistryTestHelper.getComponentTestContent(), errors);
Note: See TracChangeset for help on using the changeset viewer.