blob: 202aabe273d9b543fce3d271402dc2b118212f61 (
plain) (
blame)
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
|
/*******************************************************************************
* Copyright (c) 2004, 2007 Boeing.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
package org.eclipse.osee.orcs.api;
import static org.eclipse.osee.framework.core.enums.CoreBranches.COMMON_ID;
import static org.eclipse.osee.framework.core.enums.DemoBranches.SAW_Bld_1;
import static org.eclipse.osee.orcs.OrcsIntegrationRule.integrationRule;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import org.eclipse.osee.framework.core.enums.CoreArtifactTokens;
import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.framework.jdk.core.type.ResultSet;
import org.eclipse.osee.orcs.OrcsApi;
import org.eclipse.osee.orcs.data.ArtifactReadable;
import org.eclipse.osee.orcs.db.mock.OsgiService;
import org.eclipse.osee.orcs.search.QueryBuilder;
import org.eclipse.osee.orcs.search.QueryFactory;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TestRule;
/**
* @author Jeff C. Phillips
*/
public class OrcsAttributeLoadingTest {
@Rule
public TestRule osgi = integrationRule(this);
@OsgiService
private OrcsApi orcsApi;
private QueryFactory query;
@Before
public void setUp() throws Exception {
query = orcsApi.getQueryFactory();
}
@SuppressWarnings("unchecked")
@Test
public void testAttributeLoading() throws Exception {
ArtifactReadable art =
query.fromBranch(COMMON_ID).andIds(CoreArtifactTokens.Everyone).getResults().getExactlyOne();
Assert.assertNotNull(art);
assertEquals("Everyone", art.getSoleAttributeAsString(CoreAttributeTypes.Name));
//Test boolean attributes
assertEquals(art.getSoleAttributeAsString(CoreAttributeTypes.DefaultGroup), "true");
}
@Test
public void testLoadWordTemplateContentAttributes() throws OseeCoreException {
QueryBuilder builder = query.fromBranch(SAW_Bld_1).and(CoreAttributeTypes.Name, "Haptic Constraints");
ResultSet<ArtifactReadable> resultSet = builder.getResults();
ArtifactReadable artifact = resultSet.iterator().next();
assertTrue(artifact.getSoleAttributeAsString(CoreAttributeTypes.WordTemplateContent).length() > 2);
assertFalse(resultSet.isEmpty());
assertEquals(resultSet.size(), builder.getCount());
}
}
|