public static ActionResult RegisterApplication(Session session) { session.Log("Begin configure web application"); try { // parameters var appId = new Guid(session["APP_ID"]); ushort port = ushort.Parse(session["APP_PORT"]); string path = session["APP_PATH"]; // init WebAppConfigEntry app = Metabase.GetWebAppEntry(appId); app.ApplicationName = "NooLite Web Control Panel"; app.VirtualDirectory = string.Empty; app.PhysicalDirectory = path; app.ListenAddresses.Clear(); app.ListenAddresses.AddAddresses(new ListenAddress(port)); app.AppType = ApplicationType.AspNetOrStaticHtml; app.Stopped = false; // register webapp Metabase.RegisterApplication(RuntimeVersion.AspNet_4, false, app, new AppShortcut[0]); } catch (Exception ex) { session.Log("ERROR in configure web application: {0}", ex.ToString()); return(ActionResult.Failure); } session.Log("End configure web application"); return(ActionResult.Success); }
public object NavigateToHost(string metabasePath) { var host = Metabase.CatalogReg[metabasePath] as Metabank.SectionHost; if (host != null) { string hostURL; try { hostURL = Metabase.ResolveNetworkServiceToConnectString( metabasePath, SysConsts.NETWORK_INTERNOC, host.IsZGov ? SysConsts.NETWORK_SVC_ZGOV_WEB_MANAGER : SysConsts.NETWORK_SVC_HGOV_WEB_MANAGER); return(new Redirect(hostURL)); } catch (Exception ex) { log(MessageType.Error, ".NavigateToHost(metabasePath='{0}')".Args(metabasePath), ex.ToMessageWithType(), ex); } } WorkContext.Response.StatusCode = WebConsts.STATUS_404; WorkContext.Response.StatusDescription = WebConsts.STATUS_404_DESCRIPTION; return("Couldn't navigate to host/zone '{0}'".Args(metabasePath)); }
public void NET_SvcBindingsList() { var names = Metabase.GetNetworkSvcBindingNames("internoc", "zgov"); Aver.IsTrue(names.SequenceEqual(new List <string> { "async", "sync" })); }
public void NET_GroupList() { var names = Metabase.GetNetworkGroupNames("nocgov"); Aver.IsTrue(names.SequenceEqual(new List <string> { "any", "any2" })); }
public void NET_SvcList() { var names = Metabase.GetNetworkSvcNames("internoc"); names.ForEach(n => Console.WriteLine(n)); Aver.IsTrue(names.SequenceEqual(new List <string> { "socialgraphtodoqueue", "webman-azgov", "webman-ahgov", "zgov", "gdida" })); }
public void MR_GetOSPlatformNode() { { var pn = Metabase.GetOSPlatformNode("fedora20"); Aver.AreEqual(Metabank.CONFIG_PLATFORM_SECTION, pn.Name); Aver.AreEqual("Linux64", pn.AttrByName(Metabank.CONFIG_NAME_ATTR).Value); } }
public static ActionResult CheckWebServer(Session session) { try { Metabase.GetRegisteredApplicationCount(); session["SERVER_IS_INSTALLED"] = "1"; } catch (Exception ex) { session["SERVER_IS_INSTALLED"] = "0"; } return(ActionResult.Success); }
public void ValidateMetabank() { var output = new List <MetabaseValidationMsg>(); Metabase.Validate(output); foreach (var msg in output) { Console.WriteLine(msg); } Aver.AreEqual(5, output.Count(m => m.Type == MetabaseValidationMessageType.Warning)); Aver.AreEqual(6, output.Count(m => m.Type == MetabaseValidationMessageType.Info)); }
internal object makeChildren(IEnumerable <Metabank.SectionRegionBase> children) { var res = new List <JSONDataMap>(); foreach (var child in children) { var d = new JSONDataMap(); d["name"] = child.Name; d["path"] = child.RegionPath; d["me"] = child.IsLogicallyTheSame(App.GetThisHostMetabaseSection()); d["tp"] = child.SectionMnemonicType; d["descr"] = child.Description; var host = child as Metabank.SectionHost; if (host != null) { var isZGov = host.IsZGov; d["role"] = host.RoleName; d["dynamic"] = host.Dynamic; d["os"] = host.OS; d["apps"] = host.Role.AppNames.OrderBy(a => a).ToArray(); d["isZGov"] = isZGov; d["myZGov"] = child.IsLogicallyTheSame(host.ParentZoneGovernorPrimaryHost()); string adminURL = null; try { adminURL = Metabase.ResolveNetworkServiceToConnectString(host.RegionPath, SysConsts.NETWORK_INTERNOC, isZGov ? SysConsts.NETWORK_SVC_ZGOV_WEB_MANAGER : SysConsts.NETWORK_SVC_HGOV_WEB_MANAGER); } catch (Exception ex) { log(MessageType.Error, "LoadLevel.makeLevel()", ex.ToMessageWithType(), ex); } d["adminURL"] = adminURL; } else { d["geo"] = new { lat = child.EffectiveGeoCenter.Lat, lng = child.EffectiveGeoCenter.Lng }; } res.Add(d); } return(res); }
public static ActionResult UnRegisterApplication(Session session) { session.Log("Begin unregister web application"); try { var appId = new Guid(session["APP_ID"]); Metabase.UnregisterApplication(appId); } catch (Exception ex) { session.Log("ERROR in unregister web application: {0}", ex.ToString()); return(ActionResult.Failure); } session.Log("End unregister web application"); return(ActionResult.Success); }
public object Navigate(string metabasePath, string appName) { var svc = SysConsts.NETWORK_SVC_WEB_MANAGER_PREFIX + appName; try { var url = Metabase.ResolveNetworkServiceToConnectString(metabasePath, SysConsts.NETWORK_INTERNOC, svc); return(new Redirect(url)); } catch { WorkContext.Response.StatusCode = WebConsts.STATUS_404; WorkContext.Response.StatusDescription = WebConsts.STATUS_404_DESCRIPTION; return("Web Manager service in application '{0}' on host '{1}' netsvc '{2}' is not available".Args(appName, metabasePath, svc)); } }
public void NET_Scope() { Aver.IsTrue(NetworkScope.NOC == Metabase.GetNetworkScope("NOCGOV")); }
public void NET_Description() { Aver.AreEqual("NOC gov network", Metabase.GetNetworkDescription("NOCGOV")); }
public void Init() { instance = new Metabase(); }
public void MR_GetOSPlatformName() { { Aver.AreEqual("Android", Metabase.GetOSPlatformName("KitKat4.4")); } }