use of com.google.cloud.servicedirectory.v1.Namespace in project java by kubernetes-client.
the class ProtoExample method main.
public static void main(String[] args) throws IOException, ApiException, InterruptedException {
ApiClient client = Config.defaultClient();
Configuration.setDefaultApiClient(client);
ProtoClient pc = new ProtoClient(client);
ObjectOrStatus<PodList> list = pc.list(PodList.newBuilder(), "/api/v1/namespaces/default/pods");
if (list.object.getItemsCount() > 0) {
Pod p = list.object.getItems(0);
System.out.println(p);
}
Namespace namespace = Namespace.newBuilder().setMetadata(ObjectMeta.newBuilder().setName("test").build()).build();
ObjectOrStatus<Namespace> ns = pc.create(namespace, "/api/v1/namespaces", "v1", "Namespace");
System.out.println(ns);
if (ns.object != null) {
namespace = ns.object.toBuilder().setSpec(NamespaceSpec.newBuilder().addFinalizers("test").build()).build();
// This is how you would update an object, but you can't actually
// update namespaces, so this returns a 405
ns = pc.update(namespace, "/api/v1/namespaces/test", "v1", "Namespace");
System.out.println(ns.status);
}
ns = pc.delete(Namespace.newBuilder(), "/api/v1/namespaces/test");
System.out.println(ns);
}
use of com.google.cloud.servicedirectory.v1.Namespace in project JMRI by JMRI.
the class LocaleSelectorTest method testFindPartialCodeNoAttribute.
public void testFindPartialCodeNoAttribute() {
LocaleSelector.suffixes = new String[] { "kl_KL", "kl" };
Namespace xml = Namespace.XML_NAMESPACE;
Element el = new Element("foo").addContent(new Element("temp").setAttribute("lang", "aa_BB", xml).addContent("b")).addContent(new Element("temp").setAttribute("lang", "kl", xml).addContent("c")).addContent(new Element("temp").setAttribute("lang", "kl_AA", xml).addContent("d"));
String result = LocaleSelector.getAttribute(el, "temp");
Assert.assertEquals("find default", "c", result);
}
use of com.google.cloud.servicedirectory.v1.Namespace in project JMRI by JMRI.
the class LocaleSelectorTest method testFindFullCodeNoAttribute.
public void testFindFullCodeNoAttribute() {
LocaleSelector.suffixes = new String[] { "kl_KL", "kl" };
Namespace xml = Namespace.XML_NAMESPACE;
Element el = new Element("foo").addContent(new Element("temp").setAttribute("lang", "aa_BB", xml).addContent("b")).addContent(new Element("temp").setAttribute("lang", "kl", xml).addContent("b")).addContent(new Element("temp").setAttribute("lang", "kl_KL", xml).addContent("c"));
String result = LocaleSelector.getAttribute(el, "temp");
Assert.assertEquals("find default", "c", result);
}
use of com.google.cloud.servicedirectory.v1.Namespace in project JMRI by JMRI.
the class LocaleSelectorTest method testFindDefault.
public void testFindDefault() {
LocaleSelector.suffixes = new String[] { "kl_KL", "kl" };
Namespace xml = Namespace.XML_NAMESPACE;
Element el = new Element("foo").setAttribute("temp", "a").addContent(new Element("temp").setAttribute("lang", "hh", xml).addContent("b"));
String result = LocaleSelector.getAttribute(el, "temp");
Assert.assertEquals("find default", "a", result);
}
use of com.google.cloud.servicedirectory.v1.Namespace in project qpp-conversion-tool by CMSgov.
the class AciNumeratorDenominatorDecoderTest method testInternalDecode.
@Test
void testInternalDecode() {
// set-up
Namespace rootns = Namespace.getNamespace("urn:hl7-org:v3");
Namespace ns = Namespace.getNamespace("xsi", "http://www.w3.org/2001/XMLSchema-instance");
Element element = new Element("organizer", rootns);
Element templateIdElement = new Element("templateId", rootns).setAttribute("root", "2.16.840.1.113883.10.20.27.3.28");
Element referenceElement = new Element("reference", rootns);
Element externalDocumentElement = new Element("externalDocument", rootns);
Element idElement = new Element("id", rootns).setAttribute("extension", MEASURE_ID);
externalDocumentElement.addContent(idElement);
referenceElement.addContent(externalDocumentElement);
element.addContent(templateIdElement);
element.addContent(referenceElement);
element.addNamespaceDeclaration(ns);
Node thisNode = new Node();
AciNumeratorDenominatorDecoder objectUnderTest = new AciNumeratorDenominatorDecoder(new Context());
objectUnderTest.setNamespace(element.getNamespace());
// execute
objectUnderTest.decode(element, thisNode);
// assert
assertThat(thisNode.getValue("measureId")).isEqualTo(MEASURE_ID);
}
Aggregations