summaryrefslogtreecommitdiffstats
path: root/tools/sdkmanager/app
diff options
context:
space:
mode:
authorRaphael <raphael@google.com>2009-05-14 19:48:53 -0700
committerRaphael <raphael@google.com>2009-05-14 19:48:53 -0700
commit0837619559dc2384c32a91f4ec4ca6ea69a17fcf (patch)
tree01f4fcb4d8378934880973bef73d756e15c78d8e /tools/sdkmanager/app
parent71f5d130f5d2c512cc811f538b4d0f6613451973 (diff)
downloadandroid_development-0837619559dc2384c32a91f4ec4ca6ea69a17fcf.tar.gz
android_development-0837619559dc2384c32a91f4ec4ca6ea69a17fcf.tar.bz2
android_development-0837619559dc2384c32a91f4ec4ca6ea69a17fcf.zip
ADT #1844909: Move sdk-repository XSD and tests from SdkManager to SdkLib.
Diffstat (limited to 'tools/sdkmanager/app')
-rwxr-xr-xtools/sdkmanager/app/src/com/android/sdkmanager/repository/SdkRepositoryConstants.java33
-rwxr-xr-xtools/sdkmanager/app/src/com/android/sdkmanager/repository/sdk-repository.xsd181
-rwxr-xr-xtools/sdkmanager/app/tests/com/android/sdkmanager/repository/TestXml.java113
-rwxr-xr-xtools/sdkmanager/app/tests/com/android/sdkmanager/repository/repository_sample.xml186
4 files changed, 0 insertions, 513 deletions
diff --git a/tools/sdkmanager/app/src/com/android/sdkmanager/repository/SdkRepositoryConstants.java b/tools/sdkmanager/app/src/com/android/sdkmanager/repository/SdkRepositoryConstants.java
deleted file mode 100755
index f9119890c..000000000
--- a/tools/sdkmanager/app/src/com/android/sdkmanager/repository/SdkRepositoryConstants.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Eclipse Public License, Version 1.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.eclipse.org/org/documents/epl-v10.php
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.sdkmanager.repository;
-
-import java.io.InputStream;
-
-/**
- * Constants for the sdk-repository XML Schema
- */
-public class SdkRepositoryConstants {
-
- public static final String NS_SDK_REPOSITORY =
- "http://schemas.android.com/sdk/android/repository/1";
-
- public static InputStream getXsdStream() {
- return SdkRepositoryConstants.class.getResourceAsStream("sdk-repository.xsd");
- }
-
-}
diff --git a/tools/sdkmanager/app/src/com/android/sdkmanager/repository/sdk-repository.xsd b/tools/sdkmanager/app/src/com/android/sdkmanager/repository/sdk-repository.xsd
deleted file mode 100755
index c59197f9f..000000000
--- a/tools/sdkmanager/app/src/com/android/sdkmanager/repository/sdk-repository.xsd
+++ /dev/null
@@ -1,181 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
--->
-<xsd:schema
- targetNamespace="http://schemas.android.com/sdk/android/repository/1"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- xmlns:sdk="http://schemas.android.com/sdk/android/repository/1"
- elementFormDefault="qualified"
- attributeFormDefault="unqualified"
- version="1">
-
- <!-- The definition of a file checksum -->
-
- <xsd:simpleType name="sha1Number">
- <xsd:annotation>
- <xsd:documentation>A SHA1 checksum.</xsd:documentation>
- </xsd:annotation>
- <xsd:restriction base="xsd:string">
- <xsd:pattern value="([0-9a-fA-F]){40}"/>
- </xsd:restriction>
- </xsd:simpleType>
-
- <xsd:complexType name="checksumType">
- <xsd:annotation>
- <xsd:documentation>A file checksum, currently only SHA1.</xsd:documentation>
- </xsd:annotation>
- <xsd:simpleContent>
- <xsd:extension base="sdk:sha1Number">
- <xsd:attribute name="type" type="xsd:token" fixed="sha1" />
- </xsd:extension>
- </xsd:simpleContent>
- </xsd:complexType>
-
- <!-- The repository contains a collection of downloadable items -->
-
- <xsd:element name="sdk-repository">
- <xsd:annotation>
- <xsd:documentation>
- The repository contains collections of downloadable items.
- </xsd:documentation>
- </xsd:annotation>
-
- <xsd:complexType>
- <xsd:choice minOccurs="0" maxOccurs="unbounded">
-
- <!-- The definition of an SDK platform item -->
-
- <xsd:element name="platform">
- <xsd:complexType>
- <xsd:all>
- <xsd:element name="version" type="xsd:normalizedString" />
- <xsd:element name="api-level" type="xsd:positiveInteger" />
-
- <xsd:element name="revision" type="xsd:positiveInteger" />
- <xsd:element name="description" type="xsd:string" minOccurs="0" />
- <xsd:element name="desc-url" type="xsd:token" minOccurs="0" />
- <xsd:element name="archives" type="sdk:archivesType" />
- </xsd:all>
- </xsd:complexType>
- </xsd:element>
-
- <!-- The definition of an SDK Add-on item -->
-
- <xsd:element name="add-on">
- <xsd:complexType>
- <xsd:all>
- <xsd:element name="name" type="xsd:normalizedString" />
- <xsd:element name="vendor" type="xsd:normalizedString" />
- <xsd:element name="api-level" type="xsd:positiveInteger" />
-
- <xsd:element name="revision" type="xsd:positiveInteger" />
- <xsd:element name="description" type="xsd:string" minOccurs="0" />
- <xsd:element name="desc-url" type="xsd:token" minOccurs="0" />
- <xsd:element name="archives" type="sdk:archivesType" />
-
- <xsd:element name="libs">
- <xsd:complexType>
- <xsd:sequence maxOccurs="unbounded">
- <xsd:element name="lib">
- <xsd:complexType>
- <xsd:all>
- <xsd:element name="name" type="xsd:normalizedString" />
- <xsd:element name="description" type="xsd:string" minOccurs="0" />
- </xsd:all>
- </xsd:complexType>
- </xsd:element>
- </xsd:sequence>
- </xsd:complexType>
- </xsd:element>
- </xsd:all>
- </xsd:complexType>
- </xsd:element>
-
- <!-- The definition of an SDK tool item -->
-
- <xsd:element name="tool">
- <xsd:complexType>
- <xsd:all>
- <xsd:element name="revision" type="xsd:positiveInteger" />
- <xsd:element name="description" type="xsd:string" minOccurs="0" />
- <xsd:element name="desc-url" type="xsd:token" minOccurs="0" />
- <xsd:element name="archives" type="sdk:archivesType" />
- </xsd:all>
- </xsd:complexType>
- </xsd:element>
-
- <!-- The definition of an SDK doc item -->
-
- <xsd:element name="doc">
- <xsd:complexType>
- <xsd:all>
- <xsd:element name="api-level" type="xsd:positiveInteger" />
-
- <xsd:element name="revision" type="xsd:positiveInteger" />
- <xsd:element name="description" type="xsd:string" minOccurs="0" />
- <xsd:element name="desc-url" type="xsd:token" minOccurs="0" />
- <xsd:element name="archives" type="sdk:archivesType" />
- </xsd:all>
- </xsd:complexType>
- </xsd:element>
- </xsd:choice>
- </xsd:complexType>
- </xsd:element>
-
- <!-- A collection of files that can be downloaded for a given architectures -->
-
- <xsd:complexType name="archivesType">
- <xsd:annotation>
- <xsd:documentation>A collection of architecture-dependent archives.</xsd:documentation>
- </xsd:annotation>
- <xsd:sequence maxOccurs="unbounded">
- <!-- One archive file -->
- <xsd:element name="archive">
- <xsd:complexType>
- <!-- Properties of the file -->
- <xsd:all>
- <xsd:element name="size" type="xsd:positiveInteger" />
- <xsd:element name="checksum" type="sdk:checksumType" />
- <xsd:element name="url" type="xsd:token" />
- </xsd:all>
-
- <!-- Attributes that identify the architecture -->
- <xsd:attribute name="os" use="required">
- <xsd:simpleType>
- <xsd:restriction base="xsd:token">
- <xsd:enumeration value="any" />
- <xsd:enumeration value="linux" />
- <xsd:enumeration value="macosx" />
- <xsd:enumeration value="windows" />
- </xsd:restriction>
- </xsd:simpleType>
- </xsd:attribute>
- <xsd:attribute name="arch" use="optional">
- <xsd:simpleType>
- <xsd:restriction base="xsd:token">
- <xsd:enumeration value="any" />
- <xsd:enumeration value="ppc" />
- <xsd:enumeration value="x86" />
- <xsd:enumeration value="x86_64" />
- </xsd:restriction>
- </xsd:simpleType>
- </xsd:attribute>
- </xsd:complexType>
- </xsd:element>
- </xsd:sequence>
- </xsd:complexType>
-
-</xsd:schema>
diff --git a/tools/sdkmanager/app/tests/com/android/sdkmanager/repository/TestXml.java b/tools/sdkmanager/app/tests/com/android/sdkmanager/repository/TestXml.java
deleted file mode 100755
index 482ef2691..000000000
--- a/tools/sdkmanager/app/tests/com/android/sdkmanager/repository/TestXml.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Eclipse Public License, Version 1.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.eclipse.org/org/documents/epl-v10.php
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.sdkmanager.repository;
-
-import org.xml.sax.ErrorHandler;
-import org.xml.sax.SAXException;
-import org.xml.sax.SAXParseException;
-
-import java.io.InputStream;
-
-import javax.xml.XMLConstants;
-import javax.xml.transform.stream.StreamSource;
-import javax.xml.validation.Schema;
-import javax.xml.validation.SchemaFactory;
-import javax.xml.validation.Validator;
-
-import junit.framework.TestCase;
-
-/**
- * Tests local validation of an SDK Repository sample XMLs using an XML Schema validator.
- *
- * References:
- * http://www.ibm.com/developerworks/xml/library/x-javaxmlvalidapi.html
- */
-public class TestXml extends TestCase {
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- }
-
- @Override
- protected void tearDown() throws Exception {
- super.tearDown();
- }
-
- public void testValidateLocalRepositoryFile() throws Exception {
-
- InputStream xsdStream = SdkRepositoryConstants.getXsdStream();
- InputStream xmlStream = TestXml.class.getResourceAsStream("repository_sample.xml");
-
- SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
-
- Schema schema = factory.newSchema(new StreamSource(xsdStream));
-
- Validator validator = schema.newValidator();
-
- CaptureErrorHandler handler = new CaptureErrorHandler();
- validator.setErrorHandler(handler);
-
- validator.validate(new StreamSource(xmlStream));
-
- String warnings = handler.getWarnings();
- if (warnings.length() > 0) {
- System.err.println(warnings);
- }
-
- String errors = handler.getErrors();
- if (errors.length() > 0) {
- System.err.println(errors);
- fail(errors);
- }
- }
-
- private static class CaptureErrorHandler implements ErrorHandler {
-
- private String mWarnings = "";
- private String mErrors = "";
-
- public String getErrors() {
- return mErrors;
- }
-
- public String getWarnings() {
- return mWarnings;
- }
-
- /**
- * @throws SAXException
- */
- public void error(SAXParseException ex) throws SAXException {
- mErrors += "Error: " + ex.getMessage() + "\n";
- }
-
- public void fatalError(SAXParseException ex) throws SAXException {
- mErrors += "Fatal Error: " + ex.getMessage() + "\n";
- throw ex;
- }
-
- /**
- * @throws SAXException
- */
- public void warning(SAXParseException ex) throws SAXException {
- mWarnings += "Warning: " + ex.getMessage() + "\n";
- }
-
- }
-
-}
diff --git a/tools/sdkmanager/app/tests/com/android/sdkmanager/repository/repository_sample.xml b/tools/sdkmanager/app/tests/com/android/sdkmanager/repository/repository_sample.xml
deleted file mode 100755
index 0643185b5..000000000
--- a/tools/sdkmanager/app/tests/com/android/sdkmanager/repository/repository_sample.xml
+++ /dev/null
@@ -1,186 +0,0 @@
-<?xml version="1.0"?>
-<!--
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
--->
-<sdk:sdk-repository
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:sdk="http://schemas.android.com/sdk/android/repository/1">
- <sdk:platform>
- <sdk:version>1.0</sdk:version>
- <sdk:api-level>1</sdk:api-level>
- <sdk:revision>3</sdk:revision>
- <sdk:description>Some optional description</sdk:description>
- <sdk:desc-url>http://www.example.com/platform1.html</sdk:desc-url>
- <sdk:archives>
- <sdk:archive os="any">
- <sdk:size>65536</sdk:size>
- <sdk:checksum type="sha1">2822ae37115ebf13412bbef91339ee0d9454525e</sdk:checksum>
- <sdk:url>http://www.example.com/files/plat1.zip</sdk:url>
- </sdk:archive>
- </sdk:archives>
- </sdk:platform>
- <sdk:platform>
- <sdk:version>1.1</sdk:version>
- <sdk:api-level>2</sdk:api-level>
- <sdk:revision>12</sdk:revision>
- <!-- sdk:description and sdk:desc-url are optional -->
- <sdk:archives>
- <sdk:archive os="windows">
- <!-- arch attribute is optional -->
- <sdk:size>65536</sdk:size>
- <sdk:checksum type="sha1">2822ae37115ebf13412bbef91339ee0d9454525e</sdk:checksum>
- <sdk:url>distrib/platform-2-12-win.zip</sdk:url>
- </sdk:archive>
- <sdk:archive os="macosx" arch="any">
- <sdk:size>65536</sdk:size>
- <sdk:checksum type="sha1">2822ae37115ebf13412bbef91339ee0d9454525e</sdk:checksum>
- <sdk:url>distrib/platform-2-12-mac.zip</sdk:url>
- </sdk:archive>
- <sdk:archive os="macosx" arch="ppc">
- <sdk:size>65536</sdk:size>
- <sdk:checksum type="sha1">2822ae37115ebf13412bbef91339ee0d9454525e</sdk:checksum>
- <sdk:url>distrib/platform-2-12-mac.zip</sdk:url>
- </sdk:archive>
- <sdk:archive os="linux" arch="x86">
- <sdk:size>65536</sdk:size>
- <sdk:checksum type="sha1">2822ae37115ebf13412bbef91339ee0d9454525e</sdk:checksum>
- <sdk:url>distrib/platform-2-12-linux.tar.bz2</sdk:url>
- </sdk:archive>
- <sdk:archive os="linux" arch="x86_64">
- <sdk:size>65536</sdk:size>
- <sdk:checksum type="sha1">2822ae37115ebf13412bbef91339ee0d9454525e</sdk:checksum>
- <sdk:url>distrib/platform-2-12-linux.tar.bz2</sdk:url>
- </sdk:archive>
- </sdk:archives>
- </sdk:platform>
- <sdk:add-on>
- <sdk:name>My First add-on</sdk:name>
- <sdk:api-level>1</sdk:api-level>
- <sdk:vendor>John Doe</sdk:vendor>
- <sdk:revision>1</sdk:revision>
- <sdk:description>Some optional description</sdk:description>
- <sdk:desc-url>http://www.example.com/myfirstaddon</sdk:desc-url>
- <sdk:archives>
- <sdk:archive os="any">
- <sdk:size>65536</sdk:size>
- <sdk:checksum type="sha1">2822ae37115ebf13412bbef91339ee0d9454525e</sdk:checksum>
- <sdk:url>http://www.example.com/add-ons/first.zip</sdk:url>
- </sdk:archive>
- </sdk:archives>
- <sdk:libs>
- <sdk:lib>
- <sdk:name>android.blah.somelib</sdk:name>
- <sdk:description>The description for this library.</sdk:description>
- </sdk:lib>
- <sdk:lib>
- <!-- sdk:description is optional, name is not -->
- <sdk:name>com.android.mymaps</sdk:name>
- </sdk:lib>
- </sdk:libs>
- </sdk:add-on>
- <sdk:add-on>
- <sdk:name>My Second add-on</sdk:name>
- <sdk:api-level>2</sdk:api-level>
- <sdk:vendor>John Deer</sdk:vendor>
- <sdk:revision>42</sdk:revision>
- <sdk:archives>
- <sdk:archive os="windows">
- <sdk:size>65536</sdk:size>
- <sdk:checksum type="sha1">2822ae37115ebf13412bbef91339ee0d9454525e</sdk:checksum>
- <sdk:url>distrib/second-42-win.zip</sdk:url>
- </sdk:archive>
- <sdk:archive os="linux">
- <sdk:size>65536</sdk:size>
- <sdk:checksum type="sha1">2822ae37115ebf13412bbef91339ee0d9454525e</sdk:checksum>
- <sdk:url>distrib/second-42-linux.tar.bz2</sdk:url>
- </sdk:archive>
- </sdk:archives>
- <sdk:libs>
- <sdk:lib>
- <sdk:name>android.blah.somelib</sdk:name>
- <sdk:description>The description for this library.</sdk:description>
- </sdk:lib>
- <sdk:lib>
- <sdk:name>com.android.mymaps</sdk:name>
- </sdk:lib>
- </sdk:libs>
- </sdk:add-on>
- <sdk:doc>
- <sdk:api-level>1</sdk:api-level>
- <sdk:revision>1</sdk:revision>
- <sdk:description>Some optional description</sdk:description>
- <sdk:desc-url>http://www.example.com/docs.html</sdk:desc-url>
- <sdk:archives>
- <sdk:archive os="any">
- <sdk:size>65536</sdk:size>
- <sdk:checksum type="sha1">2822ae37115ebf13412bbef91339ee0d9454525e</sdk:checksum>
- <sdk:url>http://www.example.com/docs/docs1.zip</sdk:url>
- </sdk:archive>
- </sdk:archives>
- </sdk:doc>
- <sdk:doc>
- <sdk:api-level>2</sdk:api-level>
- <sdk:revision>42</sdk:revision>
- <sdk:archives>
- <sdk:archive os="windows">
- <sdk:size>65536</sdk:size>
- <sdk:checksum type="sha1">2822ae37115ebf13412bbef91339ee0d9454525e</sdk:checksum>
- <sdk:url>distrib/docs/2.zip</sdk:url>
- </sdk:archive>
- <sdk:archive os="linux">
- <sdk:size>65536</sdk:size>
- <sdk:checksum type="sha1">2822ae37115ebf13412bbef91339ee0d9454525e</sdk:checksum>
- <sdk:url>distrib/docs2-linux.tar.bz2</sdk:url>
- </sdk:archive>
- <sdk:archive os="macosx">
- <sdk:size>65536</sdk:size>
- <sdk:checksum type="sha1">2822ae37115ebf13412bbef91339ee0d9454525e</sdk:checksum>
- <sdk:url>distrib/docs2-mac.tar.bz2</sdk:url>
- </sdk:archive>
- </sdk:archives>
- </sdk:doc>
- <sdk:tool>
- <sdk:revision>1</sdk:revision>
- <sdk:description>Some optional description</sdk:description>
- <sdk:desc-url>http://www.example.com/tools.html</sdk:desc-url>
- <sdk:archives>
- <sdk:archive os="any">
- <sdk:size>65536</sdk:size>
- <sdk:checksum type="sha1">2822ae37115ebf13412bbef91339ee0d9454525e</sdk:checksum>
- <sdk:url>http://www.example.com/files/tools1.zip</sdk:url>
- </sdk:archive>
- </sdk:archives>
- </sdk:tool>
- <sdk:tool>
- <sdk:revision>42</sdk:revision>
- <sdk:archives>
- <sdk:archive os="windows">
- <sdk:size>65536</sdk:size>
- <sdk:checksum type="sha1">2822ae37115ebf13412bbef91339ee0d9454525e</sdk:checksum>
- <sdk:url>distrib/tools/2.zip</sdk:url>
- </sdk:archive>
- <sdk:archive os="linux">
- <sdk:size>65536</sdk:size>
- <sdk:checksum type="sha1">2822ae37115ebf13412bbef91339ee0d9454525e</sdk:checksum>
- <sdk:url>distrib/tools2-linux.tar.bz2</sdk:url>
- </sdk:archive>
- <sdk:archive os="macosx">
- <sdk:size>65536</sdk:size>
- <sdk:checksum type="sha1">2822ae37115ebf13412bbef91339ee0d9454525e</sdk:checksum>
- <sdk:url>distrib/tools2-mac.tar.bz2</sdk:url>
- </sdk:archive>
- </sdk:archives>
- </sdk:tool>
-</sdk:sdk-repository>