
6 changed files with 1 additions and 155 deletions
@ -1,33 +0,0 @@ |
|||||
include ../../../../../../../Makefile.conf |
|
||||
include ../Makefile.conf |
|
||||
|
|
||||
TEST_UNIT_NAME=jni85 |
|
||||
|
|
||||
JAVA_CLASSES = \
|
|
||||
Step1.class \
|
|
||||
Step2.class \
|
|
||||
../utils/TestUtils.class |
|
||||
|
|
||||
.PHONY: compile run test clean |
|
||||
|
|
||||
all: compile |
|
||||
$(MAKE) run |
|
||||
|
|
||||
run: compile clean-pep-home |
|
||||
cd $(JAVA_CWD);HOME=$(JAVA_PEP_HOME_DIR) $(JAVA) $(JAVA_PKG_BASENAME).$(TEST_UNIT_NAME).TestMain |
|
||||
|
|
||||
compile: $(JAVA_CLASSES) |
|
||||
|
|
||||
%.class: %.java |
|
||||
cd $(JAVA_CWD);javac -cp $(CLASSPATH) $(JAVA_PKG_BASEPATH)/$(TEST_UNIT_NAME)/$< |
|
||||
|
|
||||
clean: |
|
||||
rm -f $(JAVA_CLASSES) |
|
||||
rm -f *.class |
|
||||
rm -f *.log |
|
||||
rm -Rf .gnupg |
|
||||
rm -Rf .lldb |
|
||||
|
|
||||
clean-pep-home: |
|
||||
rm -rf $(PEP_HOME_DIR)/* |
|
||||
rm -rf $(PEP_HOME_DIR)/.pEp |
|
@ -1,58 +0,0 @@ |
|||||
package foundation.pEp.jniadapter.test.jni85; |
|
||||
import foundation.pEp.jniadapter.*; |
|
||||
import java.util.Vector; |
|
||||
import java.net.URL; |
|
||||
import java.net.URLClassLoader; |
|
||||
import java.lang.Thread; |
|
||||
import java.lang.InterruptedException; |
|
||||
|
|
||||
import java.io.IOException; |
|
||||
import java.nio.file.Files; |
|
||||
import java.nio.file.Path; |
|
||||
import java.nio.file.Paths; |
|
||||
|
|
||||
class Step1 { |
|
||||
|
|
||||
public static void main(String[] args) { |
|
||||
new Thread(() -> { |
|
||||
Engine e = null; |
|
||||
|
|
||||
// load
|
|
||||
try { |
|
||||
e = new Engine(); |
|
||||
SyncCallbacks callbacks = new SyncCallbacks(); |
|
||||
//e.setNotifyHandshakeCallback(callbacks);
|
|
||||
e.setMessageToSendCallback(callbacks); |
|
||||
} |
|
||||
catch (pEpException ex) { |
|
||||
System.out.println("Cannot load"); |
|
||||
System.exit(-1); |
|
||||
} |
|
||||
System.out.println("Test loaded"); |
|
||||
|
|
||||
|
|
||||
// Keygen
|
|
||||
Engine en = new Engine(); |
|
||||
System.out.println("Generating keys: "); |
|
||||
Identity user2 = new Identity(); |
|
||||
user2.user_id = "pEp_own_userId"; |
|
||||
user2.me = true; |
|
||||
user2.username = "Test User 2"; |
|
||||
user2.address = "jniTestUser2@peptest.ch"; |
|
||||
user2 = en.myself(user2); |
|
||||
System.out.print("Keys generated: "); |
|
||||
System.out.println(user2.fpr); |
|
||||
|
|
||||
// it's not necessary - you can just shutdown Sync and that's it
|
|
||||
// but for this test give sync a chance to process all messages
|
|
||||
try { |
|
||||
Thread.sleep(200); |
|
||||
System.out.println("End wait"); |
|
||||
} |
|
||||
catch (InterruptedException ex) { } |
|
||||
|
|
||||
}).start(); |
|
||||
|
|
||||
throw new RuntimeException(); |
|
||||
} |
|
||||
} |
|
@ -1,36 +0,0 @@ |
|||||
package foundation.pEp.jniadapter.test.jni85; |
|
||||
import foundation.pEp.jniadapter.*; |
|
||||
import java.lang.Thread; |
|
||||
import java.lang.InterruptedException; |
|
||||
|
|
||||
class Step2 { |
|
||||
|
|
||||
public static void main(String[] args) { |
|
||||
Engine e = null; |
|
||||
|
|
||||
// load
|
|
||||
try { |
|
||||
e = new Engine(); |
|
||||
SyncCallbacks callbacks = new SyncCallbacks(); |
|
||||
//e.setNotifyHandshakeCallback(callbacks);
|
|
||||
e.setMessageToSendCallback(callbacks); |
|
||||
} |
|
||||
catch (pEpException ex) { |
|
||||
System.out.println("Cannot load"); |
|
||||
System.exit(-1); |
|
||||
} |
|
||||
System.out.println("Test loaded"); |
|
||||
|
|
||||
|
|
||||
e.startSync(); |
|
||||
|
|
||||
//It should crash here.
|
|
||||
|
|
||||
try { |
|
||||
Thread.sleep(200); |
|
||||
} |
|
||||
catch (InterruptedException ex) { } |
|
||||
|
|
||||
System.exit(0); |
|
||||
} |
|
||||
} |
|
@ -1,25 +0,0 @@ |
|||||
package foundation.pEp.jniadapter.test.jni85; |
|
||||
import foundation.pEp.jniadapter.*; |
|
||||
|
|
||||
public class SyncCallbacks implements Sync.MessageToSendCallback, Sync.NotifyHandshakeCallback { |
|
||||
public void messageToSend(Message message) |
|
||||
{ |
|
||||
System.out.println("================================"); |
|
||||
System.out.println("Message to send called"); |
|
||||
System.out.println("From: " + message.getFrom()); |
|
||||
System.out.println("To: " + message.getTo()); |
|
||||
System.out.println("Subject: " + message.getShortmsg()); |
|
||||
System.out.println("================================"); |
|
||||
} |
|
||||
|
|
||||
public void notifyHandshake(Identity myself, Identity partner, SyncHandshakeSignal signal) |
|
||||
{ |
|
||||
System.out.println("================================"); |
|
||||
System.out.println("Notify handshake called"); |
|
||||
System.out.println("Myself: " + myself); |
|
||||
System.out.println("Partner: " + partner); |
|
||||
System.out.println("Signal: " + signal); |
|
||||
System.out.println("================================"); |
|
||||
} |
|
||||
} |
|
||||
|
|
Loading…
Reference in new issue