VirtualBox

Changeset 38914 in vbox


Ignore:
Timestamp:
Sep 30, 2011 10:12:01 AM (13 years ago)
Author:
vboxsync
Message:

Main/glue/tests: clean up sample Java app using the glue code

Location:
trunk/src/VBox/Main
Files:
3 edited
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/Makefile.kmk

    r38796 r38914  
    933933        $(VBOX_JAR) cf $@ -C $(VBOX_JMSCOM_JDEST) .
    934934
     935## @todo compile TestVBox.java (see below) to have sanity checking
     936
    935937endif # VBOX_WITH_JMSCOM
    936938
     
    943945javagluesample_SOURCES = \
    944946        $(VBOX_PATH_MAIN_SRC)/glue/tests/TestVBox.java=>TestVBox.java \
    945         $(VBOX_PATH_MAIN_SRC)/glue/tests/Makefile.kmk=>Makefile.kmk
     947        $(VBOX_PATH_MAIN_SRC)/glue/tests/Makefile=>Makefile
    946948
    947949updatenls::
  • trunk/src/VBox/Main/glue/tests/Makefile

    r38820 r38914  
    11#
    2 # Copyright (C) 2010 Oracle Corporation
     2# Copyright (C) 2010-2011 Oracle Corporation
    33#
    44# This file is part of VirtualBox Open Source Edition (OSE), as
     
    1010# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
    1111#
    12 ifeq ($(KBUILD_HOST),darwin)
    13  VBOX_BIN=/Applications/VirtualBox.app/Contents/MacOS
    14  VBOX_SDK=$(VBOX_BIN)/sdk
    15  JAVA15=/System/Library/Frameworks/JavaVM.framework/Versions/1.5/Commands/java
    16 # JAVA_ARGS += -d32
    17 endif
    1812
    19 ifeq ($(KBUILD_HOST),linux)
    20  VBOX_BIN=/home/nike/work/ws/out/linux.amd64/debug/bin
    21  VBOX_SDK=$(VBOX_BIN)/sdk
    22 endif
     13HOSTOS=linux
     14VBOX_BIN = ../../../..
     15VBOX_SDK = ../../..
     16JACOB_DIR =
     17CLASSPATH = .
    2318
    24 ifeq ($(KBUILD_HOST),win)
    25  VBOX_BIN=e:/ws/out/win.amd64/debug/bin
    26  VBOX_SDK=$(VBOX_BIN)/sdk
    27  JACOB_DIR=s:/jacob-1.15-M3/
     19ifeq ($(HOSTOS),win)
    2820 JACOB_JAR=$(JACOB_DIR)/jacob.jar
    29  CLASSPATH += $(JACOB_JAR)$(SEP)
    30  JAVA_ARGS += -Djava.library.path=$(JACOB_DIR)
    31 endif
    32 
    33 ifeq ($(KBUILD_HOST),win)
    3421 VBOX_JAR=$(VBOX_SDK)/bindings/mscom/java/vboxjmscom.jar
    3522 SEP=\;
     23 JAVA_COM_ARGS += -Djava.library.path=$(JACOB_DIR)
     24 CLASSPATH += $(JACOB_JAR)$(SEP)
    3625else
    3726 VBOX_JAR=$(VBOX_SDK)/bindings/xpcom/java/vboxjxpcom.jar
    3827 SEP=:
     28 JAVA_COM_ARGS += -Dvbox.home=$(VBOX_BIN)
    3929endif
    4030
    4131VBOX_JAR_WS=$(VBOX_SDK)/bindings/webservice/java/jax-ws/vboxjws.jar
    4232
    43 JAVA_ARGS += -Dvbox.home=$(VBOX_BIN)
    44 CLASSPATH  := $(CLASSPATH)$(VBOX_JAR)$(SEP).
    4533
    46 all: testvb
     34all: ws/TestVBox.class com/TestVBox.class
    4735
    48 testvb:
    49         javac -cp $(VBOX_JAR) TestVBox.java
    50         java $(JAVA_ARGS) -cp $(CLASSPATH)  TestVBox
     36test: ws/test-TestVBox com/test-TestVBox
    5137
    52 JAXLIBS=../../webservice/jaxlibs/
    53 # -noverify could be needed due http://bugs.sun.com/bugdatabase/view_bug.do;jsessionid=eb3fcd8f72ab4713f96e378a7575?bug_id=6614974
    54 testws15:
    55         javac -target 1.5 -source 1.5 -cp $(VBOX_JAR) TestVBox.java
    56         $(JAVA15) $(JAVA_ARGS) -cp $(VBOX_JAR_WS)$(SEP)$(CLASSPATH)$(SEP)$(JAXLIBS)/jaxws-api.jar$(SEP)$(JAXLIBS)/jaxws-rt.jar \
    57             TestVBox -w -url http://localhost:18083
     38com/TestVBox.class:
     39        @mkdir com 2>/dev/null || true
     40        javac -g -d com -cp $(VBOX_JAR)$(SEP)$(CLASSPATH) TestVBox.java
    5841
    59 testws:
    60         javac -cp $(VBOX_JAR_WS) TestVBox.java
    61         java $(JAVA_ARGS) -cp $(VBOX_JAR_WS)$(SEP)$(CLASSPATH) TestVBox -w -url http://localhost:18083
     42com/test-TestVBox: com/TestVBox.class
     43        java $(JAVA_COM_ARGS) -cp com$(SEP)$(VBOX_JAR)$(SEP)$(CLASSPATH) TestVBox
     44
     45ws/TestVBox.class:
     46        @mkdir ws 2>/dev/null || true
     47        javac -d ws -cp $(VBOX_JAR_WS)$(SEP)$(CLASSPATH) TestVBox.java
     48
     49ws/test-TestVBox: ws/TestVBox.class
     50        java $(JAVA_WS_ARGS) -cp ws$(SEP)$(VBOX_JAR_WS)$(SEP)$(CLASSPATH) TestVBox -w -url http://localhost:18083/
  • trunk/src/VBox/Main/glue/tests/TestVBox.java

    r36281 r38914  
    11/* $Id$ */
     2
     3/* Small sample/testcase which demonstrates that the same source code can
     4 * be used to connect to the webservice and (XP)COM APIs. */
     5
    26/*
    3  * Copyright (C) 2010 Oracle Corporation
     7 * Copyright (C) 2010-2011 Oracle Corporation
    48 *
    59 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    1115 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
    1216 */
    13 import org.virtualbox_4_1.*;
     17import org.virtualbox_4_2.*;
    1418import java.util.List;
    1519import java.util.Arrays;
     
    6064
    6165        try {
    62             for (int i=0; i<100; i++)
     66            for (int i=0; i<50; i++)
    6367            {
    6468                System.out.print(".");
    65                 IEvent ev = es.getEvent(listener, 1000);
     69                IEvent ev = es.getEvent(listener, 500);
    6670                if (ev != null)
    6771                {
     
    8286        for (IMachine m : machs)
    8387        {
    84             System.out.println("VM name: " + m.getName());// + ", RAM size: " + m.getMemorySize() + "MB");
    85             System.out.println(" HWVirt: " + m.getHWVirtExProperty(HWVirtExPropertyType.Enabled)
    86                                + ", Nested Paging: " + m.getHWVirtExProperty(HWVirtExPropertyType.NestedPaging)
    87                                + ", PAE: " + m.getCPUProperty(CPUPropertyType.PAE) );
     88            String name;
     89            Long ram = 0L;
     90            boolean hwvirtEnabled = false, hwvirtNestedPaging = false;
     91            boolean paeEnabled = false;
     92            boolean inaccessible = false;
     93            try
     94            {
     95                name = m.getName();
     96                ram = m.getMemorySize();
     97                hwvirtEnabled = m.getHWVirtExProperty(HWVirtExPropertyType.Enabled);
     98                hwvirtNestedPaging = m.getHWVirtExProperty(HWVirtExPropertyType.NestedPaging);
     99                paeEnabled = m.getCPUProperty(CPUPropertyType.PAE);
     100            }
     101            catch (VBoxException e)
     102            {
     103                name = "<inaccessible>";
     104                inaccessible = true;
     105            }
     106            System.out.println("VM name: " + name);
     107            if (!inaccessible)
     108            {
     109                System.out.println(" RAM size: " + ram + "MB"
     110                                   + ", HWVirt: " + hwvirtEnabled
     111                                   + ", Nested Paging: " + hwvirtNestedPaging
     112                                   + ", PAE: " + paeEnabled);
     113            }
    88114        }
    89115    }
     
    171197                System.out.println("VirtualBox version: " + vbox.getVersion() + "\n");
    172198                testEnumeration(mgr, vbox);
    173                 //testReadLog(mgr, vbox);
     199                testReadLog(mgr, vbox);
    174200                testStart(mgr, vbox);
    175201                testEvents(mgr, vbox.getEventSource());
  • trunk/src/VBox/Main/webservice/Makefile.kmk

    r38802 r38914  
    402402        $(VBOX_JAR) cf $@ -C $(VBOX_JWS_GEN)/java .
    403403
     404## @todo compile ../glue/tests/TestVBox.java to have sanity checking
     405
    404406 endif # VBOX_WITH_JWS
    405407
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette