diff --git a/lib/galaxy/tools/parameters/basic.py b/lib/galaxy/tools/parameters/basic.py
index a918aecd126..5004e0f2d0d 100644
--- a/lib/galaxy/tools/parameters/basic.py
+++ b/lib/galaxy/tools/parameters/basic.py
@@ -2152,6 +2152,7 @@ class DataCollectionToolParameter( BaseDataToolParameter ):
return field
def from_json( self, value, trans, other_values={} ):
+ rval = None
if trans.workflow_building_mode is workflow_building_modes.ENABLED:
return None
if not value and not self.optional:
diff --git a/lib/galaxy/tools/wrappers.py b/lib/galaxy/tools/wrappers.py
index 0acf136163a..6d203ee3860 100644
--- a/lib/galaxy/tools/wrappers.py
+++ b/lib/galaxy/tools/wrappers.py
@@ -365,7 +365,7 @@ class DatasetCollectionWrapper( ToolParameterValueWrapper, HasDatasets ):
if dataset_collection_element.is_collection:
element_wrapper = DatasetCollectionWrapper(job_working_directory, dataset_collection_element, dataset_paths, **kwargs )
else:
- element_wrapper = self._dataset_wrapper( element_object, dataset_paths, **kwargs)
+ element_wrapper = self._dataset_wrapper( element_object, dataset_paths, identifier=element_identifier, **kwargs)
element_instances[element_identifier] = element_wrapper
element_instance_list.append( element_wrapper )
diff --git a/test/api/test_tools.py b/test/api/test_tools.py
index 5f37d07db05..82e310b06a9 100644
--- a/test/api/test_tools.py
+++ b/test/api/test_tools.py
@@ -1,5 +1,6 @@
# Test tools API.
from base import api
+import json
from operator import itemgetter
from .helpers import DatasetPopulator
from .helpers import DatasetCollectionPopulator
@@ -805,6 +806,38 @@ class ToolsTestCase( api.ApiTestCase ):
output1_content = self.dataset_populator.get_history_dataset_content( history_id, dataset=output1 )
self.assertEquals( output1_content.strip(), "Pasted Entry\nPasted Entry" )
+ @skip_without_tool( "identifier_collection" )
+ def test_identifier_with_data_collection( self ):
+ history_id = self.dataset_populator.new_history()
+
+ element_identifiers = self.dataset_collection_populator.list_identifiers( history_id )
+
+ payload = dict(
+ instance_type="history",
+ history_id=history_id,
+ element_identifiers=json.dumps(element_identifiers),
+ collection_type="list",
+ )
+
+ create_response = self._post( "dataset_collections", payload )
+ dataset_collection = create_response.json()
+
+ inputs = {
+ "input1": {'src': 'hdca', 'id': dataset_collection['id']},
+ }
+
+ self.dataset_populator.wait_for_history( history_id, assert_ok=True )
+ create_response = self._run( "identifier_collection", history_id, inputs )
+ self._assert_status_code_is( create_response, 200 )
+ create = create_response.json()
+ outputs = create[ 'outputs' ]
+ jobs = create[ 'jobs' ]
+ self.assertEquals( len( jobs ), 1 )
+ self.assertEquals( len( outputs ), 1 )
+ output1 = outputs[ 0 ]
+ output1_content = self.dataset_populator.get_history_dataset_content( history_id, dataset=output1 )
+ self.assertEquals( output1_content.strip(), '\n'.join([d['name'] for d in element_identifiers]) )
+
@skip_without_tool( "cat1" )
def test_map_over_nested_collections( self ):
history_id = self.dataset_populator.new_history()
diff --git a/test/functional/tools/identifier_collection.xml b/test/functional/tools/identifier_collection.xml
new file mode 100644
index 00000000000..222302ebfce
--- /dev/null
+++ b/test/functional/tools/identifier_collection.xml
@@ -0,0 +1,15 @@
+
+
+ #for $input in $input1:
+ echo '$input.element_identifier' >> 'output1';
+ #end for
+
+
+
+
+
+
+
+
+
+
diff --git a/test/functional/tools/samples_tool_conf.xml b/test/functional/tools/samples_tool_conf.xml
index 5ec9446d0f2..035abf68203 100644
--- a/test/functional/tools/samples_tool_conf.xml
+++ b/test/functional/tools/samples_tool_conf.xml
@@ -64,6 +64,7 @@
+