From 228d4c1187ef44d02ac57e5dbfd3751db4f14111 Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Tue, 22 Nov 2016 20:10:52 +0300 Subject: [PATCH] merging old changes --- .../inr/numass/scripts/FixStampEndings.groovy | 27 --------- .../groovy/inr/numass/scripts/StartRun.groovy | 12 ---- .../inr/numass/scripts/TestClient.groovy | 44 --------------- .../numass/scripts/TestFileTransfer.groovy | 44 --------------- .../inr/numass/scripts/TestNotes.groovy | 20 ------- .../numass/scripts/TestRemoteClient.groovy | 46 --------------- .../inr/numass/scripts/TestStateChange.groovy | 43 -------------- .../numass/scripts/TestStorageAccess.groovy | 56 ------------------- .../inr/numass/scripts/TestServer.groovy | 45 --------------- 9 files changed, 337 deletions(-) delete mode 100644 numass-storage/numass-client/src/main/groovy/inr/numass/scripts/FixStampEndings.groovy delete mode 100644 numass-storage/numass-client/src/main/groovy/inr/numass/scripts/StartRun.groovy delete mode 100644 numass-storage/numass-client/src/main/groovy/inr/numass/scripts/TestClient.groovy delete mode 100644 numass-storage/numass-client/src/main/groovy/inr/numass/scripts/TestFileTransfer.groovy delete mode 100644 numass-storage/numass-client/src/main/groovy/inr/numass/scripts/TestNotes.groovy delete mode 100644 numass-storage/numass-client/src/main/groovy/inr/numass/scripts/TestRemoteClient.groovy delete mode 100644 numass-storage/numass-client/src/main/groovy/inr/numass/scripts/TestStateChange.groovy delete mode 100644 numass-storage/numass-client/src/main/groovy/inr/numass/scripts/TestStorageAccess.groovy delete mode 100644 numass-storage/numass-server/src/main/groovy/inr/numass/scripts/TestServer.groovy diff --git a/numass-storage/numass-client/src/main/groovy/inr/numass/scripts/FixStampEndings.groovy b/numass-storage/numass-client/src/main/groovy/inr/numass/scripts/FixStampEndings.groovy deleted file mode 100644 index 3171aa79..00000000 --- a/numass-storage/numass-client/src/main/groovy/inr/numass/scripts/FixStampEndings.groovy +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright 2015 Alexander Nozik. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import static groovy.io.FileType.FILES - -def fixStampEndings(File directory){ - directory.eachFileRecurse(FILES){ - byte[] bytes = it.bytes - bytes[26] = '!' - bytes[27] = '#' - it.bytes = bytes - } -} - -fixStampEndings(new File("C:\\Users\\darksnake\\Dropbox\\PlayGround\\data-test\\")) \ No newline at end of file diff --git a/numass-storage/numass-client/src/main/groovy/inr/numass/scripts/StartRun.groovy b/numass-storage/numass-client/src/main/groovy/inr/numass/scripts/StartRun.groovy deleted file mode 100644 index 713bcddc..00000000 --- a/numass-storage/numass-client/src/main/groovy/inr/numass/scripts/StartRun.groovy +++ /dev/null @@ -1,12 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package inr.numass.scripts - -import inr.numass.client.NumassClient - -NumassClient client = new NumassClient("192.168.111.1", 8335); -print client.startRun("2016_04") \ No newline at end of file diff --git a/numass-storage/numass-client/src/main/groovy/inr/numass/scripts/TestClient.groovy b/numass-storage/numass-client/src/main/groovy/inr/numass/scripts/TestClient.groovy deleted file mode 100644 index 36c68b89..00000000 --- a/numass-storage/numass-client/src/main/groovy/inr/numass/scripts/TestClient.groovy +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright 2015 Alexander Nozik. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package inr.numass.scripts - -import hep.dataforge.io.MetaStreamReader -import hep.dataforge.io.MetaStreamWriter -import hep.dataforge.meta.Meta -import hep.dataforge.storage.commons.JSONMetaWriter - -import hep.dataforge.storage.commons.StorageManager -import inr.numass.client.NumassClient - - -new StorageManager().startGlobal(); - -MetaStreamWriter parser = new JSONMetaWriter(); - -println "Starting Numass test client..." - -String line = ""; - -BufferedReader br = new BufferedReader(new InputStreamReader(System.in)) -while(line == null || !line.startsWith("exit")){ - // print ">" - line = br.readLine(); - if(line!= null && !line.startsWith("exit")){ - Cli.runComand("127.0.0.1", 8335, line.split(" ")); - } -} - - diff --git a/numass-storage/numass-client/src/main/groovy/inr/numass/scripts/TestFileTransfer.groovy b/numass-storage/numass-client/src/main/groovy/inr/numass/scripts/TestFileTransfer.groovy deleted file mode 100644 index b8c8fb76..00000000 --- a/numass-storage/numass-client/src/main/groovy/inr/numass/scripts/TestFileTransfer.groovy +++ /dev/null @@ -1,44 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package inr.numass.scripts - -import hep.dataforge.io.MetaStreamReader -import hep.dataforge.io.MetaStreamWriter -import hep.dataforge.io.envelopes.Envelope -import hep.dataforge.io.envelopes.EnvelopeBuilder -import hep.dataforge.meta.Meta -import hep.dataforge.storage.commons.JSONMetaWriter -import hep.dataforge.storage.commons.StorageManager -import java.io.RandomAccessFile; -import java.nio.ByteBuffer -import inr.numass.client.NumassClient -import java.nio.MappedByteBuffer -import java.nio.channels.FileChannel - - -new StorageManager().startGlobal(); - -new NumassClient("127.0.0.1",8335).withCloseable{ - - MetaStreamWriter parser = new JSONMetaWriter(); - - Meta startRun = it.startRun("test") - - println parser.writeString(startRun); - - Meta run = it.getCurrentRun(); - println parser.writeString(run); - - Meta response = it.sendNumassData("C:\\Users\\darksnake\\Dropbox\\PlayGround\\data-test\\zip\\20150703143643_1.nm.zip"); - - println parser.writeString(response); - - response = it.sendNumassData("C:\\Users\\darksnake\\Dropbox\\PlayGround\\data-test\\20150703144707_2"); - - println parser.writeString(response); -} - \ No newline at end of file diff --git a/numass-storage/numass-client/src/main/groovy/inr/numass/scripts/TestNotes.groovy b/numass-storage/numass-client/src/main/groovy/inr/numass/scripts/TestNotes.groovy deleted file mode 100644 index 1e092640..00000000 --- a/numass-storage/numass-client/src/main/groovy/inr/numass/scripts/TestNotes.groovy +++ /dev/null @@ -1,20 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package inr.numass.scripts - -import hep.dataforge.io.MetaStreamReader -import hep.dataforge.io.MetaStreamWriter -import hep.dataforge.meta.Meta -import hep.dataforge.storage.commons.JSONMetaWriter -import hep.dataforge.storage.commons.StorageManager -import inr.numass.client.NumassClient - -new StorageManager().startGlobal(); - -MetaStreamWriter parser = new JSONMetaWriter(); - -NumassClient.runComand("127.0.0.1", 8336, "addNote", "This is my note with html"); diff --git a/numass-storage/numass-client/src/main/groovy/inr/numass/scripts/TestRemoteClient.groovy b/numass-storage/numass-client/src/main/groovy/inr/numass/scripts/TestRemoteClient.groovy deleted file mode 100644 index b230a3fc..00000000 --- a/numass-storage/numass-client/src/main/groovy/inr/numass/scripts/TestRemoteClient.groovy +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright 2015 Alexander Nozik. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package inr.numass.scripts - -import hep.dataforge.io.MetaStreamReader -import hep.dataforge.io.MetaStreamWriter -import hep.dataforge.meta.Meta -import hep.dataforge.storage.commons.JSONMetaWriter - -import hep.dataforge.storage.commons.StorageManager -import inr.numass.client.NumassClient - - -new StorageManager().startGlobal(); - - - -MetaStreamWriter parser = new JSONMetaWriter(); - -println "Starting Numass test client..." - -String line = ""; - -BufferedReader br = new BufferedReader(new InputStreamReader(System.in)) -while(line == null || !line.startsWith("exit")){ - // print ">" - line = br.readLine(); - if(!line.startsWith("exit")){ - NumassClient.runComand("192.168.111.1", 8335, line.split(" ")); - } -} - - diff --git a/numass-storage/numass-client/src/main/groovy/inr/numass/scripts/TestStateChange.groovy b/numass-storage/numass-client/src/main/groovy/inr/numass/scripts/TestStateChange.groovy deleted file mode 100644 index 6d0968cd..00000000 --- a/numass-storage/numass-client/src/main/groovy/inr/numass/scripts/TestStateChange.groovy +++ /dev/null @@ -1,43 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package inr.numass.scripts - -import hep.dataforge.io.MetaStreamReader -import hep.dataforge.io.MetaStreamWriter -import hep.dataforge.io.envelopes.Envelope -import hep.dataforge.io.envelopes.EnvelopeBuilder -import hep.dataforge.meta.Meta -import hep.dataforge.meta.MetaBuilder -import hep.dataforge.storage.commons.JSONMetaWriter -import hep.dataforge.storage.commons.StorageManager -import java.io.RandomAccessFile; -import java.nio.ByteBuffer -import inr.numass.client.NumassClient -import java.nio.MappedByteBuffer -import java.nio.channels.FileChannel -import hep.dataforge.meta.MetaBuilder - - - -new StorageManager().startGlobal(); - -new NumassClient("127.0.0.1",8335).withCloseable{ - - MetaStreamWriter parser = new JSONMetaWriter(); - - Meta startRun = it.startRun("test") - - println parser.writeString(startRun); - - Meta set1 = it.setState("myState", 112); - - println parser.writeString(set1); - - Meta set2 = it.setState("otherState.property", ["a", "b", "c"]) - - println it.getStates() -} diff --git a/numass-storage/numass-client/src/main/groovy/inr/numass/scripts/TestStorageAccess.groovy b/numass-storage/numass-client/src/main/groovy/inr/numass/scripts/TestStorageAccess.groovy deleted file mode 100644 index 9818f70e..00000000 --- a/numass-storage/numass-client/src/main/groovy/inr/numass/scripts/TestStorageAccess.groovy +++ /dev/null @@ -1,56 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package inr.numass.scripts - -import hep.dataforge.io.MetaStreamWriter -import hep.dataforge.io.envelopes.Envelope -import hep.dataforge.meta.Meta -import hep.dataforge.meta.MetaBuilder -import hep.dataforge.storage.commons.JSONMetaWriter -import hep.dataforge.storage.commons.LoaderFactory -import hep.dataforge.storage.commons.StorageManager -import hep.dataforge.tables.MapPoint -import inr.numass.client.NumassClient - -new StorageManager().startGlobal(); - -new NumassClient("127.0.0.1",8335).withCloseable{ - - MetaStreamWriter parser = new JSONMetaWriter(); - - Meta startRun = it.startRun("test") - - println parser.writeString(startRun); - - - MetaBuilder target = new MetaBuilder("target") - .setValue("type","loader") - .setValue("name", "testPointLoader") - .putNode(LoaderFactory.buildDataPointLoaderMeta("testPointLoader","a", DataFormat.forNames("a", "b", "c")).rename("meta")) - - MetaBuilder data = new MetaBuilder("data"); - - String[] names = ["a","b","c"] - - - for(int i = 0; i<5; i++){ - data.putNode(DataPoint.toMeta(new MapPoint(names,i, 2*i,3*i))); - } - - - Envelope bin = it.requestBase("numass.storage") - .putMetaValue("action","push") - .putMetaNode(target) - .putMetaNode(data) - .build(); - - - def response = it.respond(bin); - - println parser.writeString(response.meta()); - -} \ No newline at end of file diff --git a/numass-storage/numass-server/src/main/groovy/inr/numass/scripts/TestServer.groovy b/numass-storage/numass-server/src/main/groovy/inr/numass/scripts/TestServer.groovy deleted file mode 100644 index aca62a18..00000000 --- a/numass-storage/numass-server/src/main/groovy/inr/numass/scripts/TestServer.groovy +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright 2015 Alexander Nozik. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package inr.numass.scripts - -import hep.dataforge.storage.filestorage.VFSUtils -import inr.numass.server.NumassServer -import inr.numass.storage.NumassStorage -import org.apache.commons.vfs2.FileObject - -String path = "D:\\temp\\test\\numass\\" - -FileObject file = VFSUtils.getLocalFile(new File(path)) - -NumassStorage storage = new NumassStorage(file,null) - -println "Starting test numass listener in "+path - -NumassServer listener = new NumassServer(storage, null); - -listener.open() - -String stopLine = ""; - -BufferedReader br = new BufferedReader(new InputStreamReader(System.in)) -while(stopLine == null || !stopLine.startsWith("exit")){ -// print ">" - stopLine = br.readLine(); -} - -listener.close() - -println "Stopping test numass listener"