098d59a946bc20e0ac10e13dbd33aa8b2286025a
[vfc/nfvo/wfengine.git] / winery / org.eclipse.winery.repository / src / test / java / org / eclipse / winery / repository / resources / entitytypes / capabilitytypes / TestCapabilityTypeResource.java
1 /*******************************************************************************
2  * Copyright (c) 2012-2013 University of Stuttgart.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * and the Apache License 2.0 which both accompany this distribution,
6  * and are available at http://www.eclipse.org/legal/epl-v10.html
7  * and http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Contributors:
10  *     Oliver Kopp - initial API and implementation
11  *******************************************************************************/
12 package org.eclipse.winery.repository.resources.entitytypes.capabilitytypes;
13
14 import java.io.IOException;
15
16 import org.junit.Assert;
17 import org.junit.Before;
18 import org.junit.BeforeClass;
19 import org.junit.Test;
20 import org.eclipse.winery.common.ids.Namespace;
21 import org.eclipse.winery.common.ids.XMLId;
22 import org.eclipse.winery.common.ids.definitions.CapabilityTypeId;
23 import org.eclipse.winery.repository.PrefsTestEnabledGitBackedRepository;
24 import org.eclipse.winery.repository.backend.Repository;
25 import org.eclipse.winery.repository.backend.filebased.GitBasedRepository;
26 import org.eclipse.winery.repository.resources.TestResource;
27
28 public class TestCapabilityTypeResource extends TestResource {
29         
30         private static final CapabilityTypeId id = new CapabilityTypeId(new Namespace("http://docs.oasis-open.org/tosca/ns/2011/12/ToscaBaseTypes", false), new XMLId("ContainerCapability", false));
31         
32         
33         @BeforeClass
34         public static void init() throws Exception {
35                 // enable git-backed repository
36                 new PrefsTestEnabledGitBackedRepository();
37         }
38         
39         @Before
40         public void setRevision() throws Exception {
41                 ((GitBasedRepository) Repository.INSTANCE).setRevisionTo("97fa997b92965d8bc84e86274b0203f1db7495c5");
42         }
43         
44         @Test
45         public void getElementAsXMLString() throws IOException {
46                 // ensure that no test object exists
47                 Repository.INSTANCE.forceDelete(TestCapabilityTypeResource.id);
48                 
49                 CapabilityTypeResource res = new CapabilityTypeResource(TestCapabilityTypeResource.id);
50                 String s = res.getDefinitionsAsXMLString();
51                 Assert.assertNotNull(s);
52         }
53 }