[libinline-java-perl] 395/398: Files not checked in by Pat, retrieved from CPAN 0.53

Jonas Smedegaard dr at jones.dk
Thu Feb 26 11:43:29 UTC 2015


This is an automated email from the git hooks/post-receive script.

js pushed a commit to tag 0.55
in repository libinline-java-perl.

commit c83c7f5803509f15f6807a253abe7a16c5f474ee
Author: Ed J <mohawk2 at users.noreply.github.com>
Date:   Fri Nov 14 14:36:27 2014 +0000

    Files not checked in by Pat, retrieved from CPAN 0.53
---
 Java/PerlNatives/t/01_init.t         |  10 +++
 Java/PerlNatives/t/02_perl_natives.t | 118 +++++++++++++++++++++++++++++++++++
 Java/jvm.def                         |   4 ++
 3 files changed, 132 insertions(+)

diff --git a/Java/PerlNatives/t/01_init.t b/Java/PerlNatives/t/01_init.t
new file mode 100644
index 0000000..d889213
--- /dev/null
+++ b/Java/PerlNatives/t/01_init.t
@@ -0,0 +1,10 @@
+use strict ;
+use Test ;
+
+BEGIN {
+	plan(tests => 1) ;
+	mkdir('./_Inline_test', 0777) unless -e './_Inline_test' ;
+}
+
+
+ok(1) ;
diff --git a/Java/PerlNatives/t/02_perl_natives.t b/Java/PerlNatives/t/02_perl_natives.t
new file mode 100644
index 0000000..7b6932c
--- /dev/null
+++ b/Java/PerlNatives/t/02_perl_natives.t
@@ -0,0 +1,118 @@
+use strict ;
+use Test ;
+
+
+BEGIN {
+	plan(tests => 5) ;
+}
+
+
+use Inline Config =>
+           DIRECTORY => './_Inline_test' ;
+
+use Inline::Java qw(caught) ;
+
+use Inline (
+	Java => 'DATA',
+) ;
+
+
+eval {
+	t121->init() ;
+	my $t = new t121() ;
+	ok($t->types_stub(1, 2, 3, 4, 5, 6, 1, 2, "1000"), 1024) ;
+	ok($t->array_stub([34, 56], ["toto", "789"]), 789 + 34) ;
+
+	my $t2 = new t1212() ;
+	ok($t2->types_stub(1, 2, 3, 4, 5, 6, 1, 2, "1000"), 1024) ;
+
+	ok($t->callback_stub(), "toto") ;
+	ok($t->__get_private()->{proto}->ObjectCount(), 2) ;
+} ;
+if ($@){
+	if (caught("java.lang.Throwable")){
+		$@->printStackTrace() ;
+		die("Caught Java Exception") ;
+	}
+	else{
+		die $@ ;
+	}
+}
+
+
+##################################
+
+package t121 ;
+sub types {
+	my $this = shift ;
+
+	my $sum = 0 ;
+	map {$sum += $_} @_ ;
+	return $sum ;
+}
+
+
+sub array {
+	my $this = shift ;
+	my $i = shift ;
+	my $str = shift ;
+
+	return $i->[0] + $str->[1] ;
+}
+
+
+sub callback {
+	my $this = shift ;
+
+	return $this->get_name() ;
+}
+
+
+package main ;
+__DATA__
+
+__Java__
+
+
+import java.io.* ;
+import org.perl.inline.java.* ;
+
+class t121 extends InlineJavaPerlNatives {
+    static public boolean got14(){
+        return System.getProperty("java.version").startsWith("1.4") ;
+    }
+
+	public t121() throws InlineJavaException {
+	}
+
+	static public void init() throws InlineJavaException {
+		init("test") ;
+	}
+
+	public String types_stub(byte b, short s, int i, long j, float f, double d,
+        boolean x, char c, String str){
+		return types(b, s, i, j, f, d, x, c, str) ;
+	}
+	public native String types(byte b, short s, int i, long j, float f, double d,
+		boolean x, char c, String str) ;
+
+	public String array_stub(int i[], String str[]){
+		return array(i, str) ;
+	}
+	private native String array(int i[], String str[]) ;
+
+	public String callback_stub(){
+		return callback() ;
+	}
+	public native String callback() ;
+
+	public String get_name(){
+		return "toto" ;
+	}
+} ;
+
+
+class t1212 extends t121 {
+	public t1212() throws InlineJavaException {
+	}
+} ;
diff --git a/Java/jvm.def b/Java/jvm.def
new file mode 100644
index 0000000..bdab35d
--- /dev/null
+++ b/Java/jvm.def
@@ -0,0 +1,4 @@
+EXPORTS
+JNI_CreateJavaVM at 12
+JNI_GetDefaultJavaVMInitArgs at 4
+JNI_GetCreatedJavaVMs at 12

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libinline-java-perl.git



More information about the Pkg-perl-cvs-commits mailing list