public void RemoveAllTest1() { AnchorManager target = CreateManager(); Assert.Equal(MAXDOMAINCOUNT * MAXCERTPEROWNER, target.Get(-1, MAXDOMAINCOUNT * MAXCERTPEROWNER + 1).Count()); using (ConfigDatabase db = CreateConfigDatabase()) { target.RemoveAll(db); } Assert.Equal(0, target.Get(-1, MAXDOMAINCOUNT * MAXCERTPEROWNER + 1).Count()); }
// Start is called before the first frame update void Start() { anchorConverter = FindObjectOfType <AnchorConverter>(); aRRaycastManager = GetComponent <ARRaycastManager>(); aRAnchorManager = GetComponent <ARAnchorManager>(); eventSystem = FindObjectOfType <EventSystem>(); anchorManager = FindObjectOfType <AnchorManager>(); appController = FindObjectOfType <AppController>(); materialSwitcher = FindObjectOfType <MaterialSwitcher>(); anchorLerper = FindObjectOfType <AnchorLerper>(); }
public void RemoveTest2() { using (ConfigDatabase db = CreateConfigDatabase()) { AnchorManager target = CreateManager(); Assert.Equal(MAXDOMAINCOUNT * MAXCERTPEROWNER, target.Get(-1, MAXDOMAINCOUNT * MAXCERTPEROWNER + 1).Count()); string ownerName = string.Format("CN={0}", BuildDomainName(GetRndDomainID())); target.Remove(db, ownerName); db.SubmitChanges(); Assert.Equal(MAXDOMAINCOUNT * MAXCERTPEROWNER - MAXCERTPEROWNER, target.Get(-1, MAXDOMAINCOUNT * MAXCERTPEROWNER + 1).Count()); } }
public void GetTest2() { AnchorManager target = CreateManager(); List <Anchor> certs = this.GetCleanEnumerable <Anchor>(TestAnchors); string owner = certs[GetRndCertID()].Owner; string thumbprint = certs[GetRndCertID()].Thumbprint; Anchor expected = certs[GetRndCertID()]; Anchor actual = target.Get(owner, thumbprint); Assert.Equal(expected.Owner, actual.Owner); Assert.Equal(expected.Thumbprint, actual.Thumbprint); }
public void AddTest2(Anchor anc) { AnchorManager target = CreateManager(); target.RemoveAll(); target.Add(anc); Anchor certNew = target.Get(anc.Owner, anc.Thumbprint); //---should always be 1 (table was truncated above); Assert.NotNull(anc); Assert.Equal(anc.Owner, certNew.Owner); Assert.Equal(anc.Thumbprint, certNew.Thumbprint); }
public void GetTest4() { AnchorManager target = CreateManager(); long[] certIDs = new long[] { 1, 2, 3, 4, 5, 6, 7 }; Anchor[] actual = target.Get(certIDs); Assert.Equal(certIDs.Length, actual.Length); foreach (Anchor cert in actual) { Assert.True(certIDs.Contains(cert.ID)); } }
public void GetTest3() { AnchorManager target = CreateManager(); string owner = string.Format("CN={0}", BuildDomainName(GetRndDomainID())); Anchor[] actual = target.Get(owner).ToArray(); Assert.Equal(MAXCERTPEROWNER, actual.Count()); foreach (Anchor cert in actual) { Assert.Equal(owner, cert.Owner); } }
public void GetTest6() { AnchorManager target = CreateManager(); using (ConfigDatabase db = CreateConfigDatabase()) { const long lastCertID = 0; const int maxResults = MAXCERTPEROWNER * MAXDOMAINCOUNT + 1; IEnumerable <Anchor> actual = target.Get(db, lastCertID, maxResults); Assert.Equal(MAXCERTPEROWNER * MAXDOMAINCOUNT, actual.Count()); } }
// ============================== MAJOR ACTIONS ================================== // ------------------------------------------------------------------------------- // AutoLoginPlayer // @Server // ------------------------------------------------------------------------------- protected void AutoLoginPlayer(NetworkConnection conn, string username, string playername, int token) { string prefabname = DatabaseManager.singleton.GetPlayerPrefabName(playername); GameObject prefab = GetPlayerPrefab(prefabname); // -- load player from database GameObject player = DatabaseManager.singleton.LoadDataPlayer(prefab, playername); // -- log the player in (again) DatabaseManager.singleton.LoginPlayer(conn, player, playername, username); PlayerComponent pc = player.GetComponent <PlayerComponent>(); // -- re-validate the security token if (pc.tablePlayerZones.ValidateToken(token)) { // -- update zone pc.tablePlayerZones.zonename = pc.currentZone.name; NetworkServer.AddPlayerForConnection(conn, player); // -- warp to anchor location (if any) string anchorName = pc.tablePlayerZones.anchorname; debug.Log("anchorName:" + anchorName + "/" + pc.tablePlayerZones.startpos); if (pc.tablePlayerZones.startpos) // -- warp to start position { player.transform.position = AnchorManager.GetArchetypeStartPosition(player).position; } else if (!String.IsNullOrWhiteSpace(anchorName)) // -- warp to anchor { pc.WarpLocal(anchorName); } // -- in any other case we start at the saved x,y,z position // -- now clear the anchor & startpos pc.tablePlayerZones.anchorname = ""; pc.tablePlayerZones.startpos = false; onlinePlayers[player.name] = player; state = NetworkState.Game; // -- Hooks & Events this.InvokeInstanceDevExtMethods(nameof(LoginPlayer), conn, player, playername, username); //HOOK eventListeners.OnLoginPlayer.Invoke(conn); } else { ServerSendError(conn, systemText.unknownError, true); } }
public void GetIncomingTest1() { AnchorManager target = CreateManager(); string ownerName = string.Format("CN={0}", BuildDomainName(GetRndDomainID())); target.SetStatus(ownerName, EntityStatus.Enabled); Anchor[] actual = target.GetIncoming(ownerName, null); Assert.Equal(MAXCERTPEROWNER, actual.Length); actual = target.GetIncoming(ownerName, EntityStatus.Enabled); Assert.Equal(MAXCERTPEROWNER, actual.Length); actual = target.GetIncoming(ownerName, EntityStatus.New); Assert.Equal(0, actual.Length); }
public void RemoveTest() { using (ConfigDatabase db = CreateConfigDatabase()) { AnchorManager target = CreateManager(); List <Anchor> certs = this.GetCleanEnumerable <Anchor>(TestAnchors); string owner = certs[0].Owner; string thumbprint = certs[0].Thumbprint; Assert.NotNull(target.Get(owner, thumbprint)); target.Remove(db, owner, thumbprint); Assert.Null(target.Get(owner, thumbprint)); } }
// Start is called before the first frame update void Start() { appController = FindObjectOfType <AppController>(); AnchorList.SetActive(true); AnchorOptions.SetActive(false); navigationArrow.SetActive(false); distanceText.gameObject.SetActive(false); anchorInfoText.gameObject.SetActive(true); anchorManager = FindObjectOfType <AnchorManager>(); isAnchorFound = false; waitingToDetectAnchors = false; timeSpentWaiting = 0f; }
public void AddTest(Anchor anc) { AnchorManager target = CreateManager(); using (ConfigDatabase db = CreateConfigDatabase()) { target.RemoveAll(); target.Add(db, anc); db.SubmitChanges(); Anchor certNew = target.Get(anc.Owner, anc.Thumbprint); //---should always be 1 (table was truncated above); Assert.NotNull(anc); Assert.Equal(anc.Owner, certNew.Owner); Assert.Equal(anc.Thumbprint, certNew.Thumbprint); } }
/// <summary> /// This method will clean, load and verify Anchor records based on the certs stored in the /// metadata\certs folder into the db for testing purposes /// </summary> /// <param name="mgr">CertificateManager instance used for controlling the Certificate records</param> /// <param name="db">ConfigDatabase instance used as the target storage mechanism for the records</param> /// <remarks> /// this approach goes out to db each time it is called, however it ensures that clean records /// are present for every test that is execute, if it is taking too long, simply cut down on the /// number of items using the consts above /// </remarks> protected void InitAnchorRecords(AnchorManager mgr , ConfigDatabase db) { mgr.RemoveAll(db); for (int i = 1; i <= MAXDOMAINCOUNT; i++) { //---------------------------------------------------------------------------------------------------- //---cheezy but will add MAXCERTPEROWNER certs per each relative domain for (int t = 1; t <= MAXCERTPEROWNER; t++) { Anchor anc = GetAnchorFromTestCertPfx(i, t); //---------------------------------------------------------------------------------------------------- //---cheezey but flags all as incoming and outgoing anc.ForIncoming = true; anc.ForOutgoing = true; mgr.Add(GetAnchorFromTestCertPfx(i, t)); } } }
public void RegisterPlayer_PlayerComponent(GameObject player, string userName, string prefabName) { player.transform.position = AnchorManager.GetArchetypeStartPosition(player).position; player.GetComponent <PlayerComponent>().tablePlayer.Create(player, userName, prefabName); }
// Start is called before the first frame update void Start() { instance = this; }
// Start is called before the first frame update void Start() { anchorManager = FindObjectOfType <AnchorManager>(); }