Visual Studio Test Explorer does not discover jasmine tests - visual-studio-2012

I have jasmine tests that run through the Chutzpah context menu extension (Run JS tests). However they do not get discovered by the Test Explorer and when I right-click and select Run Tests, the output from "Tests" gives me this:
System.ArgumentException: The directory name is invalid.
at System.IO.FileSystemWatcher..ctor(String path, String filter)
at Chutzpah.VS11.EventWatchers.TestFilesUpdateWatcher.AddWatch(String path)
at Chutzpah.VS2012.TestAdapter.ChutzpahTestContainerDiscoverer.UpdateTestContainersAndFileWatchers(IEnumerable`1 files, Boolean isAdd)
at Chutzpah.VS2012.TestAdapter.ChutzpahTestContainerDiscoverer.GetTestContainers()
at Chutzpah.VS2012.TestAdapter.ChutzpahTestContainerDiscoverer.get_TestContainers()
at Microsoft.VisualStudio.TestWindow.Controller.TestContainerDiscovererExtension.GetSortedContainers(ITestContainerDiscoverer discoverer)
at Microsoft.VisualStudio.TestWindow.Controller.TestContainerProvider.GetContainersFromDiscoverer(ITestContainerDiscoverer discoverer)
No tests found to run.
Here's my chutzpah.json file also:
{
"Framework": "jasmine",
"FrameworkVersion": "2",
"TestHarnessLocationMode": "SettingsFileAdjacent",
"References": [
{ "Path": "../../DIB.MemberCatalog/lib/dust/dust-full.js" },
{ "Path": "../../DIB.MemberCatalog/lib/dust-helpers/dust-helpers.js" },
{ "Path": "../../DIB.MemberCatalog/lib/harvey/harvey.js" },
{ "Path": "../../DIB.MemberCatalog/lib/hopscotch/js/hopscotch.js" },
{ "Path": "../../DIB.MemberCatalog/lib/jquery/jquery-1.11.1.js" },
{ "Path": "../../DIB.MemberCatalog/lib/jquery-ui/jquery-ui.js" },
{ "Path": "../../DIB.MemberCatalog/lib/jquery-validate/jquery.validate.js" },
{ "Path": "../../DIB.MemberCatalog/lib/knockout/knockout-3.1.0.js" },
{ "Path": "../../DIB.MemberCatalog/lib/knockout-mapping/knockout.mapping.js" },
{ "Path": "../../DIB.MemberCatalog/lib/knockout-validation/knockout.validation.js" },
{ "Path": "../../DIB.MemberCatalog/lib/lightbox/js/lightbox.js" },
{ "Path": "../../DIB.MemberCatalog/lib/respond/respond.js" },
{ "Path": "../../DIB.MemberCatalog/Scripts/jquery.qtip.min.js" },
{ "Path": "../../DIB.MemberCatalog/Scripts/json2.min.js" },
{ "Path": "../../DIB.MemberCatalog/Scripts/jquery.cookie.js" },
{ "Path": "../../DIB.MemberCatalog/Scripts/jquery.hoverIntent.min.js" },
{ "Path": "../../DIB.MemberCatalog/Scripts/jquery.lazyload.min.js" },
{ "Path": "../../DIB.MemberCatalog/Scripts/changecheck.js" },
{ "Path": "../../DIB.MemberCatalog/Scripts/stickytable.js" },
{ "Path": "../../DIB.MemberCatalog/Scripts/superalert.js" },
{ "Path": "../../DIB.MemberCatalog/Scripts/core.js" },
{ "Path": "prepare.js" },
{ "Path": "engine.js" }
],
"Tests": [
{ "Path": "tests" }
],
"CodeCoverageIncludes": [],
"CodeCoverageExcludes": []
}
Solution structure:
DIB.MemberCatalog
-Testing
- DIB.MemberCatalog.Tests.JS
- data
- lib
- jasmine-2.0.0
- (jasmine files, boot, console, jasmine)
- tests
- testfiles.js
- chutzpah.json
-DIB.MemberCatalog
- (more...)
I've scoured the internet and can't find a solution.

Solved by changing my test project name from DIB.MemberCatalog.Tests.JS to DIB.MemberCatalog.Tests.Client. Confusion happens when the project has the javascript file extension at the end of the project name.

Related

Hyperledger Explorer not starting on 8080 (discover issue)

Running hlf 1.4 and latest explorer in kubernetes. Explorer hangs in the start phase where it tries to reach peers. It doesn't reach the code were it starts web interface.
Peer has chaincode installed, connected to channel, no issues.
I have disabled TLS to make investigation easier and put logs in Channel.js, Peer.js in explorer dependencies to better investigate it.
I have added log to Channel.js in
/blockchain-explorer/node_modules/fabric-client/lib/Channel.js
to print connect to target and I can see that it shows grpc://localhost:undefined. I believe it tries to send request to invalid address and silently dies. Entire file https://gist.github.com/gad0lin/51384bfea1c207ccf016a0cad8e413b6#file-channel-js-L3474.
[{"_options":"1","_url":"2","_endpoint":"3","_name":"4","_request_timeout":45000,"_grpc_wait_for_ready_timeout":3000,
"_endorserClient":"5","_discoveryClient":"6"},{"name":"4","grpc.ssl_target_name_override":"4","grpc.default_authority":"4","grpc.max_receive_message_length":-1,"grpc.max_send_message_length":-1},"grpc://localhost:undefined",{"addr":"7","creds":"8"},"peer1-hlf-peer.peers.svc.cluster.local",
{"$interceptors":"9","$interceptor_providers":"10","$channel":"11"},{"$interceptors":"12","$interceptor_providers":"13","$channel":"14"},"localhost",{},[],[],{},[],[],{}]
Here is hlf config:
{
"network-configs": {
"network-1": {
"version": "1.0",
"clients": {
"cli": {
"tlsEnable": false,
"organization": "Org1MSP",
"channel": "mychannel",
"credentialStore": {
"path": "./tmp/credentialStore_Org1/credential",
"cryptoStore": {
"path": "./tmp/credentialStore_Org1/crypto"
}
}
}
},
"channels": {
"mychannel": {
"peers": {
"peer1-hlf-peer.peers.svc.cluster.local": {}
},
"connection": {
"timeout": {
"peer": {
"endorser": "30",
"eventHub": "30",
"eventReg": "30"
}
}
}
}
},
"organizations": {
"Org1MSP": {
"certificateAuthorities": ["fabric-ca"],
"mspid": "Org1MSP",
"fullpath": true,
"adminPrivateKey": {
"path": "/var/hyperledger/msp/admincerts/key.pem"
},
"signedCert": {
"path": "/var/hyperledger/msp/admincerts/cert.pem"
}
}
},
"peers": {
"peer1-hlf-peer.peers.svc.cluster.local": {
"url": "grpc://peer1-hlf-peer.peers.svc.cluster.local:7051",
"eventUrl": "grpc://peer1-hlf-peer.peers.svc.cluster.local:7053",
"grpcOptions": {
"ssl-target-name-override": "peer1-hlf-peer.peers.svc.cluster.local"
}
}
},
"orderers": {
"ord1-hlf-ord.orderers.svc.cluster.local" : {
"url":"grpc://ord1-hlf-ord.orderers.svc.cluster.local:7050"
}
},
"certificateAuthorities": {
"fabric-ca": {
"url": "http://ca-hlf-ca.cas.svc.cluster.local:7054",
"httpOptions":{
"verify": false
},
"registrar": {
"enrollId": "admin",
"enrollSecret": "adminpw"
},
"caName": "ca"
}
}
}
}
}{
"persistence": "postgreSQL",
"platforms": ["fabric"],
"postgreSQL": {
"host": "explorer-db.x.svc.cluster.local",
"port": "5432",
"database": "fabricexplorer",
"username": "hppoc",
"passwd": "password"
},
"sync": {
"type": "local",
"platform": "fabric",
"blocksSyncTime": "3"
}
}
I found the culprit. There were two issues.
I didn't set environment variable DISCOVERY_AS_LOCALHOST to false in explorer config. That was the reason I saw: localhost.
In peer I had set variable CORE_PEER_GOSSIP_EXTERNALENDPOINT, but without port. That was the reason I saw undefined as port.

Unable to setup hyperledger explorer with one node (like basic network example)

Has anyone managed to setup hyperledger explorer with the basic network example (managed to set it up with first network). It wont pick up my peer/channel in this case. The configuration works with four peers and an orderer with two orgs (first-network) but I cant seem to get it to work with just one peer. Any help would be appreciated !
Fabric Version : 1.2
Explorer version : 3.7.1
config.json (The actual file is well formatted) :-
{
"network-configs": {
"network-1": {
"version": "1.0",
"clients": {
"client-1": {
"tlsEnable": true,
"organization": "Org1MSP",
"channel": "myc",
"credentialStore": {
"path": "./tmp/credentialStore_Org1/credential",
"cryptoStore": {
"path": "./tmp/credentialStore_Org1/crypto"
}
}
}
},
"channels": {
"myc": {
"peers": {
"peer0.org1.example.com": {}
},
"connection": {
"timeout": {
"peer": {
"endorser": "6000",
"eventHub": "6000",
"eventReg": "6000"
}
}
}
}
},
"organizations": {
"Org1MSP": {
"mspid": "Org1MSP",
"fullpath": false,
"adminPrivateKey": {
"path":
"/fabricsamples/basic-network/crypto-config/org1.example.com/users/Admin#org1.example.com/msp/keystore"
},
"signedCert": {
"path":
"/fabricsamples/basic-network/crypto-config/org1.example.com/users/Admin#org1.example.com/msp/signcerts"
}
},
"OrdererMSP": {
"mspid": "OrdererMSP",
"adminPrivateKey": {
"path":
"/fabricsamples/basic-network/crypto-config/ordererOrganizations/example.com/users/Admin#example.com/msp/keystore"
}
}
},
"peers": {
"peer0.org1.example.com": {
"tlsCACerts": {
"path":
"/fabricsamples/basic-network/crypto-config/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt"
},
"url": "grpcs://peer0.org1.example.com:7051",
"eventUrl": "grpcs://peer0.org1.example.com:7053",
"grpcOptions": {
"ssl-target-name-override": "peer0.org1.example.com"
}
}
},
"orderers": {
"orderer.example.com": {
"url": "grpcs://orderer.example.com:7050"
}
}
}
},
"configtxgenToolPath": "/home/ett/go/src/themeSCF/bin",
"license": "Apache-2.0"
}
Firstly, a few suggestions regarding your config file:
tlsEnable should be false - the basic-network example does not use TLS.
All URLs should use grpc - grpcs is only used when TLS is enabled.
All URLs should use localhost - assuming your path entries are correct, it looks like you are running Explorer locally (i.e. not in a container). In this scenario, all addresses should use localhost.
You also need to edit the docker-compose.yml file used by basic-network to add the following:
services:
peer0.org1.example.com:
environment:
- CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.org1.example.com:7051
Without this, the peer will reject all connections from outside its own organisation.
With this change applied to docker-compose.yml, I was able to successfully deploy Explorer 3.7 in a docker container by following the instructions here, using a configuration folder named basic-network and the following command:
./deploy_explorer.sh basic-network net_basic
and with the following config.json file in blockchain-explorer/examples/basic-network:
{
"network-configs": {
"network-1": {
"version": "1.0",
"clients": {
"client-1": {
"tlsEnable": false,
"organization": "Org1MSP",
"channel": "mychannel",
"credentialStore": {
"path": "./tmp/credentialStore_Org1/credential",
"cryptoStore": {
"path": "./tmp/credentialStore_Org1/crypto"
}
}
}
},
"channels": {
"mychannel": {
"peers": {
"peer0.org1.example.com": {}
},
"connection": {
"timeout": {
"peer": {
"endorser": "6000",
"eventHub": "6000",
"eventReg": "6000"
}
}
}
}
},
"organizations": {
"Org1MSP": {
"mspid": "Org1MSP",
"fullpath": false,
"adminPrivateKey": {
"path":
"/tmp/crypto/peerOrganizations/org1.example.com/users/Admin#org1.example.com/msp/keystore"
},
"signedCert": {
"path":
"/tmp/crypto/peerOrganizations/org1.example.com/users/Admin#org1.example.com/msp/signcerts"
}
},
"OrdererMSP": {
"mspid": "OrdererMSP",
"adminPrivateKey": {
"path":
"/tmp/crypto/ordererOrganizations/example.com/users/Admin#example.com/msp/keystore"
}
}
},
"peers": {
"peer0.org1.example.com": {
"tlsCACerts": {
"path":
"/tmp/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt"
},
"url": "grpc://peer0.org1.example.com:7051",
"eventUrl": "grpc://peer0.org1.example.com:7053",
"grpcOptions": {
"ssl-target-name-override": "peer0.org1.example.com"
}
}
},
"orderers": {
"orderer.example.com": {
"url": "grpc://orderer.example.com:7050"
}
}
}
},
"configtxgenToolPath": "/home/fabric-path/workspace/fabric-samples/bin",
"license": "Apache-2.0"
}
If you're still having trouble after following the instructions above, please post details of any errors reported by Blockchain Explorer, as well as the Blockchain Explorer log file (app.log). These can be viewed using the following commands when using the docker deployment script:
docker logs blockchain-explorer
docker exec -t blockchain-explorer cat /opt/logs/app/app.log

Error creating a customContent on a confluence addon

Today I was trying to create a confluence addon for my company and I've try following atlassian documents.
My problem comes trying to run the express app when adding a new customContent to the atlassian-connect.json, after running npm start I get the following error.
Failed to register with host https‍://admin:xxx#xxx.atlassian.net/wiki (200)
{"type":"INSTALL","pingAfter":300,"status":{"done":true,"statusCode":200,"con
tentType":"application/vnd.atl.plugins.task.install.err+json","subCode":"upm.
pluginInstall.error.descriptor.not.from.marketplace","source":"https‍://1a0adc
8f.ngrok.io/atlassian-connect.json","name":"https‍://1a0adc8f.ngrok.io/atlassi
an-connect.json"},"links":{"self":"/wiki/rest/plugins/1.0/pending/b88594d3-c3
c2-4760-b687-c8d860c0a377","alternate":"/wiki/rest/plugins/1.0/tasks/b88594d3
-c3c2-4760-b687-c8d860c0a377"},"timestamp":1502272147602,"userKey":"xxx","id":"xxx"}
Add-on not registered; no compatible hosts detected
This is my atlassian-connect.json file:
{
"key": "my-add-on",
"name": "Ping Pong",
"description": "My very first add-on",
"vendor": {
"name": "Angry Nerds",
"url": "https://www.atlassian.com/angrynerds"
},
"baseUrl": "{{localBaseUrl}}",
"links": {
"self": "{{localBaseUrl}}/atlassian-connect.json",
"homepage": "{{localBaseUrl}}/atlassian-connect.json"
},
"authentication": {
"type": "jwt"
},
"lifecycle": {
"installed": "/installed"
},
"scopes": [
"READ"
],
"modules": {
"generalPages": [
{
"key": "hello-world-page-jira",
"location": "system.top.navigation.bar",
"name": {
"value": "Hello World"
},
"url": "/hello-world",
"conditions": [{
"condition": "user_is_logged_in"
}]
},
{
"key": "customersViewer",
"location": "system.header/left",
"name": {
"value": "Hello World"
},
"url": "/hello-world",
"conditions": [{
"condition": "user_is_logged_in"
}]
}
],
"customContent": [
{
"key": "customer",
"name": {
"value": "Customers"
},
"uiSupport": {
"contentViewComponent": {
"moduleKey": "customersViewer"
},
"listViewComponent": {
"moduleKey": "customerList"
},
"icons": {
"item": {
"url": "/images/customers.png"
}
}
},
"apiSupport": {
"supportedContainerTypes": ["space"]
}
}
]
}
}
Does anybody has an idea on whats going on?
The contentViewComponent can't find the generalPage it is referencing in moduleKey.
From the docs:
In the snippet above, the moduleKey “customersViewer” maps to a
generalPage module we have defined in our add-on. This generalPage is
passed the context parameters we specify, and visualizes our content
accordingly.
If you change the generalPage with the key hello-world-page-confluence to customersVieweryou be able to install and get up and running.

Modeshape full-text-search works only on binary files

I am trying to perform a full-text-search on my Modeshape 5.3.0.Final repository. The query is as simple as:
Query query = queryManager.createQuery("SELECT * FROM [nt:resource] as data WHERE ISDESCENDANTNODE('/somenode') AND CONTAINS(data.*,'*" + text + "*')
Looks like it works well for binary stored files (i.e. pdf,doc,docx, etc...) but it does not match txt files, or any text format file.
This is my repository configuration
{
"name": "Persisted-Repository",
"textExtraction": {
"extractors": {
"tikaExtractor": {
"name": "General content-based extractor",
"classname": "tika"
}
}
},
"workspaces": {
"predefined": [
"otherWorkspace"
],
"default": "default",
"allowCreation": true
},
"security": {
"anonymous": {
"roles": [
"readonly",
"readwrite",
"admin"
],
"useOnFailedLogin": false
}
},
"storage": {
"persistence": {
"type": "file",
"path": "/var/content/storage"
},
"binaryStorage": {
"type": "file",
"directory": "/var/content/binaries",
"minimumBinarySizeInBytes": 999,
"mimeTypeDetection": "content"
}
},
"indexProviders": {
"lucene": {
"classname": "lucene",
"directory": "/var/content/indexes"
}
},
"indexes": {
"textFromFiles": {
"kind": "text",
"provider": "lucene",
"nodeType": "nt:resource",
"columns": "jcr:data(BINARY)"
}
}
}
Currently I'm performing a hack to get around this issue by executing another search for configured text file extensions and manually using Tika (maybe since it's text already Tika is not required here...) to extract the text and search for occurrences.
Does anybody know if this is expected behavior or maybe I am doing something wrong?
Cheers!

Typescript project with Unit tests, problems running tests with Chutzpah

I have a project in Visual Studio that is using typescript and requirejs, and that is running QUnit tests with the help of Chutzpah.
Folderstructure in my project looks basically like this:
- chutzpah.json
- app/
- index.html
- js/
- config.js
- main.ts
- Module.ts
- tests/
- Test1.ts
up until now, I had requirejs configured so that in all my imports, I had to use
app/js/Module, for example, to load that one.
Tests were also running just fine.
Now, I have changed my requirejs config to use baseUrl of js inside the app folder, so I can use just "Module" for the import. application itself is running fine, but I cannot get the tests to work.
With my current chutzpah.json, it seems that it wants to load the test files from ../tests/, so for the Test1 example, it would want to load ../tests/Test1.js
This is my config.js:
require.config({
baseUrl: 'js',
paths: {
'swfJQ': '../libs/js/swfJQ'
},
shim: {
'swfJQ': {
"exports": "swfJQ"
}
}
});
This is my chutzpah.json:
{
"Framework": "qunit",
"TestHarnessReferenceMode": "AMD",
"TestHarnessLocationMode": "SettingsFileAdjacent",
"TypeScriptModuleKind": "AMD",
"Tests": [ { "Path": "tests", "Includes": [ "*Tests.ts" ] } ],
"AMDBaseUrl": "js",
"AMDAppDirectory": "app",
"References": [
{ "Path": "app/libs/js/jquery.js", "IsTestFrameworkFile": true },
{ "Path": "app/libs/require.js", "IsTestFrameworkFile": true },
{ "Path": "app/config.js" },
{ "Path": "require.d.ts", "IncludeInTestHarness": false },
{ "Path": "qunit.d.ts", "IncludeInTestHarness": false },
{ "Path": "tests", "IncludeInTestHarness": false, "Excludes": ["*.html"] },
{ "Path": "app/js", "IncludeInTestHarness": false }
],
"EnableCodeCoverage ": "true",
"CodeCoverageIncludes": [
"*app/js/*"
],
"CodeCoverageExcludes": [
"app/libs/*",
"tests/*"
]
}
This is one of the test files:
import Replay = require('../app/js/Module');
QUnit.module("Module tests");
test("Module.constructor", function (assert: QUnitAssert) { /* stuff */ }
I think the require('../app/js/Module') is more or less the culprit and will set the scope to ../, but if I write the code otherwise, the typescript compiler won't compile.
I guess this is probably something very easy I am missing, but I just can't pin it.
Maybe it is not a chutzpah problem I have, but my general Typescript setup should be different (so I don't have to use require('../app ... ') in my test files)?
Turned out this should have been quite easy:
I had to set the AMDBaseUrl in the Chutzpah config to "app/js", and removing the AMDAppDirectory property.
Can't believe I didn't try that before.
My chutzpah.json:
{
"Framework": "qunit",
"TestHarnessReferenceMode": "AMD",
"TestHarnessLocationMode": "SettingsFileAdjacent",
"TypeScriptModuleKind": "AMD",
"Tests": [ { "Path": "tests", "Includes": [ "*Tests.ts" ] } ],
"AMDBasePath": "app/js",
"References": [
{ "Path": "app/libs/js/jquery.js", "IsTestFrameworkFile": true },
{ "Path": "app/libs/js/kendo.ui.core.min.js", "IsTestFrameworkFile": true },
{ "Path": "app/libs/js/mediaelement-and-player.js", "IsTestFrameworkFile": true },
{ "Path": "app/libs/require.js", "IsTestFrameworkFile": true },
{ "Path": "app/libs/js/SCORM_API_wrapper.js" },
{ "Path": "require.d.ts", "IncludeInTestHarness": false },
{ "Path": "qunit.d.ts", "IncludeInTestHarness": false },
{ "Path": "tests", "IncludeInTestHarness": false, "Excludes": ["*.html"] },
{ "Path": "app/js", "IncludeInTestHarness": false }
],
"EnableCodeCoverage ": "true",
"CodeCoverageIncludes": [
"*app/js/*"
],
"CodeCoverageExcludes": [
"app/libs/*",
"tests/*"
]
}

Resources