shamblett / cmis

A browser and server based CMIS client in Dart
GNU General Public License v3.0
2 stars 0 forks source link

testing using example #4

Closed digcatcom closed 4 years ago

digcatcom commented 4 years ago

Hi, I came across your module for cmis, and thought Id give it a test, however, when trying to hit a recent alfresco 5.2.2 enterprise, im getting the below response from the cmisSession, using the example, against http://cmis.alfresco.com/cmisbrowser.

E/flutter (22370): [ERROR:flutter/lib/ui/ui_dart_state.cc(166)] Unhandled Exception: NoSuchMethodError: Class 'String' has no instance method 'toList'.

im seeing this error because im getting back

{"jsonCmisResponse":{"exception":"notSupported","message":"No selector"},"error":false,"errorCode":null}

Im just wondering whether this module is dead, or whether i'm missing something, or Alfresco version is too new. Is the example working for you ?

many thanks

shamblett commented 4 years ago

It certainly needs a bit of maintenance in its old age, I'm guessing Alfresco has moved on.

I'll have a look at this though, it should work with the latest version.

digcatcom commented 4 years ago

oh that is grand you can spend some of your time looking at this, would be great if this worked. Will test again if your find out whats up with it.

shamblett commented 4 years ago

OK, the test suite was showing the same issues, seems alfresco is a bit more particular now about trailing backslashes. I've fixed this and the test suite is now running again. If you wish to keep testing please for now use cmis from the repo rather than the package itself i.e. update your pubspec.yaml -

dependencies:
  cmis:
    git: https://github.com/shamblett/cmis.git

I'll republish when you've completed your testing, if you find anything else please add it to this issue.

If you intend to use this in a production environment It may be worth updating it to be a bit more modern, i.e use a futures based API rather than the much older completion based one.

digcatcom commented 4 years ago

Hi Steve

So I was trying to use query with this example

Future<JsonObjectLite> getQuery() async { final completer = Completer<JsonObjectLite>(); void localcompleter() { final dynamic cmisResponse = cmisSession.completionResponse; print(cmisResponse); final dynamic repo = cmisResponse.jsonCmisResponse.toList()[0]; final String repositoryId = repo.toList()[0]; cmisSession.repositoryId = repositoryId; completer.complete(repo); } cmisSession.resultCompletion = localcompleter; cmisSession.query('SELECT * FROM cmis:document'); return completer.future; }

..........

await getQuery();

but i'm seeing

{"jsonCmisResponse":{"error":"Invalid HTTP response","reason":"HEAD or status code of 0"},"error":true,"errorCode":0}

I was hoping to see a list of folders, but not 100% on this, I couldnt see an example test for running a query directly

digcatcom commented 4 years ago

hmm not sure, but on the last few tests im seeing the same Invalid HTTP response

Getting type descendants {"error":"Invalid HTTP response","reason":"HEAD or status code of 0"} 00:02 +7: C:\Users\darenf\AndroidStudioProjects\cmis\test\cmis_server_test.dart: Type children Getting type children {"error":"Invalid HTTP response","reason":"HEAD or status code of 0"} 00:02 +8: C:\Users\darenf\AndroidStudioProjects\cmis\test\cmis_server_test.dart: Type definition Getting type definition {"error":"Invalid HTTP response","reason":"HEAD or status code of 0"} 00:02 +9: All tests passed!

shamblett commented 4 years ago

Yes sorry my bad, although the test suite was running on closer inspection there were errors, it should be better now, I've added a unit test for the query method using your selector and it seems to be OK now.

digcatcom commented 4 years ago

Hi Steve Ok making a bit more progress, hopefully this isnt my lack of knowledge on flutter, but im seeing more, but im getting this error, with this code :-

Future<JsonObjectLite> getQuery() async { final completer = Completer<JsonObjectLite>(); void localcompleter() { final dynamic cmisResponse = cmisSession.completionResponse; print(cmisResponse); final dynamic repo = cmisResponse.jsonCmisResponse.toList()[0]; final String repositoryId = repo.toList()[0]; cmisSession.repositoryId = repositoryId; completer.complete(repo); } cmisSession.resultCompletion = localcompleter; cmisSession.query('SELECT * FROM cmis:document'); return completer.future; }

in console im seeing from the print(cmisResponse) a chopped off piece of very promising json

I/flutter (31797): {"jsonCmisResponse":{"results":[{"properties":{"alfcmis:nodeRef":{"id":"alfcmis:nodeRef","localName":"nodeRef","displayName":"Alfresco Node Ref","queryName":"alfcmis:nodeRef","type":"id","cardinality":"single","value":"workspace://SpacesStore/c3d3daa9-32a0-4182-94c9-eed5d1505408"},"cmis:isImmutable":{"id":"cmis:isImmutable","localName":"isImmutable","displayName":"Is Immutable","queryName":"cmis:isImmutable","type":"boolean","cardinality":"single","value":false},"cmis:versionLabel":{"id":"cmis:versionLabel","localName":"versionLabel","displayName":"Version Label","queryName":"cmis:versionLabel","type":"string","cardinality":"single","value":"1.0"},"cmis:objectTypeId":{"id":"cmis:objectTypeId","localName":"objectTypeId","displayName":"Object Type Id","queryName":"cmis:objectTypeId","type":"id","cardinality":"single","value":"cmis:document"},"cmis:description":{"id":"cmis:description","localName":"description","displayName":"Description","queryName":"cmis:description","type":"string","cardinality":"single","va E/flutter (31797): [ERROR:flutter/lib/ui/ui_dart_state.cc(166)] Unhandled Exception: type 'JsonObjectLite' is not a subtype of type 'String'

shamblett commented 4 years ago

OK, my test procedure I think does the same as above(the repo id is already set) -

test('Query ', () {
    dynamic cmisResponse;
    void completer() {
      cmisResponse = cmisSession.completionResponse;
      var resp = cmisResponse.jsonCmisResponse.toString();
      print(resp);
    }

    cmisSession.resultCompletion = expectAsync0(completer, count: 1);
    print('Running CMIS query');
    cmisSession.depth = 1;
    cmisSession.query('SELECT * FROM cmis:document');
  });

and it prints OK although it is extremely long, piccy attached of the last page of my debug output from this test,

cmis

Try explicitly calling toString() on the result or, try and narrow the query to something more manageable.

digcatcom commented 4 years ago

hi Steve Ive done the testing I need, and all good so far, so when your ready to push a new release that would be great. cheers again for your work on this, Daren

shamblett commented 4 years ago

Ok, thanks for the testing. I've re published the package at 4.1.0. If you have any other issues or indeed anything you think would make the package more useful please raise them.