use of com.microsoft.azure.toolkit.lib.common.model.Subscription in project azure-tools-for-java by microsoft.
the class ContainerRegistryMvpModelTest method testListContainerRegistries.
@Test
public void testListContainerRegistries() throws IOException {
List<Subscription> subscriptions = new ArrayList<Subscription>();
Subscription sub1 = mock(Subscription.class);
when(sub1.getId()).thenReturn("1");
Subscription sub2 = mock(Subscription.class);
when(sub2.getId()).thenReturn("2");
Subscription sub3 = mock(Subscription.class);
when(sub3.getId()).thenReturn("3");
when(mvpModel.getSelectedSubscriptions()).thenReturn(subscriptions);
ContainerRegistryMvpModel mockModel = spy(containerRegistryMvpModel);
when(authMethodManagerMock.getAzureClient(anyString())).thenReturn(azureMock);
when(registriesMock.list()).thenReturn(new PagedList<Registry>() {
@Override
public Page<Registry> nextPage(String nextPageLink) throws RestException, IOException {
return null;
}
});
mockModel.listContainerRegistries(false);
verify(mockModel, times(0)).listRegistryBySubscriptionId(anyString(), eq(false));
subscriptions.add(sub1);
subscriptions.add(sub2);
subscriptions.add(sub3);
mockModel.listContainerRegistries(false);
verify(mockModel, times(3)).listRegistryBySubscriptionId(anyString(), eq(false));
reset(mockModel);
mockModel.listContainerRegistries(true);
verify(mockModel, times(3)).listRegistryBySubscriptionId(anyString(), eq(true));
}
use of com.microsoft.azure.toolkit.lib.common.model.Subscription in project azure-tools-for-java by microsoft.
the class AppServiceInfoAdvancedPanel method onSubscriptionChanged.
private void onSubscriptionChanged(final ItemEvent e) {
// TODO: @wangmi try subscription mechanism? e.g. this.selectorGroup.subscribe(this.selectSubscription)
if (e.getStateChange() == ItemEvent.SELECTED || e.getStateChange() == ItemEvent.DESELECTED) {
final Subscription subscription = (Subscription) e.getItem();
this.selectorGroup.setSubscription(subscription);
this.textName.setSubscription(subscription);
this.selectorRegion.setSubscription(subscription);
this.selectorServicePlan.setSubscription(subscription);
}
}
use of com.microsoft.azure.toolkit.lib.common.model.Subscription in project azure-tools-for-java by microsoft.
the class AzureExplorer method getTitle.
private String getTitle() {
try {
final AzureAccount az = Azure.az(AzureAccount.class);
final Account account = az.account();
final List<Subscription> subscriptions = account.getSelectedSubscriptions();
if (subscriptions.size() == 1) {
return String.format("Azure(%s)", subscriptions.get(0).getName());
}
} catch (final Exception ignored) {
}
return "Azure";
}
use of com.microsoft.azure.toolkit.lib.common.model.Subscription in project azure-tools-for-java by microsoft.
the class AbstractSpringCloudAppInfoPanel method onSubscriptionChanged.
private void onSubscriptionChanged(final ItemEvent e) {
if (e.getStateChange() == ItemEvent.SELECTED || e.getStateChange() == ItemEvent.DESELECTED) {
final Subscription subscription = (Subscription) e.getItem();
this.getSelectorCluster().setSubscription(subscription);
}
}
use of com.microsoft.azure.toolkit.lib.common.model.Subscription in project azure-tools-for-java by microsoft.
the class SpringCloudDeploymentConfigurationPanel method onSubscriptionChanged.
private void onSubscriptionChanged(final ItemEvent e) {
if (e.getStateChange() == ItemEvent.SELECTED || e.getStateChange() == ItemEvent.DESELECTED) {
final Subscription subscription = (Subscription) e.getItem();
this.selectorCluster.setSubscription(subscription);
}
}
Aggregations