2018-12-04 12:06:22 +01:00
package org.gcube.gcat.persistence.ckan ;
2020-06-22 15:39:37 +02:00
import java.io.StringWriter ;
import java.util.ArrayList ;
2019-01-10 12:29:47 +01:00
import java.util.HashMap ;
2020-06-22 15:39:37 +02:00
import java.util.List ;
2019-01-10 12:29:47 +01:00
import java.util.Map ;
2020-06-22 15:39:37 +02:00
import java.util.Set ;
2019-01-10 12:29:47 +01:00
2019-10-01 18:00:40 +02:00
import javax.ws.rs.BadRequestException ;
import javax.ws.rs.core.MultivaluedHashMap ;
import javax.ws.rs.core.MultivaluedMap ;
2020-06-22 15:39:37 +02:00
import org.gcube.common.authorization.client.exceptions.ObjectNotFound ;
import org.gcube.common.resources.gcore.GenericResource ;
import org.gcube.common.resources.gcore.Resources ;
import org.gcube.common.scope.impl.ScopeBean ;
2018-12-04 12:06:22 +01:00
import org.gcube.gcat.ContextTest ;
2019-10-01 18:00:40 +02:00
import org.gcube.gcat.api.GCatConstants ;
2020-06-22 15:39:37 +02:00
import org.gcube.informationsystem.publisher.RegistryPublisher ;
import org.gcube.informationsystem.publisher.RegistryPublisherFactory ;
2018-12-04 12:06:22 +01:00
import org.junit.Assert ;
import org.junit.Test ;
import org.slf4j.Logger ;
import org.slf4j.LoggerFactory ;
import com.fasterxml.jackson.databind.JsonNode ;
import com.fasterxml.jackson.databind.ObjectMapper ;
import com.fasterxml.jackson.databind.node.ArrayNode ;
import com.fasterxml.jackson.databind.node.ObjectNode ;
/ * *
* @author Luca Frosini ( ISTI - CNR )
* /
public class CKANPackageTest extends ContextTest {
private static Logger logger = LoggerFactory . getLogger ( CKANPackageTest . class ) ;
private static final String NOTES_KEY = " notes " ;
private static final String URL_KEY = " url " ;
private static final String PRIVATE_KEY = " private " ;
private static final String ITEM_NAME_VALUE = " restful_transaction_model " ;
private static final String LICENSE_VALUE = " CC-BY-SA-4.0 " ;
2019-05-20 17:23:49 +02:00
private static final String EXTRAS_TYPE_VALUE_VALUE = " TestEmptyProfile " ;
2018-12-04 12:06:22 +01:00
@Test
public void list ( ) throws Exception {
CKANPackage ckanPackage = new CKANPackage ( ) ;
ObjectMapper mapper = new ObjectMapper ( ) ;
2019-10-01 18:00:40 +02:00
String ret = ckanPackage . list ( 10 , 0 ) ;
2018-12-04 12:06:22 +01:00
JsonNode gotList = mapper . readTree ( ret ) ;
Assert . assertTrue ( gotList instanceof ArrayNode ) ;
logger . debug ( " List : \ n{} " , mapper . writeValueAsString ( gotList ) ) ;
}
2019-10-01 18:00:40 +02:00
@Test
public void listWithParameters ( ) throws Exception {
CKANPackage ckanPackage = new CKANPackage ( ) ;
ObjectMapper mapper = new ObjectMapper ( ) ;
Map < String , String > parameters = new HashMap < > ( ) ;
parameters . put ( GCatConstants . Q_KEY , " organization:ckand4scienceharvest OR organization:dorne " ) ;
// parameters.put(GCatConstants.Q_KEY, "organization:ckand4scienceharvest");
// parameters.put(GCatConstants.Q_KEY, "organization:dorne");
parameters . put ( CKANPackage . ROWS_KEY , String . valueOf ( 10 ) ) ;
parameters . put ( CKANPackage . START_KEY , String . valueOf ( 0 ) ) ;
2019-10-04 14:16:51 +02:00
/ *
parameters . put ( " fl " , " [ \" name \" ] " ) ;
* /
/ *
parameters . put ( " facet.field " , " [ \" name \" ] " ) ;
parameters . put ( " sort " , " name asc " ) ;
* /
2019-10-01 18:00:40 +02:00
String ret = ckanPackage . list ( parameters ) ;
JsonNode gotList = mapper . readTree ( ret ) ;
Assert . assertTrue ( gotList instanceof ArrayNode ) ;
logger . debug ( " List : \ n{} " , mapper . writeValueAsString ( gotList ) ) ;
}
2020-06-22 15:39:37 +02:00
protected GenericResource instantiateGenericResource ( String secondaryType , String name , String xml ) throws Exception {
GenericResource genericResource = new GenericResource ( ) ;
org . gcube . common . resources . gcore . GenericResource . Profile profile = genericResource . newProfile ( ) ;
profile . type ( secondaryType ) ;
profile . name ( name ) ;
profile . description ( " This resource is read by gCat and define the list of CKAN organizations where a client is allowed to publish for the current context " ) ;
profile . newBody ( xml ) ;
StringWriter stringWriter = new StringWriter ( ) ;
Resources . marshal ( genericResource , stringWriter ) ;
logger . debug ( " The generated {} is \ n{} " , GenericResource . class . getSimpleName ( ) , stringWriter . toString ( ) ) ;
return genericResource ;
}
protected void createGenericResource ( String xml ) throws Exception {
GenericResource genericResource = instantiateGenericResource (
CKANPackage . GENERIC_RESOURCE_SECONDARY_TYPE_FOR_ORGANIZATIONS ,
CKANPackage . GENERIC_RESOURCE_NAME_FOR_ORGANIZATIONS , xml ) ;
RegistryPublisher registryPublisher = RegistryPublisherFactory . create ( ) ;
genericResource = registryPublisher . create ( genericResource ) ;
StringWriter stringWriter = new StringWriter ( ) ;
Resources . marshal ( genericResource , stringWriter ) ;
logger . trace ( " The {} with ID {} has been created \ n{} " , GenericResource . class . getSimpleName ( ) ,
genericResource . id ( ) , stringWriter . toString ( ) ) ;
}
protected String createXMLFragment ( List < String > organizations ) throws Exception {
if ( organizations = = null | | organizations . size ( ) < 1 ) {
throw new Exception ( " Unable to create the XML fragment for the generic resource with empty organization list " ) ;
}
StringWriter stringWriter = new StringWriter ( ) ;
stringWriter . append ( " < " ) ;
stringWriter . append ( CKANPackage . GENERIC_RESOURCE_TAG_NAME_PLURAL ) ;
stringWriter . append ( " > " ) ;
for ( String organizationName : organizations ) {
stringWriter . append ( " < " ) ;
stringWriter . append ( CKANPackage . GENERIC_RESOURCE_TAG_NAME ) ;
stringWriter . append ( " > " ) ;
stringWriter . append ( organizationName ) ;
stringWriter . append ( " </ " ) ;
stringWriter . append ( CKANPackage . GENERIC_RESOURCE_TAG_NAME ) ;
stringWriter . append ( " > " ) ;
}
stringWriter . append ( " </ " ) ;
stringWriter . append ( CKANPackage . GENERIC_RESOURCE_TAG_NAME_PLURAL ) ;
stringWriter . append ( " > " ) ;
return stringWriter . toString ( ) ;
}
protected void createGenericResourceForSupportedOrganizations ( List < String > organizations ) throws Exception {
String xml = createXMLFragment ( organizations ) ;
createGenericResource ( xml ) ;
}
// @Test
public void createGenericResourceForSupportedOrganizationsByName ( ) throws Exception {
List < String > organizations = new ArrayList < > ( ) ;
organizations . add ( " nextnext " ) ;
organizations . add ( " devvre " ) ;
createGenericResourceForSupportedOrganizations ( organizations ) ;
}
// @Test
public void createGenericResourceForSupportedOrganizationsByScopeBean ( ) throws Exception {
ContextTest . setContextByName ( " /gcube/devNext/NextNext " ) ;
List < ScopeBean > scopeBeans = new ArrayList < > ( ) ;
scopeBeans . add ( new ScopeBean ( " /gcube/devNext/NextNext " ) ) ;
scopeBeans . add ( new ScopeBean ( " /gcube/devsec/devVRE " ) ) ;
List < String > organizations = new ArrayList < > ( ) ;
for ( ScopeBean scopeBean : scopeBeans ) {
organizations . add ( CKANPackage . getOrganizationName ( scopeBean ) ) ;
}
createGenericResourceForSupportedOrganizations ( organizations ) ;
}
@Test
public void testGetSupportedOrganizationsFromIS ( ) throws ObjectNotFound , Exception {
ContextTest . setContextByName ( " /gcube/devNext/NextNext " ) ;
CKANPackage ckanPackage = new CKANPackage ( ) ;
Set < String > organizations = ckanPackage . getSupportedOrganizationsFromIS ( ) ;
Assert . assertTrue ( organizations . size ( ) > 0 ) ;
}
2019-10-01 18:00:40 +02:00
@Test ( expected = BadRequestException . class )
public void checkParameter ( ) throws Exception {
Map < String , String > parameters = new HashMap < > ( ) ;
CKANPackage ckanPackage = new CKANPackage ( ) ;
MultivaluedMap < String , String > queryParameters = new MultivaluedHashMap < > ( ) ;
queryParameters . add ( GCatConstants . Q_KEY , " organization:nextnext OR organization:devsec " ) ;
parameters = ckanPackage . checkListParameters ( queryParameters , parameters ) ;
logger . debug ( " {} " , parameters ) ;
}
2018-12-04 12:06:22 +01:00
/ *
2019-01-10 12:29:47 +01:00
* PRE
*
2018-12-04 12:06:22 +01:00
* Workspace ( luca . frosini ) > RESTful Transaction Model . pdf
2019-01-10 12:29:47 +01:00
* https : //data1-d.d4science.org/shub/E_YjI4STdKKzRlNjgzMm9jQWxjcmtReDNwbDFYR3lpTHo3SjdtN1RDZ3c2OGk0ZHZhdE5iZElBKzNxUDAyTGFqZw==
* https : //goo.gl/HcUWni
2018-12-04 12:06:22 +01:00
*
*
* Workspace ( luca . frosini ) > RESTful Transaction Model v 1 . 0 . pdf
2019-01-10 12:29:47 +01:00
* https : //data1-d.d4science.org/shub/E_aThRa1NpWFJpTGEydEU2bEJhMXNjZy8wK3BxekJKYnpYTy81cUkwZVdicEZ0aGFRZmY4MkRnUC8xWW0zYzVoVg==
* https : //goo.gl/J8AwQW
2018-12-04 12:06:22 +01:00
*
*
* Workspace ( luca . frosini ) > RESTful Transaction Model v 1 . 1 . pdf
2019-01-10 12:29:47 +01:00
* https : //data1-d.d4science.org/shub/E_NkhrbVV4VTluT0RKVUtCRldobFZTQU5ySTZneFdpUzJ2UjJBNlZWNDlURDVHamo4WjY5RnlrcHZGTGNkT2prUg==
* https : //goo.gl/78ViuR
2018-12-04 12:06:22 +01:00
*
* /
2019-01-10 12:29:47 +01:00
@Test
public void testNameRegex ( ) {
2019-09-16 14:50:08 +02:00
Map < String , Boolean > stringsToTest = new HashMap < > ( ) ;
2019-01-10 12:29:47 +01:00
stringsToTest . put ( " Test " , false ) ; // Fails for T
stringsToTest . put ( " test-test+test-test " , false ) ; // Fails for +
stringsToTest . put ( " t " , false ) ; // Fails because is too short. Min length is 2 characters
stringsToTest . put ( " te " , true ) ;
stringsToTest . put ( " test-test_test-test " , true ) ;
2019-09-16 14:50:08 +02:00
stringsToTest . put (
" test-test_test-test_test-test_test-test_test-test_test-test_test-test_test-test_test-test_test-test_ " ,
true ) ;
2019-01-10 12:29:47 +01:00
// // Fails because is too long. Max length is 100 characters
2019-09-16 14:50:08 +02:00
stringsToTest . put (
" test-test_test-test_test-test_test-test_test-test_test-test_test-test_test-test_test-test_test-test_t " ,
false ) ;
2019-01-10 12:29:47 +01:00
for ( String testString : stringsToTest . keySet ( ) ) {
boolean match = testString . matches ( CKANPackage . NAME_REGEX ) ;
logger . debug ( " '{}' does {}match the regex {} " , testString , match ? " " : " NOT " , CKANPackage . NAME_REGEX ) ;
Assert . assertEquals ( stringsToTest . get ( testString ) , match ) ;
}
}
2018-12-04 12:06:22 +01:00
protected CKANPackage createPackage ( ObjectMapper mapper ) throws Exception {
ObjectNode itemObjectNode = mapper . createObjectNode ( ) ;
itemObjectNode . put ( CKAN . NAME_KEY , ITEM_NAME_VALUE ) ;
itemObjectNode . put ( CKANPackage . TITLE_KEY , " RESTful Transaction Model " ) ;
itemObjectNode . put ( CKANPackage . LICENSE_KEY , LICENSE_VALUE ) ;
itemObjectNode . put ( PRIVATE_KEY , false ) ;
itemObjectNode . put ( NOTES_KEY , " A research of Luca Frosini " ) ;
itemObjectNode . put ( URL_KEY , " http://www.d4science.org " ) ;
2020-06-22 15:51:11 +02:00
// itemObjectNode.put(CKANPackage.OWNER_ORG_KEY, "devvre");
2018-12-04 12:06:22 +01:00
ArrayNode tagArrayNode = itemObjectNode . putArray ( CKANPackage . TAGS_KEY ) ;
ObjectNode tagNode = mapper . createObjectNode ( ) ;
tagNode . put ( CKANPackage . NAME_KEY , " REST " ) ;
tagArrayNode . add ( tagNode ) ;
2019-05-20 17:23:49 +02:00
/ *
2018-12-04 12:06:22 +01:00
ArrayNode resourceArrayNode = itemObjectNode . putArray ( CKANPackage . RESOURCES_KEY ) ;
ObjectNode resourceNode = mapper . createObjectNode ( ) ;
resourceNode . put ( CKANResource . NAME_KEY , " RESTful Transaction Model " ) ;
// Workspace(luca.frosini) > RESTful Transaction Model v 1.0.pdf
2019-01-10 12:29:47 +01:00
resourceNode . put ( CKANResource . URL_KEY , " https://goo.gl/J8AwQW " ) ;
2018-12-04 12:06:22 +01:00
resourceArrayNode . add ( resourceNode ) ;
2019-05-20 17:23:49 +02:00
* /
2018-12-04 12:06:22 +01:00
2019-02-08 12:04:20 +01:00
ArrayNode extraArrayNode = itemObjectNode . putArray ( CKANPackage . EXTRAS_KEY ) ;
2019-02-27 11:26:13 +01:00
ObjectNode typeNode = mapper . createObjectNode ( ) ;
typeNode . put ( CKANPackage . EXTRAS_KEY_KEY , CKANPackage . EXTRAS_KEY_VALUE_SYSTEM_TYPE ) ;
typeNode . put ( CKANPackage . EXTRAS_VALUE_KEY , EXTRAS_TYPE_VALUE_VALUE ) ;
extraArrayNode . add ( typeNode ) ;
ObjectNode modelNode = mapper . createObjectNode ( ) ;
2019-02-27 17:36:09 +01:00
modelNode . put ( CKANPackage . EXTRAS_KEY_KEY , " test " ) ;
2019-05-20 17:23:49 +02:00
modelNode . put ( CKANPackage . EXTRAS_VALUE_KEY , " test 2.9° " ) ;
2019-02-27 11:26:13 +01:00
extraArrayNode . add ( modelNode ) ;
ObjectNode populationNode = mapper . createObjectNode ( ) ;
populationNode . put ( CKANPackage . EXTRAS_KEY_KEY , " Population " ) ;
populationNode . put ( CKANPackage . EXTRAS_VALUE_KEY , " Italian " ) ;
extraArrayNode . add ( populationNode ) ;
2018-12-04 12:06:22 +01:00
CKANPackage ckanPackage = new CKANPackage ( ) ;
ckanPackage . setName ( ITEM_NAME_VALUE ) ;
//ckanPackage.setApiKey(CKANUtility.getSysAdminAPI());
String createdItem = ckanPackage . create ( mapper . writeValueAsString ( itemObjectNode ) ) ;
logger . debug ( createdItem ) ;
return ckanPackage ;
}
@Test
public void create ( ) throws Exception {
2020-06-22 15:39:37 +02:00
ContextTest . setContextByName ( " /gcube/devNext/NextNext " ) ;
2018-12-04 12:06:22 +01:00
ObjectMapper mapper = new ObjectMapper ( ) ;
createPackage ( mapper ) ;
}
2019-05-20 17:23:49 +02:00
@Test
public void testURIResolver ( ) {
CKANPackage ckanPackage = new CKANPackage ( ) ;
ckanPackage . setName ( " Test " ) ;
ObjectMapper objectMapper = new ObjectMapper ( ) ;
ObjectNode objectNode = objectMapper . createObjectNode ( ) ;
ckanPackage . addItemURLViaResolver ( objectNode ) ;
}
2018-12-04 12:06:22 +01:00
@Test
public void createReadUpdateUpdatePurge ( ) throws Exception {
ObjectMapper mapper = new ObjectMapper ( ) ;
createPackage ( mapper ) ;
CKANPackage ckanPackage = new CKANPackage ( ) ;
ckanPackage . setName ( ITEM_NAME_VALUE ) ;
String readItem = ckanPackage . read ( ) ;
JsonNode readItemObjectNode = mapper . readTree ( readItem ) ;
String readID = readItemObjectNode . get ( CKANPackage . NAME_KEY ) . asText ( ) ;
Assert . assertNotNull ( readID ) ;
2019-09-16 14:50:08 +02:00
Assert . assertTrue ( ITEM_NAME_VALUE . compareTo ( readID ) = = 0 ) ;
2018-12-04 12:06:22 +01:00
String updatedNotes = " A research of Luca Frosini made during the PhD " ;
( ( ObjectNode ) readItemObjectNode ) . put ( NOTES_KEY , updatedNotes ) ;
ArrayNode resources = ( ArrayNode ) readItemObjectNode . get ( CKANPackage . RESOURCES_KEY ) ;
ObjectNode objectNode = ( ObjectNode ) resources . get ( 0 ) ;
// Workspace(luca.frosini) > RESTful Transaction Model v 1.1.pdf
2019-01-10 12:29:47 +01:00
objectNode . put ( CKANResource . URL_KEY , " https://goo.gl/78ViuR " ) ;
2018-12-04 12:06:22 +01:00
resources . set ( 0 , objectNode ) ;
( ( ObjectNode ) readItemObjectNode ) . replace ( CKANPackage . RESOURCES_KEY , resources ) ;
2019-09-16 14:50:08 +02:00
ckanPackage = new CKANPackage ( ) ;
2018-12-04 12:06:22 +01:00
ckanPackage . setName ( ITEM_NAME_VALUE ) ;
String updatedItem = ckanPackage . update ( mapper . writeValueAsString ( readItemObjectNode ) ) ;
logger . trace ( updatedItem ) ;
JsonNode updatedItemObjectNode = mapper . readTree ( updatedItem ) ;
String gotUpdatedNotes = updatedItemObjectNode . get ( NOTES_KEY ) . asText ( ) ;
2019-09-16 14:50:08 +02:00
Assert . assertTrue ( gotUpdatedNotes . compareTo ( updatedNotes ) = = 0 ) ;
2018-12-04 12:06:22 +01:00
2019-09-16 14:50:08 +02:00
ckanPackage = new CKANPackage ( ) ;
2018-12-04 12:06:22 +01:00
ckanPackage . setName ( ITEM_NAME_VALUE ) ;
( ( ObjectNode ) updatedItemObjectNode ) . remove ( CKANPackage . RESOURCES_KEY ) ;
String secondUpdateItem = ckanPackage . update ( mapper . writeValueAsString ( updatedItemObjectNode ) ) ;
logger . trace ( secondUpdateItem ) ;
/ *
ObjectNode patchObjectNode = mapper . createObjectNode ( ) ;
String patchedNotes = updatedNotes + " in October 2018 " ;
patchObjectNode . put ( NOTES_KEY , patchedNotes ) ;
patchObjectNode . put ( CKANPackage . NAME_KEY , ITEM_NAME_VALUE ) ;
ckanPackage = new CKANPackage ( ) ;
ckanPackage . setName ( ITEM_NAME_VALUE ) ;
String patchedItem = ckanPackage . patch ( mapper . writeValueAsString ( patchObjectNode ) ) ;
logger . trace ( patchedItem ) ;
JsonNode patchedItemObjectNode = mapper . readTree ( patchedItem ) ;
String gotPatchedNotes = patchedItemObjectNode . get ( NOTES_KEY ) . asText ( ) ;
Assert . assertTrue ( gotPatchedNotes . compareTo ( patchedNotes ) = = 0 ) ;
* /
2019-09-16 14:50:08 +02:00
ckanPackage = new CKANPackage ( ) ;
2018-12-04 12:06:22 +01:00
ckanPackage . setName ( ITEM_NAME_VALUE ) ;
ckanPackage . purge ( ) ;
logger . debug ( " Item {} purge successfully " , ITEM_NAME_VALUE ) ;
}
@Test
//(expected = NotFoundException.class)
public void read ( ) throws Exception {
CKANPackage ckanPackage = new CKANPackage ( ) ;
ckanPackage . setName ( ITEM_NAME_VALUE ) ;
String ret = ckanPackage . read ( ) ;
logger . debug ( ret ) ;
}
@Test
//(expected = NotFoundException.class)
public void delete ( ) throws Exception {
CKANPackage ckanPackage = new CKANPackage ( ) ;
ckanPackage . setName ( ITEM_NAME_VALUE ) ;
ckanPackage . delete ( true ) ;
}
2020-02-04 09:45:26 +01:00
@Test
public void testUpdate ( ) {
CKANPackage ckanPackage = new CKANPackage ( ) ;
ckanPackage . setName ( " knime_workflow_with_joined_consumer_phase_and_dose_response_model " ) ;
ckanPackage . update ( " { \" rating \" :0.0, \" license_title \" : \" Academic Free License 3.0 \" , \" maintainer \" : \" \" , \" relationships_as_object \" :[], \" private \" :false, \" maintainer_email \" : \" \" , \" num_tags \" :5, \" id \" : \" f4292d0e-c94f-4542-bfa3-25f78638fc1b \" , \" metadata_created \" : \" 2020-01-07T16:40:16.987780 \" , \" owner_org \" : \" 3571cca5-b0ae-4dc6-b791-434a8e062ce5 \" , \" metadata_modified \" : \" 2020-02-03T14:24:59.221160 \" , \" author \" : \" Buschhardt Tasja \" , \" author_email \" : \" tasja.buschhardt@bfr.bund.de \" , \" state \" : \" active \" , \" version \" : \" 1 \" , \" license_id \" : \" AFL-3.0 \" , \" type \" : \" dataset \" , \" resources \" :[{ \" cache_last_updated \" :null, \" cache_url \" :null, \" mimetype_inner \" :null, \" hash \" : \" \" , \" description \" : \" \" , \" format \" : \" knwf \" , \" url \" : \" https://data.d4science.net/g9QY \" , \" created \" : \" 2019-09-16T20:49:02.168666 \" , \" state \" : \" active \" , \" package_id \" : \" f4292d0e-c94f-4542-bfa3-25f78638fc1b \" , \" last_modified \" :null, \" mimetype \" :null, \" url_type \" :null, \" position \" :0, \" revision_id \" : \" a84a35ec-2786-4835-9f50-ad52202c4e33 \" , \" size \" :null, \" datastore_active \" :false, \" id \" : \" 0734b380-ea5d-4c99-be03-c38ff6ae6fbf \" , \" resource_type \" :null, \" name \" : \" KNIME_WF_ICPMF11 \" }], \" num_resources \" :1, \" tags \" :[{ \" vocabulary_id \" :null, \" state \" : \" active \" , \" display_name \" : \" Campylobacter \" , \" id \" : \" 84c76669-d135-4c5e-9e3a-b163689a10de \" , \" name \" : \" Campylobacter \" },{ \" vocabulary_id \" :null, \" state \" : \" active \" , \" display_name \" : \" KNIME workflow \" , \" id \" : \" 30bce4d2-fc45-46ab-8f8b-5da582fff3c3 \" , \" name \" : \" KNIME workflow \" },{ \" vocabulary_id \" :null, \" state \" : \" active \" , \" display_name \" : \" chicken meat \" , \" id \" : \" f1aac698-a865-4bf4-ac55-b53f8bf7ecac \" , \" name \" : \" chicken meat \" },{ \" vocabulary_id \" :null, \" state \" : \" active \" , \" display_name \" : \" consumer phase model \" , \" id \" : \" 9e6b2337-9ac0-4bfc-8e7f-4327c531bbec \" , \" name \" : \" consumer phase model \" },{ \" vocabulary_id \" :null, \" state \" : \" active \" , \" display_name \" : \" dose response model \" , \" id \" : \" 21311c09-a928-4a9a-83de-7ef98b257af5 \" , \" name \" : \" dose response model \" }], \" groups \" :[], \" creator_user_id \" : \" 7020f836-45f4-4ee8-9c65-e7504209644f \" , \" relationships_as_subject \" :[], \" name \" : \" knime_workflow_with_joined_consumer_phase_and_dose_response_model \" , \" isopen \" :true, \" url \" : \" \" , \" notes \" : \" This KNIME workflow shows how to use FSK-Lab to read, customise, run, \\ r \\ ncombine and change simulation settings for food safety models- specifically \\ r \\ nthis workflow exemplifies a joined consumer phase model for Campylobacter \\ r \\ nin chicken meat and a dose response model for Campylobacter \" , \" title \" : \" KNIME workflow with joined consumer phase and dose response model \" , \" extras \" :[{ \" value \" : \" \" , \" key \" : \" Author \" },{ \" value \" : \" http://data.d4science.org/ctlg/RAKIP_trial/knime_workflow_with_joined_consumer_phase_and_dose_response_model \" , \" key \" : \" Item URL \" },{ \" value \" : \" ResearchObject \" , \" key \" : \" system:type \" },{ \" value \" : \" { \\ \" relatedIdentifierType \\ \" : \\ \" URL \\ \" , \\ \" relationType \\ \" : \\ \" isReferencedBy \\ \" , \\ \" link \\ \" : \\ \" https://doi.org/10.5072/zenodo.488235 \\ \" , \\ \" zenodoId \\ \" :488235} \" , \" key \" : \" relatedIdentifier:Zenodo.DOI \" }], \" license_url \" : \" http://www.opensource.org/licenses/AFL-3.0 \" , \" ratings_count \" :0, \" organization \" :{ \" description \" : \" \" , \" title \" : \" devVRE \" , \" created \" : \" 2016-05-30T11:30:41.710079 \" , \" approval_status \" : \" approved \" , \" is_organization \" :true, \" state \" : \" active \" , \" image_url \" : \" \" , \" revision_id \" : \" 7c8463df-ed3f-4d33-87d8-6c0bcbe30d5d \" , \" type \" : \" organization \" , \" id \" : \" 3571cca5-b0ae-4dc6-b791-434a8e062ce5 \" , \" name \" : \" devvre \" }, \" revision_id \" : \" 9f51fa28-0732-46c9-a208-9a0e6da0cd2c \" } " ) ;
}
@Test
public void testUpdate2 ( ) {
CKANPackage ckanPackage = new CKANPackage ( ) ;
ckanPackage . setName ( " vre_picture " ) ;
ckanPackage . update ( " { \" rating \" : 0.0, \" license_title \" : \" Academic Free License 3.0 \" , \" maintainer \" : \" Kerekes Kata \" , \" relationships_as_object \" : [], \" private \" : false, \" maintainer_email \" : \" kerekeska@nebih.gov.hu \" , \" num_tags \" : 1, \" id \" : \" 7731b70f-47ff-4b74-b943-188215e82d07 \" , \" metadata_created \" : \" 2020-01-07T16:40:24.822719 \" , \" owner_org \" : \" 3571cca5-b0ae-4dc6-b791-434a8e062ce5 \" , \" metadata_modified \" : \" 2020-02-03T15:16:42.596068 \" , \" author \" : \" Kerekes Kata \" , \" author_email \" : \" kerekeska@nebih.gov.hu \" , \" state \" : \" active \" , \" version \" : \" 1 \" , \" license_id \" : \" AFL-3.0 \" , \" type \" : \" dataset \" , \" resources \" : [{ \" cache_last_updated \" : null, \" cache_url \" : null, \" mimetype_inner \" : null, \" hash \" : \" \" , \" description \" : \" \" , \" format \" : \" JPEG \" , \" url \" : \" https://goo.gl/SnwAM7 \" , \" created \" : \" 2019-04-01T13:24:40.738838 \" , \" state \" : \" active \" , \" package_id \" : \" 7731b70f-47ff-4b74-b943-188215e82d07 \" , \" last_modified \" : null, \" mimetype \" : \" image/jpeg \" , \" url_type \" : null, \" position \" : 0, \" revision_id \" : \" 06d61000-a0c1-4155-ad2d-78ede56d6bb5 \" , \" size \" : null, \" datastore_active \" : false, \" id \" : \" 1de8851d-1385-47ae-9c93-6040d170a9cc \" , \" resource_type \" : null, \" name \" : \" th.jpeg \" }], \" num_resources \" : 1, \" tags \" : [{ \" vocabulary_id \" : null, \" state \" : \" active \" , \" display_name \" : \" DEMETER \" , \" id \" : \" 4e05058b-a006-4dbf-94f5-277a30318323 \" , \" name \" : \" DEMETER \" }], \" groups \" : [], \" creator_user_id \" : \" 7020f836-45f4-4ee8-9c65-e7504209644f \" , \" relationships_as_subject \" : [], \" name \" : \" vre_picture \" , \" isopen \" : true, \" url \" : \" \" , \" notes \" : \" This is a nice picture of a VRE ;) \" , \" title \" : \" VRE picture \" , \" extras \" : [{ \" value \" : \" http://data.d4science.org/ctlg/DEMETER_trial/vre_picture \" , \" key \" : \" Item URL \" }, { \" value \" : \" ResearchObject \" , \" key \" : \" system:type \" }], \" license_url \" : \" http://www.opensource.org/licenses/AFL-3.0 \" , \" ratings_count \" : 0, \" organization \" : { \" description \" : \" \" , \" title \" : \" devVRE \" , \" created \" : \" 2016-05-30T11:30:41.710079 \" , \" approval_status \" : \" approved \" , \" is_organization \" : true, \" state \" : \" active \" , \" image_url \" : \" \" , \" revision_id \" : \" 7c8463df-ed3f-4d33-87d8-6c0bcbe30d5d \" , \" type \" : \" organization \" , \" id \" : \" 3571cca5-b0ae-4dc6-b791-434a8e062ce5 \" , \" name \" : \" devvre \" }, \" revision_id \" : \" bdb6169a-6268-43d6-b7e1-265c0c9e1a1c \" } " ) ;
}
2018-12-04 12:06:22 +01:00
}