def get_random_intersection(self, cube_name, unique_names=False): """ Get a random Intersection in a cube used mostly for regressiontesting. Not optimized, in terms of performance. Function Loads ALL elements for EACH dim... :param cube_name: :param unique_names: unique names instead of plain element names :return: List of elements """ from TM1py.Services import DimensionService dimension_service = DimensionService(self._rest) dimensions = self.get_dimension_names(cube_name) elements = [] for dimension in dimensions: hierarchy = dimension_service.get(dimension).default_hierarchy element = random.choice(list((hierarchy.elements.keys()))) if unique_names: element = '[{}].[{}]'.format(dimension, element) elements.append(element) return elements
def __init__(self, **kwargs): self._tm1_rest = RestService(**kwargs) # instantiate all Services self.annotations = AnnotationService(self._tm1_rest) self.cells = CellService(self._tm1_rest) self.chores = ChoreService(self._tm1_rest) self.cubes = CubeService(self._tm1_rest) self.dimensions = DimensionService(self._tm1_rest) self.elements = ElementService(self._tm1_rest) self.hierarchies = HierarchyService(self._tm1_rest) self.monitoring = MonitoringService(self._tm1_rest) self.power_bi = PowerBiService(self._tm1_rest) self.processes = ProcessService(self._tm1_rest) self.security = SecurityService(self._tm1_rest) self.server = ServerService(self._tm1_rest) self.subsets = SubsetService(self._tm1_rest) self.applications = ApplicationService(self._tm1_rest) self.views = ViewService(self._tm1_rest)
def _instantiate_services(self): self.annotations = AnnotationService(self._tm1_rest) self.cells = CellService(self._tm1_rest) self.chores = ChoreService(self._tm1_rest) self.cubes = CubeService(self._tm1_rest) self.dimensions = DimensionService(self._tm1_rest) self.elements = ElementService(self._tm1_rest) self.git = GitService(self._tm1_rest) self.hierarchies = HierarchyService(self._tm1_rest) self.monitoring = MonitoringService(self._tm1_rest) self.power_bi = PowerBiService(self._tm1_rest) self.processes = ProcessService(self._tm1_rest) self.security = SecurityService(self._tm1_rest) self.server = ServerService(self._tm1_rest) self.subsets = SubsetService(self._tm1_rest) self.applications = ApplicationService(self._tm1_rest) self.views = ViewService(self._tm1_rest) self.sandboxes = SandboxService(self._tm1_rest) self.git = GitService(self._tm1_rest)