*not part of the buld*

blackConnect tests update


git-svn-id: svn://10.0.0.236/trunk@99925 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
idk%eng.sun.com
2001-07-25 22:05:35 +00:00
parent ad651ef17b
commit 4e0a322dbc
92 changed files with 1360 additions and 885 deletions

View File

@@ -1,2 +1,2 @@
a3532005-66d4-4988-8067-dd1928c60138
component://netscape/blackwood/blackconnect/test/mthreads/MThreadComponent1
@mozilla/blackwood/blackconnect/test/mthreads/MThreadComponent1;1

View File

@@ -29,48 +29,102 @@ import java.io.FileOutputStream;
public class MThreadComponent1 implements iMThreadComponent1, iMThreadComponent {
private iMThreadContext context = null;
private nsIComponentManager com=null;
private int thr=0;
private int stg=0;
public MThreadComponent1() {
System.out.println("DEbug:avm:MThreadComponent1 constructor");
}
public void initialize(iMThreadContext context) {
System.out.println("DEbug:avm:MThreadComponent1:initialize Thread is " + Thread.currentThread().getName());
this.context = context;
}
public void tHack(nsIComponentManager cm) {
nsIFactory factory = null;
System.out.println("DEbug:avm:tHack");
if(cm == null) {
System.err.println("DEbug:avm:tHack:ComponentManager is NULL!!!!!");
return;
}
com=cm;
factory = cm.findFactory(iMThreadContextCID);
if(factory == null) {
System.err.println("DEbug:avm:tHack:Factory is NULL!!!!!");
return;
}
Object res = factory.createInstance(null, iMThreadContext.IID);
if(res == null) {
System.err.println("DEbug:avm:tHack:Instance is NULL!!!!!");
return;
}
context = (iMThreadContext)res;
if(context == null) {
System.err.println("Create instance failed!! Server is NULLLLLLLLLLLLLLLLLLL");
return;
}
}
public iMThreadComponent loadComponent(CID classID) {
System.out.println("DEbug:avm:MThreadComponent1:loadComponent");
nsIComponentManager cm = context.getComponentManager();
nsIFactory factory = cm.findFactory(classID);
if(factory == null) {
System.out.println("DEbug:avm:Factory is NULL!!!!!");
System.err.println("DEbug:avm:loadComponent:Factory is NULL!!!!!");
return null;
}
iMThreadComponent component = (iMThreadComponent)factory.createInstance(null, iMThreadComponent.IID);
return component;
}
/* void Execute (); */
public void execute(String tName) {
public void execute(int thread, int stage) {
System.out.println("DEbug:avm:MThreadComponent1:execute.");
String cThreadName = Thread.currentThread().getName();
if(tName.equals(cThreadName)) {
System.out.println("PASSED: original and expected names equals to " + tName);
} else {
System.out.println("FAILED: Current thread name is " + cThreadName + " instead of " + tName );
}
CID classID = new CID(context.getNext());
iMThreadComponent component = loadComponent(classID);
if(component == null) {
System.out.println("Can't load component");
return;
}
System.out.println("Initialize of " + component + " called in thread " + cThreadName);
component.initialize(context);
(new ExecutionThread(component)).run();
//component.execute();
try{
DataOutputStream f=new DataOutputStream(new FileOutputStream(context.getResFile(),true));
f.writeBytes((new Integer(thread)).toString()+","+(new Integer(stage)).toString()+","+cThreadName+"\n");
f.close();
} catch(Exception e) {
System.err.println("Exception during writing the file: " +e);
e.printStackTrace();
}
CID classID = new CID(context.getContractID(thread+1,stage+1));
if (!(classID.toString().equals("org.mozilla.xpcom.CID@null"))){
iMThreadComponent component = loadComponent(classID);
if(component == null) {
System.err.println("Can't load component");
} else {
component.initialize(context);
component.tHack(com);
(new ExecutionThread(component)).run(thread+1,stage+1);
}
}
classID = new CID(context.getContractID(thread,stage+1));
if (!(classID.toString().equals("org.mozilla.xpcom.CID@null"))){
iMThreadComponent component = loadComponent(classID);
if(component == null) {
System.err.println("Can't load component");
} else {
component.initialize(context);
component.tHack(com);
component.execute(thread,stage+1);
}
}
}
public Object queryInterface(IID iid) {
System.out.println("DEbug:avm:MThreadComponent1::queryInterface iid="+iid);
if ( iid.equals(nsISupports.IID)
@@ -81,13 +135,12 @@ public class MThreadComponent1 implements iMThreadComponent1, iMThreadComponent
}
}
static CID J2XINServerCID = new CID("1ddc5b10-9852-11d4-aa22-00a024a8bbac");
static CID iMThreadContextCID = new CID("139b8350-280a-46d0-8afc-f1939173c2ea");
static {
try {
Class nsIComponentManagerClass =
Class.forName("org.mozilla.xpcom.nsIComponentManager");
InterfaceRegistry.register(nsIComponentManagerClass);
Class iMThreadComponentClass =
Class.forName("org.mozilla.xpcom.iMThreadComponent");
InterfaceRegistry.register(iMThreadComponentClass);
@@ -104,11 +157,3 @@ public class MThreadComponent1 implements iMThreadComponent1, iMThreadComponent
}
}
}

View File

@@ -18,6 +18,8 @@
# Rights Reserved.
#
# Contributor(s):
# Client QA Team, St. Petersburg, Russia
#
DEPTH=../../../../../..
topsrcdir = $(DEPTH)

View File

@@ -40,7 +40,7 @@ interface iMThreadComponent1 : nsISupports
{0x80, 0x67, 0xdd, 0x19, 0x28, 0xc6, 0x01, 0x38} \
}
#define MTHREADCOMPONENT1_PROGID "component://netscape/blackwood/blackconnect/test/mthreads/MThreadComponent1"
#define MTHREADCOMPONENT1_PROGID "@mozilla/blackwood/blackconnect/test/mthreads/MThreadComponent1;1"
%}

View File

@@ -18,36 +18,41 @@
# Rights Reserved.
#
# Contributor(s):
# Client QA Team, St. Petersburg, Russia
#
DEPTH=..\..\..\..\..\..
topsrcdir = $(DEPTH)
srcdir = .
VPATH = .
JAVA_OR_NSJVM=1
NO_CAFE=1
include <$(topsrcdir)\config\rules.mak>
include <$(DEPTH)\config\config.mak>
JAVA_SRC = \
MThreadComponent1.java
MThreadComponent1.java \
$(NULL)
JDIRS = .
JAVAC_PROG=$(JDKHOME)\bin\javac
JAVAC_FLAGS=-classpath $(CLASSPATH);$(JAVA_DESTPATH) -d $(JAVA_DESTPATH)
include <$(topsrcdir)\config\rules.mak>
include <$(topsrcdir)\config\javarules.mak>
JAVAI_SRC = \
iMThreadComponent1.java
MThreadComponent1.jar.comp: manifest MThreadComponent1.class
$(JDKHOME)\bin\jar cvfm MThreadComponent1.jar.comp manifest *.class
MThreadComponent1.class:
$(JDKHOME)\bin\javac -classpath $(DEPTH)\dist\classes $(JAVA_SRC)
export::
$(JDKHOME)\bin\javac -classpath $(DEPTH)\dist\classes -d $(DEPTH)\dist\classes $(JAVAI_SRC)
install-component: MThreadComponent1.jar.comp MThreadComponent1.jar.info
copy MThreadComponent1.jar* $(DIST)\bin\components
clobber::
del /f *.class *.jar.comp
del /f $(DIST)\bin\components\MThreadComponent1.jar.*
del /f $(DIST)\..\classes\org\mozilla\xpcom\iMThreadComponent1.class
del /f $(DIST)\..\classes\MThreadComponent1.class
clobber_all:: clobber
install:: install-component