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
10 * Oliver Kopp - initial API and implementation
11 *******************************************************************************/
12 package org.eclipse.winery.repository.resources.entitytypes.capabilitytypes;
14 import java.io.IOException;
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;
28 public class TestCapabilityTypeResource extends TestResource {
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));
34 public static void init() throws Exception {
35 // enable git-backed repository
36 new PrefsTestEnabledGitBackedRepository();
40 public void setRevision() throws Exception {
41 ((GitBasedRepository) Repository.INSTANCE).setRevisionTo("97fa997b92965d8bc84e86274b0203f1db7495c5");
45 public void getElementAsXMLString() throws IOException {
46 // ensure that no test object exists
47 Repository.INSTANCE.forceDelete(TestCapabilityTypeResource.id);
49 CapabilityTypeResource res = new CapabilityTypeResource(TestCapabilityTypeResource.id);
50 String s = res.getDefinitionsAsXMLString();
51 Assert.assertNotNull(s);