Failed to deserialize exception response from stream - Grails ElasticSearch - grails

I have a simple Grails app, which I am trying to set upo to use ElasticSearch.
I have a single-node ElasticSearch instance running on EC2, which is running happily enough. (For reference, I just followed the steps here: http://www.elasticsearch.org/tutorials/elasticsearch-on-ec2/), but using 0.90.7 and the cloud-aws plugin version 1.15.0)
I am using the Grails ElasticSearch GORM plugin (http://grails.org/plugin/elasticsearch-gorm) (Master branch) and i'm connecting to ES using the transport client mode (elasticSearch.client.mode = 'transport')
Here's where it gets really odd...
The first time I boot up my app, it will happily index my Domain data on ES, I can query, etc, no problems.
If I then restart my grails app, it won't launch at all. I get
Message: Error creating bean with name 'searchableClassMappingConfigurator': Invocation of init method failed; nested exception is org.elasticsearch.transport.TransportSerializationException: Failed to deserialize exception response from stream
Line | Method
->> 262 | run in java.util.concurrent.FutureTask
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
| 615 | run . . . in java.util.concurrent.ThreadPoolExecutor$Worker
^ 724 | run in java.lang.Thread
Caused by TransportSerializationException: Failed to deserialize exception response from stream
->> 169 | handlerResponseError in org.elasticsearch.transport.netty.MessageChannelHandler
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 123 | messageReceived in ''
| 70 | handleUpstream in org.elasticsearch.common.netty.channel.SimpleChannelUpstreamHandler
| 564 | sendUpstream in org.elasticsearch.common.netty.channel.DefaultChannelPipeline
| 791 | sendUpstream in org.elasticsearch.common.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext
| 296 | fireMessageReceived in org.elasticsearch.common.netty.channel.Channels
| 462 | unfoldAndFireMessageReceived in org.elasticsearch.common.netty.handler.codec.frame.FrameDecoder
| 443 | callDecode in ''
| 310 | messageReceived in ''
| 70 | handleUpstream in org.elasticsearch.common.netty.channel.SimpleChannelUpstreamHandler
| 564 | sendUpstream in org.elasticsearch.common.netty.channel.DefaultChannelPipeline
| 559 | sendUpstream in ''
| 268 | fireMessageReceived in org.elasticsearch.common.netty.channel.Channels
| 255 | fireMessageReceived in ''
| 88 | read . . in org.elasticsearch.common.netty.channel.socket.nio.NioWorker
| 108 | process in org.elasticsearch.common.netty.channel.socket.nio.AbstractNioWorker
| 318 | run . . . in org.elasticsearch.common.netty.channel.socket.nio.AbstractNioSelector
| 89 | run in org.elasticsearch.common.netty.channel.socket.nio.AbstractNioWorker
| 178 | run . . . in org.elasticsearch.common.netty.channel.socket.nio.NioWorker
| 108 | run in org.elasticsearch.common.netty.util.ThreadRenamingRunnable
| 42 | run . . . in org.elasticsearch.common.netty.util.internal.DeadLockProofWorker$1
| 1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
| 615 | run . . . in java.util.concurrent.ThreadPoolExecutor$Worker
^ 724 | run in java.lang.Thread
Caused by StreamCorruptedException: unexpected end of block data
->> 1370 | readObject0 in java.io.ObjectInputStream
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 1989 | defaultReadFields in ''
| 499 | defaultReadObject in ''
| 914 | readObject in java.lang.Throwable
| 1017 | invokeReadObject in java.io.ObjectStreamClass
| 1891 | readSerialData in java.io.ObjectInputStream
| 1796 | readOrdinaryObject in ''
| 1348 | readObject0 in ''
| 1989 | defaultReadFields in ''
| 499 | defaultReadObject in ''
| 914 | readObject in java.lang.Throwable
| 1017 | invokeReadObject in java.io.ObjectStreamClass
| 1891 | readSerialData in java.io.ObjectInputStream
| 1796 | readOrdinaryObject in ''
| 1348 | readObject0 in ''
| 370 | readObject in ''
| 167 | handlerResponseError in org.elasticsearch.transport.netty.MessageChannelHandler
| 123 | messageReceived in ''
| 70 | handleUpstream in org.elasticsearch.common.netty.channel.SimpleChannelUpstreamHandler
| 564 | sendUpstream in org.elasticsearch.common.netty.channel.DefaultChannelPipeline
| 791 | sendUpstream in org.elasticsearch.common.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext
| 296 | fireMessageReceived in org.elasticsearch.common.netty.channel.Channels
| 462 | unfoldAndFireMessageReceived in org.elasticsearch.common.netty.handler.codec.frame.FrameDecoder
| 443 | callDecode in ''
| 310 | messageReceived in ''
| 70 | handleUpstream in org.elasticsearch.common.netty.channel.SimpleChannelUpstreamHandler
| 564 | sendUpstream in org.elasticsearch.common.netty.channel.DefaultChannelPipeline
| 559 | sendUpstream in ''
| 268 | fireMessageReceived in org.elasticsearch.common.netty.channel.Channels
| 255 | fireMessageReceived in ''
| 88 | read . . in org.elasticsearch.common.netty.channel.socket.nio.NioWorker
| 108 | process in org.elasticsearch.common.netty.channel.socket.nio.AbstractNioWorker
| 318 | run . . . in org.elasticsearch.common.netty.channel.socket.nio.AbstractNioSelector
| 89 | run in org.elasticsearch.common.netty.channel.socket.nio.AbstractNioWorker
| 178 | run . . . in org.elasticsearch.common.netty.channel.socket.nio.NioWorker
| 108 | run in org.elasticsearch.common.netty.util.ThreadRenamingRunnable
| 42 | run . . . in org.elasticsearch.common.netty.util.internal.DeadLockProofWorker$1
| 1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
| 615 | run . . . in java.util.concurrent.ThreadPoolExecutor$Worker
^ 724 | run in java.lang.Thread
This happens until I change the elasticSearch host details - ie, I can't boot my ap at all, with the original host details, ever again.
Both the ES node and my Grails app are both using elasticSearch 0.90.7, my config for the ES plugin looks like so:#
elasticSearch.client.mode = 'transport'
elasticSearch.client.hosts = [[host:'<my EC2 DNS>', port:9300]]
elasticSearch.datastoreImpl = 'mongoDatastore'
elasticSearch.client.transport.sniff = true
The only domain object I am marking as 'searchable' is mapped with mongoDB, which looks like so:
class CompletedApplicationFormSearchEntry {
static searchable = true
Long formId
Long jobId
Long employerId
Long jobseekerId
Date applicationDate
static mapWith = "mongo"
static constraints = {
}
}
If I remove the searchable attribute from the domain class, then relaunch the app, it launches fine, so I assume that there's something going on in the bootstrapping process when the domain object is detected as being searchable, but of course, it only causes an issue when the app's been restarted.
There are a handful of threads kicking about where people are seeing similar issue,s where they have nodes running different ES versions, different JVM version,s etc. But in this case, I only have one node!
I am absolutely tearing my hair out over this - I just can't work out what on earth's going wrong. I've tried different plugin versions, elasticsearch versions, 32-bit EC2 instance, 64bit EC2 instance - no luck!

Not with grails es plugin, but I fixed similar issue by fixing the jvm versions in ide ( used by the es client) to be the same as es master running on different jvm version.
STEP 0 : Make sure api and actual es version are identical.
STEP 1 : check jvm versions used by the es nodes
In following case, I had two different jvm versions, as pointed by "jvm" json key of both es nodes.
$ curl -XGET "http://localhost:9200/_nodes?jvm=true&pretty=true"
{
"cluster_name" : "elasticsearch",
"nodes" : {
"A6PDUvlWSN-zN2GKRxrSHA" : {
"name" : "Madeline Joyce",
"transport_address" : "inet[/192.168.1.4:9301]",
"host" : "prayagupd",
"ip" : "127.0.1.1",
"version" : "1.3.2",
"build" : "dee175d",
"http_address" : "inet[/192.168.1.4:9201]",
"settings" : {
"path" : {
"logs" : "/usr/local/elasticsearch-1.3.2/logs",
"home" : "/usr/local/elasticsearch-1.3.2"
},
"cluster" : {
"name" : "elasticsearch"
},
"http" : {
"port" : "9201"
},
"transport" : {
"tcp" : {
"port" : "9301"
}
},
"foreground" : "yes",
"name" : "Madeline Joyce"
},
"os" : {
"refresh_interval_in_millis" : 1000,
"available_processors" : 4,
"cpu" : {
"vendor" : "Intel",
"model" : "Core(TM) i5 CPU M 480 # 2.67GHz",
"mhz" : 2667,
"total_cores" : 4,
"total_sockets" : 4,
"cores_per_socket" : 16,
"cache_size_in_bytes" : 3072
},
"mem" : {
"total_in_bytes" : 3803283456
},
"swap" : {
"total_in_bytes" : 5998899200
}
},
"process" : {
"refresh_interval_in_millis" : 1000,
"id" : 9036,
"max_file_descriptors" : 4096,
"mlockall" : false
},
"jvm" : {
"pid" : 9036,
"version" : "1.7.0_65",
"vm_name" : "Java HotSpot(TM) 64-Bit Server VM",
"vm_version" : "24.65-b04",
"vm_vendor" : "Oracle Corporation",
"start_time_in_millis" : 1421578674811,
"mem" : {
"heap_init_in_bytes" : 268435456,
"heap_max_in_bytes" : 1038876672,
"non_heap_init_in_bytes" : 24313856,
"non_heap_max_in_bytes" : 136314880,
"direct_max_in_bytes" : 1038876672
},
"gc_collectors" : [ "ParNew", "ConcurrentMarkSweep" ],
"memory_pools" : [ "Code Cache", "Par Eden Space", "Par Survivor Space", "CMS Old Gen", "CMS Perm Gen" ]
},
"thread_pool" : {
"generic" : {
"type" : "cached",
"keep_alive" : "30s",
"queue_size" : -1
},
"index" : {
"type" : "fixed",
"min" : 4,
"max" : 4,
"queue_size" : "200"
},
"snapshot_data" : {
"type" : "scaling",
"min" : 1,
"max" : 5,
"keep_alive" : "5m",
"queue_size" : -1
},
"bench" : {
"type" : "scaling",
"min" : 1,
"max" : 2,
"keep_alive" : "5m",
"queue_size" : -1
},
"get" : {
"type" : "fixed",
"min" : 4,
"max" : 4,
"queue_size" : "1k"
},
"snapshot" : {
"type" : "scaling",
"min" : 1,
"max" : 2,
"keep_alive" : "5m",
"queue_size" : -1
},
"merge" : {
"type" : "scaling",
"min" : 1,
"max" : 2,
"keep_alive" : "5m",
"queue_size" : -1
},
"suggest" : {
"type" : "fixed",
"min" : 4,
"max" : 4,
"queue_size" : "1k"
},
"bulk" : {
"type" : "fixed",
"min" : 4,
"max" : 4,
"queue_size" : "50"
},
"optimize" : {
"type" : "fixed",
"min" : 1,
"max" : 1,
"queue_size" : -1
},
"warmer" : {
"type" : "scaling",
"min" : 1,
"max" : 2,
"keep_alive" : "5m",
"queue_size" : -1
},
"flush" : {
"type" : "scaling",
"min" : 1,
"max" : 2,
"keep_alive" : "5m",
"queue_size" : -1
},
"search" : {
"type" : "fixed",
"min" : 12,
"max" : 12,
"queue_size" : "1k"
},
"percolate" : {
"type" : "fixed",
"min" : 4,
"max" : 4,
"queue_size" : "1k"
},
"management" : {
"type" : "scaling",
"min" : 1,
"max" : 5,
"keep_alive" : "5m",
"queue_size" : -1
},
"refresh" : {
"type" : "scaling",
"min" : 1,
"max" : 2,
"keep_alive" : "5m",
"queue_size" : -1
}
},
"network" : {
"refresh_interval_in_millis" : 5000,
"primary_interface" : {
"address" : "192.168.1.4",
"name" : "eth0",
"mac_address" : "20:6A:8A:2A:24:E6"
}
},
"transport" : {
"bound_address" : "inet[/0:0:0:0:0:0:0:0%0:9301]",
"publish_address" : "inet[/192.168.1.4:9301]"
},
"http" : {
"bound_address" : "inet[/0:0:0:0:0:0:0:0%0:9201]",
"publish_address" : "inet[/192.168.1.4:9201]",
"max_content_length_in_bytes" : 104857600
},
"plugins" : [ ]
},
"TWNkkYYZSWe8NnrOPU57mQ" : {
"name" : "Scarlet Spider",
"transport_address" : "inet[/192.168.1.4:9300]",
"host" : "prayagupd",
"ip" : "127.0.1.1",
"version" : "1.3.2",
"build" : "dee175d",
"http_address" : "inet[/192.168.1.4:9200]",
"attributes" : {
"client" : "true",
"data" : "false"
},
"settings" : {
"path" : {
"data" : "/var/lib/elasticsearch",
"work" : "/tmp/elasticsearch",
"conf" : "/etc/elasticsearch",
"logs" : "/var/log/elasticsearch"
},
"cluster" : {
"name" : "elasticsearch"
},
"node" : {
"client" : "true"
},
"name" : "Scarlet Spider"
},
"os" : {
"refresh_interval_in_millis" : 1000,
"available_processors" : 4
},
"process" : {
"refresh_interval_in_millis" : 1000,
"id" : 11028,
"max_file_descriptors" : 4096,
"mlockall" : false
},
"jvm" : {
"pid" : 11028,
"version" : "1.7.0_05",
"vm_name" : "Java HotSpot(TM) 64-Bit Server VM",
"vm_version" : "23.1-b03",
"vm_vendor" : "Oracle Corporation",
"start_time_in_millis" : 1421580829189,
"mem" : {
"heap_init_in_bytes" : 59426304,
"heap_max_in_bytes" : 846331904,
"non_heap_init_in_bytes" : 24313856,
"non_heap_max_in_bytes" : 136314880,
"direct_max_in_bytes" : 846331904
},
"gc_collectors" : [ "PS Scavenge", "PS MarkSweep" ],
"memory_pools" : [ "Code Cache", "PS Eden Space", "PS Survivor Space", "PS Old Gen", "PS Perm Gen" ]
},
"thread_pool" : {
"generic" : {
"type" : "cached",
"keep_alive" : "30s",
"queue_size" : -1
},
"index" : {
"type" : "fixed",
"min" : 4,
"max" : 4,
"queue_size" : "200"
},
"snapshot_data" : {
"type" : "scaling",
"min" : 1,
"max" : 5,
"keep_alive" : "5m",
"queue_size" : -1
},
"bench" : {
"type" : "scaling",
"min" : 1,
"max" : 2,
"keep_alive" : "5m",
"queue_size" : -1
},
"get" : {
"type" : "fixed",
"min" : 4,
"max" : 4,
"queue_size" : "1k"
},
"snapshot" : {
"type" : "scaling",
"min" : 1,
"max" : 2,
"keep_alive" : "5m",
"queue_size" : -1
},
"merge" : {
"type" : "scaling",
"min" : 1,
"max" : 2,
"keep_alive" : "5m",
"queue_size" : -1
},
"suggest" : {
"type" : "fixed",
"min" : 4,
"max" : 4,
"queue_size" : "1k"
},
"bulk" : {
"type" : "fixed",
"min" : 4,
"max" : 4,
"queue_size" : "50"
},
"optimize" : {
"type" : "fixed",
"min" : 1,
"max" : 1,
"queue_size" : -1
},
"warmer" : {
"type" : "scaling",
"min" : 1,
"max" : 2,
"keep_alive" : "5m",
"queue_size" : -1
},
"flush" : {
"type" : "scaling",
"min" : 1,
"max" : 2,
"keep_alive" : "5m",
"queue_size" : -1
},
"search" : {
"type" : "fixed",
"min" : 12,
"max" : 12,
"queue_size" : "1k"
},
"percolate" : {
"type" : "fixed",
"min" : 4,
"max" : 4,
"queue_size" : "1k"
},
"management" : {
"type" : "scaling",
"min" : 1,
"max" : 5,
"keep_alive" : "5m",
"queue_size" : -1
},
"refresh" : {
"type" : "scaling",
"min" : 1,
"max" : 2,
"keep_alive" : "5m",
"queue_size" : -1
}
},
"network" : {
"refresh_interval_in_millis" : 5000
},
"transport" : {
"bound_address" : "inet[/0:0:0:0:0:0:0:0:9300]",
"publish_address" : "inet[/192.168.1.4:9300]"
},
"http" : {
"bound_address" : "inet[/0:0:0:0:0:0:0:0:9200]",
"publish_address" : "inet[/192.168.1.4:9200]",
"max_content_length_in_bytes" : 104857600
},
"plugins" : [ ]
}
}
}
STEP 2: update jvm version in ide (following shows for intellij ide)
Update to required jvm version, and add to project,
STEP 3 : Run both es nodes, the problem of TransportSerializationException should get fixed
$ curl -XGET "http://localhost:9200/_nodes?jvm=true&pretty=true"
{
"cluster_name": "elasticsearch",
"nodes": {
"GeRZFRiDSje8zLM_m90WRw": {
"name" : "Dougboy",
"jvm": {
"pid": 15223,
"version": "1.7.0_65",
"vm_name": "Java HotSpot(TM) 64-Bit Server VM",
"vm_version": "24.65-b04",
"vm_vendor": "Oracle Corporation",
"start_time_in_millis": 1421586819876,
"mem": {
"heap_init_in_bytes": 59426304,
"heap_max_in_bytes": 846200832,
"non_heap_init_in_bytes": 24576000,
"non_heap_max_in_bytes": 136314880,
"direct_max_in_bytes": 846200832
}
}
},
"A6PDUvlWSN-zN2GKRxrSHA": {
"name": "Madeline Joyce",
"jvm": {
"pid": 9036,
"version": "1.7.0_65",
"vm_name": "Java HotSpot(TM) 64-Bit Server VM",
"vm_version": "24.65-b04",
"vm_vendor": "Oracle Corporation",
"start_time_in_millis": 1421578674811,
"mem": {
"heap_init_in_bytes": 268435456,
"heap_max_in_bytes": 1038876672,
"non_heap_init_in_bytes": 24313856,
"non_heap_max_in_bytes": 136314880,
"direct_max_in_bytes": 1038876672
}
}
}
}
}
Reference
Java Client TransportSerializationException #3835, Oct 6, 2013

Looks like it was an issue with the plugin with Elasticsearch 0.90.7 throwing an exception which wasn't caught by the plugin.
Pull request here: https://github.com/mstein/elasticsearch-grails-plugin/pull/74 has a fix and includes ES 0.90.7

Related

Make a monocolor jpeg file encoded one bit per pixel?

For example, I see the following output. I don't quite understand its complete meaning. But when I look at the figure, it is just black and white, without gray or other color.
$ file 0447.jpg
0447.jpg: JPEG image data, JFIF standard 1.01, aspect ratio, density 1x1, segment length 16, baseline, precision 8, 1725x2751, components 1
The file size is 652708. To encode, 1725x2751 bits, the file size should be no more than 1725 * 2751/8 = 593184.4. But the file size is bigger than this.
So it seems that a pixel is not encoded as one bit. Is there a way to shrink the size of the file (without loss of info) so that one pixel is one bit (maybe using other formats)?
Don't use IM identify to find the actual bits-per pixel. Use EXIFTOOL.
Input JPG:
Exiftool shows BitsPerSample of 8
exiftool -s -ee -g1 -u -n -D cow.jpg
---- ExifTool ----
- ExifToolVersion : 12.44
---- System ----
- FileName : cow.jpg
- Directory : .
- FileSize : 16214
- FileModifyDate : 2022:10:14 11:31:44-07:00
- FileAccessDate : 2022:10:14 11:31:44-07:00
- FileInodeChangeDate : 2022:10:14 11:31:44-07:00
- FilePermissions : 100644
---- File ----
- FileType : JPEG
- FileTypeExtension : JPG
- MIMEType : image/jpeg
- ImageWidth : 300
- ImageHeight : 300
- EncodingProcess : 0
- BitsPerSample : 8 <-------
- ColorComponents : 1
---- JFIF ----
0 JFIFVersion : 1 1
2 ResolutionUnit : 2
3 XResolution : 28
5 YResolution : 28
---- Composite ----
- ImageSize : 300 300
- Megapixels : 0.09
Threshold to GIF:
convert cow.jpg -threshold 50% cow_bw1.gif
Exiftool shows BitsPerPixel = 1
exiftool -s -ee -g1 -u -n -D cow_bw1.gif
---- ExifTool ----
- ExifToolVersion : 12.44
---- System ----
- FileName : cow_bw1.gif
- Directory : .
- FileSize : 2698
- FileModifyDate : 2022:10:14 11:44:17-07:00
- FileAccessDate : 2022:10:14 11:44:19-07:00
- FileInodeChangeDate : 2022:10:14 11:44:17-07:00
- FilePermissions : 100644
---- File ----
- FileType : GIF
- FileTypeExtension : GIF
- MIMEType : image/gif
---- GIF ----
- GIFVersion : 89a
0 ImageWidth : 300
2 ImageHeight : 300
4.1 HasColorMap : 1
4.2 ColorResolutionDepth : 8
4.3 BitsPerPixel : 1 <-------
5 BackgroundColor : 1
---- Composite ----
- ImageSize : 300 300
- Megapixels : 0.09
Threshold to PNG:
convert cow.jpg -threshold 50% cow_bw1.png
Exiftool shows BitDepth of 1
exiftool -s -ee -g1 -u -n -D cow_bw1.png
---- ExifTool ----
- ExifToolVersion : 12.44
- Warning : [minor] Text/EXIF chunk(s) found after PNG IDAT (may be ignored by some readers)
---- System ----
- FileName : cow_bw1.png
- Directory : .
- FileSize : 2251
- FileModifyDate : 2022:10:14 11:49:20-07:00
- FileAccessDate : 2022:10:14 11:49:21-07:00
- FileInodeChangeDate : 2022:10:14 11:49:20-07:00
- FilePermissions : 100644
---- File ----
- FileType : PNG
- FileTypeExtension : PNG
- MIMEType : image/png
---- PNG ----
0 ImageWidth : 300
4 ImageHeight : 300
8 BitDepth : 1 <-------
9 ColorType : 0
10 Compression : 0
11 Filter : 0
12 Interlace : 0
- Gamma : 2.2
- BackgroundColor : 1
- ModifyDate : 2022:10:14 18:49:20
- Datecreate : 2022-10-14T18:31:44+00:00
- Datemodify : 2022-10-14T18:31:44+00:00
- Datetimestamp : 2022-10-14T18:49:19+00:00
---- PNG-pHYs ----
0 PixelsPerUnitX : 2800
4 PixelsPerUnitY : 2800
8 PixelUnits : 1
---- Composite ----
- ImageSize : 300 300
- Megapixels : 0.09
ADDITION
Here is how to make a 2-bit TIFF file.
convert lena.jpg -colorspace gray -depth 2 -type palette lena_d2.tif
exiftool -s -ee -g1 -u -n -D lena_d2.tif
---- ExifTool ----
- ExifToolVersion : 12.44
---- System ----
- FileName : lena_d2.tif
- Directory : .
- FileSize : 16642
- FileModifyDate : 2022:10:14 16:42:42-07:00
- FileAccessDate : 2022:10:14 16:42:43-07:00
- FileInodeChangeDate : 2022:10:14 16:42:42-07:00
- FilePermissions : 100644
---- File ----
- FileType : TIFF
- FileTypeExtension : TIF
- MIMEType : image/tiff
- ExifByteOrder : II
---- IFD0 ----
256 ImageWidth : 256
257 ImageHeight : 256
258 BitsPerSample : 2 <------
259 Compression : 1
262 PhotometricInterpretation : 3
266 FillOrder : 1
273 StripOffsets : 8
274 Orientation : 1
277 SamplesPerPixel : 1
278 RowsPerStrip : 256
279 StripByteCounts : 16384
282 XResolution : 72
283 YResolution : 72
284 PlanarConfiguration : 1
296 ResolutionUnit : 2
297 PageNumber : 0 1
320 ColorMap : (Binary data 24 bytes, use -b option to extract)
---- Composite ----
- ImageSize : 256 256
- Megapixels : 0.065536

specflow external data using json with many property

I am trying to migrate from specflow excel to using a json data file and the external data plugin
Related to Specflow - using data from external file in feature file is there a walkthrough to setup a feature file, and json data file with new #property approach to data?
I have a Specflow feature like this, which originally came from Specflow Excel.
Feature: EndToEndId
Scenario Outline: Single Payment
Given a client <clientNo> called <cName>
And a broker <bName> with book ref <bRef>
When a deal to <buyOrSell> an amount <fromAmt> of <ccy1> for <ccy2> for value <vDate> at client rate <cRate> and bank rate <bRate>
Then create a deal <dealNo> with client amt <toCAmt> and cover amt <coverAmt> and PnL <PnL> and profit rate <pRate> and <bYes>
And add beneficiary <benName> and country <ctry> and pay type <payType> and charge <charge> and <abYes>
When a credit file <c1> with <c1Name> for <c1Amt> <c1Ccy> for value <c1Date> with ref <EndToEndId1>
Then CreditNotice gets <fIn1Type> for client <fIn1Client>
Examples:
| case | clientNo | cName | bName | bRef | buyOrSell | fromAmt | ccy1 | ccy2 | vDate | cRate | bRate | dealNo | toCAmt | coverAmt | PnL | pRate | bYes | benName | ctry | payType | charge | abYes | c1 | c1Name | c1Amt | c1Ccy | c1Date | EndToEndId1 | fIn1Type | fIn1Client |
| T1: 99549 ###### | 99549 | Gherkin Test | MERCURY | 01W3RG5638 | SELL | 100000 | EUR | GBP | SP | 0.89435 | 0.89935 | ###### | 89435 | 89935 | 500 | 1 | yes | Gherkin Ben | GB | CHAPS | NONE | yes | 99549 | Gherkin Test | 100000 | EUR | SP | 99549 ###### | FullFundsIn | Gherkin Test |
To use the with a json file for the data, am I going to need to define each property again like this:
#property:clientNo=clientNo
#property:cName=cName
#property:bName=bName
and a json data file like this:
{
"case": "T-9: 99549 ######",
"clientNo": "99549",
"cName": "Gherkin Test",
"bName": "MERCURY",
"bRef": "01W3RG5638",
"buyOrSell": "SELL",
"fromAmt": "100,000",
"ccy1": "EUR",
"ccy2": "GBP",
"vDate": "SP",
"cRate": " 0.894350 ",
"bRate": " 0.894350 ",
"dealNo": "######",
"toCAmt": "89,435.00",
"coverAmt": "89,435.00",
"PnL": "0.00",
"pRate": " 1.000000 ",
"bYes": " yes ",
"benName": "Gherkin Ben",
"ctry": "GB",
"payType": "CHAPS",
"charge": "NONE",
"abYes": "yes",
"c1": "99549",
"c1Name": "Gherkin Test",
"c1Amt": "100,000",
"c1Ccy": "EUR",
"c1Date": "SP",
"EndToEndId1": "99549 ######",
"fIn1Type": "FullFundsIn",
"fIn1Client": "Gherkin Test"
},
{
"case": "T-8: 1234 1234",
"clientNo": "99549",
"cName": "Gherkin Test",
"bName": "JUPITER",
"bRef": "01W3RG5639",
"buyOrSell": "SELL",
"fromAmt": "200,000",
"ccy1": "EUR",
"ccy2": "GBP",
"vDate": "SP",
"cRate": " 0.894350 ",
"bRate": " 0.894350 ",
"dealNo": "######",
"toCAmt": "178,870.00",
"coverAmt": "178,870.00",
"PnL": "0.00",
"pRate": " 1.000000 ",
"bYes": " yes ",
"benName": "Gherkin Ben",
"ctry": "GB",
"payType": "FASTER",
"charge": "NONE",
"abYes": "yes",
"c1": "99549",
"c1Name": "Gherkin Test",
"c1Amt": "200,000",
"c1Ccy": "EUR",
"c1Date": "SP",
"EndToEndId1": "1234 1234",
"fIn1Type": "BankRec",
"fIn1Client": "Gherkin Test"
}
Thanks for some pointers on how to get the json data into the specflow feature file.
The SpecFlow.ExternalData plugin is currently limited to a single parameter.
Please upvote the feature request at https://support.specflow.org/hc/en-us/community/posts/360015106078-Allow-multiple-parameters-to-be-used-with-External-Data-plugin to get this higher in our backlog priority.
There is a separate plugin called Specflow.Contrib.JsonData as part of Nuget packages which accepts JSON data as an input for specflow scenarios. It is an extension to the Specflow.ExternalData plugin. It also accepts multiple properties. Check out https://libraries.io/nuget/SpecFlow.Contrib.JsonData.

pwm-backlight driver not being probed in u-boot

I'm trying to get my PWM working on a custom am33x board (same beagle-bone black target). For some reason I don't see the pwm-backlight driver being probed and thus no PWM as indicated on my scope. Here are my relevant source files:
dts snippet:
/dts-v1/;
#include "am33xx.dtsi"
#include <dt-bindings/interrupt-controller/irq.h>
/ {
model = "test";
compatible = "ti,am33xx";
chosen {
stdout-path = &uart0;
};
backlight: backlight {
status = "okay";
compatible = "pwm-backlight";
pwms = <&ehrpwm1 0 10000 0>;
brightness-levels = <0 10 20 30 40 50 60 70 80 90 99>;
default-brightness-level = <6>;
};
};
&am33xx_pinmux {
ehrpwm1_pins: pinmux-ehrpwm1-pins {
pinctrl-single,pins = <
AM33XX_IOPAD(0x848, PIN_OUTPUT_PULLDOWN | MUX_MODE6) /* gpmc_a2.ehrpwm1a */
>;
};
};
&ehrpwm1 {
u-boot,dm-spl;
status = "okay";
pinctrl-names = "default";
pinctrl-0 = <&ehrpwm1_pins>;
};
defconfig
CONFIG_DM=y
CONFIG_CMD_DM=y
CONFIG_DM_VIDEO=y
CONFIG_DM_PWM=y
CONFIG_BACKLIGHT_PWM=y
pwm-backlight driver info
config BACKLIGHT_PWM
bool "Generic PWM based Backlight Driver"
depends on DM_VIDEO && DM_PWM
default y
help
If you have a LCD backlight adjustable by PWM, say Y to enable
this driver.
This driver can be use with "simple-panel" and
it understands the standard device tree
(leds/backlight/pwm-backlight.txt)
(linux version)
https://github.com/torvalds/linux/blob/master/Documentation/devicetree/bindings/leds/backlight/pwm-backlight.txt
and when I interrupt u-boot and use dm tree you can see that its not probed. Why?
=> dm tree
Class Index Probed Driver Name
-----------------------------------------------------------
root 0 [ + ] root_driver root_driver
simple_bus 0 [ + ] generic_simple_bus |-- ocp
simple_bus 1 [ ] generic_simple_bus | |-- l4_wkup#44c00000
simple_bus 2 [ ] generic_simple_bus | | |-- prcm#200000
simple_bus 3 [ ] generic_simple_bus | | `-- scm#210000
syscon 0 [ ] syscon | | `-- scm_conf#0
gpio 0 [ ] gpio_omap | |-- gpio#44e07000
gpio 1 [ ] gpio_omap | |-- gpio#4804c000
gpio 2 [ ] gpio_omap | |-- gpio#481ac000
gpio 3 [ ] gpio_omap | |-- gpio#481ae000
serial 0 [ + ] omap_serial | |-- serial#44e09000
mmc 0 [ + ] omap_hsmmc | |-- mmc#481d8000
timer 0 [ + ] omap_timer | |-- timer#48040000
timer 1 [ ] omap_timer | |-- timer#48042000
timer 2 [ ] omap_timer | |-- timer#48044000
timer 3 [ ] omap_timer | |-- timer#48046000
timer 4 [ ] omap_timer | |-- timer#48048000
timer 5 [ ] omap_timer | |-- timer#4804a000
misc 0 [ + ] ti-musb-wrapper | `-- usb#47400000
usb 0 [ + ] ti-musb-peripheral | `-- usb#47401000
eth 0 [ + ] usb_ether | `-- usb_ether
backlight 0 [ ] pwm_backlight `-- backlight

How can I locate an XCUIElement searching by partial label text in Swift?

I have been locating XCUIElements using this method:
app.staticTexts["Full Label Text"]
But what if I only know part of the label text? Part of the label text is generated dynamically (e.g. "Item #1", "Item #2", etc.) so I would like to search for it by finding an element that contains part of the text (e.g. searching by "Item"). Is there any method to do this in Swift?
You can find elements with a predicate. Use the containing(_ predicate: NSPredicate) -> XCUIElementQuery method from XCUIElementQuery.
let predicate = NSPredicate(format: "label CONTAINS[c] 'Item'")
let labels = XCUIApplication().staticTexts.containing(predicate)
The accepted answer only seems to work if you DO NOT set an accessibilityLabel in which case you might want to use .accessibilityIdentifier instead
I also ran into this issue and wasn't getting the expected results beacuse I was using accessibilityLabel and not accessibilityIdentifier .
Here is the UI,
Here is the output of the test case code,
Element Info - Type: Window Label: Value:
Element Info - Type: StaticText Label: Hello World with No Acccessibility Label Value:
Element Info - Type: StaticText Label: AcccessibilityLabel Value:
Element Info - Type: TextField Label: TextFieldSwiftUI Value: Initial Text
Element Info - Type: Button Label: Click Me! Value:
Here is the code,
DemoView
struct DemoView: View {
#State
var textEntry = "Initial Text"
var body: some View{
Text("Hello World with No Acccessibility Label")
.font(.largeTitle)
.accessibilityIdentifier("AcccessibilityID")
.padding()
Text("Hello World with an Acccessibility Label")
.font(.largeTitle)
.accessibilityLabel("AcccessibilityLabel")
.padding()
TextField("Title", text: $textEntry)
.accessibilityLabel("TextFieldSwiftUI")
.padding()
Button("Click Me!") {
print("Clicked")
}
}
}
DemoViewUITests
class DemoViewUITests: XCTestCase {
override func setUpWithError() throws {}
override func tearDownWithError() throws {}
func testExample() throws {
// UI tests must launch the application that they test.
let app = XCUIApplication()
app.launch()
// get all the elements in the app
let allTheElements = app.descendants(matching: .any)
// filter out the 'other' elements
// These seem to be the internal views wrapping the app
// as they all have a frame of the full window
// looking at the Window Inspector I think they are
// - UITransitionView
// - UIDropShadowView
// - HostingViewController
// - HostingView
let notOtherPredicate = NSPredicate(format: "elementType != %d",
// can't just use the enum value
// see stackoverflow.com/questions/32298645/enum-value-and-predicates
// so we pass in the NSUInteger version (other is 1)
// see developer.apple.com/documentation/xctest/xcuielementattributes/1500614-elementtype
argumentArray: [XCUIElement.ElementType.other.rawValue])
let elements = allTheElements.matching(notOtherPredicate)
// should have 5
// 1 - the Window
// 2 - the Text with no accessibility label
// 3 - the Text with an accessibility label
// 4 - the TextField
// 5 - the Button
XCTAssertEqual(elements.count, 5)
for elementIndex in 0..<elements.count{
let element = elements.element(boundBy: elementIndex)
let type = ELEMENT_TYPE[element.elementType.rawValue]!.padding(toLength: 10, withPad: " ", startingAt: 0)
let label = "\(element.label)".padding(toLength: 40, withPad: " ", startingAt: 0)
let value = "\(element.value ?? "NIL")"
print("Element Info - Type: \(type) Label: \(label) Value: \(value)")
}
}
}
// Rest is just for pretty formatting :)
// can't extract key representation
// from C Struct XCUIElementType
// (even though it's XCUIElement.ElementType it
// points to XCUIElementType weird...)
// so we provide a table here
var ELEMENT_TYPE : [UInt: String] = [
0 : "Any",
1 : "Other",
2 : "Application",
3 : "Group",
4 : "Window",
5 : "Sheet",
6 : "Drawer",
7 : "Alert",
8 : "Dialog",
9 : "Button",
10 : "RadioButton",
11 : "RadioGroup",
12 : "CheckBox",
13 : "DisclosureTriangle",
14 : "PopUpButton",
15 : "ComboBox",
16 : "MenuButton",
17 : "ToolbarButton",
18 : "Popover",
19 : "Keyboard",
20 : "Key",
21 : "NavigationBar",
22 : "TabBar",
23 : "TabGroup",
24 : "Toolbar",
25 : "StatusBar",
26 : "Table",
27 : "TableRow",
28 : "TableColumn",
29 : "Outline",
30 : "OutlineRow",
31 : "Browser",
32 : "CollectionView",
33 : "Slider",
34 : "PageIndicator",
35 : "ProgressIndicator",
36 : "ActivityIndicator",
37 : "SegmentedControl",
38 : "Picker",
39 : "PickerWheel",
40 : "Switch",
41 : "Toggle",
42 : "Link",
43 : "Image",
44 : "Icon",
45 : "SearchField",
46 : "ScrollView",
47 : "ScrollBar",
48 : "StaticText",
49 : "TextField",
50 : "SecureTextField",
51 : "DatePicker",
52 : "TextView",
53 : "Menu",
54 : "MenuItem",
55 : "MenuBar",
56 : "MenuBarItem",
57 : "Map",
58 : "WebView",
59 : "IncrementArrow",
60 : "DecrementArrow",
61 : "Timeline",
62 : "RatingIndicator",
63 : "ValueIndicator",
64 : "SplitGroup",
65 : "Splitter",
66 : "RelevanceIndicator",
67 : "ColorWell",
68 : "HelpTag",
69 : "Matte",
70 : "DockItem",
71 : "Ruler",
72 : "RulerMarker",
73 : "Grid",
74 : "LevelIndicator",
75 : "Cell",
76 : "LayoutArea",
77 : "LayoutItem",
78 : "Handle",
79 : "Stepper",
80 : "Tab",
81 : "TouchBar",
82 : "StatusItem",
]

Why this parameter '+profile "*"' get convert killed?

If I run this command,
convert -limit memory 2071963648 -quality 100 -alpha off -density 165% -scene 1 infile.jpg outfile.png
The conversion runs without any issue.
However if I add +profile "*",
convert +profile "*" -limit memory 2071963648 -quality 100 -alpha off -density 165% -scene 1 infile.jpg outfile.png
The process is killed.
Here is output from dmesg
[ 1403.401440] [ pid ] uid tgid total_vm rss nr_ptes swapents oom_score_adj name
[ 1403.401444] [ 474] 0 474 4869 49 13 0 0 upstart-udev-br
[ 1403.401446] [ 480] 0 480 12460 207 27 0 -1000 systemd-udevd
[ 1403.401448] [ 659] 0 659 3815 55 13 0 0 upstart-socket-
[ 1403.401449] [ 671] 0 671 2556 572 8 0 0 dhclient
[ 1403.401451] [ 852] 102 852 9806 94 23 0 0 dbus-daemon
[ 1403.401453] [ 860] 101 860 65019 147 29 0 0 rsyslogd
[ 1403.401454] [ 884] 0 884 10863 85 27 0 0 systemd-logind
[ 1403.401456] [ 888] 0 888 3819 64 11 0 0 upstart-file-br
[ 1403.401463] [ 967] 0 967 3635 41 12 0 0 getty
[ 1403.401464] [ 970] 0 970 3635 42 12 0 0 getty
[ 1403.401466] [ 974] 0 974 3635 40 12 0 0 getty
[ 1403.401467] [ 975] 0 975 3635 40 12 0 0 getty
[ 1403.401468] [ 977] 0 977 3635 41 12 0 0 getty
[ 1403.401470] [ 1047] 0 1047 15341 169 33 0 -1000 sshd
[ 1403.401472] [ 1052] 0 1052 5914 58 17 0 0 cron
[ 1403.401473] [ 1057] 0 1057 4785 40 13 0 0 atd
[ 1403.401475] [ 1089] 0 1089 1092 36 8 0 0 acpid
[ 1403.401476] [ 1099] 0 1099 4797 63 15 0 0 irqbalance
[ 1403.401478] [ 1224] 0 1224 6336 78 16 0 0 master
[ 1403.401479] [ 1230] 106 1230 6852 73 18 0 0 pickup
[ 1403.401481] [ 1231] 106 1231 6893 81 19 0 0 qmgr
[ 1403.401482] [ 1281] 999 1281 278175 5269 82 0 0 sensu-client
[ 1403.401484] [ 1397] 0 1397 3635 42 11 0 0 getty
[ 1403.401485] [ 1398] 0 1398 3197 37 11 0 0 getty
[ 1403.401487] [ 1515] 107 1515 7862 150 19 0 0 ntpd
[ 1403.401488] [ 1929] 0 1929 26408 247 55 0 0 sshd
[ 1403.401490] [ 1982] 1000 1982 26442 256 53 0 0 sshd
[ 1403.401491] [ 1983] 1000 1983 5580 761 16 0 0 bash
[ 1403.401493] [ 2488] 1000 2488 8685 1607 22 0 0 pynt
[ 1403.401494] [ 2490] 1000 2490 8685 1607 21 0 0 pynt
[ 1403.401495] [ 2491] 1000 2491 1111 24 7 0 0 sh
[ 1403.401497] [ 2492] 1000 2492 1111 25 7 0 0 sh
[ 1403.401498] [ 2493] 1000 2493 15638 3221 36 0 0 python
[ 1403.401500] [ 2494] 1000 2494 15939 3535 36 0 0 python
[ 1403.401501] [ 2924] 1000 2924 975967 954941 1894 0 0 convert
[ 1403.401503] Out of memory: Kill process 2924 (convert) score 945 or sacrifice child
[ 1403.406111] Killed process 2924 (convert) total-vm:3903868kB, anon-rss:3819760kB, file-rss:4kB
I am using this version of ImageMagick
$ convert -version
Version: ImageMagick 6.8.9-7 Q16 x86_64 2014-12-30 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2014 ImageMagick Studio LLC
Features: DPC OpenMP
Delegates: jng jpeg png x xml zlib
on ubuntu 14.04.1
I don't know why +profile would cause ImageMagick to crash, but as an alternative you might like to try -strip like this.
convert image.jpg -strip output.jpg
It strips the image of all profiles and comments.

Resources