ludc
2025-01-16 986aa62ed00bee39363bab41b4eeb8259d446efd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
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.server.bof.BOFactoryServiceImpl;
 
 
public class BOFactoryTest {
    
    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 testCreatObject() {
        
        BusinessObject bo = new BusinessObject();
        bo.oid = "100003";
        bo.revisionid = "200001";
        bo.nameoid = "300001";
        bo.btName = "fileobject";
        bo.isLastR = true;
        bo.isFirstR = true;
        bo.isLastV = true;
        bo.isFirstV = true;
        
        bo.creator = "creator";
        bo.createTime = System.currentTimeMillis();
        bo.modifier = "modifier";
        bo.modifyTime = System.currentTimeMillis();
        bo.revisionRule = "revisionRule001";
        bo.versionRule = "versionrule001";
        bo.revisionSeq = 1;
        bo.revisionValue = "reval";
        bo.versionSeq = 2;
        bo.versionValue = "verVal";
        bo.lctId = "lctId001";
        bo.lcStatus = "create";
        bo.id = "ABC-001";
        bo.name = "六角头螺栓";
        bo.description = "test";
        bo.owner = "xx";
//        bo.checkinBy = "liucq";
//        bo.checkoutBy = "liucq2";
        bo.fromVersion = "ssssss";
        
        AttributeValue[] attrValArray = new AttributeValue[3];
        AttributeValue name = new AttributeValue();
        name.attrName = "RevisionLimit";
        name.attrVal = "3";
        attrValArray[0] = name;
        
        AttributeValue filePath = new AttributeValue();
        filePath.attrName = "FilePath";
        filePath.attrVal = "E:\\DevelopWorkspace\\AXISWebService\\test.txt";
        attrValArray[1] = filePath;
        
        AttributeValue FileType = new AttributeValue();
        FileType.attrName = "FileType";
        FileType.attrVal = "txt";
        attrValArray[2] = FileType;
        bo.newAttrValList = attrValArray;
 
//        try {
//            //impl.createBusinessObject(bo, false, false);
//        } catch (VCIError e) {
//            // TODO Auto-generated catch block
//            e.printStackTrace();
//        }
        Assert.assertNotNull(bo.oid);
    }
    
    @Test
    public void testUpdateBO() {
        BusinessObject bo = new BusinessObject();
        bo.oid = "100003";
        
        AttributeValue[] attrValArray = new AttributeValue[2];
        AttributeValue name = new AttributeValue();
        name.attrName = "filename";
        name.attrVal = "测试文件更改";
        attrValArray[0] = name;
        
        AttributeValue filePath = new AttributeValue();
        filePath.attrName = "FilePath";
        filePath.attrVal = "E:\\DevelopWorkspace\\AXISWebService\\test1.txt";
        attrValArray[1] = filePath;
        bo.newAttrValList = attrValArray;
        bo.btName = "plm_cus_FOM2";
        
        boolean rs = false;
//        try {
//            //BusinessObjectHolder boHolder = new BusinessObjectHolder();
//            //boHolder.value = bo;
//            //rs = impl.updateBusinessObject(bo);
//        } catch (VCIError e) {
//            // TODO Auto-generated catch block
//            e.printStackTrace();
//        }
        Assert.assertTrue(rs);
    }
    
    @Test
    public void testDeleteBO() {
        BusinessObject bo = new BusinessObject();
        bo.oid = "100003";
        bo.btName = "FileType";
        boolean rs = false;
//        try {
//            rs = impl.deleteBusinessObject(bo, 1);
//        } catch (VCIError e) {
//            // TODO Auto-generated catch block
//            e.printStackTrace();
//        }
        Assert.assertTrue(rs);
    }
    
    @Test
    public void testSelectBO() {
        String[] queryColumns = {"FILEPATH","FILETYPE"};
        
//        try {
//            
//            BusinessObject bo = impl.readBusinessObject("100003", "fileobject");
//            System.out.println(bo.newAttrValList[0].attrVal);
//        } catch (VCIError e) {
//            // TODO Auto-generated catch block
//            e.printStackTrace();
//        }
    }
    
    @Test
    public void testCheckinBO() throws VCIError {
        BusinessObject bo = new BusinessObject();
        bo.oid = "100003";
        bo.btName = "fileobject";
        bo.modifier = "lzm";
//        boolean rs = impl.checkInBusinessObject(bo);
//        Assert.assertTrue(true);
    }
    
    
    @Test
    public void testCheckoutBO() throws VCIError {
        BusinessObject bo = new BusinessObject();
        bo.oid = "100003";
        bo.btName = "fileobject";
        bo.modifier = "lzm";
//        boolean rs = impl.checkoutBusinessObject(bo);
//        Assert.assertTrue(true);
    }
    
    @Test
    public void testTransitionBO() throws VCIError {
        BusinessObject bo = new BusinessObject();
        bo.oid = "100003";
        bo.btName = "fileobject";
        bo.lcStatus = "lzm-state";
        
//        BusinessObjectHolder boHolder = new BusinessObjectHolder();
//        boHolder.value = bo;
//        boolean rs = impl.transferBusinessObject(boHolder, null);
//        Assert.assertTrue(true);
    }
    
    @Test
    public void testUnchecnoutBO() throws VCIError {
        BusinessObject bo = new BusinessObject();
        bo.oid = "100003";
        bo.btName = "fileobject";
//        boolean rs = impl.unCheckOutBusinessObject(bo);
//        Assert.assertTrue(true);
    }
    
    @Test
    public void testChangeBOOwner() throws VCIError {
        BusinessObject bo = new BusinessObject();
        bo.oid = "100003";
        bo.btName = "fileobject";
        bo.owner = "lzm";
//        boolean rs = impl.changeBusinessObjectOwner(bo, null);
//        Assert.assertTrue(true);
    }
    
    public static void main(String args[]){
        
        boolean rs = false;
//        try {
//            impl = new BOFactoryServiceImpl();
//            BusinessObject bo = impl.readBusinessObject("42B69FE2-1606-31E6-8CD4-01AED0B5EBA8", "Part");
//            BusinessObjectHolder holder = new BusinessObjectHolder();
//            holder.value=bo;
//            rs = impl.updateBusinessObjectOut(holder);
//            System.out.println();
//        } catch (VCIError e) {
//            // TODO Auto-generated catch block
//            e.printStackTrace();
//        }
        Assert.assertTrue(rs);
    }
}