package com.vci.test.bof.event; import junit.framework.Assert; import org.junit.After; import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; import com.vci.corba.common.VCIError; import com.vci.corba.omd.data.AttributeValue; import com.vci.corba.omd.data.BusinessObject; import com.vci.corba.omd.data.LinkObject; import com.vci.server.bof.BOFactoryServiceImpl; public class LOFactoryTest { public static BOFactoryServiceImpl impl = null; @BeforeClass public static void setUpBeforeClass() throws Exception { } @AfterClass public static void tearDownAfterClass() throws Exception { } @Before public void setUp() throws Exception { impl = new BOFactoryServiceImpl(); } @After public void tearDown() throws Exception { } @Test public void createLinkObject() throws VCIError { LinkObject lo = new LinkObject(); lo.oid = "lo001"; lo.creator = "liucq"; lo.modifier = "liucq2"; lo.fromOid = "fOID"; lo.fromRevOid = "froid"; lo.fromNameOid = "fnoid"; lo.fromBTName = "fbtwname"; lo.toOid = "toid"; lo.toRevOid = "troid"; lo.toNameOid = "tnoid"; lo.toBTName = "tbtwname"; lo.ts = 11; lo.ltName = "FILETYPERELATION"; AttributeValue[] attrValArray = new AttributeValue[2]; AttributeValue name = new AttributeValue(); name.attrName = "LINKONW"; name.attrVal = "ONE"; attrValArray[0] = name; AttributeValue filePath = new AttributeValue(); filePath.attrName = "LINKTWO"; filePath.attrVal = "TWO"; attrValArray[1] = filePath; lo.newAttrValList = attrValArray; // LinkObject rs = impl.createLinkObject(lo); // Assert.assertTrue(rs == null); } @Test public void testUpdateLinkObeject() throws VCIError { LinkObject lo = new LinkObject(); lo.oid = "lo001"; lo.creator = "liucq"; lo.modifier = "liucq2"; lo.fromOid = "fOID"; lo.fromRevOid = "froid"; lo.fromNameOid = "fnoid"; lo.fromBTName = "fbtwname"; lo.toOid = "toid"; lo.toRevOid = "troid"; lo.toNameOid = "tnoid"; lo.toBTName = "tbtwname"; lo.ts = 11; lo.ltName = "FILETYPERELATION"; AttributeValue[] attrValArray = new AttributeValue[2]; AttributeValue name = new AttributeValue(); name.attrName = "LINKONW"; name.attrVal = "ONE1"; attrValArray[0] = name; AttributeValue filePath = new AttributeValue(); filePath.attrName = "LINKTWO"; filePath.attrVal = "TWO2"; attrValArray[1] = filePath; lo.newAttrValList = attrValArray; // LinkObjectHolder holder = new LinkObjectHolder(); // holder.value = lo; // boolean rs = impl.updateLinkObject(holder); // Assert.assertTrue(rs); } @Test public void testSelectLinkObject() throws VCIError { LinkObject lo = new LinkObject(); lo.oid = "lo001"; lo.ltName = "FILETYPERELATION"; BusinessObject bo = new BusinessObject(); bo.oid = ""; // LinkObject[] los = impl.readLinkObjectByFromBO(bo, lo.linkTypeName); // System.out.println(los.length); } @Test public void testDeleteLinkObject() throws VCIError { LinkObject lo = new LinkObject(); lo.oid = "lo001"; lo.ltName = "FILETYPERELATION"; // boolean rs = impl.deleteLinkObject(lo); // Assert.assertTrue(rs); } }