Changeset 5556 for ComponentRegistry/trunk/ComponentRegistry/src/test/java/clarin/cmdi/componentregistry/rest/RegistryTestHelper.java
- Timestamp:
- 08/18/14 09:50:16 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
ComponentRegistry/trunk/ComponentRegistry/src/test/java/clarin/cmdi/componentregistry/rest/RegistryTestHelper.java
r5553 r5556 49 49 return addComponent(testRegistry, id, getComponentTestContent(), isPublic); 50 50 } 51 51 52 52 53 public static ComponentDescription addComponent(ComponentRegistry testRegistry, String id, String content, boolean isPublic) throws ParseException, 53 54 JAXBException, UnsupportedEncodingException { … … 60 61 desc.setCreatorName(DummyPrincipal.DUMMY_CREDENTIALS.getDisplayName()); 61 62 desc.setUserId(DummyPrincipal.DUMMY_PRINCIPAL.getName()); 63 desc.setName(id); 64 desc.setDescription("Test Description"); 65 desc.setId(ComponentDescription.COMPONENT_PREFIX + id); 66 desc.setHref("link:" + desc.getId()); 67 desc.setPublic(isPublic); 68 CMDComponentSpec spec = marshaller.unmarshal(CMDComponentSpec.class, content, marshaller.getCMDComponentSchema()); 69 testRegistry.register(desc, spec); 70 return desc; 71 } 72 73 public static ComponentDescription addComponentAnotherPrincipal(ComponentRegistry testRegistry, String id, boolean isPublic) throws ParseException, JAXBException { 74 return addComponentAnotherPrincipal(testRegistry, id, getComponentTestContent(), isPublic); 75 } 76 77 private static ComponentDescription addComponentAnotherPrincipal(ComponentRegistry testRegistry, String id, InputStream content, boolean isPublic) throws ParseException, 78 JAXBException { 79 ComponentDescription desc = ComponentDescription.createNewDescription(); 80 desc.setCreatorName("AnotherPrincipal"); 81 desc.setUserId("AnotherPrincipal"); 82 desc.setDbUserId(2); 62 83 desc.setName(id); 63 84 desc.setDescription("Test Description"); … … 121 142 desc.setCreatorName(DummyPrincipal.DUMMY_CREDENTIALS.getDisplayName()); 122 143 desc.setUserId(DummyPrincipal.DUMMY_CREDENTIALS.getPrincipalName()); 144 desc.setName(id); 145 desc.setDescription("Test Description"); 146 desc.setId(ProfileDescription.PROFILE_PREFIX + id); 147 desc.setHref("link:" + ProfileDescription.PROFILE_PREFIX + id); 148 desc.setPublic(isPublic); 149 CMDComponentSpec spec = marshaller.unmarshal(CMDComponentSpec.class, content, marshaller.getCMDComponentSchema()); 150 testRegistry.register(desc, spec); 151 return desc; 152 } 153 154 public static ProfileDescription addProfileAnotherPrincipal(ComponentRegistry testRegistry, String id, boolean isPublic) throws ParseException, JAXBException, ItemNotFoundException { 155 return addProfileAnotherPrincipal(testRegistry, id, RegistryTestHelper.getTestProfileContent(), isPublic); 156 } 157 158 private static ProfileDescription addProfileAnotherPrincipal(ComponentRegistry testRegistry, String id, InputStream content, boolean isPublic) throws ParseException, 159 JAXBException, ItemNotFoundException { 160 ProfileDescription desc = ProfileDescription.createNewDescription(); 161 desc.setCreatorName("AnotherPrincipal"); 162 desc.setUserId("AnotherPrincipal"); 163 desc.setDbUserId(2); 123 164 desc.setName(id); 124 165 desc.setDescription("Test Description");
Note: See TracChangeset
for help on using the changeset viewer.