diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/models/Asset.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/models/Asset.java new file mode 100644 index 0000000000000..be3b534bcb3d0 --- /dev/null +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/models/Asset.java @@ -0,0 +1,132 @@ +/* + * Copyright 2011 Microsoft Corporation + * + * 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. + */ + +package com.microsoft.windowsazure.services.media.models; + +import java.util.Date; + +public class Asset { + private String id; + private AssetState state; + private Date created; + private Date lastModified; + private String alternateId; + private String name; + private EncryptionOption options; + private Iterable locators; + private Iterable contentKeys; + private Iterable files; + private Iterable parentAssets; + + public String getId() { + return this.id; + } + + public Asset setId(String id) { + this.id = id; + return this; + } + + public AssetState getState() { + return this.state; + } + + public Asset setState(AssetState state) { + this.state = state; + return this; + } + + public Date getCreated() { + return this.created; + } + + public Asset setCreate(Date created) { + this.created = created; + return this; + } + + public Date getLastModified() { + return this.lastModified; + } + + public Asset setLastModified(Date lastModified) { + this.lastModified = lastModified; + return this; + } + + public String getAlternateId() { + return this.alternateId; + } + + public Asset setAlternateId(String alternateId) { + this.alternateId = alternateId; + return this; + } + + public String getName() { + return this.name; + } + + public Asset setName(String name) { + this.name = name; + return this; + } + + public EncryptionOption getOptions() { + return this.options; + } + + public Asset setOptions(EncryptionOption options) { + this.options = options; + return this; + } + + public Iterable getLocators() { + return this.locators; + } + + public Asset setLocators(Iterable locators) { + this.locators = locators; + return this; + } + + public Iterable getContentKeys() { + return this.contentKeys; + } + + public Asset setContentKeys(Iterable expectedContentKeys) { + this.contentKeys = expectedContentKeys; + return this; + } + + public Iterable getFiles() { + return this.files; + } + + public Asset setFiles(Iterable files) { + this.files = files; + return this; + } + + public Iterable getParentAssets() { + return this.parentAssets; + } + + public Asset setParentAssets(Iterable parentAssets) { + this.parentAssets = parentAssets; + return this; + } + +} diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/models/AssetState.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/models/AssetState.java new file mode 100644 index 0000000000000..35a504b6da720 --- /dev/null +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/models/AssetState.java @@ -0,0 +1,18 @@ +package com.microsoft.windowsazure.services.media.models; + +/** + * Specifies the states of the asset. + */ +public enum AssetState { + Initialized(0), Published(1), Deleted(2); + + private int assetStateCode; + + private AssetState(int assetStateCode) { + this.assetStateCode = assetStateCode; + } + + public int getCode() { + return assetStateCode; + } +} diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/models/ContentKey.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/models/ContentKey.java new file mode 100644 index 0000000000000..8ea9b530b43f6 --- /dev/null +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/models/ContentKey.java @@ -0,0 +1,117 @@ +/* + * Copyright 2011 Microsoft Corporation + * + * 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. + */ + +package com.microsoft.windowsazure.services.media.models; + +import java.util.Date; + +public class ContentKey { + private String id; + private Date created; + private Date lastModified; + private ContentKeyType contentKeyType; + private String encryptedContentKey; + private String name; + private String protectionKeyId; + private String checkSum; + private ProtectionKeyType protectionKeyType; + + public String getId() { + return this.id; + } + + public ContentKey setId(String id) { + this.id = id; + return this; + } + + public ContentKey setCreate(Date created) { + this.created = created; + return this; + } + + public Date getLastModified() { + return this.lastModified; + } + + public ContentKey setLastModified(Date lastModified) { + this.lastModified = lastModified; + return this; + } + + public String getName() { + return this.name; + } + + public ContentKey setName(String name) { + this.name = name; + return this; + } + + public ContentKey setCheckSum(String checkSum) { + this.checkSum = checkSum; + return this; + } + + public String getCheckSum() { + return this.checkSum; + } + + public ContentKey setProtectionKeyType(ProtectionKeyType protectionKeyType) { + this.protectionKeyType = protectionKeyType; + return this; + } + + public ProtectionKeyType getProtectionKeyType() { + return this.protectionKeyType; + } + + public ContentKey setProtectionKeyId(String protectionKeyId) { + this.protectionKeyId = protectionKeyId; + return this; + } + + public String getProtectionKeyId() { + return this.protectionKeyId; + } + + public ContentKey setEncryptedContentKey(String encryptedContentKey) { + this.encryptedContentKey = encryptedContentKey; + return this; + } + + public String getEncryptedContentKey() { + return this.encryptedContentKey; + } + + public ContentKey setContentKeyType(ContentKeyType contentKeyType) { + this.contentKeyType = contentKeyType; + return this; + } + + public ContentKeyType getContentKeyType() { + return this.contentKeyType; + } + + public ContentKey setCreated(Date created) { + this.created = created; + return this; + } + + public Date getCreated() { + return this.created; + } + +} diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/models/ContentKeyType.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/models/ContentKeyType.java new file mode 100644 index 0000000000000..1a7bc64e9d565 --- /dev/null +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/models/ContentKeyType.java @@ -0,0 +1,35 @@ +/* + * Copyright 2011 Microsoft Corporation + * + * 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. + */ + +package com.microsoft.windowsazure.services.media.models; + +/** + * + * Specifies the type of a content key. + * + */ +public enum ContentKeyType { + CommonEncryption(0), StorageEncryption(1), ConfigurationEncryption(2); + + private int contentKeyTypeCode; + + private ContentKeyType(int contentKeyTypeCode) { + this.contentKeyTypeCode = contentKeyTypeCode; + } + + public int getCode() { + return contentKeyTypeCode; + } +} diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/models/EncryptionOption.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/models/EncryptionOption.java new file mode 100644 index 0000000000000..9e98aecb69aab --- /dev/null +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/models/EncryptionOption.java @@ -0,0 +1,33 @@ +/* + * Copyright 2011 Microsoft Corporation + * + * 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. + */ + +package com.microsoft.windowsazure.services.media.models; + +/** + * Specifies the options for encryption. + */ +public enum EncryptionOption { + None(0), StorageEncrypted(1), CommonEncryptionProtected(2); + + private int encryptionOptionCode; + + private EncryptionOption(int encryptionOptionCode) { + this.encryptionOptionCode = encryptionOptionCode; + } + + public int getCode() { + return encryptionOptionCode; + } +} diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/models/File.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/models/File.java new file mode 100644 index 0000000000000..f171d4a1fe576 --- /dev/null +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/models/File.java @@ -0,0 +1,167 @@ +/* + * Copyright 2011 Microsoft Corporation + * + * 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. + */ + +package com.microsoft.windowsazure.services.media.models; + +import java.util.Date; + +public class File { + private String id; + private String name; + private int contentFileSize; + private String parentAssetId; + private String encryptionVersion; + private String encryptionScheme; + private Boolean isEncrypted; + private String encryptionKeyId; + private String initializationVector; + private Boolean isPrimary; + private Date lastModified; + private Date created; + private String mimeType; + private String contentChecksum; + + public String getId() { + return this.id; + } + + public File setId(String id) { + this.id = id; + return this; + } + + public String getName() { + return this.name; + } + + public File setName(String name) { + this.name = name; + return this; + } + + public int getContentFileSize() { + return this.contentFileSize; + } + + public File setContentFileSize(int contentFileSize) { + this.contentFileSize = contentFileSize; + return this; + } + + public String getParentAssetId() { + return this.parentAssetId; + } + + public File setParentAssetId(String parentAssetId) { + this.parentAssetId = parentAssetId; + return this; + } + + public Date getCreated() { + return this.created; + } + + public File setCreate(Date created) { + this.created = created; + return this; + } + + public Date getLastModified() { + return this.lastModified; + } + + public File setLastModified(Date lastModified) { + this.lastModified = lastModified; + return this; + } + + public File setEncryptionVersion(String encryptionVersion) { + this.encryptionVersion = encryptionVersion; + return this; + } + + public String getEncryptionVersion() { + return this.encryptionVersion; + } + + public File setEncryptionScheme(String encryptionScheme) { + this.encryptionScheme = encryptionScheme; + return this; + } + + public String getEncryptionScheme() { + return this.encryptionScheme; + } + + public File setIsEncrypted(Boolean isEncrypted) { + this.isEncrypted = isEncrypted; + return this; + } + + public Boolean getIsEncrypted() { + return this.isEncrypted; + } + + public File setEncryptionKeyId(String encryptionKeyId) { + this.encryptionKeyId = encryptionKeyId; + return this; + } + + public String getEncryptionKeyId() { + return this.encryptionKeyId; + } + + public File setInitializationVector(String expectedInitializationVector) { + this.initializationVector = expectedInitializationVector; + return this; + } + + public String getInitializationVector() { + return this.initializationVector; + } + + public File setIsPrimary(Boolean isPrimary) { + this.isPrimary = isPrimary; + return this; + } + + public Boolean getIsPrimary() { + return this.isPrimary; + } + + public File setCreated(Date created) { + this.created = created; + return this; + } + + public File setMimeType(String mimeType) { + this.mimeType = mimeType; + return this; + } + + public String getMimeType() { + return this.mimeType; + } + + public File setContentChecksum(String contentChecksum) { + this.contentChecksum = contentChecksum; + return this; + } + + public String getContentChecksum() { + return this.contentChecksum; + } + +} diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/models/Locator.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/models/Locator.java new file mode 100644 index 0000000000000..2cfa54e1a429d --- /dev/null +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/models/Locator.java @@ -0,0 +1,92 @@ +/* + * Copyright 2011 Microsoft Corporation + * + * 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. + */ + +package com.microsoft.windowsazure.services.media.models; + +import java.util.Date; + +public class Locator { + private String id; + private Date expirationDatetime; + private String path; + private String accessPolicyId; + private String assetId; + private Date startTime; + private LocatorType locatorType; + + public String getId() { + return this.id; + } + + public Locator setId(String id) { + this.id = id; + return this; + } + + public Locator setExpirationDateTime(Date expirationDateTime) { + this.expirationDatetime = expirationDateTime; + return this; + } + + public Date getExpirationDateTime() { + return this.expirationDatetime; + } + + public Locator setLocatorType(LocatorType locatorType) { + this.locatorType = locatorType; + return this; + } + + public LocatorType getLocatorType() { + return this.locatorType; + } + + public Locator setPath(String path) { + this.path = path; + return this; + } + + public String getPath() { + return this.path; + } + + public Locator setAccessPolicyId(String accessPolicyId) { + this.accessPolicyId = accessPolicyId; + return this; + } + + public String getAccessPolicyId() { + return this.accessPolicyId; + } + + public Locator setAssetId(String assetId) { + this.assetId = assetId; + return this; + } + + public String getAssetId() { + return this.assetId; + } + + public Locator setStartTime(Date startTime) { + this.startTime = startTime; + return this; + } + + public Date getStartTime() { + return this.startTime; + } + +} diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/models/LocatorType.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/models/LocatorType.java new file mode 100644 index 0000000000000..ef74b364fa655 --- /dev/null +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/models/LocatorType.java @@ -0,0 +1,30 @@ +/** + * Copyright 2011 Microsoft Corporation + * + * 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. + */ + +package com.microsoft.windowsazure.services.media.models; + +public enum LocatorType { + None(0), SAS(1), Origin(2), WindowsAzureCDN(3); + + private int locatorTypeCode; + + private LocatorType(int locatorTypeCode) { + this.locatorTypeCode = locatorTypeCode; + } + + public int getCode() { + return this.locatorTypeCode; + } +} diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/models/ProtectionKeyType.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/models/ProtectionKeyType.java new file mode 100644 index 0000000000000..88f0099e20bd9 --- /dev/null +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/models/ProtectionKeyType.java @@ -0,0 +1,30 @@ +/* + * Copyright 2011 Microsoft Corporation + * + * 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. + */ + +package com.microsoft.windowsazure.services.media.models; + +public enum ProtectionKeyType { + X509CertificateThumbprint(0); + + private int protectionKeyTypeCode; + + private ProtectionKeyType(int protectionKeyTypeCode) { + this.protectionKeyTypeCode = protectionKeyTypeCode; + } + + public int getCode() { + return protectionKeyTypeCode; + } +} diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/models/AssetTest.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/models/AssetTest.java new file mode 100644 index 0000000000000..d622d9473bb04 --- /dev/null +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/models/AssetTest.java @@ -0,0 +1,170 @@ +/** + * Copyright 2011 Microsoft Corporation + * + * 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. + */ +package com.microsoft.windowsazure.services.media.models; + +import static org.junit.Assert.*; + +import java.util.ArrayList; +import java.util.Date; + +import org.junit.Test; + +public class AssetTest { + + @Test + public void testGetSetId() { + // Arrange + String expectedId = "expectedId"; + Asset asset = new Asset(); + + // Act + String actualId = asset.setId(expectedId).getId(); + + // Assert + assertEquals(expectedId, actualId); + + } + + @Test + public void testGetSetState() { + // Arrange + AssetState expectedState = AssetState.Published; + Asset asset = new Asset(); + + // Act + AssetState actualState = asset.setState(expectedState).getState(); + + // Assert + assertEquals(expectedState, actualState); + } + + @Test + public void testGetSetCreated() { + // Arrange + Date expectedCreated = new Date(); + Asset asset = new Asset(); + + // Act + Date actualCreated = asset.setCreate(expectedCreated).getCreated(); + + // Assert + assertEquals(expectedCreated, actualCreated); + + } + + @Test + public void testGetSetLastModified() { + // Arrange + Date expectedLastModified = new Date(); + Asset asset = new Asset(); + + // Act + Date actualLastModified = asset.setLastModified(expectedLastModified).getLastModified(); + + // Assert + assertEquals(expectedLastModified, actualLastModified); + } + + @Test + public void testGetSetAlternateId() { + // Arrange + String expectedAlternateId = "testAlternateId"; + Asset asset = new Asset(); + + // Act + String actualAlternateId = asset.setAlternateId(expectedAlternateId).getAlternateId(); + + // Assert + assertEquals(expectedAlternateId, actualAlternateId); + } + + @Test + public void testGetSetName() { + // Arrange + String expectedName = "testName"; + Asset asset = new Asset(); + + // Act + String actualName = asset.setName(expectedName).getName(); + + // Assert + assertEquals(expectedName, actualName); + } + + @Test + public void testGetSetOptions() { + // Arrange + EncryptionOption expectedOptions = EncryptionOption.None; + Asset asset = new Asset(); + + // Act + EncryptionOption actualOptions = asset.setOptions(expectedOptions).getOptions(); + + // Assert + assertEquals(expectedOptions, actualOptions); + } + + @Test + public void testGetSetLocators() { + // Arrange + Iterable expectedLocators = new ArrayList(); + Asset asset = new Asset(); + + // Act + Iterable actualLocators = asset.setLocators(expectedLocators).getLocators(); + + // Assert + assertEquals(expectedLocators, actualLocators); + } + + @Test + public void testGetSetContentKeys() { + // Arrange + Iterable expectedContentKeys = new ArrayList(); + Asset asset = new Asset(); + + // Act + Iterable actualContentKeys = asset.setContentKeys(expectedContentKeys).getContentKeys(); + + // Assert + assertEquals(expectedContentKeys, actualContentKeys); + } + + @Test + public void testGetSetFiles() { + // Arrange + Iterable expectedFiles = new ArrayList(); + Asset asset = new Asset(); + + // Act + Iterable actualFiles = asset.setFiles(expectedFiles).getFiles(); + + // Assert + assertEquals(expectedFiles, actualFiles); + } + + @Test + public void testGetSetParentAsset() { + // Arrange + Iterable expectedParentAssets = new ArrayList(); + Asset asset = new Asset(); + + // Act + Iterable actualAssets = asset.setParentAssets(expectedParentAssets).getParentAssets(); + + // Assert + assertEquals(expectedParentAssets, actualAssets); + } +} diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/models/ContentKeyTest.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/models/ContentKeyTest.java new file mode 100644 index 0000000000000..a2cf7644b10db --- /dev/null +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/models/ContentKeyTest.java @@ -0,0 +1,147 @@ +/** + * Copyright 2011 Microsoft Corporation + * + * 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. + */ +package com.microsoft.windowsazure.services.media.models; + +import static org.junit.Assert.*; + +import java.util.Date; + +import org.junit.Test; + +public class ContentKeyTest { + + @Test + public void testGetSetId() { + // Arrange + String expectedId = "expectedId"; + ContentKey contentKey = new ContentKey(); + + // Act + String actualId = contentKey.setId(expectedId).getId(); + + // Assert + assertEquals(expectedId, actualId); + } + + @Test + public void testGetSetCreated() { + // Arrange + Date expectedCreated = new Date(); + ContentKey contentKey = new ContentKey(); + + // Act + Date actualCreated = contentKey.setCreated(expectedCreated).getCreated(); + + // Assert + assertEquals(expectedCreated, actualCreated); + } + + @Test + public void testGetSetLastModified() { + // Arrange + Date expectedLastModified = new Date(); + ContentKey contentKey = new ContentKey(); + + // Act + Date actualLastModified = contentKey.setLastModified(expectedLastModified).getLastModified(); + + // Assert + assertEquals(expectedLastModified, actualLastModified); + } + + @Test + public void testGetSetContentKeyType() { + // Arrange + ContentKeyType expectedContentKeyType = ContentKeyType.ConfigurationEncryption; + ContentKey contentKey = new ContentKey(); + + // Act + ContentKeyType actualContentKeyType = contentKey.setContentKeyType(expectedContentKeyType).getContentKeyType(); + + // Assert + assertEquals(expectedContentKeyType, actualContentKeyType); + + } + + @Test + public void testGetSetEncryptedContentKey() { + // Arrange + String expectedEncryptedContentKey = "testX509Certificate"; + ContentKey contentKey = new ContentKey(); + + // Act + String actualEncryptedContentKey = contentKey.setEncryptedContentKey(expectedEncryptedContentKey) + .getEncryptedContentKey(); + + // Assert + assertEquals(expectedEncryptedContentKey, actualEncryptedContentKey); + } + + @Test + public void testGetSetName() { + // Arrange + String expectedName = "expectedName"; + ContentKey contentKey = new ContentKey(); + + // Act + String actualName = contentKey.setName(expectedName).getName(); + + // Assert + assertEquals(expectedName, actualName); + } + + @Test + public void testGetSetProtectionKeyId() { + // Arrange + String expectedProtectionKeyId = "expectedProtectionKeyId"; + ContentKey contentKey = new ContentKey(); + + // Act + String actualProtectionKeyId = contentKey.setProtectionKeyId(expectedProtectionKeyId).getProtectionKeyId(); + + // Assert + assertEquals(expectedProtectionKeyId, actualProtectionKeyId); + + } + + @Test + public void testGetSetProtectionKeyType() { + // Arrange + ProtectionKeyType expectedProtectionKeyType = ProtectionKeyType.X509CertificateThumbprint; + ContentKey contentKey = new ContentKey(); + + // Act + ProtectionKeyType actualProtectionKeyType = contentKey.setProtectionKeyType(expectedProtectionKeyType) + .getProtectionKeyType(); + + // Assert + assertEquals(expectedProtectionKeyType, actualProtectionKeyType); + } + + @Test + public void testGetSetCheckSum() { + // Arrange + String expectedCheckSum = "testCheckSum"; + ContentKey contentKey = new ContentKey(); + + // Act + String actualCheckSum = contentKey.setCheckSum(expectedCheckSum).getCheckSum(); + + // Assert + assertEquals(expectedCheckSum, actualCheckSum); + + } + +} diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/models/FileTest.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/models/FileTest.java new file mode 100644 index 0000000000000..3a4a760cdbacd --- /dev/null +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/models/FileTest.java @@ -0,0 +1,209 @@ +/** + * Copyright 2011 Microsoft Corporation + * + * 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. + */ +package com.microsoft.windowsazure.services.media.models; + +import static org.junit.Assert.*; + +import java.util.Date; + +import org.junit.Test; + +public class FileTest { + + @Test + public void testGetSetId() { + // Arrange + String expectedId = "testId"; + File file = new File(); + + // Act + String actualId = file.setId(expectedId).getId(); + + // Assert + assertEquals(expectedId, actualId); + } + + @Test + public void testGetSetName() { + // Arrange + String expectedName = "testName"; + File file = new File(); + + // Act + String actualName = file.setName(expectedName).getName(); + + // Assert + assertEquals(expectedName, actualName); + } + + @Test + public void testGetSetContentFileSize() { + // Arrange + int expectedContentFileSize = 1234; + File file = new File(); + + // Act + int actualContentFileSize = file.setContentFileSize(expectedContentFileSize).getContentFileSize(); + + // Assert + assertEquals(expectedContentFileSize, actualContentFileSize); + + } + + @Test + public void testGetSetParentAssetId() { + // Arrange + String expectedParentAssetId = "testParentAssetId"; + File file = new File(); + + // Act + String actualParentAssetId = file.setParentAssetId(expectedParentAssetId).getParentAssetId(); + + // Assert + assertEquals(expectedParentAssetId, actualParentAssetId); + } + + @Test + public void testGetSetEncryptionVersion() { + // Arrange + String expectedEncryptionVersion = "testEncryptionVersion"; + File file = new File(); + + // Act + String actualEncryptionVersion = file.setEncryptionVersion(expectedEncryptionVersion).getEncryptionVersion(); + + // Assert + assertEquals(expectedEncryptionVersion, actualEncryptionVersion); + } + + @Test + public void testGetSetEncryptionScheme() { + // Arrange + String expectedEncryptionScheme = "testEncryptionScheme"; + File file = new File(); + + // Act + String actualEncryptionScheme = file.setEncryptionScheme(expectedEncryptionScheme).getEncryptionScheme(); + + // Assert + assertEquals(expectedEncryptionScheme, actualEncryptionScheme); + } + + @Test + public void testGetSetIsEncrypted() { + // Arrange + Boolean expectedIsEncrypted = true; + File file = new File(); + + // Act + Boolean actualIsEncrypted = file.setIsEncrypted(expectedIsEncrypted).getIsEncrypted(); + + // Assert + assertEquals(expectedIsEncrypted, actualIsEncrypted); + } + + @Test + public void testGetSetEncryptionKeyId() { + // Arrange + String expectedEncryptionKeyId = "testEncryptionKeyId"; + File file = new File(); + + // Act + String actualEncryptionKeyId = file.setEncryptionKeyId(expectedEncryptionKeyId).getEncryptionKeyId(); + + // Assert + assertEquals(expectedEncryptionKeyId, actualEncryptionKeyId); + } + + @Test + public void testGetSetInitializationVector() { + // Arrange + String expectedInitializationVector = "testInitializationVector"; + File file = new File(); + + // Act + String actualInitializationVector = file.setInitializationVector(expectedInitializationVector) + .getInitializationVector(); + + // Assert + assertEquals(expectedInitializationVector, actualInitializationVector); + + } + + @Test + public void testGetSetIsPrimary() { + // Arrange + Boolean expectedIsPrimary = true; + File file = new File(); + + // Act + Boolean actualIsPrimary = file.setIsPrimary(expectedIsPrimary).getIsPrimary(); + + // Assert + assertEquals(expectedIsPrimary, actualIsPrimary); + } + + @Test + public void testGetSetLastModified() { + // Arrange + Date expectedLastModified = new Date(); + File file = new File(); + + // Act + Date actualLastModified = file.setLastModified(expectedLastModified).getLastModified(); + + // Assert + assertEquals(expectedLastModified, actualLastModified); + } + + @Test + public void testGetSetCreated() { + // Arrange + Date expectedCreated = new Date(); + File file = new File(); + + // Act + Date actualCreated = file.setCreated(expectedCreated).getCreated(); + + // Assert + assertEquals(expectedCreated, actualCreated); + } + + @Test + public void testGetSetMimeType() { + // Arrange + String expectedMimeType = "testMimeType"; + File file = new File(); + + // Act + String actualMimeType = file.setMimeType(expectedMimeType).getMimeType(); + + // Assert + assertEquals(expectedMimeType, actualMimeType); + } + + @Test + public void testGetSetContentChecksum() { + // Arrange + String expectedContentChecksum = "testContentChecksum"; + File file = new File(); + + // Act + String actualContentChecksum = file.setContentChecksum(expectedContentChecksum).getContentChecksum(); + + // Assert + assertEquals(expectedContentChecksum, actualContentChecksum); + } +} diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/models/LocatorTest.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/models/LocatorTest.java new file mode 100644 index 0000000000000..c4c0da8c02f4e --- /dev/null +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/models/LocatorTest.java @@ -0,0 +1,117 @@ +/** + * Copyright 2011 Microsoft Corporation + * + * 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. + */ +package com.microsoft.windowsazure.services.media.models; + +import static org.junit.Assert.*; + +import java.util.Date; + +import org.junit.Test; + +public class LocatorTest { + + @Test + public void testGetSetId() { + // Arrange + String expectedId = "testId"; + Locator locator = new Locator(); + + // Act + String actualId = locator.setId(expectedId).getId(); + + // Assert + assertEquals(expectedId, actualId); + } + + @Test + public void testGetSetExpirationDateTime() { + // Arrange + Date expectedExpirationDateTime = new Date(); + Locator locator = new Locator(); + + // Act + Date actualExpirationDateTime = locator.setExpirationDateTime(expectedExpirationDateTime) + .getExpirationDateTime(); + + // Assert + assertEquals(expectedExpirationDateTime, actualExpirationDateTime); + } + + @Test + public void testGetSetType() { + // Arrange + LocatorType expectedLocatorType = LocatorType.WindowsAzureCDN; + Locator locator = new Locator(); + + // Act + LocatorType actualLocatorType = locator.setLocatorType(expectedLocatorType).getLocatorType(); + + // Assert + assertEquals(expectedLocatorType, actualLocatorType); + } + + @Test + public void testGetSetPath() { + // Arrange + String expectedPath = "testPath"; + Locator locator = new Locator(); + + // Act + String actualPath = locator.setPath(expectedPath).getPath(); + + // Assert + assertEquals(expectedPath, actualPath); + } + + @Test + public void testGetSetAccessPolicyId() { + // Arrange + String expectedAccessPolicyId = "testAccessPolicyId"; + Locator locator = new Locator(); + + // Act + String actualAccessPolicyId = locator.setAccessPolicyId(expectedAccessPolicyId).getAccessPolicyId(); + + // Assert + assertEquals(expectedAccessPolicyId, actualAccessPolicyId); + } + + @Test + public void testGetSetAssetId() { + // Arrange + String expectedAssetId = "testAssetId"; + Locator locator = new Locator(); + + // Act + String actualAssetId = locator.setAssetId(expectedAssetId).getAssetId(); + + // Assert + assertEquals(expectedAssetId, actualAssetId); + } + + @Test + public void testGetSetStartTime() { + // Arrange + Date expectedStartTime = new Date(); + Locator locator = new Locator(); + + // Act + Date actualStartTime = locator.setStartTime(expectedStartTime).getStartTime(); + + // Assert + assertEquals(expectedStartTime, actualStartTime); + } + +}