incubator-kato-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From spo...@apache.org
Subject svn commit: r819618 - in /incubator/kato/trunk/org.apache.kato/kato.native/kato.native.vmapi: src/main/native/ tests/ tests/.settings/ tests/src/test/java/test/apache/kato/vmapi/
Date Mon, 28 Sep 2009 15:59:44 GMT
Author: spoole
Date: Mon Sep 28 15:59:44 2009
New Revision: 819618

URL: http://svn.apache.org/viewvc?rev=819618&view=rev
Log:
added win32 get process and send break signal code to vm api 

Added:
    incubator/kato/trunk/org.apache.kato/kato.native/kato.native.vmapi/tests/.classpath
    incubator/kato/trunk/org.apache.kato/kato.native/kato.native.vmapi/tests/.project
    incubator/kato/trunk/org.apache.kato/kato.native/kato.native.vmapi/tests/.settings/
    incubator/kato/trunk/org.apache.kato/kato.native/kato.native.vmapi/tests/.settings/org.eclipse.jdt.core.prefs
    incubator/kato/trunk/org.apache.kato/kato.native/kato.native.vmapi/tests/.settings/org.maven.ide.eclipse.prefs
Modified:
    incubator/kato/trunk/org.apache.kato/kato.native/kato.native.vmapi/src/main/native/katovmapi.c
    incubator/kato/trunk/org.apache.kato/kato.native/kato.native.vmapi/tests/src/test/java/test/apache/kato/vmapi/TestLibraryLoad.java

Modified: incubator/kato/trunk/org.apache.kato/kato.native/kato.native.vmapi/src/main/native/katovmapi.c
URL: http://svn.apache.org/viewvc/incubator/kato/trunk/org.apache.kato/kato.native/kato.native.vmapi/src/main/native/katovmapi.c?rev=819618&r1=819617&r2=819618&view=diff
==============================================================================
--- incubator/kato/trunk/org.apache.kato/kato.native/kato.native.vmapi/src/main/native/katovmapi.c
(original)
+++ incubator/kato/trunk/org.apache.kato/kato.native/kato.native.vmapi/src/main/native/katovmapi.c
Mon Sep 28 15:59:44 2009
@@ -1,9 +1,55 @@
+/*******************************************************************************
+ * 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.
+ ******************************************************************************/
+
+
 #include "org_apache_kato_common_DumpTrigger.h"
 
-JNIEXPORT jboolean JNICALL Java_org_apache_kato_common_DumpTrigger_triggerDump
+#ifdef WIN32
+#include <Windows.h>
+#endif
+/*
+ * Class:     org_apache_kato_common_DumpTrigger
+ * Method:    getNativeProcessID
+ * Signature: ()I
+ */
+JNIEXPORT jint JNICALL Java_org_apache_kato_common_DumpTrigger_getNativeProcessID
 (JNIEnv *env, jobject obj) {
+	 jint result=0;
+
+#ifdef WIN32
+	 DWORD ProcessId = GetCurrentProcessId();
+	 result=ProcessId;
+#endif
+
+	 return result;
+
+}
+
+/*
+ * Class:     org_apache_kato_common_DumpTrigger
+ * Method:    triggernativeDump
+ * Signature: ()Z
+ */JNIEXPORT jboolean JNICALL Java_org_apache_kato_common_DumpTrigger_sendDumpSignal
+ (JNIEnv *env, jobject obj, jint processID) {
+
+	
+	jboolean result=JNI_TRUE;
+	
+	GenerateConsoleCtrlEvent(CTRL_BREAK_EVENT,0);
 
-	printf("\nCalled...\n");
+	return result;
+	
 }
 
 

Added: incubator/kato/trunk/org.apache.kato/kato.native/kato.native.vmapi/tests/.classpath
URL: http://svn.apache.org/viewvc/incubator/kato/trunk/org.apache.kato/kato.native/kato.native.vmapi/tests/.classpath?rev=819618&view=auto
==============================================================================
--- incubator/kato/trunk/org.apache.kato/kato.native/kato.native.vmapi/tests/.classpath (added)
+++ incubator/kato/trunk/org.apache.kato/kato.native/kato.native.vmapi/tests/.classpath Mon
Sep 28 15:59:44 2009
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="src" output="target/classes" path="src/main/java"/>
+	<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"/>
+	<classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
+	<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+	<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
+	<classpathentry kind="output" path="target/classes"/>
+</classpath>

Added: incubator/kato/trunk/org.apache.kato/kato.native/kato.native.vmapi/tests/.project
URL: http://svn.apache.org/viewvc/incubator/kato/trunk/org.apache.kato/kato.native/kato.native.vmapi/tests/.project?rev=819618&view=auto
==============================================================================
--- incubator/kato/trunk/org.apache.kato/kato.native/kato.native.vmapi/tests/.project (added)
+++ incubator/kato/trunk/org.apache.kato/kato.native/kato.native.vmapi/tests/.project Mon
Sep 28 15:59:44 2009
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>kato.native.vmapi.tests</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.maven.ide.eclipse.maven2Builder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+		<nature>org.maven.ide.eclipse.maven2Nature</nature>
+	</natures>
+</projectDescription>

Added: incubator/kato/trunk/org.apache.kato/kato.native/kato.native.vmapi/tests/.settings/org.eclipse.jdt.core.prefs
URL: http://svn.apache.org/viewvc/incubator/kato/trunk/org.apache.kato/kato.native/kato.native.vmapi/tests/.settings/org.eclipse.jdt.core.prefs?rev=819618&view=auto
==============================================================================
--- incubator/kato/trunk/org.apache.kato/kato.native/kato.native.vmapi/tests/.settings/org.eclipse.jdt.core.prefs
(added)
+++ incubator/kato/trunk/org.apache.kato/kato.native/kato.native.vmapi/tests/.settings/org.eclipse.jdt.core.prefs
Mon Sep 28 15:59:44 2009
@@ -0,0 +1,5 @@
+#Mon Sep 28 15:32:54 BST 2009
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.source=1.6

Added: incubator/kato/trunk/org.apache.kato/kato.native/kato.native.vmapi/tests/.settings/org.maven.ide.eclipse.prefs
URL: http://svn.apache.org/viewvc/incubator/kato/trunk/org.apache.kato/kato.native/kato.native.vmapi/tests/.settings/org.maven.ide.eclipse.prefs?rev=819618&view=auto
==============================================================================
--- incubator/kato/trunk/org.apache.kato/kato.native/kato.native.vmapi/tests/.settings/org.maven.ide.eclipse.prefs
(added)
+++ incubator/kato/trunk/org.apache.kato/kato.native/kato.native.vmapi/tests/.settings/org.maven.ide.eclipse.prefs
Mon Sep 28 15:59:44 2009
@@ -0,0 +1,9 @@
+#Mon Sep 28 15:32:46 BST 2009
+activeProfiles=
+eclipse.preferences.version=1
+fullBuildGoals=process-test-resources
+includeModules=false
+resolveWorkspaceProjects=true
+resourceFilterGoals=process-resources resources\:testResources
+skipCompilerPlugin=true
+version=1

Modified: incubator/kato/trunk/org.apache.kato/kato.native/kato.native.vmapi/tests/src/test/java/test/apache/kato/vmapi/TestLibraryLoad.java
URL: http://svn.apache.org/viewvc/incubator/kato/trunk/org.apache.kato/kato.native/kato.native.vmapi/tests/src/test/java/test/apache/kato/vmapi/TestLibraryLoad.java?rev=819618&r1=819617&r2=819618&view=diff
==============================================================================
--- incubator/kato/trunk/org.apache.kato/kato.native/kato.native.vmapi/tests/src/test/java/test/apache/kato/vmapi/TestLibraryLoad.java
(original)
+++ incubator/kato/trunk/org.apache.kato/kato.native/kato.native.vmapi/tests/src/test/java/test/apache/kato/vmapi/TestLibraryLoad.java
Mon Sep 28 15:59:44 2009
@@ -10,8 +10,16 @@
 
 	private static String getLibName() {
 		Object libloc=System.getProperties().get("libloc");
-		if(libloc==null) throw new RuntimeException("system property libloc which defines the directory
containing the native lib is missing");
-		String location=libloc.toString();
+		String location=null;
+		
+		if(libloc==null) {
+			location="../target";
+		}
+		else  {
+			//if(libloc==null) throw new RuntimeException("system property libloc which defines the
directory containing the native lib is missing");
+		 location=libloc.toString();
+		}
+	
 		File dir=new File(location);
 		if(dir.exists()==false) {
 			 throw new RuntimeException("Directory location defined by system property libloc does
not exist [libloc="+location+"]"); 
@@ -28,11 +36,21 @@
 		 throw new RuntimeException("system property libloc location does not hold a file matching
*katovmapi* [libloc="+location+"]");
 		
 	}
+	
 	public void testTrigger() {
 		
+		loadLibrary();
+		DumpTrigger.triggerDump();
+	}
+	public void testGetProcessID() {
+		
+		loadLibrary();
+		int id=DumpTrigger.getProcessID();
+		assertFalse("id is zero",id==0);
+	}
+
+	private void loadLibrary() {
 		String libname=getLibName();	
 		System.load(libname);
-		DumpTrigger t=new DumpTrigger();
-		t.triggerDump();
 	}
 }



Mime
View raw message